1
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/common"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/event"
|
||||
"io"
|
||||
@@ -5856,3 +5857,33 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis
|
||||
}
|
||||
return homePages, "", nil
|
||||
}
|
||||
|
||||
// 抖店定时任务 主动拉取门店审核状态信息并更新
|
||||
func UpdateStorePoiStatus(ctx *jxcontext.Context) error {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
)
|
||||
storeList, _ := dao.GetStoresMapList(db, []int{model.VendorIDDD}, nil, []int{model.StoreStatusOpened, model.StoreStatusHaveRest}, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "")
|
||||
task := tasksch.NewParallelTask("UpdateDDStorePoiAuditInfo", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
storeMap := batchItemList[0].(*model.StoreMap)
|
||||
if handler := CurVendorSync.GetStoreHandler(storeMap.VendorID); handler != nil {
|
||||
if storePoiStatus, err := handler.GetStoreStatus(ctx, storeMap.VendorOrgCode, storeMap.StoreID, storeMap.VendorStoreID); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
if storePoiStatus == tiktok_api.PoiAuditStateSuccessBind {
|
||||
storeMap.AuditStatus = model.StoreAuditStatusCreated
|
||||
} else if storePoiStatus == tiktok_api.PoiAuditStateReject {
|
||||
storeMap.AuditStatus = model.StoreAuditStatusRejected
|
||||
}
|
||||
dao.UpdateEntity(db, storeMap, "AuditStatus")
|
||||
store := fmt.Sprintf("门店ID:%d,门店名称:%s,抖店平台审核状态:%d,抖店平台门店ID:%s", storeMap.StoreID, storeMap.StoreName, storeMap.AuditStatus, storeMap.VendorStoreID)
|
||||
event.AddOperateEvent(ctx, ctx.GetTrackInfo(), store, "", "", 10, "UpdateStore")
|
||||
}
|
||||
}
|
||||
return retVal, err
|
||||
}, storeList)
|
||||
tasksch.HandleTask(task, nil, true).Run()
|
||||
task.GetID()
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cms
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
@@ -154,4 +155,9 @@ func TestQueryPageStores2(t *testing.T) {
|
||||
|
||||
func TestUpdate(t *testing.T) {
|
||||
UpdateStoreOperatorConfig()
|
||||
}
|
||||
}
|
||||
func TestUpdateStorePoiStatus(t *testing.T) {
|
||||
var ctx *jxcontext.Context
|
||||
err := UpdateStorePoiStatus(ctx)
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
@@ -178,6 +178,13 @@ func Init() {
|
||||
delivery.GetOrderRiderInfoToPlatform("")
|
||||
}, 10*time.Second, 5*time.Minute)
|
||||
|
||||
//每天晚上23:00更新抖店 审核状态
|
||||
ScheduleTimerFunc("UpdateStorePoiStatus", func() {
|
||||
cms.UpdateStorePoiStatus(jxcontext.AdminCtx)
|
||||
}, []string{
|
||||
"22:00:00",
|
||||
})
|
||||
|
||||
// 定时任务更新负责人信息
|
||||
ScheduleTimerFunc("RefreshStoreOperator", func() {
|
||||
cms.UpdateStoreOperatorConfig()
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/baseapi/utils/errlist"
|
||||
"git.rosy.net.cn/jx-callback/business/jxcallback/scheduler"
|
||||
//"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/event"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
@@ -594,14 +595,18 @@ func (P *PurchaseHandler) UpdateStoreOpTime(ctx *jxcontext.Context, vendorOrgCod
|
||||
//获取门店状态
|
||||
func (P *PurchaseHandler) GetStoreStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string) (storeStatus int, err error) {
|
||||
params := &shop_getStoreDetail_request.ShopGetStoreDetailParam{
|
||||
StoreId: utils.Str2Int64(vendorStoreID),
|
||||
StoreId: utils.Str2Int64(vendorStoreID),
|
||||
IsNeedChargeInfo: false,
|
||||
IsNeedPoiAuditInfo: false,
|
||||
IsNeedRelShopUser: false,
|
||||
}
|
||||
result, err := getAPI(vendorOrgCode, storeID, vendorStoreID).GetStoreDetail(params)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
status := bizStatusJX2DouDian(int(result.StoreDetail.Store.State))
|
||||
return status, nil
|
||||
poiStatus := int(result.StoreDetail.Store.PoiAuditState)
|
||||
//status := bizStatusJX2DouDian(int(result.StoreDetail.Store.PoiAuditState))
|
||||
return poiStatus, nil
|
||||
}
|
||||
|
||||
func (P *PurchaseHandler) EnableAutoAcceptOrder(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, isSetEnable bool) (err error) {
|
||||
@@ -649,7 +654,6 @@ func (P *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendo
|
||||
return nil, err
|
||||
}
|
||||
globals.SugarLogger.Debugf("AddAuthBind user================:%s", utils.Format4Output(vendorStore, true))
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(result, false))
|
||||
retVal := &dao.StoreDetail{
|
||||
Store: model.Store{
|
||||
Address: vendorStore.StoreDetail.Store.Address,
|
||||
|
||||
@@ -496,15 +496,15 @@ func CreateSaleTemp(storeId int64, api *tiktokShop.API) (int64, error) {
|
||||
}
|
||||
tradeLimitRuleRequestList := make([]trade_createTradeLimitTemplate_request.TradeLimitRuleRequestListItem, 0)
|
||||
tradeLimitRuleRequest := trade_createTradeLimitTemplate_request.TradeLimitRuleRequestListItem{
|
||||
TradeLimitModel: 1, // 限购模型 1-重量,2-数量,3-地区,4-金额
|
||||
TradeLimitResource: 2, // 限购资源类别1-抖店,2-门店,3-商品ID,4-sku,5-类目,6-活动,7-商品标
|
||||
TradeLimitResourceObject: nil,
|
||||
TradeLimitModel: 1, // 限购模型 1-重量,2-数量,3-地区,4-金额
|
||||
TradeLimitResource: 2, // 限购资源类别1-抖店,2-门店,3-商品ID,4-sku,5-类目,6-活动,7-商品标
|
||||
//TradeLimitResourceObject: nil,
|
||||
TradeLimitPattern: &trade_createTradeLimitTemplate_request.TradeLimitPattern{
|
||||
Minimum: 1, // 1毫克
|
||||
Maximum: 500 * 1000 * 1000, //500千克
|
||||
CumulativeMax: 99999,
|
||||
},
|
||||
TimePeriod: nil,
|
||||
//TimePeriod: nil,
|
||||
TradeLimitSubjectList: []int32{1},
|
||||
}
|
||||
tradeLimitRuleRequestList = append(tradeLimitRuleRequestList, tradeLimitRuleRequest)
|
||||
|
||||
Reference in New Issue
Block a user