未营业门店,授权,改营业范围
This commit is contained in:
@@ -137,6 +137,9 @@ type VendorStoreExcel struct {
|
||||
Tel2 string `json:"电话2"`
|
||||
CityName string `json:"城市名"`
|
||||
Address string `json:"地址"`
|
||||
MarketManName string `json:"市场负责人"`
|
||||
OperatorName string `json:"运营负责人"`
|
||||
OperatorName2 string `json:"运营负责人2"`
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -178,6 +181,24 @@ var (
|
||||
"电话2",
|
||||
"城市名",
|
||||
"地址",
|
||||
"市场负责人",
|
||||
"运营负责人",
|
||||
"运营负责人2",
|
||||
}
|
||||
roleMap = map[string]string{
|
||||
"marketManPhone": "市场负责人电话",
|
||||
"marketManRole": "市场负责人组(角色,单人)",
|
||||
"jxBrandFeeFactor": "京西品牌费因子",
|
||||
"marketAddFeeFactor": "市场附加费因子",
|
||||
"payeeName": "收款人姓名",
|
||||
"payeeAccountNo": "收款账号",
|
||||
"payeeBankBranchName": "开户支行",
|
||||
"payeeBankCode": "开户行代码",
|
||||
"payPercentage": "支付比例",
|
||||
}
|
||||
roleMoblieMap = map[string]string{
|
||||
"17380734342": "17380734342", //漆云的手机 ,用于判断updatestore的权限
|
||||
"18328080405": "18328080405", //肖娜娜的手机
|
||||
}
|
||||
)
|
||||
|
||||
@@ -741,6 +762,10 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
if valid["status"] != nil {
|
||||
syncStatus |= model.SyncFlagStoreStatus
|
||||
status = int(utils.Interface2Int64WithDefault(valid["status"], 0))
|
||||
if status == model.StoreStatusDisabled {
|
||||
valid["deliveryRangeType"] = model.DeliveryRangeTypeRadius
|
||||
valid["deliveryRange"] = 1
|
||||
}
|
||||
} else {
|
||||
status = store.Status
|
||||
}
|
||||
@@ -789,6 +814,16 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
}
|
||||
}
|
||||
|
||||
for k, _ := range valid {
|
||||
if roleMap[k] != "" {
|
||||
if authInfo, err := ctx.GetV2AuthInfo(); err == nil {
|
||||
if roleMoblieMap[authInfo.Mobile] == "" {
|
||||
return 0, errors.New(fmt.Sprintf("当前用户 [%v] 无权限修改 [%] 字段!", authInfo.Name, roleMap[k]))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// districtCode := 0
|
||||
// if valid["districtCode"] != nil {
|
||||
// districtCode = int(utils.MustInterface2Int64(valid["districtCode"]))
|
||||
@@ -833,6 +868,7 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
dao.Commit(db)
|
||||
}
|
||||
notifyStoreOperatorChanged(store, valid["operatorPhone"])
|
||||
notifyStoreMarketChanged(store, valid["marketManPhone"])
|
||||
if err == nil {
|
||||
if valid["openTime1"] != 0 || valid["closeTime1"] != 0 || valid["openTime2"] != 0 || valid["closeTime2"] != 0 {
|
||||
err = CurVendorSync.ChangeStoreSkuSaleStatus(ctx, storeID, true, true)
|
||||
@@ -860,6 +896,21 @@ func notifyStoreOperatorChanged(store *model.Store, newOperator2 interface{}) {
|
||||
}
|
||||
}
|
||||
|
||||
func notifyStoreMarketChanged(store *model.Store, newMarketManPhone2 interface{}) {
|
||||
if store.MarketManPhone != "" && newMarketManPhone2 != nil {
|
||||
db := dao.GetDB()
|
||||
if user, err := dao.GetUserByID(db, "mobile", store.MarketManPhone); err == nil {
|
||||
curUserName := ""
|
||||
if newOperator := utils.Interface2String(newMarketManPhone2); newOperator != "" {
|
||||
if curUser, err := dao.GetUserByID(db, "mobile", newOperator); err == nil {
|
||||
curUserName = curUser.GetName()
|
||||
}
|
||||
}
|
||||
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, user.GetID(), "门店市场变更", fmt.Sprintf("门店:%d-%s,原市场:%s,变更为:%s", store.ID, store.Name, user.GetName(), curUserName))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func SetStoreStatus(ctx *jxcontext.Context, storeID, status int) (err error) {
|
||||
payload := map[string]interface{}{
|
||||
"status": status,
|
||||
@@ -2325,6 +2376,8 @@ func GetVendorStoreInfo(ctx *jxcontext.Context, vendorIDList []int, isAsync, isC
|
||||
return retVal, err
|
||||
}
|
||||
}
|
||||
db := dao.GetDB()
|
||||
storeDetail2, err := dao.GetStoreDetailByVendorStoreID(db, storeDetail.VendorStoreID, vendorID)
|
||||
if storeDetail.Status != model.StoreStatusOpened {
|
||||
var storeExcel = VendorStoreExcel{
|
||||
StoreID: storeDetail.ID,
|
||||
@@ -2334,6 +2387,9 @@ func GetVendorStoreInfo(ctx *jxcontext.Context, vendorIDList []int, isAsync, isC
|
||||
Address: storeDetail.Address,
|
||||
Status: StoreStatus2Chinese(storeDetail.Status),
|
||||
CityName: storeDetail.CityName,
|
||||
MarketManName: storeDetail2.MarketManName,
|
||||
OperatorName: storeDetail2.OperatorName,
|
||||
OperatorName2: storeDetail2.OperatorName2,
|
||||
}
|
||||
retVal = []VendorStoreExcel{storeExcel}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user