门店商品添加锁定概念

This commit is contained in:
gazebo
2019-12-18 11:55:48 +08:00
parent d1cb4a8c8b
commit 51217978ba
8 changed files with 59 additions and 11 deletions

View File

@@ -81,7 +81,9 @@ type StoreSkuSyncInfo struct {
CatSyncStatus int8
VendorCatID string `orm:"column(vendor_cat_id)"`
VendorPrice int64
VendorPrice int64
LockTime *time.Time
MergedStatus int
SkuName string
StatusSaleBegin int16 `json:"statusSaleBegin"` //商品可售时间范围
@@ -167,6 +169,11 @@ type StoreSkuExt struct {
MtwmPrice int `json:"mtwmPrice"`
JxPrice int `json:"jxPrice"`
JdLockTime *time.Time `orm:"null" json:"jdLockTime,omitempty"`
EbaiLockTime *time.Time `orm:"null" json:"ebaiLockTime,omitempty"`
MtwmLockTime *time.Time `orm:"null" json:"mtwmLockTime,omitempty"`
JxLockTime *time.Time `orm:"null" json:"jxLockTime,omitempty"`
AutoSaleAt time.Time `orm:"type(datetime);null" json:"autoSaleAt"`
ActPrice int `json:"actPrice"`
@@ -302,7 +309,7 @@ func newGetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty
SELECT
t14.vendor_id, t14.vendor_org_code,
t1.id bind_id, t1.sku_id, t1.price, t1.unit_price, t1.status store_sku_status,
%s vendor_sku_id, t1.%s_sync_status sku_sync_status, t1.%s_price vendor_price,
%s vendor_sku_id, t1.%s_sync_status sku_sync_status, t1.%s_price vendor_price, t1.%s_lock_time lock_time,
t1.store_id, t1.deleted_at bind_deleted_at,t1.status_sale_begin,t1.status_sale_end,
t2.*,
t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc,
@@ -311,7 +318,7 @@ func newGetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty
t13.%s desc_img,
t4.%s_category_id vendor_vendor_cat_id`
fmtParams := []interface{}{
skuVendorIDField, fieldPrefix, fieldPrefix,
skuVendorIDField, fieldPrefix, fieldPrefix, fieldPrefix,
GetDataResFieldName(vendorID), GetDataResFieldName(vendorID),
GetDataResFieldName(vendorID), GetDataResFieldName(vendorID),
GetDataResFieldName(vendorID),
@@ -509,7 +516,8 @@ func newGetFullStoreSkus(db *DaoDB, vendorID, storeID int) (skus []*StoreSkuSync
SELECT
sm.vendor_id, sm.vendor_org_code,
t1.id bind_id, t1.price, t1.unit_price, t1.status store_sku_status,
t1.%s_sync_status sku_sync_status, t1.store_id, t1.deleted_at bind_deleted_at,
t1.%s_sync_status sku_sync_status, t1.%s_price vendor_price, t1.%s_lock_time lock_time,
t1.store_id, t1.deleted_at bind_deleted_at,
t2.*, t2.id sku_id, t2m.vendor_thing_id vendor_sku_id,
t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc,
IF(t11.%s <> '', t11.%s, t3.img) img,
@@ -544,7 +552,7 @@ func newGetFullStoreSkus(db *DaoDB, vendorID, storeID int) (skus []*StoreSkuSync
}
fieldPrefix := ConvertDBFieldPrefix(model.VendorNames[vendorID])
sql = fmt.Sprintf(sql,
fieldPrefix,
fieldPrefix, fieldPrefix, fieldPrefix,
GetDataResFieldName(vendorID), GetDataResFieldName(vendorID),
GetDataResFieldName(vendorID), GetDataResFieldName(vendorID),
GetDataResFieldName(vendorID),
@@ -1108,16 +1116,21 @@ func GetStoreSkuNamePrice(db *DaoDB) (storeSkuNamePriceList []*model.StoreSkuNam
return storeSkuNamePriceList, err
}
func SetStoreSkuBindVendorPrice(storeSkuBind *model.StoreSkuBind, vendorID int, vendorPrice int) {
func SetStoreSkuBindVendorPrice(storeSkuBind *model.StoreSkuBind, vendorID int, vendorPrice int, lockTime time.Time) {
pLockTime := utils.Time2Pointer(lockTime)
switch vendorID {
case model.VendorIDJD:
storeSkuBind.JdPrice = vendorPrice
storeSkuBind.JdLockTime = pLockTime
case model.VendorIDMTWM:
storeSkuBind.MtwmPrice = vendorPrice
storeSkuBind.MtwmLockTime = pLockTime
case model.VendorIDEBAI:
storeSkuBind.EbaiPrice = vendorPrice
storeSkuBind.EbaiLockTime = pLockTime
case model.VendorIDJX:
storeSkuBind.JxPrice = vendorPrice
storeSkuBind.JxLockTime = pLockTime
}
}

View File

@@ -0,0 +1,17 @@
package dao
import (
"testing"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/globals"
)
func TestGetFullStoreSkus(t *testing.T) {
skuList, err := GetFullStoreSkus(GetDB(), model.VendorIDJD, 100118)
if err != nil {
t.Fatal(err)
}
globals.SugarLogger.Debug(utils.Format4Output(skuList, false))
}