|
@@ -12,7 +12,6 @@ import (
|
|
|
"hongze/hongze_yb/services"
|
|
|
"hongze/hongze_yb/services/company"
|
|
|
"hongze/hongze_yb/services/user"
|
|
|
- "hongze/hongze_yb/services/wechat"
|
|
|
"hongze/hongze_yb/utils"
|
|
|
"io/ioutil"
|
|
|
"os"
|
|
@@ -46,7 +45,7 @@ func BroadcastList(c *gin.Context) {
|
|
|
userinfo := user.GetInfoByClaims(c)
|
|
|
ok, checkInfo, _, err := company.CheckBaseFiccPermission(userinfo.CompanyID, int(userinfo.UserID))
|
|
|
if err != nil {
|
|
|
- response.FailMsg("用户权限验证失败", "CheckBaseAuth-用户权限验证失败" + err.Error(), c)
|
|
|
+ response.FailMsg("用户权限验证失败", "CheckBaseAuth-用户权限验证失败"+err.Error(), c)
|
|
|
c.Abort()
|
|
|
return
|
|
|
}
|
|
@@ -81,7 +80,7 @@ func BroadcastList(c *gin.Context) {
|
|
|
// @Router /add [post]
|
|
|
func AddBroadcast(c *gin.Context) {
|
|
|
broadcastName := c.PostForm("broadcast_name")
|
|
|
- fmt.Println("broadcastName:",broadcastName)
|
|
|
+ fmt.Println("broadcastName:", broadcastName)
|
|
|
nsectionId := c.PostForm("section_id")
|
|
|
sectionId, _ := strconv.Atoi(nsectionId)
|
|
|
sectionName := c.PostForm("section_name")
|
|
@@ -168,12 +167,6 @@ func AddBroadcast(c *gin.Context) {
|
|
|
if err != nil {
|
|
|
fmt.Println("AddUserViewHistory err", err.Error())
|
|
|
}
|
|
|
-
|
|
|
- // 推送回复消息给用户
|
|
|
- go wechat.SendVoiceBroadcastWxMsg(voiceBroadcast.BroadcastId, voiceBroadcast.SectionName, voiceBroadcast.BroadcastName)
|
|
|
-
|
|
|
- //同花顺客群
|
|
|
- go services.SendVoiceBroadcastToThs(voiceBroadcast)
|
|
|
response.Ok("发布成功", c)
|
|
|
}
|
|
|
|
|
@@ -219,7 +212,7 @@ func SectionList(c *gin.Context) {
|
|
|
|
|
|
//如果有被禁用的板块,去语音列表查找被禁用板块有没有语音
|
|
|
var lists []*voice_broadcast.VoiceBroadcast
|
|
|
- if len(bannedIds) > 0{
|
|
|
+ if len(bannedIds) > 0 {
|
|
|
lists, err = voice_section.GetVoiceSectionFromBroadcast(bannedIds)
|
|
|
if err != nil {
|
|
|
response.FailMsg("查询语音播报禁用板块失败", "GetVoiceSectionFromBroadcast, Err:"+err.Error(), c)
|
|
@@ -235,7 +228,7 @@ func SectionList(c *gin.Context) {
|
|
|
bannedMap[broadcast.SectionId] = broadcast.SectionId
|
|
|
}
|
|
|
for _, section := range sList {
|
|
|
- _,ok := bannedMap[section.SectionId]
|
|
|
+ _, ok := bannedMap[section.SectionId]
|
|
|
if section.Status != 0 || ok {
|
|
|
newsList = append(newsList, section)
|
|
|
}
|
|
@@ -262,7 +255,7 @@ func SectionList(c *gin.Context) {
|
|
|
sectionList = append(sectionList, section)
|
|
|
}
|
|
|
}
|
|
|
- if len(sectionList) == 0{
|
|
|
+ if len(sectionList) == 0 {
|
|
|
continue
|
|
|
}
|
|
|
v.Children = sectionList
|
|
@@ -285,7 +278,7 @@ func DelBroadcast(c *gin.Context) {
|
|
|
response.FailMsg("转换id失败,请输入正确的id", "strconv.Atoi, Err:"+err.Error(), c)
|
|
|
}
|
|
|
if broadcastId <= 0 {
|
|
|
- response.FailMsg("参数错误","参数有误", c)
|
|
|
+ response.FailMsg("参数错误", "参数有误", c)
|
|
|
return
|
|
|
}
|
|
|
var item voice_broadcast.VoiceBroadcast
|
|
@@ -310,12 +303,86 @@ func AddStatistics(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if req.BroadcastId <= 0{
|
|
|
+ if req.BroadcastId <= 0 {
|
|
|
response.Fail("参数有误", c)
|
|
|
}
|
|
|
userinfo := user.GetInfoByClaims(c)
|
|
|
-
|
|
|
+
|
|
|
go services.AddBroadcastRecord(userinfo, req.Source, req.BroadcastId)
|
|
|
|
|
|
response.Ok("新增记录成功", c)
|
|
|
}
|
|
|
+
|
|
|
+// BroadcastDetail 获取语音播报详情
|
|
|
+// @Tags 语音播报模块
|
|
|
+// @Description 获取语音播报详情
|
|
|
+// @Param variety_tag_id query int true "标签ID"
|
|
|
+// @Success 200 {object} response.PriceDrivenItem
|
|
|
+// @failure 400 {string} string "获取失败"
|
|
|
+// @Router /detail [get]
|
|
|
+func BroadcastDetail(c *gin.Context) {
|
|
|
+ var req request.BroadcastDetailReq
|
|
|
+ if err := c.Bind(&req); err != nil {
|
|
|
+ response.Fail("参数有误", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if req.BroadcastId <= 0 {
|
|
|
+ response.Fail("参数有误", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ userInfo := user.GetInfoByClaims(c)
|
|
|
+ item, e := voice_broadcast.GetBroadcastById(req.BroadcastId)
|
|
|
+ if e != nil {
|
|
|
+ response.FailMsg("获取失败", "BroadcastDetail ErrMsg:"+e.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp := &voiceResp.Broadcast{
|
|
|
+ BroadcastId: item.BroadcastId,
|
|
|
+ BroadcastName: item.BroadcastName,
|
|
|
+ SectionId: item.SectionId,
|
|
|
+ SectionName: item.SectionName,
|
|
|
+ VarietyId: item.VarietyId,
|
|
|
+ VarietyName: item.VarietyName,
|
|
|
+ AuthorId: item.AuthorId,
|
|
|
+ Author: item.Author,
|
|
|
+ ImgUrl: item.ImgUrl,
|
|
|
+ VoiceUrl: item.VoiceUrl,
|
|
|
+ VoicePlaySeconds: item.VoicePlaySeconds,
|
|
|
+ VoiceSize: item.VoiceSize,
|
|
|
+ CreateTime: item.CreateTime,
|
|
|
+ }
|
|
|
+ // 是否为作者、是否可以推送消息
|
|
|
+ if int(userInfo.UserID) == item.AuthorId {
|
|
|
+ resp.IsAuthor = true
|
|
|
+ if item.MsgState == 0 {
|
|
|
+ resp.CouldSendMsg = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ response.OkData("获取成功", resp, c)
|
|
|
+}
|
|
|
+
|
|
|
+// MsgSend 语音播报消息推送
|
|
|
+// @Tags 语音播报模块
|
|
|
+// @Description 语音播报消息推送
|
|
|
+// @Param broadcast_id query int true "语音播报ID"
|
|
|
+// @Success 200 {string} string "操作成功"
|
|
|
+// @failure 400 {string} string "操作失败"
|
|
|
+// @Router /msg_send [post]
|
|
|
+func MsgSend(c *gin.Context) {
|
|
|
+ var req request.BroadcastMsgSendReq
|
|
|
+ if err := c.Bind(&req); err != nil {
|
|
|
+ response.Fail("参数有误", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if req.BroadcastId <= 0 {
|
|
|
+ response.Fail("参数有误", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ userInfo := user.GetInfoByClaims(c)
|
|
|
+ errMsg, err := services.SendBroadcastMsg(req.BroadcastId, int(userInfo.UserID))
|
|
|
+ if err != nil {
|
|
|
+ response.FailMsg(errMsg, "MsgSend ErrMsg:"+err.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ response.Ok("操作成功", c)
|
|
|
+}
|