@@ -6,6 +6,7 @@ import (
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/globals"
)
// 带购物平台信息的
@@ -26,7 +27,6 @@ type StoreDetail struct {
FreightDeductionPackStr string ` orm:"size(4096)" json:"-" ` //
FreightDeductionPackObj *model.FreightDeductionPack `orm:"-" json:"-"`
BoxFee int ` orm:"default(1)" json:"boxFee" ` // 打包费
AutoPickup int8 ` orm:"default(1)" json:"autoPickup" ` // 是否自动拣货
DeliveryType int8 ` orm:"default(0)" json:"deliveryType" ` // 配送类型
@@ -85,7 +85,7 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (sto
sql := `
SELECT t1.*,
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.box_fee,
t2.price_percentage, t2.auto_pickup, t2.delivery_type, t2.delivery_competition, t2.is_sync, t2.vendor_store_name,
t3.value price_percentage_pack_str,
t4.value freight_deduction_pack_str,
district.name district_name,
@@ -211,7 +211,7 @@ func GetStoreCourierList(db *DaoDB, storeIDs []int, status, auditStatus int) (co
return nil , err
}
func GetStoresMapList ( db * DaoDB , vendorIDs , storeIDs [ ] int , status , isSync int , pricePack string ) ( storeMapList [ ] * model . StoreMap , err error ) {
func GetStoresMapList2 ( db * DaoDB , vendorIDs , storeIDs [ ] int , status , isSync int , pricePack string , mustDirty bool ) ( storeMapList [ ] * model . StoreMap , err error ) {
sql := `
SELECT t1.*
FROM store_map t1
@@ -242,6 +242,10 @@ func GetStoresMapList(db *DaoDB, vendorIDs, storeIDs []int, status, isSync int,
sql += " AND t1.price_percentage_pack = ?"
sqlParams = append ( sqlParams , pricePack )
}
if mustDirty {
sql += " AND t1.sync_status <> 0"
sqlParams = append ( sqlParams , pricePack )
}
sql += " ORDER BY t1.store_id DESC, t1.vendor_id"
if err = GetRows ( db , & storeMapList , sql , sqlParams ... ) ; err == nil {
return storeMapList , nil
@@ -249,6 +253,10 @@ func GetStoresMapList(db *DaoDB, vendorIDs, storeIDs []int, status, isSync int,
return nil , err
}
func GetStoresMapList ( db * DaoDB , vendorIDs , storeIDs [ ] int , status , isSync int , pricePack string ) ( storeMapList [ ] * model . StoreMap , err error ) {
return GetStoresMapList2 ( db , vendorIDs , storeIDs , status , isSync , pricePack , false )
}
// 此函数在检测到一个门店的所有平台状态一样, 且不为StoreStatusOpened时,
// 将平台门店状态全部改为StoreStatusOpened, 则把京西门店状态改为之前那个统一的平台门店状态
func FormalizeStoreStatus ( db * DaoDB , storeID , storeStatus int ) ( err error ) {
@@ -580,3 +588,26 @@ func GetStorePriceScoreSnapshot(db *DaoDB, snapDate time.Time) (storePriceScoreS
err = GetRows ( db , & storePriceScoreSnapshot , sql , sqlParams ... )
return storePriceScoreSnapshot , err
}
func SetStoreMapSyncStatus ( db * DaoDB , vendorIDs , storeIDs [ ] int , syncStatus int ) ( num int64 , err error ) {
globals . SugarLogger . Debugf ( "SetStoreMapSyncStatus, vendorIDs:%v, storeIDs:%v" , vendorIDs , storeIDs )
sql := `
UPDATE store_map t1
SET t1.sync_status = t1.sync_status | ?
`
sqlParams := [ ] interface { } {
syncStatus ,
}
sql += " WHERE t1.is_sync <> 0 AND t1.deleted_at = ? AND t1.sync_status & ? = 0"
sqlParams = append ( sqlParams , utils . DefaultTimeValue , model . SyncFlagDeletedMask )
if len ( vendorIDs ) > 0 {
sql += " AND t1.vendor_id IN (" + GenQuestionMarks ( len ( vendorIDs ) ) + ")"
sqlParams = append ( sqlParams , vendorIDs )
}
if len ( storeIDs ) > 0 {
sql += " AND t1.store_id IN (" + GenQuestionMarks ( len ( storeIDs ) ) + ")"
sqlParams = append ( sqlParams , storeIDs )
}
return ExecuteSQL ( db , sql , sqlParams ... )
}