变更运营时,发送钉钉消息
This commit is contained in:
@@ -30,6 +30,7 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/ebai"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -758,6 +759,7 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
}
|
||||
} else {
|
||||
dao.Commit(db)
|
||||
notifyStoreOperatorChanged(store, valid["operatorPhone"])
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -766,6 +768,21 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
return num, err
|
||||
}
|
||||
|
||||
func notifyStoreOperatorChanged(store *model.Store, newOperator2 interface{}) {
|
||||
if store.OperatorPhone != "" && newOperator2 != nil {
|
||||
db := dao.GetDB()
|
||||
if user, err := dao.GetUserByID(db, "mobile", store.OperatorPhone); err == nil {
|
||||
curUserName := ""
|
||||
if newOperator := utils.Interface2String(newOperator2); newOperator != "" {
|
||||
if curUser, err := dao.GetUserByID(db, "mobile", store.OperatorPhone); 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,
|
||||
|
||||
Reference in New Issue
Block a user