aa
This commit is contained in:
@@ -1638,6 +1638,13 @@ func GetStoreCourierMaps(ctx *jxcontext.Context, db *dao.DaoDB, storeID int, ven
|
||||
}
|
||||
}
|
||||
}
|
||||
handler := partner.GetDeliveryPlatformFromVendorID(vendorID).Handler
|
||||
storeDetail, _ := handler.GetStore(ctx, storeID, "")
|
||||
for _, v := range storeCourierMaps {
|
||||
if v.VendorStoreName == "" {
|
||||
v.VendorStoreName = storeDetail.Name
|
||||
}
|
||||
}
|
||||
return storeCourierMaps, err
|
||||
}
|
||||
|
||||
@@ -1853,9 +1860,10 @@ func UpdateOrCreateCourierStores(ctx *jxcontext.Context, storeID int, isForceUpd
|
||||
}
|
||||
if _, err = updateOrCreateCourierStore(ctx, storeDetail); err == nil && isNeedAdd {
|
||||
storeCourier := &model.StoreCourierMap{
|
||||
VendorStoreID: storeDetail.VendorStoreID,
|
||||
Status: model.StoreStatusOpened,
|
||||
AuditStatus: storeDetail.AuditStatus,
|
||||
VendorStoreID: storeDetail.VendorStoreID,
|
||||
Status: model.StoreStatusOpened,
|
||||
AuditStatus: storeDetail.AuditStatus,
|
||||
VendorStoreName: storeDetail.Name,
|
||||
}
|
||||
if storeDetail.AuditStatus != model.StoreAuditStatusOnline {
|
||||
storeCourier.Status = model.StoreStatusDisabled
|
||||
@@ -2506,7 +2514,7 @@ func SyncStoresCourierInfo(ctx *jxcontext.Context, storeIDs []int, isAsync, isCo
|
||||
storeCourier, err2 := handler.Handler.GetStore(ctx, store.ID, storeDetail2.VendorStoreID)
|
||||
if err = err2; err == nil {
|
||||
if storeDetail2.AuditStatus == model.StoreAuditStatusCreated { // 如果已经通过审核,更新本地状态
|
||||
partner.CurStoreManager.OnCourierStoreStatusChanged(ctx, storeCourier.VendorStoreID, vendorID, storeCourier.AuditStatus)
|
||||
partner.CurStoreManager.OnCourierStoreStatusChanged(ctx, storeCourier.VendorStoreID, vendorID, storeCourier.AuditStatus, storeCourier.Comment)
|
||||
}
|
||||
|
||||
distance := jxutils.EarthDistance(jxutils.IntCoordinate2Standard(store.Lng), jxutils.IntCoordinate2Standard(store.Lat), jxutils.IntCoordinate2Standard(storeCourier.Lng), jxutils.IntCoordinate2Standard(storeCourier.Lat))
|
||||
|
||||
@@ -102,18 +102,23 @@ func (s *StoreManager) OnStoreStatusChanged(vendorStoreID string, vendorID int,
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *StoreManager) OnCourierStoreStatusChanged(ctx *jxcontext.Context, vendorStoreID string, vendorID int, auditStatus int) (err error) {
|
||||
func (s *StoreManager) OnCourierStoreStatusChanged(ctx *jxcontext.Context, vendorStoreID string, vendorID int, auditStatus int, message string) (err error) {
|
||||
if vendorStoreID != "" {
|
||||
db := dao.GetDB()
|
||||
_, err2 := dao.GetStoreDetail2(db, 0, vendorStoreID, vendorID)
|
||||
if err = err2; err == nil {
|
||||
status := model.StoreStatusOpened
|
||||
if auditStatus != model.StoreAuditStatusOnline {
|
||||
if auditStatus != model.StoreAuditStatusOnline && auditStatus != model.StoreAuditStatusUpdated {
|
||||
status = model.StoreStatusDisabled
|
||||
}
|
||||
comment := ""
|
||||
if auditStatus == model.StoreAuditStatusRejected {
|
||||
comment = message
|
||||
}
|
||||
_, err = dao.UpdateEntityLogically(db, &model.StoreCourierMap{}, map[string]interface{}{
|
||||
model.FieldStatus: status,
|
||||
"AuditStatus": auditStatus,
|
||||
"Comment": comment,
|
||||
}, ctx.GetUserName(), map[string]interface{}{
|
||||
model.FieldVendorStoreID: vendorStoreID,
|
||||
model.FieldVendorID: vendorID,
|
||||
|
||||
@@ -22,6 +22,7 @@ const (
|
||||
StoreAuditStatusCreated = 1
|
||||
StoreAuditStatusOnline = 0
|
||||
StoreAuditStatusRejected = -1
|
||||
StoreAuditStatusUpdated = 2
|
||||
StoreAuditStatusAll = -9
|
||||
)
|
||||
|
||||
@@ -475,6 +476,7 @@ type StoreCourierMap struct {
|
||||
AuditStatus int `json:"auditStatus"`
|
||||
VendorStatus int `json:"vendorStatus"`
|
||||
VendorStoreName string `orm:"size(255)" json:"vendorStoreName"` //平台门店名,由京西到平台
|
||||
Comment string `orm:"size(255)" json:"comment"`
|
||||
|
||||
// 以下数据仅用于同步使用
|
||||
Lng int `json:"-"` // 乘了10的6次方
|
||||
|
||||
@@ -18,10 +18,12 @@ const (
|
||||
|
||||
var (
|
||||
auditStatusMap = map[int]int{
|
||||
mtpsapi.ShopStatusAuditCreated: model.StoreAuditStatusCreated,
|
||||
mtpsapi.ShopStatusAuditRejected: model.StoreAuditStatusRejected,
|
||||
mtpsapi.ShopStatusAuditPassed: model.StoreAuditStatusCreated,
|
||||
mtpsapi.ShopStatusAuditOnline: model.StoreAuditStatusOnline,
|
||||
mtpsapi.ShopStatusAuditCreated: model.StoreAuditStatusCreated,
|
||||
mtpsapi.ShopStatusAuditRejected: model.StoreAuditStatusRejected,
|
||||
mtpsapi.ShopStatusAuditPassed: model.StoreAuditStatusCreated,
|
||||
mtpsapi.ShopStatusAuditOnline: model.StoreAuditStatusOnline,
|
||||
mtpsapi.ShopStatusAuditUpdatePassed: model.StoreAuditStatusUpdated,
|
||||
mtpsapi.ShopStatusAuditUpdateRejected: model.StoreAuditStatusRejected,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -38,7 +40,7 @@ func OnStoreStatus(msg *mtpsapi.CallbackShopStatusMsg) (retVal *mtpsapi.Callback
|
||||
|
||||
func (c *DeliveryHandler) OnStoreStatus(msg *mtpsapi.CallbackShopStatusMsg) (retVal *mtpsapi.CallbackResponse) {
|
||||
globals.SugarLogger.Debugf("mtps OnStoreStatus, msg:%s", utils.Format4Output(msg, true))
|
||||
err := partner.CurStoreManager.OnCourierStoreStatusChanged(jxcontext.AdminCtx, msg.ShopID, model.VendorIDMTPS, getAuditStatus(msg.Status))
|
||||
err := partner.CurStoreManager.OnCourierStoreStatusChanged(jxcontext.AdminCtx, msg.ShopID, model.VendorIDMTPS, getAuditStatus(msg.Status), msg.RejectMessage)
|
||||
retVal = mtpsapi.Err2CallbackResponse(err, "mtps OnStoreStatus")
|
||||
return retVal
|
||||
}
|
||||
@@ -134,8 +136,17 @@ func (c *DeliveryHandler) IsErrStoreExist(err error) bool {
|
||||
}
|
||||
|
||||
func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (err error) {
|
||||
// if globals.EnableStoreWrite {
|
||||
// err = api.MtpsAPI.PagePoiUpdate(storeDetail.VendorStoreID, storeDetail.PayeeName, storeDetail.Tel1, fakeContactEmail)
|
||||
// }
|
||||
if globals.EnableStoreWrite {
|
||||
// err = api.MtpsAPI.PagePoiUpdate(storeDetail.VendorStoreID, storeDetail.PayeeName, storeDetail.Tel1, fakeContactEmail)
|
||||
shopInfo := &mtpsapi.ShopInfo{
|
||||
ShopID: utils.Int2Str(storeDetail.ID),
|
||||
ContactName: storeDetail.PayeeName,
|
||||
ContactPhone: storeDetail.Tel1,
|
||||
ShopAddress: storeDetail.Address,
|
||||
ShopLat: storeDetail.Lat,
|
||||
ShopLng: storeDetail.Lng,
|
||||
}
|
||||
_, err = api.MtpsAPI.ShopUpdate(shopInfo)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ type IOrderManager interface {
|
||||
|
||||
type IStoreManager interface {
|
||||
OnStoreStatusChanged(vendorStoreID string, vendorID int, storeStatus int) (err error)
|
||||
OnCourierStoreStatusChanged(ctx *jxcontext.Context, vendorStoreID string, vendorID int, auditStatus int) (err error)
|
||||
OnCourierStoreStatusChanged(ctx *jxcontext.Context, vendorStoreID string, vendorID int, auditStatus int, message string) (err error)
|
||||
}
|
||||
|
||||
// purchase handler中
|
||||
|
||||
Reference in New Issue
Block a user