同步错误还是返回,通联支付兼容

This commit is contained in:
苏尹岚
2020-03-04 09:51:18 +08:00
parent 0655a8fca1
commit 95b2009579
3 changed files with 41 additions and 30 deletions

View File

@@ -3398,10 +3398,10 @@ func UpdateStoreSkusSpecTagBin(ctx *jxcontext.Context, reader io.Reader, vendorI
}
for _, v := range results {
store, err := dao.GetStoreDetail(db, v.StoreID, model.VendorIDMTWM)
food, err := api.MtwmAPI.RetailGet(store.VendorStoreID, utils.Int2Str(v.SkuID))
if err != nil || store == nil {
continue
}
food, err := api.MtwmAPI.RetailGet(store.VendorStoreID, utils.Int2Str(v.SkuID))
var foodData = make(map[string]interface{})
if v.IsSpec != 0 && v.IsSpec == -1 {
v.IsSpec = 0

View File

@@ -663,17 +663,16 @@ func buildSetFinishHook(task tasksch.ITask, ctx *jxcontext.Context) {
} else {
globals.SugarLogger.Debugf("同步错误发送钉钉消息失败, authinfo [%v] , [%v]", *authInfo, err)
}
}else {
if time.Now().Hour() >= 20 || time.Now().Hour() < 7 {
downloadURL, _, _ := WirteToExcelBySyncFailed(task)
user, err := dao.GetUserByID(dao.GetDB(), "mobile", "")
noticeMsg += fmt.Sprintf("[详情点我]%s/billshow/?normal=true&path=%s \n", globals.BackstageHost, downloadURL)
if user != nil && err == nil {
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, user.UserID, "同步错误返回", noticeMsg)
}
}
}
// else {
// if time.Now().Hour() >= 20 || time.Now().Hour() < 7 {
// downloadURL, _, _ := WirteToExcelBySyncFailed(task)
// user, err := dao.GetUserByID(dao.GetDB(), "mobile", "")
// noticeMsg += fmt.Sprintf("[详情点我]%s/billshow/?normal=true&path=%s \n", globals.BackstageHost, downloadURL)
// if user != nil && err == nil {
// ddmsg.SendUserMessage(dingdingapi.MsgTyeText, user.UserID, "同步错误返回", noticeMsg)
// }
// }
// }
})
}

View File

@@ -30,26 +30,38 @@ func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayTyp
if vendorPayType == "JSAPI" {
param.PayType = tonglianpayapi.PayTypeWxXcx
}
if authInfo, err := ctx.GetV2AuthInfo(); err == nil && authInfo.GetAuthType() == weixin.AuthTypeMini {
param.Acct = authInfo.GetAuthID()
if vendorPayType == tonglianpayapi.PayTypeWxXcx {
if authInfo, err := ctx.GetV2AuthInfo(); err == nil && authInfo.GetAuthType() == weixin.AuthTypeMini {
param.Acct = authInfo.GetAuthID()
}
}
result, err := api.TLpayAPI.CreateUnitorderOrder(param)
if err == nil {
var result2 tonglianpayapi.PayInfo
json.Unmarshal([]byte(result.PayInfo), &result2)
prePayID := result2.Package[strings.LastIndex(result2.Package, "=")+1 : len(result2.Package)]
orderPay = &model.OrderPay{
PayOrderID: param.Reqsn,
PayType: model.PayTypeTL,
VendorPayType: vendorPayType,
TransactionID: result.TrxID,
VendorOrderID: order.VendorOrderID,
VendorID: order.VendorID,
Status: 0,
PayCreatedAt: payCreatedAt,
PrepayID: prePayID,
CodeURL: utils.LimitUTF8StringLen(result.PayInfo, 3200),
TotalFee: int(order.ActualPayPrice),
if vendorPayType == tonglianpayapi.PayTypeH5 {
param2 := &tonglianpayapi.CreateH5UnitorderOrderParam{
Trxamt: int(order.ActualPayPrice),
NotifyUrl: globals.TLPayNotifyURL,
Body: "京西菜市",
Charset: "UTF-8",
}
err = api.TLpayAPI.CreateH5UnitorderOrder(param2)
} else {
result, err := api.TLpayAPI.CreateUnitorderOrder(param)
if err == nil {
var result2 tonglianpayapi.PayInfo
json.Unmarshal([]byte(result.PayInfo), &result2)
prePayID := result2.Package[strings.LastIndex(result2.Package, "=")+1 : len(result2.Package)]
orderPay = &model.OrderPay{
PayOrderID: param.Reqsn,
PayType: model.PayTypeTL,
VendorPayType: vendorPayType,
TransactionID: result.TrxID,
VendorOrderID: order.VendorOrderID,
VendorID: order.VendorID,
Status: 0,
PayCreatedAt: payCreatedAt,
PrepayID: prePayID,
CodeURL: utils.LimitUTF8StringLen(result.PayInfo, 3200),
TotalFee: int(order.ActualPayPrice),
}
}
}
return orderPay, err