- fk
This commit is contained in:
@@ -229,9 +229,9 @@ func GetStoreVendorMaps(db *dao.DaoDB, storeID int, vendorID int) (storeMaps []*
|
|||||||
}
|
}
|
||||||
|
|
||||||
func AddStoreVendorMap(db *dao.DaoDB, storeID, vendorID int, storeMap *model.StoreMap, userName string) (outStoreMap *model.StoreMap, err error) {
|
func AddStoreVendorMap(db *dao.DaoDB, storeID, vendorID int, storeMap *model.StoreMap, userName string) (outStoreMap *model.StoreMap, err error) {
|
||||||
if handler := GetPurchaseHandler(storeMap.VendorID); handler != nil {
|
if handler := GetPurchaseHandler(vendorID); handler != nil {
|
||||||
store, err := handler.ReadStore(storeMap.VendorStoreID)
|
store, err2 := handler.ReadStore(storeMap.VendorStoreID)
|
||||||
if err == nil {
|
if err = err2; err == nil {
|
||||||
dao.WrapAddIDCULDEntity(storeMap, userName)
|
dao.WrapAddIDCULDEntity(storeMap, userName)
|
||||||
storeMap.StoreID = storeID
|
storeMap.StoreID = storeID
|
||||||
storeMap.VendorID = vendorID
|
storeMap.VendorID = vendorID
|
||||||
|
|||||||
@@ -28,9 +28,8 @@ type StoreSkuNamesInfo struct {
|
|||||||
|
|
||||||
// UpdateStoreSku用,API调用时
|
// UpdateStoreSku用,API调用时
|
||||||
type StoreSkuBindSkuInfo struct {
|
type StoreSkuBindSkuInfo struct {
|
||||||
SubStoreID int `json:"subStoreID"`
|
SkuID int `json:"skuID"`
|
||||||
SkuID int `json:"skuID"`
|
IsSale int `json:"isSale"` // -1:不可售,0:忽略,1:可售
|
||||||
IsSale int `json:"isSale"` // -1:不可售,0:忽略,1:可售
|
|
||||||
|
|
||||||
ElmID int64 `json:"elmID"`
|
ElmID int64 `json:"elmID"`
|
||||||
EbaiID int64 `json:"ebaiID"`
|
EbaiID int64 `json:"ebaiID"`
|
||||||
@@ -38,16 +37,19 @@ type StoreSkuBindSkuInfo struct {
|
|||||||
|
|
||||||
// UpdateStoreSku用,API调用时
|
// UpdateStoreSku用,API调用时
|
||||||
type StoreSkuBindInfo struct {
|
type StoreSkuBindInfo struct {
|
||||||
NameID int `json:"nameID"`
|
NameID int `json:"nameID"`
|
||||||
UnitPrice int `json:"unitPrice"`
|
UnitPrice int `json:"unitPrice"`
|
||||||
IsFocus int `json:"isFocus"` // -1:不关注,0:忽略,1:关注
|
IsFocus int `json:"isFocus"` // -1:不关注,0:忽略,1:关注
|
||||||
Skus []*StoreSkuBindSkuInfo `json:"skus"`
|
SubStoreID int `json:"subStoreID"`
|
||||||
|
Skus []*StoreSkuBindSkuInfo `json:"skus"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type tStoreSkuBindAndSpec struct {
|
type tStoreSkuBindAndSpec struct {
|
||||||
model.StoreSkuBind
|
model.StoreSkuBind
|
||||||
SpecQuality float32
|
SpecQuality float32
|
||||||
SpecUnit string
|
SpecUnit string
|
||||||
|
SkuNamePrice int
|
||||||
|
RealSkuID int `orm:"column(real_sku_id)"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetStoreSkus(storeID int, isFocused bool, keyword string, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *StoreSkuNamesInfo, err error) {
|
func GetStoreSkus(storeID int, isFocused bool, keyword string, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *StoreSkuNamesInfo, err error) {
|
||||||
@@ -230,104 +232,109 @@ func UpdateStoreSkus(storeID int, skuBindInfos []*StoreSkuBindInfo, userName str
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
for _, skuBindInfo := range skuBindInfos {
|
for _, skuBindInfo := range skuBindInfos {
|
||||||
skuBinds := skuBindInfo.Skus
|
inSkuBinds := skuBindInfo.Skus
|
||||||
var existBinds []*tStoreSkuBindAndSpec
|
var allBinds []*tStoreSkuBindAndSpec
|
||||||
if err = dao.GetRows(db, &existBinds, `
|
if err = dao.GetRows(db, &allBinds, `
|
||||||
SELECT t1.*, t2.spec_quality, t2.spec_unit
|
SELECT t2.*, t1.id real_sku_id, t1.spec_quality, t1.spec_unit, t3.price sku_name_price
|
||||||
FROM store_sku_bind t1
|
FROM sku t1
|
||||||
JOIN sku t2 ON t1.sku_id = t2.id
|
LEFT JOIN store_sku_bind t2 ON t2.sku_id = t1.id AND store_id = ?
|
||||||
WHERE store_id = ?
|
JOIN sku_name t3 ON t1.name_id = t3.id
|
||||||
AND t2.name_id = ?`, storeID, skuBindInfo.NameID); err == nil {
|
WHERE t1.name_id = ?
|
||||||
existBindsMap := make(map[int]*model.StoreSkuBind, len(existBinds))
|
`, storeID, skuBindInfo.NameID); err == nil {
|
||||||
|
globals.SugarLogger.Debug(len(allBinds))
|
||||||
|
inSkuBinsMap := make(map[int]*StoreSkuBindSkuInfo, len(inSkuBinds))
|
||||||
|
for _, v := range inSkuBinds {
|
||||||
|
inSkuBinsMap[v.SkuID] = v
|
||||||
|
}
|
||||||
unitPrice := 0
|
unitPrice := 0
|
||||||
if skuBindInfo.UnitPrice != 0 {
|
if skuBindInfo.UnitPrice != 0 {
|
||||||
unitPrice = skuBindInfo.UnitPrice
|
unitPrice = skuBindInfo.UnitPrice
|
||||||
} else {
|
} else {
|
||||||
unitPrice = existBinds[0].UnitPrice
|
unitPrice = allBinds[0].UnitPrice
|
||||||
}
|
if unitPrice == 0 {
|
||||||
for _, v := range existBinds {
|
unitPrice = allBinds[0].SkuNamePrice
|
||||||
if skuBindInfo.UnitPrice != 0 {
|
|
||||||
v.UnitPrice = unitPrice
|
|
||||||
v.Price = calStoreSkuPrice(unitPrice, v.SpecQuality, v.SpecUnit)
|
|
||||||
setStoreSkuBindStatus(&v.StoreSkuBind, model.SyncFlagPriceMask)
|
|
||||||
dao.WrapUpdateULEntity(v, userName)
|
|
||||||
if num, err = dao.UpdateEntity(db, &v.StoreSkuBind); err != nil {
|
|
||||||
dao.Rollback(db)
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
if num == 1 {
|
|
||||||
needSyncIDMap[v.ID] = 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if skuBindInfo.IsFocus != 0 {
|
}
|
||||||
|
for _, v := range allBinds {
|
||||||
|
inSkuBind := inSkuBinsMap[v.SkuID]
|
||||||
|
var skuBind *model.StoreSkuBind
|
||||||
|
// globals.SugarLogger.Debug(ok)
|
||||||
|
if v.ID == 0 {
|
||||||
|
if skuBindInfo.IsFocus == 1 {
|
||||||
|
skuBind = &model.StoreSkuBind{
|
||||||
|
StoreID: storeID,
|
||||||
|
SkuID: v.RealSkuID,
|
||||||
|
SubStoreID: skuBindInfo.SubStoreID, // todo 这个应该从用户信息中自动获得
|
||||||
|
UnitPrice: unitPrice,
|
||||||
|
Price: calStoreSkuPrice(unitPrice, v.SpecQuality, v.SpecUnit),
|
||||||
|
Status: model.StoreSkuBindStatusDontSale, // 缺省不可售?
|
||||||
|
}
|
||||||
|
if inSkuBind != nil && inSkuBind.IsSale == 1 {
|
||||||
|
skuBind.Status = model.StoreSkuBindStatusNormal
|
||||||
|
}
|
||||||
|
setStoreSkuBindStatus(skuBind, model.SyncFlagNewMask)
|
||||||
|
dao.WrapAddIDCULDEntity(skuBind, userName)
|
||||||
|
globals.SugarLogger.Debug(utils.Format4Output(skuBind, false))
|
||||||
|
if err = dao.CreateEntity(db, skuBind); err != nil {
|
||||||
|
dao.Rollback(db)
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
num = 1
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
skuBind = &v.StoreSkuBind
|
||||||
|
|
||||||
if skuBindInfo.IsFocus == -1 {
|
if skuBindInfo.IsFocus == -1 {
|
||||||
globals.SugarLogger.Debug(utils.Format4Output(v, false))
|
if num, err = dao.DeleteEntityLogically(db, skuBind, map[string]interface{}{
|
||||||
num, err = dao.DeleteEntityLogically(db, &v.StoreSkuBind, map[string]interface{}{
|
|
||||||
model.FieldStatus: model.StoreSkuBindStatusDeleted,
|
model.FieldStatus: model.StoreSkuBindStatusDeleted,
|
||||||
model.FieldJdSyncStatus: model.SyncFlagDeletedMask,
|
model.FieldJdSyncStatus: model.SyncFlagDeletedMask,
|
||||||
model.FieldElmSyncStatus: model.SyncFlagDeletedMask,
|
model.FieldElmSyncStatus: model.SyncFlagDeletedMask,
|
||||||
model.FieldEbaiSyncStatus: model.SyncFlagDeletedMask,
|
model.FieldEbaiSyncStatus: model.SyncFlagDeletedMask,
|
||||||
}, userName, nil)
|
}, userName, nil); err != nil {
|
||||||
globals.SugarLogger.Debug(num)
|
|
||||||
} else {
|
|
||||||
// todo 如果修改ebai与elm ID怎么处理呢?
|
|
||||||
v.DeletedAt = utils.DefaultTimeValue
|
|
||||||
setStoreSkuBindStatus(&v.StoreSkuBind, model.SyncFlagModifiedMask)
|
|
||||||
num, err = dao.UpdateEntity(db, &v.StoreSkuBind)
|
|
||||||
globals.SugarLogger.Debug(num)
|
|
||||||
}
|
|
||||||
if num == 1 {
|
|
||||||
needSyncIDMap[v.ID] = 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
existBindsMap[v.SkuID] = &v.StoreSkuBind
|
|
||||||
}
|
|
||||||
for _, v := range skuBinds {
|
|
||||||
skuBind, ok := existBindsMap[v.SkuID]
|
|
||||||
if !ok {
|
|
||||||
if skuBindInfo.IsFocus == 1 {
|
|
||||||
sku := &model.Sku{}
|
|
||||||
sku.ID = v.SkuID
|
|
||||||
if err2 := dao.GetEntity(db, sku); err2 != nil {
|
|
||||||
dao.Rollback(db)
|
dao.Rollback(db)
|
||||||
return 0, err2
|
return 0, err
|
||||||
}
|
}
|
||||||
skuBind = &model.StoreSkuBind{
|
} else {
|
||||||
StoreID: storeID,
|
needUpdate := false
|
||||||
SkuID: v.SkuID,
|
if skuBindInfo.IsFocus == 1 {
|
||||||
SubStoreID: v.SubStoreID, // todo 这个应该从用户信息中自动获得
|
skuBind.DeletedAt = utils.DefaultTimeValue
|
||||||
UnitPrice: unitPrice,
|
needUpdate = true
|
||||||
Price: calStoreSkuPrice(unitPrice, sku.SpecQuality, sku.SpecUnit),
|
|
||||||
Status: model.StoreSkuBindStatusDontSale,
|
|
||||||
}
|
}
|
||||||
dao.WrapAddIDCULDEntity(skuBind, userName)
|
if inSkuBind != nil && inSkuBind.IsSale != 0 {
|
||||||
}
|
if inSkuBind.IsSale == 1 {
|
||||||
}
|
skuBind.Status = model.StoreSkuBindStatusNormal
|
||||||
if skuBind != nil {
|
} else {
|
||||||
if v.IsSale != 0 {
|
skuBind.Status = model.StoreSkuBindStatusDontSale
|
||||||
if v.IsSale == 1 {
|
}
|
||||||
skuBind.Status = model.StoreSkuBindStatusNormal
|
setStoreSkuBindStatus(skuBind, model.SyncFlagSaleMask)
|
||||||
} else {
|
needUpdate = true
|
||||||
skuBind.Status = model.StoreSkuBindStatusDontSale
|
|
||||||
}
|
}
|
||||||
setStoreSkuBindStatus(skuBind, model.SyncFlagSaleMask)
|
if skuBindInfo.UnitPrice != 0 { // 这里是否需要加此条件限制
|
||||||
}
|
skuBind.UnitPrice = unitPrice
|
||||||
if !ok {
|
skuBind.Price = calStoreSkuPrice(unitPrice, v.SpecQuality, v.SpecUnit)
|
||||||
if v.EbaiID != 0 {
|
setStoreSkuBindStatus(skuBind, model.SyncFlagPriceMask)
|
||||||
skuBind.EbaiID = v.EbaiID
|
needUpdate = true
|
||||||
}
|
}
|
||||||
if v.ElmID != 0 {
|
if inSkuBind != nil && inSkuBind.EbaiID != 0 {
|
||||||
skuBind.ElmID = v.ElmID
|
skuBind.EbaiID = inSkuBind.EbaiID
|
||||||
|
needUpdate = true
|
||||||
}
|
}
|
||||||
setStoreSkuBindStatus(skuBind, model.SyncFlagNewMask)
|
if inSkuBind != nil && inSkuBind.ElmID != 0 {
|
||||||
if err = dao.CreateEntity(db, skuBind); err == nil {
|
skuBind.ElmID = inSkuBind.ElmID
|
||||||
needSyncIDMap[skuBind.ID] = 1
|
needUpdate = true
|
||||||
|
}
|
||||||
|
if needUpdate {
|
||||||
|
setStoreSkuBindStatus(skuBind, model.SyncFlagModifiedMask)
|
||||||
|
dao.WrapUpdateULEntity(skuBind, userName)
|
||||||
|
if num, err = dao.UpdateEntity(db, skuBind); err != nil {
|
||||||
|
dao.Rollback(db)
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if skuBind != nil && num == 1 {
|
||||||
if err != nil {
|
needSyncIDMap[skuBind.ID] = 1
|
||||||
dao.Rollback(db)
|
}
|
||||||
return 0, err
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ func StrTime2JxOperationTime(strTime string, defValue int16) int16 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func JxOperationTime2StrTime(value int16) string {
|
func JxOperationTime2StrTime(value int16) string {
|
||||||
return fmt.Sprintf("%02d:%02d:00", value/100, value%100)
|
return fmt.Sprintf("%02d:%02d", value/100, value%100)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPolygonFromCircle(lng, lat, distance float64, pointCount int) (points [][2]float64) {
|
func GetPolygonFromCircle(lng, lat, distance float64, pointCount int) (points [][2]float64) {
|
||||||
|
|||||||
@@ -45,6 +45,6 @@ type StoreSkuBind struct {
|
|||||||
|
|
||||||
func (*StoreSkuBind) TableUnique() [][]string {
|
func (*StoreSkuBind) TableUnique() [][]string {
|
||||||
return [][]string{
|
return [][]string{
|
||||||
[]string{"StoreID", "SkuID"},
|
[]string{"StoreID", "SkuID", "DeletedAt"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
23
business/partner/purchase/ebai/ebai_test.go
Normal file
23
business/partner/purchase/ebai/ebai_test.go
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package ebai
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "git.rosy.net.cn/jx-callback/business/jxcallback/scheduler/defsch"
|
||||||
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
|
"git.rosy.net.cn/jx-callback/globals/api"
|
||||||
|
"git.rosy.net.cn/jx-callback/globals/beegodb"
|
||||||
|
"github.com/astaxie/beego"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
testShopBaiduID = 2233043816
|
||||||
|
testShopID = "test_708706_63032"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
beego.InitBeegoBeforeTest("/Users/xujianhua/go/src/git.rosy.net.cn/jx-callback/conf/app.conf")
|
||||||
|
// beego.BConfig.RunMode = "dev" // InitBeegoBeforeTest会将runmode设置为test
|
||||||
|
|
||||||
|
globals.Init()
|
||||||
|
beegodb.Init()
|
||||||
|
api.Init()
|
||||||
|
}
|
||||||
@@ -25,6 +25,7 @@ type tEbaiStoreInfo struct {
|
|||||||
VendorStoreID string `orm:"column(vendor_store_id)"`
|
VendorStoreID string `orm:"column(vendor_store_id)"`
|
||||||
RealLastOperator string
|
RealLastOperator string
|
||||||
EbaiStoreStatus int
|
EbaiStoreStatus int
|
||||||
|
SyncStatus int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) ReadStore(vendorStoreID string) (*model.Store, error) {
|
func (p *PurchaseHandler) ReadStore(vendorStoreID string) (*model.Store, error) {
|
||||||
@@ -90,11 +91,12 @@ func (p *PurchaseHandler) UpdateStore(storeID int, userName string) (err error)
|
|||||||
var store tEbaiStoreInfo
|
var store tEbaiStoreInfo
|
||||||
sql := `
|
sql := `
|
||||||
SELECT t1.*, t2.status ebai_store_status, t2.vendor_store_id,
|
SELECT t1.*, t2.status ebai_store_status, t2.vendor_store_id,
|
||||||
IF(t1.updated_at > t2.updated_at, t1.last_operator, t2.last_operator) real_last_operator
|
IF(t1.updated_at > t2.updated_at, t1.last_operator, t2.last_operator) real_last_operator, t2.sync_status
|
||||||
FROM store t1
|
FROM store t1
|
||||||
JOIN store_map t2 ON t1.id = t2.store_id AND t2.vendor_id = ?
|
JOIN store_map t2 ON t1.id = t2.store_id AND t2.vendor_id = ?
|
||||||
WHERE t1.id = ?`
|
WHERE t1.id = ?;
|
||||||
if err = dao.GetRow(db, &store, sql, model.VendorIDJD, storeID); err == nil {
|
`
|
||||||
|
if err = dao.GetRow(db, &store, sql, model.VendorIDEBAI, storeID); err == nil {
|
||||||
params := map[string]interface{}{
|
params := map[string]interface{}{
|
||||||
"baidu_shop_id": store.VendorStoreID,
|
"baidu_shop_id": store.VendorStoreID,
|
||||||
"name": jxutils.ComposeStoreName(store.Name, partner.StoreNameSeparator, VendorStorePrefix),
|
"name": jxutils.ComposeStoreName(store.Name, partner.StoreNameSeparator, VendorStorePrefix),
|
||||||
@@ -107,10 +109,26 @@ func (p *PurchaseHandler) UpdateStore(storeID int, userName string) (err error)
|
|||||||
"delivery_region": JxDeliveryRegion2Ebai(&store.Store),
|
"delivery_region": JxDeliveryRegion2Ebai(&store.Store),
|
||||||
"business_time": JxBusinessTime2Ebai(&store.Store),
|
"business_time": JxBusinessTime2Ebai(&store.Store),
|
||||||
}
|
}
|
||||||
// globals.SugarLogger.Debug(utils.Format4Output(params, false))
|
globals.SugarLogger.Debug(utils.Format4Output(params, false))
|
||||||
if globals.EnableStoreWrite {
|
if globals.EnableStoreWrite {
|
||||||
if err = api.EbaiAPI.ShopUpdate(params); err == nil {
|
if err = api.EbaiAPI.ShopUpdate(params); err == nil {
|
||||||
// todo 设置 shop_id
|
shopID := 0
|
||||||
|
if store.SyncStatus&model.SyncFlagDeletedMask == 0 {
|
||||||
|
shopID = store.ID
|
||||||
|
}
|
||||||
|
store2, err2 := p.ReadStore(store.VendorStoreID)
|
||||||
|
if err = err2; err == nil {
|
||||||
|
if store2.ID == store.ID {
|
||||||
|
shopID = -1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err == nil {
|
||||||
|
if shopID > 0 {
|
||||||
|
err = api.EbaiAPI.ShopIDBatchUpdate([]string{store.VendorStoreID}, []string{utils.Int2Str(shopID)})
|
||||||
|
} else if shopID == 0 {
|
||||||
|
// todo remove out shop id
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -171,8 +189,10 @@ func JxDeliveryRegion2Ebai(store *model.Store) interface{} {
|
|||||||
|
|
||||||
func JxBusinessTime2Ebai(store *model.Store) interface{} {
|
func JxBusinessTime2Ebai(store *model.Store) interface{} {
|
||||||
bTime := make([]map[string]interface{}, 1)
|
bTime := make([]map[string]interface{}, 1)
|
||||||
bTime[0]["start"] = jxutils.JxOperationTime2StrTime(store.OpenTime1)
|
bTime[0] = map[string]interface{}{
|
||||||
bTime[0]["end"] = jxutils.JxOperationTime2StrTime(store.CloseTime1)
|
"start": jxutils.JxOperationTime2StrTime(store.OpenTime1),
|
||||||
|
"end": jxutils.JxOperationTime2StrTime(store.CloseTime1),
|
||||||
|
}
|
||||||
if store.OpenTime2 != 0 {
|
if store.OpenTime2 != 0 {
|
||||||
bTime = append(bTime, map[string]interface{}{
|
bTime = append(bTime, map[string]interface{}{
|
||||||
"start": jxutils.JxOperationTime2StrTime(store.OpenTime2),
|
"start": jxutils.JxOperationTime2StrTime(store.OpenTime2),
|
||||||
|
|||||||
22
business/partner/purchase/ebai/store_test.go
Normal file
22
business/partner/purchase/ebai/store_test.go
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package ebai
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestReadStore(t *testing.T) {
|
||||||
|
result, err := new(PurchaseHandler).ReadStore(utils.Int2Str(testShopBaiduID))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err.Error())
|
||||||
|
}
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUpdateStore(t *testing.T) {
|
||||||
|
err := new(PurchaseHandler).UpdateStore(100002, "autotest")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@ func (p *PurchaseHandler) SyncStoreSku(storeID int, skuIDs []int, isForce bool,
|
|||||||
FROM store_sku_bind
|
FROM store_sku_bind
|
||||||
WHERE store_id = ?
|
WHERE store_id = ?
|
||||||
`
|
`
|
||||||
if skuIDs != nil {
|
if skuIDs != nil && len(skuIDs) > 0 {
|
||||||
sql += " AND sku_id IN (" + dao.GenQuestionMarks(len(skuIDs)) + ")"
|
sql += " AND sku_id IN (" + dao.GenQuestionMarks(len(skuIDs)) + ")"
|
||||||
sqlParams = append(sqlParams, skuIDs)
|
sqlParams = append(sqlParams, skuIDs)
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ func (p *PurchaseHandler) SyncStoreSku(storeID int, skuIDs []int, isForce bool,
|
|||||||
SET jd_sync_status = 0
|
SET jd_sync_status = 0
|
||||||
WHERE store_id = ?
|
WHERE store_id = ?
|
||||||
`
|
`
|
||||||
if skuIDs != nil {
|
if skuIDs != nil && len(skuIDs) > 0 {
|
||||||
sql += " AND sku_id IN (" + dao.GenQuestionMarks(len(skuIDs)) + ")"
|
sql += " AND sku_id IN (" + dao.GenQuestionMarks(len(skuIDs)) + ")"
|
||||||
}
|
}
|
||||||
_, err = dao.ExecuteSQL(db, sql, sqlParams)
|
_, err = dao.ExecuteSQL(db, sql, sqlParams)
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ func (c *StoreController) UpdateStoreVendorMap() {
|
|||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param storeID formData int true "门店ID,payload中的相应字段会被忽略"
|
// @Param storeID formData int true "门店ID,payload中的相应字段会被忽略"
|
||||||
// @Param vendorID formData int true "厂商ID,payload中的相应字段会被忽略"
|
// @Param vendorID formData int true "厂商ID,payload中的相应字段会被忽略"
|
||||||
// @Param payload formData string true "json数据,storeMap对象({'vendorID':0,'vendorStoreID':'11732425','autoPickup':1,'deliveryCompetition':1, 'pricePercentage':100})"
|
// @Param payload formData string true "json数据,storeMap对象({'vendorStoreID':'11732425','autoPickup':1,'deliveryCompetition':1, 'pricePercentage':100})"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @router /AddStoreVendorMap [post]
|
// @router /AddStoreVendorMap [post]
|
||||||
|
|||||||
Reference in New Issue
Block a user