12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- package service
- import (
- "encoding/json"
- . "bp.jydev.jianyu360.cn/BaseService/orderCenter/entity"
- "bp.jydev.jianyu360.cn/BaseService/orderCenter/rpc/ordercenter"
- )
- func PayAdd(this *ordercenter.PayAddReq) *ordercenter.OrderAddUpdateResp {
- payId := Mysql.Insert(Pay, map[string]interface{}{
- "appid": this.Appid,
- "order_code": this.OrderCode,
- "pay_time": this.Pay.PayTime,
- "pay_way": this.Pay.PayWay,
- "pay_money": this.Pay.PayMoney,
- "pay_code": this.Pay.PayCode,
- "pay_voucher_url": this.Pay.PayVoucherUrl,
- "pay_account": this.Pay.PayAccount,
- "pay_name": this.Pay.PayName,
- "collect_account": this.Pay.CollectAccount,
- "collect_name": this.Pay.CollectName,
- "operate_person": this.Pay.OperatePerson,
- "operate_time": this.Pay.OperateTime,
- "remark": this.Pay.Remark,
- "prepay_time": this.Pay.PrepayTime,
- "prepay_id": this.Pay.PrepayId,
- "out_trade_no": this.Pay.OutTradeNo,
- "code_url": this.Pay.CodeUrl,
- "origin_price": this.Pay.OriginPrice,
- "points_deduct_count": this.Pay.PointsDeductCount,
- "points_deduct_amount": this.Pay.PointsDeductAmount,
- "card_count": this.Pay.CardCount,
- "card_amount": this.Pay.CardAmount,
- })
- status := 0
- if payId > 0 {
- status = 1
- }
- return &ordercenter.OrderAddUpdateResp{
- ErrorCode: 1,
- Data: &ordercenter.DataStatus{Status: int64(status)},
- }
- }
- func PayInfo(this *ordercenter.OrderInfoReq) *ordercenter.PayInfoResp {
- PayList := []*ordercenter.Pay{}
- pay := Mysql.Find(Pay, map[string]interface{}{"appid": this.Appid, "order_code": this.OrderCode}, "", "", 0, 0)
- if pay != nil && len(*pay) > 0 {
- for _, v := range *pay {
- payData := &ordercenter.Pay{}
- payByte, _ := json.Marshal(v)
- json.Unmarshal(payByte, payData)
- PayList = append(PayList, payData)
- }
- }
- return &ordercenter.PayInfoResp{
- ErrorCode: 1,
- Data: PayList,
- }
- }
|