aa
This commit is contained in:
@@ -88,8 +88,8 @@ type StoreSkuBindInfo struct {
|
||||
IsFocus int `json:"isFocus"` // -1:不关注,0:忽略,1:关注
|
||||
IsSale int `json:"isSale"` // -1:不可售,0:忽略,1:可售
|
||||
SubStoreID int `json:"subStoreID,omitempty"`
|
||||
StatusSaleBegin int16 `json:"statusSaleBegin" validate:"max=2359,min=1,ltfield=StatusSaleEnd"` //商品可售时间范围
|
||||
StatusSaleEnd int16 `json:"statusSaleEnd" validate:"max=2359,min=1"`
|
||||
StatusSaleBegin *int16 `json:"statusSaleBegin" validate:"max=2359,min=1,ltfield=StatusSaleEnd"` //商品可售时间范围
|
||||
StatusSaleEnd *int16 `json:"statusSaleEnd" validate:"max=2359,min=1"`
|
||||
UPC string `json:"upc"`
|
||||
MtLadderBoxPrice int `json:"mtLadderBoxPrice"`
|
||||
Skus []*StoreSkuBindSkuInfo `json:"skus,omitempty"`
|
||||
@@ -1764,26 +1764,26 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
||||
// checkActDirectDown(ctx, skuBind, beforeMsg)
|
||||
}
|
||||
}
|
||||
if skuBindInfo.StatusSaleBegin != 0 && skuBindInfo.StatusSaleEnd != 0 {
|
||||
if skuBindInfo.StatusSaleBegin != nil && skuBindInfo.StatusSaleEnd != nil {
|
||||
if err := ValidateStruct(skuBindInfo); err != nil {
|
||||
globals.SugarLogger.Infof("更改商品:%s, 可售时间不合法!时间范围:[%v] 至 [%v]", allBinds[0].Name, skuBindInfo.StatusSaleBegin, skuBindInfo.StatusSaleEnd)
|
||||
} else {
|
||||
if skuBind.StatusSaleBegin != skuBindInfo.StatusSaleBegin || skuBind.StatusSaleEnd != skuBindInfo.StatusSaleEnd {
|
||||
if skuBind.StatusSaleBegin != *skuBindInfo.StatusSaleBegin || skuBind.StatusSaleEnd != *skuBindInfo.StatusSaleEnd {
|
||||
updateFieldMap["StatusSaleBegin"] = 1
|
||||
updateFieldMap["StatusSaleEnd"] = 1
|
||||
}
|
||||
skuBind.StatusSaleBegin = skuBindInfo.StatusSaleBegin
|
||||
skuBind.StatusSaleEnd = skuBindInfo.StatusSaleEnd
|
||||
skuBind.StatusSaleBegin = *skuBindInfo.StatusSaleBegin
|
||||
skuBind.StatusSaleEnd = *skuBindInfo.StatusSaleEnd
|
||||
}
|
||||
}
|
||||
if skuBindInfo.StatusSaleBegin == 0 && skuBindInfo.StatusSaleEnd == 0 {
|
||||
if skuBind.StatusSaleBegin != skuBindInfo.StatusSaleBegin || skuBind.StatusSaleEnd != skuBindInfo.StatusSaleEnd {
|
||||
updateFieldMap["StatusSaleBegin"] = 1
|
||||
updateFieldMap["StatusSaleEnd"] = 1
|
||||
}
|
||||
skuBind.StatusSaleBegin = skuBindInfo.StatusSaleBegin
|
||||
skuBind.StatusSaleEnd = skuBindInfo.StatusSaleEnd
|
||||
}
|
||||
//if skuBindInfo.StatusSaleBegin == 0 && skuBindInfo.StatusSaleEnd == 0 {
|
||||
// if skuBind.StatusSaleBegin != skuBindInfo.StatusSaleBegin || skuBind.StatusSaleEnd != skuBindInfo.StatusSaleEnd {
|
||||
// updateFieldMap["StatusSaleBegin"] = 1
|
||||
// updateFieldMap["StatusSaleEnd"] = 1
|
||||
// }
|
||||
// skuBind.StatusSaleBegin = skuBindInfo.StatusSaleBegin
|
||||
// skuBind.StatusSaleEnd = skuBindInfo.StatusSaleEnd
|
||||
//}
|
||||
|
||||
if globals.IsAddEvent {
|
||||
if len(updateFieldMap) > 0 {
|
||||
|
||||
@@ -2,8 +2,9 @@ package smsmsg
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
aliyunsmsclient "github.com/KenmyZhang/aliyun-communicate"
|
||||
dyvmsapiclient "github.com/alibabacloud-go/Dyvmsapi-20170525/client"
|
||||
"github.com/alibabacloud-go/tea/tea"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/baseapi/utils/errlist"
|
||||
@@ -30,7 +31,7 @@ func SendSMSMsg(mobileList []string, signName, templateCode string, templatePara
|
||||
for _, mobileNum := range mobileList {
|
||||
if mobileNum != "" {
|
||||
globals.SugarLogger.Debugf("SendSMSMsg mobileNum:%s, templateCode:%s", mobileNum, templateCode)
|
||||
if true { //globals.EnableStoreWrite {
|
||||
if true {
|
||||
if response, err := api.SMSClient.Execute(globals.AliKey, globals.AliSecret, mobileNum, signName, templateCode, string(utils.MustMarshal(templateParam))); err != nil {
|
||||
globals.SugarLogger.Warnf("SendSMSMsg mobileNum:%s failed with error:%v", mobileNum, err)
|
||||
errList.AddErr(err)
|
||||
@@ -43,11 +44,32 @@ func SendSMSMsg(mobileList []string, signName, templateCode string, templatePara
|
||||
globals.SugarLogger.Infof(errMsg)
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// if order != nil {
|
||||
// err = updateStoreSMSNotifyMark(order)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
err = errList.GetErrListAsOne()
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func SendVoiceMsg(mobileList []string, templateParam map[string]interface{}) (err error) {
|
||||
if len(mobileList) > 0 {
|
||||
errList := errlist.New()
|
||||
mobileList = jxutils.StringMap2List(jxutils.StringList2Map(mobileList))
|
||||
for _, mobileNum := range mobileList {
|
||||
if mobileNum != "" {
|
||||
request := &dyvmsapiclient.SingleCallByTtsRequest{
|
||||
CalledNumber: tea.String(mobileNum),
|
||||
TtsCode: tea.String(globals.SMSVoicePickOrderTemplate),
|
||||
TtsParam: tea.String(string(utils.MustMarshal(templateParam))),
|
||||
}
|
||||
res, _err := api.VoiceClient.SingleCallByTts(request)
|
||||
if _err != nil {
|
||||
errList.AddErr(err)
|
||||
}
|
||||
if res.Body.Code != tea.String("OK") {
|
||||
globals.SugarLogger.Debugf("SendVoiceMsg mobileNum:%s failed with response:%s", mobileNum, utils.Format4Output(res, true))
|
||||
errList.AddErr(fmt.Errorf(*res.Body.Message))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,9 +113,29 @@ func NotifyNewOrder(order *model.GoodsOrder) (err error) {
|
||||
}
|
||||
|
||||
func NotifyPickOrder(order *model.GoodsOrder) (err error) {
|
||||
if isPushSMS(order) {
|
||||
err = SendSMSMsg(getOrderNotifyPhone(order), globals.SMSSignName, globals.SMSPickOrderTemplate, nil, order)
|
||||
//if isPushSMS(order) {
|
||||
store, _ := dao.GetStoreDetail(dao.GetDB(), jxutils.GetSaleStoreIDFromOrder(order), order.VendorID, order.VendorOrgCode)
|
||||
mobileList := []string{}
|
||||
if store.Tel1 != "" {
|
||||
mobileList = append(mobileList, store.Tel1)
|
||||
}
|
||||
if store.Tel2 != "" {
|
||||
mobileList = append(mobileList, store.Tel2)
|
||||
}
|
||||
if store.SMSNotify != 0 && store.IsOrder == model.NO && store.ID != model.MatterStoreID && store.ID != model.JdShopMainStoreID && len(mobileList) > 0 {
|
||||
switch store.SMSNotify {
|
||||
case 1:
|
||||
err = SendSMSMsg(mobileList, globals.SMSSignName, globals.SMSPickOrderTemplate, nil, order)
|
||||
case 2:
|
||||
if store.MarketManPhone == "" {
|
||||
store.MarketManPhone = "18048531223"
|
||||
}
|
||||
err = SendVoiceMsg(mobileList, map[string]interface{}{
|
||||
"tel": store.MarketManPhone,
|
||||
})
|
||||
}
|
||||
}
|
||||
//}
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user