1
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/astaxie/beego/server/web"
|
"github.com/astaxie/beego/server/web"
|
||||||
|
beego "github.com/astaxie/beego/server/web"
|
||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"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) {
|
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 {
|
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
|
return "", nil
|
||||||
}
|
}
|
||||||
handler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler)
|
handler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler)
|
||||||
num := 0
|
num := 0
|
||||||
db := dao.GetDB()
|
|
||||||
rootTask := tasksch.NewSeqTask(fmt.Sprintf("%s SyncStoreCategory step1", model.VendorChineseNames[vendorID]), ctx,
|
rootTask := tasksch.NewSeqTask(fmt.Sprintf("%s SyncStoreCategory step1", model.VendorChineseNames[vendorID]), ctx,
|
||||||
func(rootTask *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
func(rootTask *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
||||||
level := step + 1
|
level := step + 1
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package dao
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
beego "github.com/astaxie/beego/server/web"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -2011,6 +2012,40 @@ func GetStoreSkuCategoryMap(db *DaoDB, categoryID, storeID int) (storeSkuCategor
|
|||||||
return storeSkuCategoryMap, err
|
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) {
|
func GetStoreSkuListWithVendor(db *DaoDB, storeID, vendorID int, vendorOrgCode string) (skuList []*StoreSkuSyncInfo, err error) {
|
||||||
sql := `
|
sql := `
|
||||||
SELECT DISTINCT b.*, c.vendor_thing_id vendor_sku_id
|
SELECT DISTINCT b.*, c.vendor_thing_id vendor_sku_id
|
||||||
|
|||||||
@@ -319,7 +319,6 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku
|
|||||||
WarnDays: utils.Int64ToPointer(model.NO), // ? 0
|
WarnDays: utils.Int64ToPointer(model.NO), // ? 0
|
||||||
FixedFlag: utils.Int64ToPointer(model.NO), // ? 0
|
FixedFlag: utils.Int64ToPointer(model.NO), // ? 0
|
||||||
PurchaseSpec: utils.String2Pointer(utils.Int2Str(model.YES)), // ? 1
|
PurchaseSpec: utils.String2Pointer(utils.Int2Str(model.YES)), // ? 1
|
||||||
//PurchaseUnit: utils.String2Pointer(storeSku.Unit), // ? 同上
|
|
||||||
PurchaseUnit: utils.String2Pointer("份"), // ? 同上
|
PurchaseUnit: utils.String2Pointer("份"), // ? 同上
|
||||||
LabelStyleType: utils.String2Pointer(tao_vegetable.CreateLabelStyleType), // 库存单位
|
LabelStyleType: utils.String2Pointer(tao_vegetable.CreateLabelStyleType), // 库存单位
|
||||||
ItemTypeNew: utils.Int64ToPointer(tao_vegetable.CreateItemTypeNewVegetable),
|
ItemTypeNew: utils.Int64ToPointer(tao_vegetable.CreateItemTypeNewVegetable),
|
||||||
@@ -330,6 +329,8 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku
|
|||||||
TemporaryFlag: utils.Int64ToPointer(model.NO),
|
TemporaryFlag: utils.Int64ToPointer(model.NO),
|
||||||
IsOnline: utils.Int64ToPointer(tao_vegetable.CreateIsOnline),
|
IsOnline: utils.Int64ToPointer(tao_vegetable.CreateIsOnline),
|
||||||
MerchantCatCode: utils.String2Pointer(storeSku.VendorCatID), // 优先使用 靠后 category_code
|
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})
|
sku.SkuPicUrls = uploadImg(api, []string{storeSku.ImgOrigin, storeSku.Img, storeSku.Img2, storeSku.Img3, storeSku.Img4, storeSku.Img5, storeSku.DescImg})
|
||||||
if sku.SkuPicUrls == nil {
|
if sku.SkuPicUrls == nil {
|
||||||
|
|||||||
@@ -636,6 +636,9 @@ func (c *OrderController) AdjustOrder() {
|
|||||||
func (c *OrderController) CancelOrder() {
|
func (c *OrderController) CancelOrder() {
|
||||||
c.callCancelOrder(func(params *tOrderCancelOrderParams) (retVal interface{}, errCode string, err error) {
|
c.callCancelOrder(func(params *tOrderCancelOrderParams) (retVal interface{}, errCode string, err error) {
|
||||||
order, err := partner.CurOrderManager.LoadOrder(params.VendorOrderID, params.VendorID)
|
order, err := partner.CurOrderManager.LoadOrder(params.VendorOrderID, params.VendorID)
|
||||||
|
if order.Status >= model.OrderStatusEndBegin {
|
||||||
|
return nil, "", fmt.Errorf("订单处于完成状态,不支持取消操作!请走售后流程")
|
||||||
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = defsch.FixedScheduler.CancelOrder(params.Ctx, order, params.Reason)
|
err = defsch.FixedScheduler.CancelOrder(params.Ctx, order, params.Reason)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user