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

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 { for _, v := range results {
store, err := dao.GetStoreDetail(db, v.StoreID, model.VendorIDMTWM) 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 { if err != nil || store == nil {
continue continue
} }
food, err := api.MtwmAPI.RetailGet(store.VendorStoreID, utils.Int2Str(v.SkuID))
var foodData = make(map[string]interface{}) var foodData = make(map[string]interface{})
if v.IsSpec != 0 && v.IsSpec == -1 { if v.IsSpec != 0 && v.IsSpec == -1 {
v.IsSpec = 0 v.IsSpec = 0

View File

@@ -663,17 +663,16 @@ func buildSetFinishHook(task tasksch.ITask, ctx *jxcontext.Context) {
} else { } else {
globals.SugarLogger.Debugf("同步错误发送钉钉消息失败, authinfo [%v] , [%v]", *authInfo, err) 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" { if vendorPayType == "JSAPI" {
param.PayType = tonglianpayapi.PayTypeWxXcx param.PayType = tonglianpayapi.PayTypeWxXcx
} }
if authInfo, err := ctx.GetV2AuthInfo(); err == nil && authInfo.GetAuthType() == weixin.AuthTypeMini { if vendorPayType == tonglianpayapi.PayTypeWxXcx {
param.Acct = authInfo.GetAuthID() if authInfo, err := ctx.GetV2AuthInfo(); err == nil && authInfo.GetAuthType() == weixin.AuthTypeMini {
param.Acct = authInfo.GetAuthID()
}
} }
result, err := api.TLpayAPI.CreateUnitorderOrder(param) if vendorPayType == tonglianpayapi.PayTypeH5 {
if err == nil { param2 := &tonglianpayapi.CreateH5UnitorderOrderParam{
var result2 tonglianpayapi.PayInfo Trxamt: int(order.ActualPayPrice),
json.Unmarshal([]byte(result.PayInfo), &result2) NotifyUrl: globals.TLPayNotifyURL,
prePayID := result2.Package[strings.LastIndex(result2.Package, "=")+1 : len(result2.Package)] Body: "京西菜市",
orderPay = &model.OrderPay{ Charset: "UTF-8",
PayOrderID: param.Reqsn, }
PayType: model.PayTypeTL, err = api.TLpayAPI.CreateH5UnitorderOrder(param2)
VendorPayType: vendorPayType, } else {
TransactionID: result.TrxID, result, err := api.TLpayAPI.CreateUnitorderOrder(param)
VendorOrderID: order.VendorOrderID, if err == nil {
VendorID: order.VendorID, var result2 tonglianpayapi.PayInfo
Status: 0, json.Unmarshal([]byte(result.PayInfo), &result2)
PayCreatedAt: payCreatedAt, prePayID := result2.Package[strings.LastIndex(result2.Package, "=")+1 : len(result2.Package)]
PrepayID: prePayID, orderPay = &model.OrderPay{
CodeURL: utils.LimitUTF8StringLen(result.PayInfo, 3200), PayOrderID: param.Reqsn,
TotalFee: int(order.ActualPayPrice), 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 return orderPay, err