aa
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg"
|
||||||
beego "github.com/astaxie/beego/server/web"
|
beego "github.com/astaxie/beego/server/web"
|
||||||
"math"
|
"math"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -1782,6 +1783,7 @@ func RefreshJdsOrderConsigneeInfo(ctx *jxcontext.Context, vendorOrderID string)
|
|||||||
func UpdateOrderInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID int, payload map[string]interface{}) (num int64, err error) {
|
func UpdateOrderInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID int, payload map[string]interface{}) (num int64, err error) {
|
||||||
var (
|
var (
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
|
jxSubsidyMoney int64
|
||||||
)
|
)
|
||||||
order, err := partner.CurOrderManager.LoadOrder(vendorOrderID, vendorID)
|
order, err := partner.CurOrderManager.LoadOrder(vendorOrderID, vendorID)
|
||||||
if payload["consigneeLng"] != nil || payload["consigneeLat"] != nil {
|
if payload["consigneeLng"] != nil || payload["consigneeLat"] != nil {
|
||||||
@@ -1792,7 +1794,7 @@ func UpdateOrderInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID int,
|
|||||||
payload["expectedDeliveredTime"] = utils.Str2Time(payload["expectedDeliveredTime"].(string))
|
payload["expectedDeliveredTime"] = utils.Str2Time(payload["expectedDeliveredTime"].(string))
|
||||||
}
|
}
|
||||||
if payload["jxSubsidyMoney"] != nil {
|
if payload["jxSubsidyMoney"] != nil {
|
||||||
jxSubsidyMoney := utils.Interface2Int64WithDefault(payload["jxSubsidyMoney"], 0)
|
jxSubsidyMoney = utils.Interface2Int64WithDefault(payload["jxSubsidyMoney"], 0)
|
||||||
if order.EarningType == model.EarningTypeQuote {
|
if order.EarningType == model.EarningTypeQuote {
|
||||||
payload["earningPrice"] = order.EarningPrice - order.JxSubsidyMoney + jxSubsidyMoney
|
payload["earningPrice"] = order.EarningPrice - order.JxSubsidyMoney + jxSubsidyMoney
|
||||||
}
|
}
|
||||||
@@ -1812,6 +1814,25 @@ func UpdateOrderInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID int,
|
|||||||
}
|
}
|
||||||
dao.Commit(db, txDB)
|
dao.Commit(db, txDB)
|
||||||
}
|
}
|
||||||
|
if payload["jxSubsidyMoney"] != nil {
|
||||||
|
var (
|
||||||
|
userIDs []string
|
||||||
|
)
|
||||||
|
storeDetail, _ := dao.GetStoreDetail(db, jxutils.GetSaleStoreIDFromOrder(order), order.VendorID, order.VendorOrgCode)
|
||||||
|
if storeDetail != nil && storeDetail.Tel1 != "" {
|
||||||
|
user, _ := dao.GetUserByID(db, "mobile", storeDetail.Tel1)
|
||||||
|
if user != nil {
|
||||||
|
userIDs = append(userIDs, user.UserID)
|
||||||
|
}
|
||||||
|
if storeDetail.Tel2 != "" {
|
||||||
|
user2, _ := dao.GetUserByID(db, "mobile", storeDetail.Tel2)
|
||||||
|
if user2 != nil {
|
||||||
|
userIDs = append(userIDs, user2.UserID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
weixinmsg.SendUserMessage(jxcontext.AdminCtx, "订单补偿", fmt.Sprintf("您收到了%v元的订单补偿,订单号:[%v]", jxSubsidyMoney, order.VendorOrderID), userIDs, true, true)
|
||||||
|
}
|
||||||
return num, err
|
return num, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user