Merge remote-tracking branch 'origin/mark' into yonghui

This commit is contained in:
苏尹岚
2019-12-18 15:19:39 +08:00
11 changed files with 77 additions and 17 deletions

View File

@@ -160,6 +160,10 @@ func GetCategoryIDDBField(prefix string) string {
return ConvertDBFieldPrefix(prefix) + "_category_id"
}
func GetVendorLockTimeStructField(prefix string) string {
return ConvertStructFieldPrefix(prefix) + "LockTime"
}
func value2Value(srcValue, dstValue reflect.Value, copyType int) {
srcType := srcValue.Type()
for i := 0; i < srcType.NumField(); i++ {

View File

@@ -84,7 +84,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"` //商品可售时间范围
@@ -170,6 +172,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"`
@@ -305,7 +312,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, t3.ex_prefix, t3.ex_prefix_begin, t3.ex_prefix_end,
@@ -314,7 +321,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),
@@ -512,7 +519,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, t3.ex_prefix, t3.ex_prefix_begin, t3.ex_prefix_end,
IF(t11.%s <> '', t11.%s, t3.img) img,
@@ -547,7 +555,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),
@@ -1111,16 +1119,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))
}