aa
This commit is contained in:
@@ -795,7 +795,7 @@ func NotifyStoreAlertMessage(storeID int, storeName, title, content string) (err
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func SendStoreMessage(ctx *jxcontext.Context, title, content string, storeIDs []int, actInfo string, messageType int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
func SendStoreMessage(ctx *jxcontext.Context, title, content string, storeIDs []int, imgs []string, actInfo string, messageType int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
//权限
|
//权限
|
||||||
if permission.IsRoled(ctx) {
|
if permission.IsRoled(ctx) {
|
||||||
@@ -831,6 +831,7 @@ func SendStoreMessage(ctx *jxcontext.Context, title, content string, storeIDs []
|
|||||||
Content: content,
|
Content: content,
|
||||||
Type: int8(messageType),
|
Type: int8(messageType),
|
||||||
ActInfo: actInfo,
|
ActInfo: actInfo,
|
||||||
|
Imgs: strings.Join(imgs, ","),
|
||||||
}
|
}
|
||||||
dao.WrapAddIDCULDEntity(msg, ctx.GetUserName())
|
dao.WrapAddIDCULDEntity(msg, ctx.GetUserName())
|
||||||
if err = dao.CreateEntity(db, msg); err != nil {
|
if err = dao.CreateEntity(db, msg); err != nil {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ type Message struct {
|
|||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Content string `orm:"type(text)" json:"content"`
|
Content string `orm:"type(text)" json:"content"`
|
||||||
ActInfo string `json:"actInfo"` //活动信息,时间平台等
|
ActInfo string `json:"actInfo"` //活动信息,时间平台等
|
||||||
|
Imgs string `json:"imgs"` //图片集合
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*Message) TableIndex() [][]string {
|
func (*Message) TableIndex() [][]string {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ type MsgController struct {
|
|||||||
// @Param content formData string true "消息内容"
|
// @Param content formData string true "消息内容"
|
||||||
// @Param messageType formData int true "消息类型,1为普通给商家发的消息,3为活动内容通知"
|
// @Param messageType formData int true "消息类型,1为普通给商家发的消息,3为活动内容通知"
|
||||||
// @Param actInfo formData string false "如果是活动内容通知需传"
|
// @Param actInfo formData string false "如果是活动内容通知需传"
|
||||||
|
// @Param imgs formData string false "图片s"
|
||||||
// @Param isAsync formData bool false "是否异步操作,缺省否"
|
// @Param isAsync formData bool false "是否异步操作,缺省否"
|
||||||
// @Param isContinueWhenError formData bool false "单个失败是否继续,缺省false"
|
// @Param isContinueWhenError formData bool false "单个失败是否继续,缺省false"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
@@ -31,10 +32,11 @@ type MsgController struct {
|
|||||||
func (c *MsgController) SendStoreMessage() {
|
func (c *MsgController) SendStoreMessage() {
|
||||||
c.callSendStoreMessage(func(params *tMsgSendStoreMessageParams) (retVal interface{}, errCode string, err error) {
|
c.callSendStoreMessage(func(params *tMsgSendStoreMessageParams) (retVal interface{}, errCode string, err error) {
|
||||||
var storeIDs []int
|
var storeIDs []int
|
||||||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs); err != nil {
|
var imgs []string
|
||||||
|
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.Imgs, &imgs); err != nil {
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
}
|
}
|
||||||
retVal, err = weixinmsg.SendStoreMessage(params.Ctx, params.Title, params.Content, storeIDs, params.ActInfo, params.MessageType, params.IsAsync, params.IsContinueWhenError)
|
retVal, err = weixinmsg.SendStoreMessage(params.Ctx, params.Title, params.Content, storeIDs, imgs, params.ActInfo, params.MessageType, params.IsAsync, params.IsContinueWhenError)
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user