pay
This commit is contained in:
@@ -3,6 +3,8 @@ package cms
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/financial"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
|
||||
@@ -13,13 +15,13 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
)
|
||||
|
||||
func CreateOrder(ctx *jxcontext.Context, orderType, price int) (orderID int64, err error) {
|
||||
func CreateOrder(ctx *jxcontext.Context, orderType, price int) (orderID string, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
order *model.Order
|
||||
)
|
||||
order = &model.Order{
|
||||
OrderID: jxutils.GenOrderNo(),
|
||||
OrderID: utils.Int64ToStr(jxutils.GenOrderNo()),
|
||||
UserID: ctx.GetUserID(),
|
||||
Type: orderType,
|
||||
Status: model.OrderStatusWait4Pay,
|
||||
@@ -40,11 +42,11 @@ func CreateOrder(ctx *jxcontext.Context, orderType, price int) (orderID int64, e
|
||||
return order.OrderID, err
|
||||
}
|
||||
|
||||
func Pay(ctx *jxcontext.Context, orderID, payType int, vendorPayType string) (result *model.Order, err error) {
|
||||
func Pay(ctx *jxcontext.Context, orderID string, payType int, vendorPayType string) (result *model.Order, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
order = &model.Order{
|
||||
OrderID: int64(orderID),
|
||||
OrderID: orderID,
|
||||
}
|
||||
payHandler = &financial.PayHandler{
|
||||
PayType: payType,
|
||||
@@ -66,11 +68,11 @@ func Pay(ctx *jxcontext.Context, orderID, payType int, vendorPayType string) (re
|
||||
return payHandler.Order, err
|
||||
}
|
||||
|
||||
func Cash(ctx *jxcontext.Context, orderID, payType int, vendorPayType string) (errCode string, err error) {
|
||||
func Cash(ctx *jxcontext.Context, orderID string, payType int, vendorPayType string) (errCode string, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
order = &model.Order{
|
||||
OrderID: int64(orderID),
|
||||
OrderID: orderID,
|
||||
}
|
||||
payHandler = &financial.PayHandler{
|
||||
PayType: payType,
|
||||
|
||||
@@ -26,7 +26,7 @@ func (p *PayHandler) CreatePay() (err error) {
|
||||
param := &tonglianpayapi.CreateUnitorderOrderParam{
|
||||
Trxamt: int(p.Order.PayPrice),
|
||||
NotifyUrl: globals.TLPayNotifyURL,
|
||||
Reqsn: utils.Int64ToStr(p.Order.OrderID),
|
||||
Reqsn: p.Order.OrderID,
|
||||
PayType: p.VendorPayType,
|
||||
}
|
||||
if p.VendorPayType == tonglianpayapi.PayTypeWxXcx {
|
||||
@@ -44,7 +44,7 @@ func (p *PayHandler) CreatePay() (err error) {
|
||||
}
|
||||
case model.PayTypeWX:
|
||||
param := &wxpayapi.CreateOrderParam{
|
||||
OutTradeNo: utils.Int64ToStr(p.Order.OrderID),
|
||||
OutTradeNo: p.Order.OrderID,
|
||||
Body: "冲天猴儿App账户充值",
|
||||
NotifyURL: globals.WxpayNotifyURL,
|
||||
SpbillCreateIP: p.Ctx.GetRealRemoteIP(),
|
||||
@@ -75,7 +75,7 @@ func (p *PayHandler) CreateRefund() (err error) {
|
||||
//企业付款(提现)
|
||||
if p.VendorPayType == model.VendorPayTypeCompanyPay {
|
||||
param := &wxpayapi.TransfersParam{
|
||||
PartnerTradeNo: utils.Int64ToStr(p.Order.OrderID),
|
||||
PartnerTradeNo: p.Order.OrderID,
|
||||
CheckName: wxpayapi.CheckName,
|
||||
Desc: "冲天猴儿app提现到账",
|
||||
SpbillCreateIP: p.Ctx.GetRealRemoteIP(),
|
||||
@@ -125,7 +125,7 @@ func OnTLPayCallback(call *tonglianpayapi.CallBackResult) (err error) {
|
||||
|
||||
func onTLpayFinished(call *tonglianpayapi.CallBackResult) (err error) {
|
||||
order := &model.Order{
|
||||
OrderID: utils.Str2Int64(call.CusorderID),
|
||||
OrderID: call.CusorderID,
|
||||
}
|
||||
db := dao.GetDB()
|
||||
if err = dao.GetEntity(db, order, "OrderID"); err == nil {
|
||||
@@ -231,7 +231,7 @@ func OnWxPayCallback(msg *wxpayapi.CallbackMsg) (err error) {
|
||||
|
||||
func onWxpayFinished(msg *wxpayapi.PayResultMsg) (err error) {
|
||||
order := &model.Order{
|
||||
OrderID: utils.Str2Int64(msg.OutTradeNo),
|
||||
OrderID: msg.OutTradeNo,
|
||||
}
|
||||
db := dao.GetDB()
|
||||
if err = dao.GetEntity(db, order, "OrderID"); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user