- 美团配送使用页面API修改门店信息

This commit is contained in:
gazebo
2019-07-24 16:23:47 +08:00
parent b513ee9c74
commit aa05678e5d
4 changed files with 27 additions and 4 deletions

View File

@@ -987,6 +987,8 @@ func AddStoreCourierMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID
}
func addStoreCourierMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID int, storeCourierMap *model.StoreCourierMap, isNeedUpdateRemote bool) (outStoreCourierMap *model.StoreCourierMap, err error) {
globals.SugarLogger.Debugf("addStoreCourierMap %s, storeID:%d, isNeedUpdateRemote:%t", model.VendorChineseNames[vendorID], storeCourierMap, isNeedUpdateRemote)
userName := ctx.GetUserName()
if handler := partner.GetDeliveryPlatformFromVendorID(vendorID); handler != nil {
if db == nil {
@@ -1068,6 +1070,8 @@ func UpdateStoreCourierMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendo
}
func updateCourierStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (err error) {
globals.SugarLogger.Debugf("updateCourierStore %s, storeID:%d, vendorStoreID:%s", model.VendorChineseNames[storeDetail.VendorID], storeDetail.ID, storeDetail.VendorStoreID)
if handlerInfo := partner.GetDeliveryPlatformFromVendorID(storeDetail.VendorID); handlerInfo != nil && handlerInfo.Use4CreateWaybill {
if updateHandler, ok := handlerInfo.Handler.(partner.IDeliveryUpdateStoreHandler); ok {
storeDetail.CourierStoreName = composeDadaStoreName(storeDetail)
@@ -1078,6 +1082,8 @@ func updateCourierStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (
}
func updateCourierStores(ctx *jxcontext.Context, storeID int) (err error) {
globals.SugarLogger.Debugf("updateCourierStores storeID:%d", storeID)
db := dao.GetDB()
errList := errlist.New()
for k, v := range partner.DeliveryPlatformHandlers {
@@ -1095,6 +1101,8 @@ func updateCourierStores(ctx *jxcontext.Context, storeID int) (err error) {
}
func updateOrCreateCourierStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (isCreated bool, err error) {
globals.SugarLogger.Debugf("updateOrCreateCourierStore %s, storeID:%d, vendorStoreID:%s", model.VendorChineseNames[storeDetail.VendorID], storeDetail.ID, storeDetail.VendorStoreID)
if handlerInfo := partner.GetDeliveryPlatformFromVendorID(storeDetail.VendorID); handlerInfo != nil && handlerInfo.Use4CreateWaybill {
if storeDetail.DistrictName == "" {
return false, fmt.Errorf("门店的区码有问题,请检查")
@@ -1124,6 +1132,8 @@ func updateOrCreateCourierStore(ctx *jxcontext.Context, storeDetail *dao.StoreDe
}
func UpdateOrCreateCourierStores(ctx *jxcontext.Context, storeID int, isForceUpdate, isAsync, isContinueWhenError bool) (hint string, err error) {
globals.SugarLogger.Debugf("UpdateOrCreateCourierStores storeID:%d", storeID)
var storeIDs []int
if storeID != 0 {
storeIDs = []int{storeID}
@@ -1148,7 +1158,7 @@ func UpdateOrCreateCourierStores(ctx *jxcontext.Context, storeID int, isForceUpd
if _, ok := v.Handler.(partner.IDeliveryUpdateStoreHandler); ok {
storeDetail, err2 := dao.GetStoreDetail2(db, storeID, "", k)
if err = err2; err2 == nil {
isStoreExist := storeDetail.VendorStoreID == ""
isStoreExist := storeDetail.VendorStoreID != ""
storeDetail.VendorStoreID = utils.Int2Str(storeDetail.ID)
if isForceUpdate || !isStoreExist {
var isCreated bool