饿鲜达商品库合并测试,订单分账修改
This commit is contained in:
@@ -660,7 +660,6 @@ func AutoPayForPopluarMan(ctx *jxcontext.Context, isAsync, isContinueWhenError b
|
||||
toDateStr = time.Now().AddDate(0, 0, -1).Format("2006-1-2") + " 23:59:59"
|
||||
)
|
||||
result, err := dao.GetOrdersForJxPay(db, utils.Str2Time(fromDateStr), utils.Str2Time(toDateStr))
|
||||
fmt.Println(result)
|
||||
task := tasksch.NewParallelTask("AutoPayForPopluarMan", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
goods := batchItemList[0].(*dao.GoodsOrderPay)
|
||||
@@ -670,6 +669,9 @@ func AutoPayForPopluarMan(ctx *jxcontext.Context, isAsync, isContinueWhenError b
|
||||
TransactionID: goods.TransactionID,
|
||||
OutOrderNo: goods.VendorOrderID,
|
||||
}
|
||||
payPrice1 int
|
||||
payPrice2 int
|
||||
receivers string = "["
|
||||
)
|
||||
user, err := dao.GetUserByID(db, "user_id", goods.UserID)
|
||||
if user.ParentMobile == "" {
|
||||
@@ -683,11 +685,9 @@ func AutoPayForPopluarMan(ctx *jxcontext.Context, isAsync, isContinueWhenError b
|
||||
if len(auth) == 0 {
|
||||
errMsg += fmt.Sprintf("打款失败!未找到此用户的微信验证方式!订单号:[%v],用户ID:[%v]\n", goods.VendorOrderID, user2.UserID)
|
||||
} else {
|
||||
param.Receivers = wxpayapi.CData(`[{"type":"` + wxpayapi.AccountTypeOpen + `","account":"` + auth[0].AuthID + `","amount":` + utils.Int2Str(int(goods.ActualPayPrice)*user2.DividePercentage/100) + `,"description":"每日订单打款分到个人"}]`)
|
||||
_, err := api.WxpayAPI.MultiProfitSharing(param)
|
||||
if err != nil {
|
||||
return retVal, err
|
||||
}
|
||||
payPrice1 = int(goods.ActualPayPrice) * user2.DividePercentage / 100
|
||||
receivers += `{"type":"` + wxpayapi.AccountTypeOpen + `","account":"` + auth[0].AuthID + `","amount":` + utils.Int2Str(payPrice1) + `,"description":"每日订单打款分到个人"}`
|
||||
// _, err := api.WxpayAPI.MultiProfitSharing(param)
|
||||
}
|
||||
if user2.ParentMobile != "" {
|
||||
user3, err := dao.GetUserByID(db, "mobile", user2.ParentMobile)
|
||||
@@ -698,13 +698,17 @@ func AutoPayForPopluarMan(ctx *jxcontext.Context, isAsync, isContinueWhenError b
|
||||
if len(auth) == 0 {
|
||||
errMsg += fmt.Sprintf("打款失败!未找到此用户的微信验证方式!订单号:[%v],用户ID:[%v]\n", goods.VendorOrderID, user3.UserID)
|
||||
} else {
|
||||
param.Receivers = wxpayapi.CData(`[{"type":"` + wxpayapi.AccountTypeOpen + `","account":"` + auth[0].AuthID + `","amount":` + utils.Int2Str(int(goods.ActualPayPrice)*user3.DividePercentage/100) + `,"description":"每日订单打款分到个人"}]`)
|
||||
_, err := api.WxpayAPI.MultiProfitSharing(param)
|
||||
if err != nil {
|
||||
return retVal, err
|
||||
}
|
||||
payPrice2 = (int(goods.ActualPayPrice) - payPrice1) * user3.DividePercentage / 100
|
||||
receivers += `,{"type":"` + wxpayapi.AccountTypeOpen + `","account":"` + auth[0].AuthID + `","amount":` + utils.Int2Str(payPrice2) + `,"description":"每日订单打款分到个人"}`
|
||||
// _, err := api.WxpayAPI.MultiProfitSharing(param)
|
||||
}
|
||||
}
|
||||
receivers += "]"
|
||||
param.Receivers = wxpayapi.CData(receivers)
|
||||
_, err = api.WxpayAPI.MultiProfitSharing(param)
|
||||
if err != nil {
|
||||
return retVal, err
|
||||
}
|
||||
return retVal, errors.New(errMsg)
|
||||
}, result)
|
||||
tasksch.HandleTask(task, nil, true).Run()
|
||||
|
||||
Reference in New Issue
Block a user