aa
This commit is contained in:
@@ -88,8 +88,8 @@ type StoreSkuBindInfo struct {
|
|||||||
IsFocus int `json:"isFocus"` // -1:不关注,0:忽略,1:关注
|
IsFocus int `json:"isFocus"` // -1:不关注,0:忽略,1:关注
|
||||||
IsSale int `json:"isSale"` // -1:不可售,0:忽略,1:可售
|
IsSale int `json:"isSale"` // -1:不可售,0:忽略,1:可售
|
||||||
SubStoreID int `json:"subStoreID,omitempty"`
|
SubStoreID int `json:"subStoreID,omitempty"`
|
||||||
StatusSaleBegin int16 `json:"statusSaleBegin" validate:"max=2359,min=1,ltfield=StatusSaleEnd"` //商品可售时间范围
|
StatusSaleBegin *int16 `json:"statusSaleBegin" validate:"max=2359,min=1,ltfield=StatusSaleEnd"` //商品可售时间范围
|
||||||
StatusSaleEnd int16 `json:"statusSaleEnd" validate:"max=2359,min=1"`
|
StatusSaleEnd *int16 `json:"statusSaleEnd" validate:"max=2359,min=1"`
|
||||||
UPC string `json:"upc"`
|
UPC string `json:"upc"`
|
||||||
MtLadderBoxPrice int `json:"mtLadderBoxPrice"`
|
MtLadderBoxPrice int `json:"mtLadderBoxPrice"`
|
||||||
Skus []*StoreSkuBindSkuInfo `json:"skus,omitempty"`
|
Skus []*StoreSkuBindSkuInfo `json:"skus,omitempty"`
|
||||||
@@ -1764,26 +1764,26 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
|||||||
// checkActDirectDown(ctx, skuBind, beforeMsg)
|
// checkActDirectDown(ctx, skuBind, beforeMsg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if skuBindInfo.StatusSaleBegin != 0 && skuBindInfo.StatusSaleEnd != 0 {
|
if skuBindInfo.StatusSaleBegin != nil && skuBindInfo.StatusSaleEnd != nil {
|
||||||
if err := ValidateStruct(skuBindInfo); err != nil {
|
if err := ValidateStruct(skuBindInfo); err != nil {
|
||||||
globals.SugarLogger.Infof("更改商品:%s, 可售时间不合法!时间范围:[%v] 至 [%v]", allBinds[0].Name, skuBindInfo.StatusSaleBegin, skuBindInfo.StatusSaleEnd)
|
globals.SugarLogger.Infof("更改商品:%s, 可售时间不合法!时间范围:[%v] 至 [%v]", allBinds[0].Name, skuBindInfo.StatusSaleBegin, skuBindInfo.StatusSaleEnd)
|
||||||
} else {
|
} else {
|
||||||
if skuBind.StatusSaleBegin != skuBindInfo.StatusSaleBegin || skuBind.StatusSaleEnd != skuBindInfo.StatusSaleEnd {
|
if skuBind.StatusSaleBegin != *skuBindInfo.StatusSaleBegin || skuBind.StatusSaleEnd != *skuBindInfo.StatusSaleEnd {
|
||||||
updateFieldMap["StatusSaleBegin"] = 1
|
updateFieldMap["StatusSaleBegin"] = 1
|
||||||
updateFieldMap["StatusSaleEnd"] = 1
|
updateFieldMap["StatusSaleEnd"] = 1
|
||||||
}
|
}
|
||||||
skuBind.StatusSaleBegin = skuBindInfo.StatusSaleBegin
|
skuBind.StatusSaleBegin = *skuBindInfo.StatusSaleBegin
|
||||||
skuBind.StatusSaleEnd = skuBindInfo.StatusSaleEnd
|
skuBind.StatusSaleEnd = *skuBindInfo.StatusSaleEnd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if skuBindInfo.StatusSaleBegin == 0 && skuBindInfo.StatusSaleEnd == 0 {
|
//if skuBindInfo.StatusSaleBegin == 0 && skuBindInfo.StatusSaleEnd == 0 {
|
||||||
if skuBind.StatusSaleBegin != skuBindInfo.StatusSaleBegin || skuBind.StatusSaleEnd != skuBindInfo.StatusSaleEnd {
|
// if skuBind.StatusSaleBegin != skuBindInfo.StatusSaleBegin || skuBind.StatusSaleEnd != skuBindInfo.StatusSaleEnd {
|
||||||
updateFieldMap["StatusSaleBegin"] = 1
|
// updateFieldMap["StatusSaleBegin"] = 1
|
||||||
updateFieldMap["StatusSaleEnd"] = 1
|
// updateFieldMap["StatusSaleEnd"] = 1
|
||||||
}
|
// }
|
||||||
skuBind.StatusSaleBegin = skuBindInfo.StatusSaleBegin
|
// skuBind.StatusSaleBegin = skuBindInfo.StatusSaleBegin
|
||||||
skuBind.StatusSaleEnd = skuBindInfo.StatusSaleEnd
|
// skuBind.StatusSaleEnd = skuBindInfo.StatusSaleEnd
|
||||||
}
|
//}
|
||||||
|
|
||||||
if globals.IsAddEvent {
|
if globals.IsAddEvent {
|
||||||
if len(updateFieldMap) > 0 {
|
if len(updateFieldMap) > 0 {
|
||||||
|
|||||||
@@ -2,8 +2,9 @@ package smsmsg
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
aliyunsmsclient "github.com/KenmyZhang/aliyun-communicate"
|
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"
|
||||||
"git.rosy.net.cn/baseapi/utils/errlist"
|
"git.rosy.net.cn/baseapi/utils/errlist"
|
||||||
@@ -30,7 +31,7 @@ func SendSMSMsg(mobileList []string, signName, templateCode string, templatePara
|
|||||||
for _, mobileNum := range mobileList {
|
for _, mobileNum := range mobileList {
|
||||||
if mobileNum != "" {
|
if mobileNum != "" {
|
||||||
globals.SugarLogger.Debugf("SendSMSMsg mobileNum:%s, templateCode:%s", mobileNum, templateCode)
|
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 {
|
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)
|
globals.SugarLogger.Warnf("SendSMSMsg mobileNum:%s failed with error:%v", mobileNum, err)
|
||||||
errList.AddErr(err)
|
errList.AddErr(err)
|
||||||
@@ -43,11 +44,32 @@ func SendSMSMsg(mobileList []string, signName, templateCode string, templatePara
|
|||||||
globals.SugarLogger.Infof(errMsg)
|
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) {
|
func NotifyPickOrder(order *model.GoodsOrder) (err error) {
|
||||||
if isPushSMS(order) {
|
//if isPushSMS(order) {
|
||||||
err = SendSMSMsg(getOrderNotifyPhone(order), globals.SMSSignName, globals.SMSPickOrderTemplate, nil, 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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ smsOrderCanceledTemplate = "SMS_175573134"
|
|||||||
smsNewUserOrderTemplate = "SMS_190284055"
|
smsNewUserOrderTemplate = "SMS_190284055"
|
||||||
smsJxOrderDelivering = "SMS_217235545"
|
smsJxOrderDelivering = "SMS_217235545"
|
||||||
smsPickOrderTemplate = "SMS_222861531"
|
smsPickOrderTemplate = "SMS_222861531"
|
||||||
|
smsVoicePickOrderTemplate = "TTS_222871733"
|
||||||
|
|
||||||
addEvent = true
|
addEvent = true
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package api
|
|||||||
import (
|
import (
|
||||||
"git.rosy.net.cn/baseapi/platformapi/jxprintapi"
|
"git.rosy.net.cn/baseapi/platformapi/jxprintapi"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/qywxapi"
|
"git.rosy.net.cn/baseapi/platformapi/qywxapi"
|
||||||
|
"github.com/alibabacloud-go/tea/tea"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi/platformapi/fnpsapi"
|
"git.rosy.net.cn/baseapi/platformapi/fnpsapi"
|
||||||
@@ -19,6 +20,8 @@ import (
|
|||||||
"git.rosy.net.cn/baseapi/platformapi/tonglianpayapi"
|
"git.rosy.net.cn/baseapi/platformapi/tonglianpayapi"
|
||||||
|
|
||||||
aliyunsmsclient "github.com/KenmyZhang/aliyun-communicate"
|
aliyunsmsclient "github.com/KenmyZhang/aliyun-communicate"
|
||||||
|
"github.com/alibabacloud-go/darabonba-openapi/client"
|
||||||
|
dyvmsapiclient "github.com/alibabacloud-go/dyvmsapi-20170525/client"
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi/platformapi"
|
"git.rosy.net.cn/baseapi/platformapi"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/alipayapi"
|
"git.rosy.net.cn/baseapi/platformapi/alipayapi"
|
||||||
@@ -105,8 +108,9 @@ var (
|
|||||||
|
|
||||||
PushAPI *unipushapi.API
|
PushAPI *unipushapi.API
|
||||||
|
|
||||||
Cacher cache.ICacher
|
Cacher cache.ICacher
|
||||||
SMSClient *aliyunsmsclient.SmsClient
|
SMSClient *aliyunsmsclient.SmsClient
|
||||||
|
VoiceClient *dyvmsapiclient.Client
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -284,6 +288,19 @@ func Init() {
|
|||||||
JxPrintAPI = jxprintapi.New(beego.AppConfig.DefaultString("jxPrintAppID", ""), beego.AppConfig.DefaultString("jxPrintAppKey", ""))
|
JxPrintAPI = jxprintapi.New(beego.AppConfig.DefaultString("jxPrintAppID", ""), beego.AppConfig.DefaultString("jxPrintAppKey", ""))
|
||||||
|
|
||||||
SMSClient = aliyunsmsclient.New("http://dysmsapi.aliyuncs.com/")
|
SMSClient = aliyunsmsclient.New("http://dysmsapi.aliyuncs.com/")
|
||||||
|
VoiceClient, _ = CreateClient(tea.String(beego.AppConfig.DefaultString("aliKey", "")), tea.String(beego.AppConfig.DefaultString("aliSecret", "")))
|
||||||
|
|
||||||
QywxAPI = qywxapi.New(beego.AppConfig.DefaultString("qywxID", ""), beego.AppConfig.DefaultString("qywxSecret", ""), "")
|
QywxAPI = qywxapi.New(beego.AppConfig.DefaultString("qywxID", ""), beego.AppConfig.DefaultString("qywxSecret", ""), "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CreateClient(accessKeyId *string, accessKeySecret *string) (_result *dyvmsapiclient.Client, _err error) {
|
||||||
|
config := &client.Config{}
|
||||||
|
// 您的AccessKey ID
|
||||||
|
config.AccessKeyId = accessKeyId
|
||||||
|
// 您的AccessKey Secret
|
||||||
|
config.AccessKeySecret = accessKeySecret
|
||||||
|
config.Endpoint = tea.String("dysmsapi.aliyuncs.com/")
|
||||||
|
_result = &dyvmsapiclient.Client{}
|
||||||
|
_result, _err = dyvmsapiclient.NewClient(config)
|
||||||
|
return _result, _err
|
||||||
|
}
|
||||||
|
|||||||
@@ -46,14 +46,15 @@ var (
|
|||||||
StoreNameEbai string
|
StoreNameEbai string
|
||||||
StoreNameEbai2 string
|
StoreNameEbai2 string
|
||||||
|
|
||||||
SMSSignName string
|
SMSSignName string
|
||||||
SMSMobileVerifyTemplate string
|
SMSMobileVerifyTemplate string
|
||||||
SMSNewOrderTemplate string
|
SMSNewOrderTemplate string
|
||||||
SMSNewOrderTemplateQ string
|
SMSNewOrderTemplateQ string
|
||||||
SMSOrderCanceledTemplate string
|
SMSOrderCanceledTemplate string
|
||||||
SMSNewUserOrderTemplate string
|
SMSNewUserOrderTemplate string
|
||||||
SMSJxOrderDelivering string
|
SMSJxOrderDelivering string
|
||||||
SMSPickOrderTemplate string
|
SMSPickOrderTemplate string
|
||||||
|
SMSVoicePickOrderTemplate string
|
||||||
|
|
||||||
EnableWXAuth2 bool
|
EnableWXAuth2 bool
|
||||||
DisableWXAuth1 bool
|
DisableWXAuth1 bool
|
||||||
@@ -138,6 +139,7 @@ func Init() {
|
|||||||
SMSOrderCanceledTemplate = web.AppConfig.DefaultString("smsOrderCanceledTemplate", "")
|
SMSOrderCanceledTemplate = web.AppConfig.DefaultString("smsOrderCanceledTemplate", "")
|
||||||
SMSNewUserOrderTemplate = web.AppConfig.DefaultString("smsNewUserOrderTemplate", "")
|
SMSNewUserOrderTemplate = web.AppConfig.DefaultString("smsNewUserOrderTemplate", "")
|
||||||
SMSJxOrderDelivering = web.AppConfig.DefaultString("smsJxOrderDelivering", "")
|
SMSJxOrderDelivering = web.AppConfig.DefaultString("smsJxOrderDelivering", "")
|
||||||
|
SMSVoicePickOrderTemplate = web.AppConfig.DefaultString("smsVoicePickOrderTemplate", "")
|
||||||
|
|
||||||
EnableWXAuth2 = true // web.BConfig.RunMode == "beta"
|
EnableWXAuth2 = true // web.BConfig.RunMode == "beta"
|
||||||
DisableWXAuth1 = true
|
DisableWXAuth1 = true
|
||||||
|
|||||||
Reference in New Issue
Block a user