sensitive的新增和修改方法,美团配送打开和新增的时候实时更新的方法
This commit is contained in:
@@ -1509,7 +1509,17 @@ func GetStoreCourierMaps(ctx *jxcontext.Context, db *dao.DaoDB, storeID int, ven
|
|||||||
if vendorID != -1 {
|
if vendorID != -1 {
|
||||||
cond[model.FieldVendorID] = vendorID
|
cond[model.FieldVendorID] = vendorID
|
||||||
}
|
}
|
||||||
return storeCourierMaps, dao.GetEntitiesByKV(db, &storeCourierMaps, cond, false)
|
err = dao.GetEntitiesByKV(db, &storeCourierMaps, cond, false)
|
||||||
|
if len(storeCourierMaps) != 0 {
|
||||||
|
//同步美团配送与否状态及美团门店是否存在
|
||||||
|
for _, v := range storeCourierMaps {
|
||||||
|
if v.VendorID != model.VendorIDMTPS {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
SetMTPSStatus(jxcontext.AdminCtx, v.StoreID, v.Status)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return storeCourierMaps, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddStoreCourierMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID int, storeCourierMap *model.StoreCourierMap) (outStoreCourierMap *model.StoreCourierMap, err error) {
|
func AddStoreCourierMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID int, storeCourierMap *model.StoreCourierMap) (outStoreCourierMap *model.StoreCourierMap, err error) {
|
||||||
@@ -1556,6 +1566,10 @@ func addStoreCourierMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID
|
|||||||
} else {
|
} else {
|
||||||
err = ErrCanNotFindVendor
|
err = ErrCanNotFindVendor
|
||||||
}
|
}
|
||||||
|
//同步美团配送与否状态及美团门店是否存在
|
||||||
|
if outStoreCourierMap.VendorID == model.VendorIDMTPS {
|
||||||
|
SetMTPSStatus(jxcontext.AdminCtx, outStoreCourierMap.StoreID, outStoreCourierMap.Status)
|
||||||
|
}
|
||||||
return outStoreCourierMap, err
|
return outStoreCourierMap, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1279,9 +1279,26 @@ func SyncSkuExperfixAndWatermark(ctx *jxcontext.Context) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetMTPSStatus(ctx *jxcontext.Context) {
|
func SetMTPSStatus(ctx *jxcontext.Context, StoreId, CourierStatus int) {
|
||||||
globals.SugarLogger.Debug("StoreOpenAll skuID is start ")
|
globals.SugarLogger.Debug("StoreOpenAll skuID is start ")
|
||||||
|
globals.SugarLogger.Debug("StoreId", "CourierStatus", StoreId, CourierStatus)
|
||||||
/*获取美团门店信息*/
|
/*获取美团门店信息*/
|
||||||
|
if StoreId != 0 && CourierStatus != 0 {
|
||||||
|
StoreLists, _ := dao.GetStoreList(nil, []int{StoreId}, nil, nil, nil, "")
|
||||||
|
StoreInfoList, _ := api.MtpsAPI.GetStoreStatus(StoreLists[0].Name)
|
||||||
|
if StoreInfoList != nil && StoreInfoList.PoiName != "" {
|
||||||
|
//若存在且名字不为空,就是找到了
|
||||||
|
if StoreInfoList.OpenType != CourierStatus {
|
||||||
|
sl := make(map[string]interface{})
|
||||||
|
sl["vendorStoreID"] = StoreInfoList.OuterPoiID
|
||||||
|
sl["status"] = StoreInfoList.OpenType
|
||||||
|
sl["vendorStatus"] = StoreInfoList.OpenType
|
||||||
|
globals.SugarLogger.Debugf("被修改配送状态的VendorStoreID是:%s,名称是:%s,美团状态是:%s,本地状态是:%s",
|
||||||
|
StoreInfoList.OuterPoiID, StoreInfoList.PoiName, strconv.Itoa(StoreInfoList.OpenType), strconv.Itoa(StoreLists[0].Status))
|
||||||
|
UpdateStoreCourierMap(ctx, nil, StoreId, model.VendorIDMTPS, sl, ctx.GetUserName())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
StoreInfoList, _ := api.MtpsAPI.GetStoreStatusAll()
|
StoreInfoList, _ := api.MtpsAPI.GetStoreStatusAll()
|
||||||
StoreInfoList2 := make(map[string]string)
|
StoreInfoList2 := make(map[string]string)
|
||||||
for _, store := range StoreInfoList {
|
for _, store := range StoreInfoList {
|
||||||
@@ -1364,5 +1381,6 @@ func SetMTPSStatus(ctx *jxcontext.Context) {
|
|||||||
//break test
|
//break test
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
globals.SugarLogger.Debug("StoreOpenAll skuID is Complete")
|
globals.SugarLogger.Debug("StoreOpenAll skuID is Complete")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -423,7 +423,7 @@ func doDailyWork() {
|
|||||||
//同步上架京东商城待售商品
|
//同步上架京东商城待售商品
|
||||||
cms.RefreshJdsSkusStatus(jxcontext.AdminCtx)
|
cms.RefreshJdsSkusStatus(jxcontext.AdminCtx)
|
||||||
//同步美团配送与否状态及美团门店是否存在
|
//同步美团配送与否状态及美团门店是否存在
|
||||||
cms.SetMTPSStatus(jxcontext.AdminCtx)
|
cms.SetMTPSStatus(jxcontext.AdminCtx, 0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func RefreshRealMobile(ctx *jxcontext.Context, vendorID int, fromTime, toTime time.Time, isAsync, isContinueWhenError bool) (hint string, err error) {
|
func RefreshRealMobile(ctx *jxcontext.Context, vendorID int, fromTime, toTime time.Time, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
package dao
|
package dao
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetSensitiveWordList() (wordList []*model.SensitiveWord, err error) {
|
func GetSensitiveWordList() (wordList []*model.SensitiveWord, err error) {
|
||||||
sql := `SELECT * FROM sensitive_word`
|
sql := `SELECT * FROM sensitive_word WHERE deleted_at = ?`
|
||||||
err = GetRows(nil, &wordList, sql)
|
err = GetRows(nil, &wordList, sql, utils.DefaultTimeValue)
|
||||||
return wordList, err
|
return wordList, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15,3 +18,27 @@ func InsertSensitiveWord(word string, vendorID int, userName string) error {
|
|||||||
WrapAddIDCULDEntity(sensitiveWord, userName)
|
WrapAddIDCULDEntity(sensitiveWord, userName)
|
||||||
return CreateEntity(nil, sensitiveWord)
|
return CreateEntity(nil, sensitiveWord)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DeleteSensitiveWord(wordList *model.SensitiveWord, id int) error {
|
||||||
|
if id == 0 {
|
||||||
|
return errors.New("入参错误,找不到相应ID")
|
||||||
|
}
|
||||||
|
wordList.ID = id
|
||||||
|
wordList.DeletedAt = time.Now()
|
||||||
|
if _, err := UpdateEntity(nil, wordList, "deleted_at"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func UpdateSensitiveWord(wordList *model.SensitiveWord, id int, params ...string) error {
|
||||||
|
if id == 0 {
|
||||||
|
return errors.New("入参错误,找不到相应ID")
|
||||||
|
}
|
||||||
|
wordList.ID = id
|
||||||
|
wordList.DeletedAt = time.Now()
|
||||||
|
if _, err := UpdateEntity(nil, wordList, params...); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -353,6 +353,31 @@ func (c *SkuController) GetSensitiveWordList() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Title 插入敏感词列表
|
||||||
|
// @Description 插入敏感词列表
|
||||||
|
// @Param token header string true "认证token"
|
||||||
|
// @Param word query string true "关键词名字"
|
||||||
|
// @Param vendorID query int false "VendorID"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @router /InsertSensitiveWord [post]
|
||||||
|
func (c *SkuController) InsertSensitiveWord() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title 修改敏感词列表
|
||||||
|
// @Description 修改敏感词列表
|
||||||
|
// @Param token header string true "认证token"
|
||||||
|
// @Param word query string true "关键词名字"
|
||||||
|
// @Param vendorID query int false "VendorID"
|
||||||
|
// @Param Status query int false "状态,0为修改默认,1为删除"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @router /UpdateSensitiveWord [put]
|
||||||
|
func (c *SkuController) UpdateSensitiveWord() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// @Title 子分类下商品的重排序
|
// @Title 子分类下商品的重排序
|
||||||
// @Description 子分类下商品的重排序
|
// @Description 子分类下商品的重排序
|
||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
|
|||||||
Reference in New Issue
Block a user