aa
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"crypto/sha1"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"time"
|
||||
@@ -64,15 +65,25 @@ func (c *DDAPIController) Sign() {
|
||||
// @Param token header string true "认证token"
|
||||
// @Param title query string true "消息标题"
|
||||
// @Param content query string true "消息内容"
|
||||
// @Param mobile query string true "发送给谁"
|
||||
// @Param mobiles query string true "发送给谁,电话列表"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /SendDDmsgToUser [post]
|
||||
func (c *DDAPIController) SendDDmsgToUser() {
|
||||
c.callSendDDmsgToUser(func(params *tDdapiSendDDmsgToUserParams) (retVal interface{}, errCode string, err error) {
|
||||
if user, _ := dao.GetUserByID(dao.GetDB(), "mobile", params.Mobile); user != nil {
|
||||
var (
|
||||
mobiles []string
|
||||
mobileMap = make(map[string]string)
|
||||
)
|
||||
jxutils.Strings2Objs(params.Mobiles, &mobiles)
|
||||
for _, v := range mobiles {
|
||||
mobileMap[v] = v
|
||||
}
|
||||
for _, mobile := range mobileMap {
|
||||
if user, _ := dao.GetUserByID(dao.GetDB(), "mobile", mobile); user != nil {
|
||||
err = ddmsg.SendUserMessage(dingdingapi.MsgTyeText, user.UserID, params.Title, params.Content)
|
||||
}
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user