1
This commit is contained in:
@@ -122,3 +122,16 @@ func (a *Auther) getAPI() *weixinapi.API {
|
|||||||
func (a *Auther) GetUserType() (userType int8) {
|
func (a *Auther) GetUserType() (userType int8) {
|
||||||
return model.UserTypeStoreBoss
|
return model.UserTypeStoreBoss
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetAPI(authType string) *weixinapi.API {
|
||||||
|
if authType == AuthTypeWeixin {
|
||||||
|
return api.WeixinPageAPI
|
||||||
|
}
|
||||||
|
if authType == AuthTypeWxApp {
|
||||||
|
return api.WeixinApp
|
||||||
|
}
|
||||||
|
if authType == AuthTypeWxAppCaishi {
|
||||||
|
return api.WeixinApp2
|
||||||
|
}
|
||||||
|
return api.WeixinAPI
|
||||||
|
}
|
||||||
|
|||||||
@@ -324,7 +324,7 @@ func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType
|
|||||||
//if subAppID == tiktok.TiktokAppId || subAppID == tiktok.TiktokJXDJAppID {
|
//if subAppID == tiktok.TiktokAppId || subAppID == tiktok.TiktokJXDJAppID {
|
||||||
// subAppID = model.JXC4AppId // 京西商城
|
// subAppID = model.JXC4AppId // 京西商城
|
||||||
//}
|
//}
|
||||||
if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType, subAppID); err == nil && orderPay != nil {
|
if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType, subAppID, ""); err == nil && orderPay != nil {
|
||||||
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
||||||
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
||||||
}
|
}
|
||||||
@@ -351,7 +351,7 @@ func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType
|
|||||||
ActualPayPrice: priceDefendOrders[0].ActualPayPrice,
|
ActualPayPrice: priceDefendOrders[0].ActualPayPrice,
|
||||||
VendorID: model.VendorIDJX,
|
VendorID: model.VendorIDJX,
|
||||||
}
|
}
|
||||||
if orderPay, err = pay4OrderByTL(ctx, order2, payType, vendorPayType, subAppID); err == nil && orderPay != nil {
|
if orderPay, err = pay4OrderByTL(ctx, order2, payType, vendorPayType, subAppID, ""); err == nil && orderPay != nil {
|
||||||
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
||||||
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
||||||
}
|
}
|
||||||
@@ -359,7 +359,7 @@ func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType
|
|||||||
return orderPay, err
|
return orderPay, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func Pay4User(ctx *jxcontext.Context, thingID int, vendorOrderID string, payType int, vendorPayType, subAppID string) (orderPay *model.OrderPay, err error) {
|
func Pay4User(ctx *jxcontext.Context, thingID int, vendorOrderID string, payType int, vendorPayType, subAppID, code string) (orderPay *model.OrderPay, err error) {
|
||||||
var (
|
var (
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
order *model.GoodsOrder
|
order *model.GoodsOrder
|
||||||
@@ -383,7 +383,7 @@ func Pay4User(ctx *jxcontext.Context, thingID int, vendorOrderID string, payType
|
|||||||
ActualPayPrice: int64(discountCard.Price),
|
ActualPayPrice: int64(discountCard.Price),
|
||||||
VendorID: model.VendorIDJX,
|
VendorID: model.VendorIDJX,
|
||||||
}
|
}
|
||||||
if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType, subAppID); err == nil && orderPay != nil {
|
if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType, subAppID, code); err == nil && orderPay != nil {
|
||||||
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
||||||
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
||||||
}
|
}
|
||||||
@@ -416,7 +416,7 @@ func Pay4User(ctx *jxcontext.Context, thingID int, vendorOrderID string, payType
|
|||||||
ActualPayPrice: int64(storeOrder.ActualPayPrice),
|
ActualPayPrice: int64(storeOrder.ActualPayPrice),
|
||||||
VendorID: model.VendorIDJX,
|
VendorID: model.VendorIDJX,
|
||||||
}
|
}
|
||||||
if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType, subAppID); err == nil && orderPay != nil {
|
if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType, subAppID, code); err == nil && orderPay != nil {
|
||||||
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
||||||
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
||||||
}
|
}
|
||||||
@@ -431,7 +431,7 @@ func Pay4User(ctx *jxcontext.Context, thingID int, vendorOrderID string, payType
|
|||||||
ActualPayPrice: int64(brandOrder.ActualPayPrice),
|
ActualPayPrice: int64(brandOrder.ActualPayPrice),
|
||||||
VendorID: model.VendorIDJX,
|
VendorID: model.VendorIDJX,
|
||||||
}
|
}
|
||||||
if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType, subAppID); err == nil && orderPay != nil {
|
if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType, subAppID, code); err == nil && orderPay != nil {
|
||||||
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
||||||
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/globals/api"
|
"git.rosy.net.cn/jx-callback/globals/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, payType int, vendorPayType, subAppID string) (orderPay *model.OrderPay, err error) {
|
func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, payType int, vendorPayType, subAppID, code string) (orderPay *model.OrderPay, err error) {
|
||||||
// if order.FromStoreID != 0 {
|
// if order.FromStoreID != 0 {
|
||||||
// result, _ := orderman.GetMatterStoreOrderCount(nil, order.FromStoreID)
|
// result, _ := orderman.GetMatterStoreOrderCount(nil, order.FromStoreID)
|
||||||
// if !result.Flag {
|
// if !result.Flag {
|
||||||
@@ -45,6 +45,14 @@ func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, payType int,
|
|||||||
if err == nil && authInfo.GetAuthType() == weixin.AuthTypeMini && authInfo.GetAuthTypeID() == subAppID {
|
if err == nil && authInfo.GetAuthType() == weixin.AuthTypeMini && authInfo.GetAuthTypeID() == subAppID {
|
||||||
param.Acct = authInfo.GetAuthID()
|
param.Acct = authInfo.GetAuthID()
|
||||||
}
|
}
|
||||||
|
if code != "" {
|
||||||
|
appAuth := strings.Split(code, "_")
|
||||||
|
sessionInfo, err := weixin.GetAPI(appAuth[0]).SNSCode2Session(appAuth[1])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
param.Acct = sessionInfo.OpenID
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if vendorPayType == tonglianpayapi.PayTypeZfbJS || vendorPayType == tonglianpayapi.PayTypeZfbApp {
|
if vendorPayType == tonglianpayapi.PayTypeZfbJS || vendorPayType == tonglianpayapi.PayTypeZfbApp {
|
||||||
if authInfo, err := ctx.GetV2AuthInfo(); err == nil {
|
if authInfo, err := ctx.GetV2AuthInfo(); err == nil {
|
||||||
|
|||||||
@@ -123,12 +123,13 @@ func (c *JxOrderController) Pay4StoreMyselfDeliverOrder() {
|
|||||||
// @Param vendorOrderID formData string false "订单ID"
|
// @Param vendorOrderID formData string false "订单ID"
|
||||||
// @Param payType formData int true "支付类型"
|
// @Param payType formData int true "支付类型"
|
||||||
// @Param vendorPayType formData string true "平台支付类型"
|
// @Param vendorPayType formData string true "平台支付类型"
|
||||||
|
// @Param code formData string false "app吊起微信支付时,需要code获取openID"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @router /Pay4User [post]
|
// @router /Pay4User [post]
|
||||||
func (c *JxOrderController) Pay4User() {
|
func (c *JxOrderController) Pay4User() {
|
||||||
c.callPay4User(func(params *tJxorderPay4UserParams) (retVal interface{}, errCode string, err error) {
|
c.callPay4User(func(params *tJxorderPay4UserParams) (retVal interface{}, errCode string, err error) {
|
||||||
retVal, err = localjx.Pay4User(params.Ctx, params.ThingID, params.VendorOrderID, params.PayType, params.VendorPayType, params.SubAppID)
|
retVal, err = localjx.Pay4User(params.Ctx, params.ThingID, params.VendorOrderID, params.PayType, params.VendorPayType, params.SubAppID, params.Code)
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user