1
This commit is contained in:
@@ -6095,3 +6095,7 @@ func BatchCreateFreeShipTemplate(relInfo map[string][]tiktok_store.RelInfo, ship
|
||||
func GetVendorStoreBind(vendorStoreId string, vendorId int) (int, error) {
|
||||
return dao.GetCodeAndIDByMeiTuan(vendorStoreId, vendorId)
|
||||
}
|
||||
|
||||
func BindJxPrintToStore(storeId int64, printSn, printKey string) error {
|
||||
return dao.BindJXPrintToStore(storeId, printSn, printKey)
|
||||
}
|
||||
|
||||
@@ -249,10 +249,10 @@ func Init() {
|
||||
cms.RefreshTiktokShopToken(jxcontext.AdminCtx)
|
||||
}, 60*time.Second, 30*time.Minute)
|
||||
|
||||
// 更新门店商品
|
||||
//ScheduleTimerFuncByInterval(func() {
|
||||
// syncStoreSkuTiktok()
|
||||
//}, 60*time.Second, 1*time.Minute)
|
||||
// 抖音更新门店商品
|
||||
ScheduleTimerFuncByInterval(func() {
|
||||
syncStoreSkuTiktok()
|
||||
}, 60*time.Second, 1*time.Minute)
|
||||
|
||||
// 定时任务刷新当前订单的物流信息
|
||||
ScheduleTimerFunc("RefreshMaterialLogistics", func() {
|
||||
@@ -574,6 +574,7 @@ func syncStoreSku() {
|
||||
}
|
||||
|
||||
func syncStoreSkuTiktok() {
|
||||
globals.SugarLogger.Debugf("==========syncStoreSkuTiktok=")
|
||||
syncFlag := 0 | model.SyncFlagSaleMask
|
||||
task := tasksch.NewParallelTask("同步京西商品到抖音平台,方案二使用", nil, jxcontext.AdminCtx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
@@ -593,6 +594,7 @@ func syncStoreSkuTiktok() {
|
||||
errList.AddErr(err)
|
||||
SaveImportantTaskID(TaskNameSyncStoreSku, SpecialTaskID)
|
||||
}
|
||||
globals.SugarLogger.Debugf("===============syncStoreSkuTiktok ,errList %s", utils.Format4Output(errList, false))
|
||||
err = errList.GetErrListAsOne()
|
||||
return retVal, err
|
||||
}, []int{0, 1})
|
||||
|
||||
@@ -1631,8 +1631,15 @@ func InsertIntoFreightTemplate(storeID int, vendorStoreID string, templateID, wa
|
||||
return err
|
||||
}
|
||||
|
||||
//只获取美团平台的京西storeID
|
||||
// GetCodeAndIDByMeiTuan 只获取美团平台的京西storeID
|
||||
func GetCodeAndIDByMeiTuan(vendorStoreID string, vendorId int) (storeID int, err error) {
|
||||
err = GetRow(GetDB(), &storeID, "SELECT s.store_id FROM store_map s WHERE s.vendor_store_id = ? AND s.vendor_id = ? ", vendorStoreID, vendorId)
|
||||
err = GetRow(GetDB(), &storeID, "SELECT s.store_id FROM store_map s WHERE s.vendor_store_id = ? AND s.vendor_id = ? AND deleted_at = ?", vendorStoreID, vendorId, utils.DefaultTimeValue)
|
||||
return storeID, err
|
||||
}
|
||||
|
||||
// BindJXPrintToStore 更新绑定门店的京西打印机 PrinterFontSize printer_sn printer_key printer_vendor_id printer_font_size
|
||||
func BindJXPrintToStore(storeId int64, printSn, printKey string) error {
|
||||
sql := ` UPDATE store SET printer_sn = ? , printer_key = ? , printer_vendor_id = ? , printer_font_size = ? WHERE id = ?`
|
||||
_, err := ExecuteSQL(GetDB(), sql, []interface{}{printSn, printKey, model.VendorIDJxprint, model.NO, storeId})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -43,15 +43,16 @@ func CreateThingMap(thingId int64, vendorThingID, appOrgCode, err string, thingT
|
||||
}
|
||||
|
||||
// GetThingToTiktokMapList 抖店获取同步类型
|
||||
func GetThingToTiktokMapList(db *DaoDB, vendorId int, thingId int64) (cats []*model.ThingMap, err error) {
|
||||
func GetThingToTiktokMapList(db *DaoDB, vendorId int, thingId int64, vendorOrgCode string) (cats []*model.ThingMap, err error) {
|
||||
sql := `
|
||||
SELECT t1.*
|
||||
FROM thing_map t1
|
||||
WHERE t1.thing_id = ? AND t1.vendor_id = ? AND t1.deleted_at = ?
|
||||
WHERE t1.thing_id = ? AND t1.vendor_id = ? AND vendor_org_code = ? AND t1.deleted_at = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
thingId,
|
||||
vendorId,
|
||||
vendorOrgCode,
|
||||
utils.DefaultTimeValue,
|
||||
}
|
||||
|
||||
|
||||
@@ -589,9 +589,6 @@ func (c *PurchaseHandler) Swtich2SelfDeliver(order *model.GoodsOrder, userName s
|
||||
AddressId: 0,
|
||||
StoreId: utils.Str2Int64(order.VendorStoreID),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
|
||||
// 根据本地商品id获取线上商品是否存在,存在则只创建子商品
|
||||
// 获取本地存储映射关系,获取本地主商品id是否存在
|
||||
localThing, err := dao.GetThingToTiktokMapList(db, model.VendorIDDD, int64(storeSku.SkuID))
|
||||
localThing, err := dao.GetThingToTiktokMapList(db, model.VendorIDDD, int64(storeSku.SkuID), storeDetail.VendorOrgCode)
|
||||
if len(localThing) == 0 {
|
||||
mainOrderDetail, err := api.GetSkuDetailLocalID("", utils.Int2Str(storeSku.SkuID))
|
||||
if err != nil || mainOrderDetail == nil || mainOrderDetail.ProductIdStr == "" {
|
||||
|
||||
@@ -1544,7 +1544,7 @@ func (c *StoreController) CreateFreeShipTemplates() {
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 打印机获取授权账号再京西菜市的绑定关系
|
||||
// @Title 打印机获取授权账号再京西菜市的绑定关系(其实就是根据平台门店id获取绑定门店id)
|
||||
// @Description 打印机获取授权账号再京西菜市的绑定关系
|
||||
// @Param token header string true "认证token"
|
||||
// @Param vendorStoreId formData string true "平台账号id"
|
||||
@@ -1558,3 +1558,20 @@ func (c *StoreController) PrintCheckAccountAuthorization() {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 门店存在时,绑定打印机账号信息
|
||||
// @Description 门店存在时,绑定打印机账号信息
|
||||
// @Param token header string true "认证token"
|
||||
// @Param storeId formData int64 true "京西门店id"
|
||||
// @Param printSn formData string true "打印机编号"
|
||||
// @Param printKey formData string true "打印机秘钥"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /BindJxPrinter [post]
|
||||
func (c *StoreController) BindJxPrinter() {
|
||||
c.callBindJxPrinter(func(params *tStoreBindJxPrinterParams) (interface{}, string, error) {
|
||||
err := cms.BindJxPrintToStore(int64(params.StoreId), params.PrintSn, params.PrintKey)
|
||||
return nil, "", err
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -3000,6 +3000,16 @@ func init() {
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
// 绑定京西打印机到京西菜市
|
||||
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"],
|
||||
web.ControllerComments{
|
||||
Method: "BindJxPrinter",
|
||||
Router: `/BindJxPrinter`,
|
||||
AllowHTTPMethods: []string{"post"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreSkuController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreSkuController"],
|
||||
web.ControllerComments{
|
||||
Method: "BackUpStoreSkuBind",
|
||||
|
||||
Reference in New Issue
Block a user