+ cms/SendMsg2Somebody

This commit is contained in:
gazebo
2019-07-15 11:28:36 +08:00
parent 1bc869b11d
commit 498bbe07f8
3 changed files with 48 additions and 0 deletions

View File

@@ -4,6 +4,8 @@ import (
"strconv"
"time"
"git.rosy.net.cn/jx-callback/business/jxutils/msg"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
@@ -17,6 +19,8 @@ import (
const (
qiniuTokenExpires = 300 // 七牛TOKEN有效时间5分钟
SendMsgTypeOpenStoreRequest = "openStoreRequest"
)
var (
@@ -26,6 +30,13 @@ var (
"enabled": true,
"mtpsPrice": true,
}
receiveMsgUsersMap = map[string][]string{
SendMsgTypeOpenStoreRequest: []string{
"石峰",
"徐建华",
},
}
)
func InitServiceInfo(version string, buildTime time.Time, gitCommit string) {
@@ -161,3 +172,16 @@ func UpdatePlace(ctx *jxcontext.Context, placeCode int, payload map[string]inter
func GetCoordinateDistrictCode(ctx *jxcontext.Context, lng, lat float64) (code int, err error) {
return api.AutonaviAPI.GetCoordinateDistrictCode(lng, lat), nil
}
func SendMsg2Somebody(ctx *jxcontext.Context, msgType, msgContent string) (err error) {
db := dao.GetDB()
for _, v := range receiveMsgUsersMap[msgType] {
user, err2 := dao.GetUserByID(db, "name", v)
if err2 == nil {
msg.SendUserMessage(user.GetID(), msgType, msgContent)
} else if err == nil {
err = err2
}
}
return err
}