1
This commit is contained in:
@@ -1016,17 +1016,19 @@ func (*BrandCategoryMap) TableUnique() [][]string {
|
||||
}
|
||||
}
|
||||
|
||||
// 抖店 创建运费模板映射关系
|
||||
// 抖店 运费模板、仓库以及电子围栏绑定
|
||||
type FreightTemplate struct {
|
||||
ModelIDCULD
|
||||
StoreID int64 `orm:"column(store_id)" json:"storeID"` //京西本地门店ID
|
||||
StoreID int64 `orm:"column(store_id)" json:"storeID"` //京西本地门店ID即抖店门店编码
|
||||
VendorStoreID int64 `orm:"column(vendor_store_id)" json:"vendorStoreID"` //抖店平台门店ID
|
||||
TemplateID int64 `orm:"column(template_id)" json:"templateID"` //运费模板ID
|
||||
TemplateID int64 `orm:"column(template_id)" json:"templateID"` //运费模板ID 1对1
|
||||
TemplateDetail string `orm:"column(template_detail)" json:"templateDetail"` //json转化的模板信息
|
||||
WarehouseID string `orm:"column(warehouse_id)" json:"warehouseID"` //创建门店时绑定的仓库id 1对1
|
||||
FenceID string `orm:"column(fence_id)" json:"fenceID"` //电子围栏id 1对1
|
||||
}
|
||||
|
||||
func (*FreightTemplate) TableUnique() [][]string {
|
||||
return [][]string{
|
||||
[]string{"StoreID", "TemplateID", "VendorStoreID"},
|
||||
[]string{"StoreID", "VendorStoreID"},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ func (P *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
|
||||
lists []shop_batchCreateStore_request.StoreListItem
|
||||
ShopBatchCreateStoreParam *shop_batchCreateStore_request.ShopBatchCreateStoreParam
|
||||
)
|
||||
//a:=getAPI(storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID)
|
||||
timeStr := ""
|
||||
if storeDetail.OpenTime1 == 0 || storeDetail.CloseTime1 == 0 {
|
||||
return "", fmt.Errorf("营业时间必填")
|
||||
@@ -117,7 +118,7 @@ func (P *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
|
||||
return "", err
|
||||
} else {
|
||||
if len(resp.ResultList) == 0 {
|
||||
return "", errors.New("创建店铺失败")
|
||||
return "", errors.New("创建店铺失败,请检查店铺基本信息")
|
||||
}
|
||||
for k, v := range resp.ResultList {
|
||||
if k != len(resp.ResultList) {
|
||||
@@ -128,7 +129,16 @@ func (P *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
|
||||
if utils.Str2Int(storeIDs) == 0 {
|
||||
return "", errors.New("创建店铺失败,请检查店铺基本信息")
|
||||
}
|
||||
//创建成功即创建并绑定电子围栏
|
||||
//创建满减模板
|
||||
|
||||
//创建仓库
|
||||
//warehouse, err := P.CreateWarehouse(utils.Int2Str(storeDetail.Store.ID))
|
||||
//if err != nil {
|
||||
// return "", err
|
||||
//}
|
||||
//创建成功的id存入
|
||||
|
||||
//创建并绑定电子围栏
|
||||
fences := []string{}
|
||||
if fenceID, err := CreateFenceByStore(int(resp.ResultList[0].Store.StoreId)); err != nil {
|
||||
return "", err
|
||||
@@ -205,6 +215,8 @@ func (P *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
||||
globals.SugarLogger.Debug("================mergedStoreStatus", mergedStoreStatus)
|
||||
errList.AddErr(P.UpdateStoreStatus(jxcontext.AdminCtx, storeInfo.VendorOrgCode, storeID, storeInfo.VendorStoreID, mergedStoreStatus))
|
||||
}
|
||||
//TODO 需增加 更新运费模板、电子围栏
|
||||
|
||||
_, err3 := api.EditStore(params)
|
||||
if err3 != nil {
|
||||
errList.AddErr(err3)
|
||||
@@ -247,8 +259,30 @@ func (p *PurchaseHandler) UpdateStoreStatus(ctx *jxcontext.Context, vendorOrgCod
|
||||
return err
|
||||
}
|
||||
|
||||
//默认只创建固定运费模板
|
||||
func (P *PurchaseHandler) CreateFreightTemplate(storeCode, full, subtraction int) (int64, error) {
|
||||
//获取本地门店信息
|
||||
//storeDetail, err := dao.GetStoreDetail(dao.GetDB(), storeCode, model.VendorIDDD, "")
|
||||
//if err != nil {
|
||||
// return 0, err
|
||||
//}
|
||||
//param := &freightTemplate_create_request.FreightTemplateCreateParam{
|
||||
// Template: &freightTemplate_create_request.Template{
|
||||
// TemplateName: "门店编码:" + utils.Int2Str(storeCode) + "的运费模板",
|
||||
// ProductProvince: storeDetail.pro,
|
||||
// ProductCity: int64(storeDetail.CityCode),
|
||||
// //CalculateType: ,
|
||||
// TransferType: 1,
|
||||
// RuleType: 1, //固定运费
|
||||
// FixedAmount: int64(storeDetail.DeliveryFeeDeductionSill), //固定的运费价格 满x包邮,订单需特殊判断vendor_ID=14
|
||||
//
|
||||
// },
|
||||
//}
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
// /freightTemplate/create 创建运费模板
|
||||
func (P *PurchaseHandler) CreateFreightTemplate(templateInfo freightTemplate_create_request.FreightTemplateCreateParam, storeID, vendorStoreID int64) error {
|
||||
func (P *PurchaseHandler) CreateFreightTemplateDirectly(templateInfo freightTemplate_create_request.FreightTemplateCreateParam, storeID, vendorStoreID int64) error {
|
||||
var (
|
||||
db *dao.DaoDB
|
||||
)
|
||||
@@ -260,7 +294,6 @@ func (P *PurchaseHandler) CreateFreightTemplate(templateInfo freightTemplate_cre
|
||||
Columns: templateInfo.Columns,
|
||||
}
|
||||
api := getAPI("", int(storeID), utils.Int64ToStr(vendorStoreID))
|
||||
|
||||
resp, err := api.FreightTemplateCreate(info)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -270,7 +303,7 @@ func (P *PurchaseHandler) CreateFreightTemplate(templateInfo freightTemplate_cre
|
||||
StoreId: vendorStoreID,
|
||||
FreightId: resp.TemplateId,
|
||||
}
|
||||
_, err1 := api.BindFreightTemplate(bindInfo)
|
||||
err1 := api.BindFreightTemplate(bindInfo)
|
||||
if err != nil {
|
||||
return err1
|
||||
}
|
||||
@@ -294,7 +327,7 @@ func (P *PurchaseHandler) ShopBindStoreFreight(storeID, freightID int64) error {
|
||||
FreightId: freightID,
|
||||
}
|
||||
api := getAPI("", int(storeID), "")
|
||||
_, err := api.BindFreightTemplate(param)
|
||||
err := api.BindFreightTemplate(param)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -408,6 +441,7 @@ func (P *PurchaseHandler) UpdateStoreOpTime(ctx *jxcontext.Context, vendorOrgCod
|
||||
return err
|
||||
}
|
||||
|
||||
//获取门店状态
|
||||
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),
|
||||
@@ -518,8 +552,6 @@ func (P *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendo
|
||||
// }
|
||||
//}
|
||||
return retVal, nil
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func (P *PurchaseHandler) RefreshAllStoresID(ctx *jxcontext.Context, parentTask tasksch.ITask, isAsync bool) (hint string, err error) {
|
||||
@@ -541,6 +573,11 @@ func (P *PurchaseHandler) UpdateStoreCustomID(ctx *jxcontext.Context, vendorOrgC
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetOrderStatus(vendorOrgCode, vendorOrderID string) (status int, err error) {
|
||||
func (P *PurchaseHandler) GetOrderStatus(vendorOrgCode, vendorOrderID string) (status int, err error) {
|
||||
return 0, errors.New("抖店暂不支持此操作")
|
||||
}
|
||||
|
||||
// /address/getProvince 获取四级地址全量省份信息
|
||||
//func (P *PurchaseHandler) GetProvince()([]) {
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
warehouse_bindFencesByStore_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_bindFencesByStore/request"
|
||||
warehouse_bindStore_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_bindStore/request"
|
||||
warehouse_create_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_create/request"
|
||||
warehouse_createBatch_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_createBatch/request"
|
||||
warehouse_createFence_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_createFence/request"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
|
||||
@@ -13,6 +14,23 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// /warehouse/create 创建单个区域仓
|
||||
func (P *PurchaseHandler) CreateWarehouse(outWarehouseID string) (warehouseID int64, err error) {
|
||||
tempName := "门店编码:" + outWarehouseID + "的区域仓"
|
||||
req := &warehouse_create_request.WarehouseCreateParam{
|
||||
OutWarehouseId: outWarehouseID,
|
||||
Name: tempName,
|
||||
Intro: "",
|
||||
}
|
||||
resp, err := getAPI("", 0, "").CreateWarehouse(req)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
//todo 存入数据库
|
||||
|
||||
return resp.Data, err
|
||||
}
|
||||
|
||||
// /warehouse/createBatch 批量创建区域仓
|
||||
func (P *PurchaseHandler) BatchCreateWarehouse(param warehouse_createBatch_request.WarehouseCreateBatchParam) error {
|
||||
infos := []warehouse_createBatch_request.OutWarehouseListItem{}
|
||||
|
||||
Reference in New Issue
Block a user