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