整理订单调整中对于DeliveryType相关的流程

This commit is contained in:
gazebo
2019-11-06 14:29:13 +08:00
parent dc7d712ff6
commit 208e836f40
6 changed files with 38 additions and 90 deletions

View File

@@ -6,8 +6,6 @@ import (
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/globals"
"github.com/astaxie/beego/orm"
)
// 带购物平台信息的
@@ -97,13 +95,15 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (sto
sql += " AND t2.vendor_store_id = ?"
sqlParams = append(sqlParams, vendorStoreID)
}
storeDetail = &StoreDetail{}
if err = GetRow(db, storeDetail, sql, sqlParams...); err == nil {
if err = GetRow(db, &storeDetail, sql, sqlParams...); err == nil {
storeDetail.PricePercentagePackObj = PricePercentagePack2Obj(storeDetail.PricePercentagePackStr)
storeDetail.FreightDeductionPackObj = FreightDeductionPack2Obj(storeDetail.FreightDeductionPackStr)
if vendorID == model.VendorIDJX {
if storeDetail.VendorStoreID == "" {
storeDetail.VendorStatus = storeDetail.Status
storeDetail.PricePercentage = 100
storeDetail.AutoPickup = 1
storeDetail.DeliveryType = model.StoreDeliveryTypeByStore
storeDetail.DeliveryCompetition = 1
}
return storeDetail, nil
}
@@ -339,49 +339,6 @@ func AddStoreCategoryMap(db *DaoDB, storeID, categoryID int, vendorID int, vendo
return err
}
func GetStoreMapByStoreID(db *DaoDB, storeID, vendorID int) (storeMap *model.StoreMap, err error) {
if db == nil {
db = GetDB()
}
storeMap = &model.StoreMap{
StoreID: storeID,
VendorID: vendorID,
}
storeMap.DeletedAt = utils.DefaultTimeValue
if err = GetEntity(db, storeMap, model.FieldStoreID, model.FieldVendorID, model.FieldDeletedAt); err != nil {
if err != orm.ErrNoRows {
globals.SugarLogger.Warnf("GetStoreMapByStoreID storeID:%d, vendorID:%d read storeMap failed with error:%v", storeID, vendorID, err)
}
return nil, err
}
return storeMap, nil
}
func FakeGetStoreMapByStoreID(db *DaoDB, storeID, vendorID int) (storeMap *model.StoreMap, err error) {
vendorID2 := vendorID
if model.IsSpecialVendorID(vendorID) {
vendorID2 = model.VendorIDJD // 微商城与京西的属性以京东属性为准(以免再绑定)
}
if storeMap, err = GetStoreMapByStoreID(db, storeID, vendorID2); model.IsSpecialVendorID(vendorID) && IsNoRowsError(err) {
err = nil
storeMap = &model.StoreMap{
StoreID: storeID,
VendorID: vendorID2,
Status: model.StoreStatusOpened,
PricePercentage: 100,
AutoPickup: 1,
DeliveryType: model.StoreDeliveryTypeByStore,
// DeliveryFee
DeliveryCompetition: 1,
IsSync: 1,
}
}
if storeMap != nil && vendorID == model.VendorIDJX {
storeMap.DeliveryType = model.StoreDeliveryTypeByStore
}
return storeMap, err
}
func GetOpenedStoreCouriersByStoreID(db *DaoDB, storeID, vendorID int) (storeMaps []*model.StoreCourierMap, err error) {
if db == nil {
db = GetDB()