配送和发消息品牌余额限制
This commit is contained in:
@@ -2,6 +2,7 @@ package smsmsg
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
aliyunsmsclient "github.com/KenmyZhang/aliyun-communicate"
|
||||
dyvmsapiclient "github.com/alibabacloud-go/dyvmsapi-20170525-2.0.2/client"
|
||||
@@ -125,14 +126,21 @@ func NotifyPickOrder(order *model.GoodsOrder) (err error) {
|
||||
if store.Tel2 != "" {
|
||||
mobileList = append(mobileList, store.Tel2)
|
||||
}
|
||||
updateSth := func(order *model.GoodsOrder, store *dao.StoreDetail, feeType int) (err error) {
|
||||
order.NotifyType = int(store.SMSNotify)
|
||||
err = partner.CurOrderManager.UpdateOrderFields(order, []string{"NotifyType"})
|
||||
//品牌余额, 一条5分
|
||||
err = partner.CurStoreAcctManager.InsertBrandBill(jxcontext.AdminCtx, store.BrandID, 5, model.BrandBillTypeExpend, feeType, order.VendorOrderID, "")
|
||||
return err
|
||||
}
|
||||
balance, _ := partner.CurStoreAcctManager.GetBrandBalance(store.BrandID)
|
||||
if order.NotifyType == 0 && store.SMSNotify != 0 && store.IsOrder == model.NO && store.ID != model.MatterStoreID && store.ID != model.JdShopMainStoreID && len(mobileList) > 0 {
|
||||
globals.SugarLogger.Debugf("NotifyPickOrder orderID: %s , smsNotify :%d", order.VendorOrderID, store.SMSNotify)
|
||||
switch store.SMSNotify {
|
||||
case model.NotifyTypeSMS:
|
||||
if store.BrandIsOpen&model.BrandOpenSMS != 0 {
|
||||
if store.BrandIsOpen&model.BrandOpenSMS != 0 && balance >= model.BrandBalanceLimit {
|
||||
if err = SendSMSMsg(mobileList, globals.SMSSignName, globals.SMSPickOrderTemplate, nil, order); err == nil {
|
||||
order.NotifyType = int(store.SMSNotify)
|
||||
partner.CurOrderManager.UpdateOrderFields(order, []string{"NotifyType"})
|
||||
err = updateSth(order, store, model.BrandBillFeeTypeSms)
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Debugf("NotifyPickOrder sms brand is close , orderID: %s ,isOpen: %d", order.VendorOrderID, store.BrandIsOpen)
|
||||
@@ -141,12 +149,11 @@ func NotifyPickOrder(order *model.GoodsOrder) (err error) {
|
||||
if store.MarketManPhone == "" {
|
||||
store.MarketManPhone = "18048531223"
|
||||
}
|
||||
if store.BrandIsOpen&model.BrandOpenVoice != 0 {
|
||||
if store.BrandIsOpen&model.BrandOpenVoice != 0 && balance >= model.BrandBalanceLimit {
|
||||
if err = SendVoiceMsg(mobileList, map[string]interface{}{
|
||||
"tel": store.MarketManPhone,
|
||||
}); err == nil {
|
||||
order.NotifyType = int(store.SMSNotify)
|
||||
partner.CurOrderManager.UpdateOrderFields(order, []string{"NotifyType"})
|
||||
err = updateSth(order, store, model.BrandBillFeeTypeVoice)
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Debugf("NotifyPickOrder voice brand is close , orderID: %s ,isOpen: %d", order.VendorOrderID, store.BrandIsOpen)
|
||||
|
||||
Reference in New Issue
Block a user