add line push message api
This commit is contained in:
@@ -6,10 +6,32 @@ import (
|
||||
"strconv"
|
||||
|
||||
"git.trj.tw/golang/mtfosbot/model"
|
||||
"git.trj.tw/golang/mtfosbot/module/apis/line"
|
||||
"git.trj.tw/golang/mtfosbot/module/context"
|
||||
"git.trj.tw/golang/mtfosbot/module/utils"
|
||||
)
|
||||
|
||||
// PushMessage -
|
||||
func PushLineMessage(c *context.Context) {
|
||||
bodyData := struct {
|
||||
Group string `json:"group,required"`
|
||||
Message string `json:"message,required"`
|
||||
}{}
|
||||
|
||||
err := c.BindData(&bodyData)
|
||||
if err != nil {
|
||||
c.DataFormat(nil)
|
||||
return
|
||||
}
|
||||
|
||||
textObj := line.TextMessage{}
|
||||
textObj.Text = bodyData.Message
|
||||
|
||||
line.PushMessage(bodyData.Group, textObj)
|
||||
|
||||
c.Success(nil)
|
||||
}
|
||||
|
||||
// GetLineList -
|
||||
func GetLineList(c *context.Context) {
|
||||
ls, err := model.GetLineGroupList()
|
||||
|
||||
Reference in New Issue
Block a user