This commit is contained in:
邹宗楠
2023-07-10 09:26:57 +08:00
parent 5208d50b41
commit 9b3d652ed7
4 changed files with 74 additions and 20 deletions

View File

@@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"github.com/astaxie/beego/server/web"
beego "github.com/astaxie/beego/server/web"
"regexp"
"sort"
"strings"
@@ -69,13 +70,27 @@ func CreateStoreCategoryByStoreSku(ctx *jxcontext.Context, vendorID, storeID int
}
func SyncStoreCategories(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID, storeID int, vendorStoreID string, nameIDs, skuIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
// 668594 正式服印象汇 668469 测试服芬姐
db := dao.GetDB()
// 668594 正式服印象汇 668469 测试服芬姐(淘宝所有门店公用分类)
if storeID != 668594 && storeID != 668469 && vendorID == model.VendorIDTaoVegetable {
var totalCategory []*model.StoreSkuCategoryMap
switch beego.BConfig.RunMode {
case "dev":
totalCategory, _ = dao.GetDetailStoreSkuCategoryMap(db, 668469)
case "jxgy":
default:
totalCategory, _ = dao.GetDetailStoreSkuCategoryMap(db, 668594)
}
if totalCategory != nil {
for _, v := range totalCategory {
dao.UpdateStoreSkuCategory(db, v.CategoryID, storeID, v.TaoID)
}
}
return "", nil
}
handler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler)
num := 0
db := dao.GetDB()
rootTask := tasksch.NewSeqTask(fmt.Sprintf("%s SyncStoreCategory step1", model.VendorChineseNames[vendorID]), ctx,
func(rootTask *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
level := step + 1

View File

@@ -3,6 +3,7 @@ package dao
import (
"errors"
"fmt"
beego "github.com/astaxie/beego/server/web"
"strings"
"time"
@@ -2011,6 +2012,40 @@ func GetStoreSkuCategoryMap(db *DaoDB, categoryID, storeID int) (storeSkuCategor
return storeSkuCategoryMap, err
}
// GetDetailStoreSkuCategoryMap 淘宝是所有门店公用一套分类 用默认门店赋值其余门店
func GetDetailStoreSkuCategoryMap(db *DaoDB, storeId int) (storeSkuCategoryMap []*model.StoreSkuCategoryMap, err error) {
sql := `
SELECT *
FROM store_sku_category_map
WHERE deleted_at = ?
`
sqlParams := []interface{}{utils.DefaultTimeValue}
if storeId != 0 {
sql += " AND store_id = ? "
sqlParams = append(sqlParams, storeId)
} else {
switch beego.BConfig.RunMode {
case "jxgy":
storeId = 0
case "dev":
storeId = 668469 // 测试服芬姐(淘宝所有门店公用分类)
default:
storeId = 668594 // 正式服印象汇
}
}
GetRows(db, &storeSkuCategoryMap, sql, sqlParams)
return storeSkuCategoryMap, err
}
// UpdateStoreSkuCategory 修改淘宝门店的分类code以及同步装太
func UpdateStoreSkuCategory(db *DaoDB, categoryId int, storeID int, vendorCode string) {
sql := ` UPDATE store_sku_category_map SET tao_id = ? ,tao_sync_status = ? WHERE store_id = ? AND category_id = ?`
param := []interface{}{vendorCode, 0, storeID, categoryId}
ExecuteSQL(db, sql, param...)
}
func GetStoreSkuListWithVendor(db *DaoDB, storeID, vendorID int, vendorOrgCode string) (skuList []*StoreSkuSyncInfo, err error) {
sql := `
SELECT DISTINCT b.*, c.vendor_thing_id vendor_sku_id

View File

@@ -312,24 +312,25 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku
DeliverySpec: utils.String2Pointer(utils.Int2Str(model.YES)),
MemberPrice: price,
Storage: utils.String2Pointer(tao_vegetable.CreateStorage),
PickFloatRate: utils.String2Pointer(utils.Int2Str(model.NO)), // ? 0
ForbidReceiveDays: utils.Int64ToPointer(tao_vegetable.CreateShelfLife), // ? 7
ForbidSalesDays: utils.Int64ToPointer(model.NO), // ? 0
OverloadRate: utils.String2Pointer(utils.Int2Str(model.NO)), // ? 0
WarnDays: utils.Int64ToPointer(model.NO), // ? 0
FixedFlag: utils.Int64ToPointer(model.NO), // ? 0
PurchaseSpec: utils.String2Pointer(utils.Int2Str(model.YES)), // ? 1
//PurchaseUnit: utils.String2Pointer(storeSku.Unit), // ? 同上
PurchaseUnit: utils.String2Pointer("份"), // ? 同上
LabelStyleType: utils.String2Pointer(tao_vegetable.CreateLabelStyleType), // 库存单位
ItemTypeNew: utils.Int64ToPointer(tao_vegetable.CreateItemTypeNewVegetable),
SkuPrice: price, // 优先使用skuPrice 靠后SalePrice
Period: utils.Int64ToPointer(tao_vegetable.CreateShelfLife), // 优先使用period 靠后shelf_life
FragileFlag: utils.Int64ToPointer(model.YES),
DeliveryStorage: utils.String2Pointer(tao_vegetable.CreateItemDeliveryStorage),
TemporaryFlag: utils.Int64ToPointer(model.NO),
IsOnline: utils.Int64ToPointer(tao_vegetable.CreateIsOnline),
MerchantCatCode: utils.String2Pointer(storeSku.VendorCatID), // 优先使用 靠后 category_code
PickFloatRate: utils.String2Pointer(utils.Int2Str(model.NO)), // ? 0
ForbidReceiveDays: utils.Int64ToPointer(tao_vegetable.CreateShelfLife), // ? 7
ForbidSalesDays: utils.Int64ToPointer(model.NO), // ? 0
OverloadRate: utils.String2Pointer(utils.Int2Str(model.NO)), // ? 0
WarnDays: utils.Int64ToPointer(model.NO), // ? 0
FixedFlag: utils.Int64ToPointer(model.NO), // ? 0
PurchaseSpec: utils.String2Pointer(utils.Int2Str(model.YES)), // ? 1
PurchaseUnit: utils.String2Pointer("份"), // ? 同上
LabelStyleType: utils.String2Pointer(tao_vegetable.CreateLabelStyleType), // 库存单位
ItemTypeNew: utils.Int64ToPointer(tao_vegetable.CreateItemTypeNewVegetable),
SkuPrice: price, // 优先使用skuPrice 靠后SalePrice
Period: utils.Int64ToPointer(tao_vegetable.CreateShelfLife), // 优先使用period 靠后shelf_life
FragileFlag: utils.Int64ToPointer(model.YES),
DeliveryStorage: utils.String2Pointer(tao_vegetable.CreateItemDeliveryStorage),
TemporaryFlag: utils.Int64ToPointer(model.NO),
IsOnline: utils.Int64ToPointer(tao_vegetable.CreateIsOnline),
MerchantCatCode: utils.String2Pointer(storeSku.VendorCatID), // 优先使用 靠后 category_code
RichText: utils.String2Pointer(storeSku.Name),
AllowAppSale: utils.Int64ToPointer(tao_vegetable.IsAllowAppSale),
}
sku.SkuPicUrls = uploadImg(api, []string{storeSku.ImgOrigin, storeSku.Img, storeSku.Img2, storeSku.Img3, storeSku.Img4, storeSku.Img5, storeSku.DescImg})
if sku.SkuPicUrls == nil {

View File

@@ -636,6 +636,9 @@ func (c *OrderController) AdjustOrder() {
func (c *OrderController) CancelOrder() {
c.callCancelOrder(func(params *tOrderCancelOrderParams) (retVal interface{}, errCode string, err error) {
order, err := partner.CurOrderManager.LoadOrder(params.VendorOrderID, params.VendorID)
if order.Status >= model.OrderStatusEndBegin {
return nil, "", fmt.Errorf("订单处于完成状态,不支持取消操作!请走售后流程")
}
if err == nil {
err = defsch.FixedScheduler.CancelOrder(params.Ctx, order, params.Reason)
}