Merge remote-tracking branch 'origin/mark' into yonghui
This commit is contained in:
@@ -176,6 +176,13 @@ var (
|
|||||||
"promoteInfo": 1,
|
"promoteInfo": 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
storeMapKeyPropertyMap = map[string]int{
|
||||||
|
"status": 1,
|
||||||
|
"freightDeductionPack": 1,
|
||||||
|
"vendorStoreName": 1,
|
||||||
|
"boxFee": 1,
|
||||||
|
}
|
||||||
|
|
||||||
WatchVendorStoreTimeList = []string{
|
WatchVendorStoreTimeList = []string{
|
||||||
"8:00:00",
|
"8:00:00",
|
||||||
"10:00:00",
|
"10:00:00",
|
||||||
@@ -1121,6 +1128,17 @@ func DeleteStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
|
|||||||
return num, err
|
return num, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isStoreMapNeedSync(vendorID int, valid map[string]interface{}) bool {
|
||||||
|
if vendorID != model.VendorIDJX {
|
||||||
|
for k := range valid {
|
||||||
|
if storeMapKeyPropertyMap[k] == 1 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID int, payload map[string]interface{}, userName string) (num int64, err error) {
|
func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID int, payload map[string]interface{}, userName string) (num int64, err error) {
|
||||||
if vendorID != model.VendorIDJD {
|
if vendorID != model.VendorIDJD {
|
||||||
if autoPickup, ok := payload["autoPickup"]; ok && autoPickup == 0 {
|
if autoPickup, ok := payload["autoPickup"]; ok && autoPickup == 0 {
|
||||||
@@ -1196,7 +1214,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
|
|||||||
panic(r)
|
panic(r)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
if valid["status"] != nil || valid["vendorStoreName"] != nil { // 对于store vendor map,只有Status改变才需要同步到厂商
|
if isStoreMapNeedSync(vendorID, valid) { // 对于store vendor map,只有Status改变才需要同步到厂商
|
||||||
num, err = dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, storeMap, valid, userName, map[string]interface{}{
|
num, err = dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, storeMap, valid, userName, map[string]interface{}{
|
||||||
model.FieldStoreID: storeID,
|
model.FieldStoreID: storeID,
|
||||||
model.FieldVendorID: vendorID,
|
model.FieldVendorID: vendorID,
|
||||||
@@ -1229,7 +1247,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dao.Commit(db)
|
dao.Commit(db)
|
||||||
if vendorID != model.VendorIDJX && (valid["status"] != nil || valid["freightDeductionPack"] != nil || valid["vendorStoreName"] != nil) {
|
if isStoreMapNeedSync(vendorID, valid) {
|
||||||
_, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName)
|
_, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ type StoreDetail struct {
|
|||||||
|
|
||||||
FreightDeductionPackStr string `orm:"size(4096)" json:"-"` //
|
FreightDeductionPackStr string `orm:"size(4096)" json:"-"` //
|
||||||
FreightDeductionPackObj *model.FreightDeductionPack `orm:"-" json:"-"`
|
FreightDeductionPackObj *model.FreightDeductionPack `orm:"-" json:"-"`
|
||||||
|
BoxFee int `orm:"default(1)" json:"boxFee"` // 打包费
|
||||||
|
|
||||||
AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货
|
AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货
|
||||||
DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型
|
DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型
|
||||||
@@ -84,7 +85,7 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (sto
|
|||||||
sql := `
|
sql := `
|
||||||
SELECT t1.*,
|
SELECT t1.*,
|
||||||
t2.vendor_store_id, t2.status vendor_status, t2.delivery_fee, t2.sync_status, t2.vendor_org_code,
|
t2.vendor_store_id, t2.status vendor_status, t2.delivery_fee, t2.sync_status, t2.vendor_org_code,
|
||||||
t2.price_percentage, t2.auto_pickup, t2.delivery_type, t2.delivery_competition, t2.is_sync, t2.vendor_store_name,
|
t2.price_percentage, t2.auto_pickup, t2.delivery_type, t2.delivery_competition, t2.is_sync, t2.vendor_store_name, t2.box_fee,
|
||||||
t3.value price_percentage_pack_str,
|
t3.value price_percentage_pack_str,
|
||||||
t4.value freight_deduction_pack_str,
|
t4.value freight_deduction_pack_str,
|
||||||
district.name district_name,
|
district.name district_name,
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ func GetThingMapMap(db *DaoDB, thingType int, vendorIDs, thingIDs []int) (thingM
|
|||||||
func SetThingMapSyncStatus(db *DaoDB, vendorIDs []int, vendorOrgCodes []string, thingType int, thingIDs []int, syncStatus int8) (num int64, err error) {
|
func SetThingMapSyncStatus(db *DaoDB, vendorIDs []int, vendorOrgCodes []string, thingType int, thingIDs []int, syncStatus int8) (num int64, err error) {
|
||||||
sql := `
|
sql := `
|
||||||
UPDATE thing_map t1
|
UPDATE thing_map t1
|
||||||
SET t1.sync_status |= ?
|
SET t1.sync_status = t1.sync_status | ?
|
||||||
WHERE t1.deleted_at = ? AND t1.thing_type = ?
|
WHERE t1.deleted_at = ? AND t1.thing_type = ?
|
||||||
`
|
`
|
||||||
sqlParams := []interface{}{
|
sqlParams := []interface{}{
|
||||||
|
|||||||
@@ -398,6 +398,8 @@ type StoreMap struct {
|
|||||||
|
|
||||||
FreightDeductionPack string `orm:"size(32)" json:"freightDeductionPack"` //
|
FreightDeductionPack string `orm:"size(32)" json:"freightDeductionPack"` //
|
||||||
|
|
||||||
|
BoxFee int `orm:"default(0)" json:"boxFee"` // 打包费
|
||||||
|
|
||||||
AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货
|
AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货
|
||||||
DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型
|
DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型
|
||||||
DeliveryFee int `json:"deliveryFee"`
|
DeliveryFee int `json:"deliveryFee"`
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
|||||||
errList.AddErr(p.UpdateStoreStatus(jxcontext.AdminCtx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, mergedStoreStatus))
|
errList.AddErr(p.UpdateStoreStatus(jxcontext.AdminCtx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, mergedStoreStatus))
|
||||||
}
|
}
|
||||||
errList.AddErr(p.UpdateStoreOpTime(jxcontext.AdminCtx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, storeDetail.GetOpTimeList()))
|
errList.AddErr(p.UpdateStoreOpTime(jxcontext.AdminCtx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, storeDetail.GetOpTimeList()))
|
||||||
|
errList.AddErr(p.UpdateStoreBoxFee(jxcontext.AdminCtx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, storeDetail.BoxFee))
|
||||||
return errList.GetErrListAsOne()
|
return errList.GetErrListAsOne()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,3 +291,8 @@ func (c *PurchaseHandler) GetAllStoresVendorID(ctx *jxcontext.Context, vendorOrg
|
|||||||
func (c *PurchaseHandler) UpdateStoreCustomID(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID string, storeID int64) (err error) {
|
func (c *PurchaseHandler) UpdateStoreCustomID(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID string, storeID int64) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *PurchaseHandler) UpdateStoreBoxFee(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, boxFee int) (err error) {
|
||||||
|
err = api.MtwmAPI.PackagePriceUpdate(vendorStoreID, 1, boxFee)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ const (
|
|||||||
|
|
||||||
specialStoreID = "8171010"
|
specialStoreID = "8171010"
|
||||||
// specialStoreID = "2523687"
|
// specialStoreID = "2523687"
|
||||||
|
fixBoxFee = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -252,8 +253,8 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
|||||||
}
|
}
|
||||||
foodData["min_order_count"] = 1
|
foodData["min_order_count"] = 1
|
||||||
foodData["unit"] = storeSku.Unit
|
foodData["unit"] = storeSku.Unit
|
||||||
foodData["box_num"] = 0
|
foodData["box_num"] = 1
|
||||||
foodData["box_price"] = 0.0
|
foodData["box_price"] = jxutils.IntPrice2Standard(fixBoxFee)
|
||||||
catCode := tryCatName2Code(storeSku.VendorCatID)
|
catCode := tryCatName2Code(storeSku.VendorCatID)
|
||||||
if catCode != "" {
|
if catCode != "" {
|
||||||
foodData["category_code"] = catCode
|
foodData["category_code"] = catCode
|
||||||
|
|||||||
Reference in New Issue
Block a user