|
@@ -85,10 +85,30 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
|
|
|
br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+ //处理识图建会的会议信息列表 因为活动发布处理的业务逻辑过多,方便后期统一维护这里 根据 list 数据类型自己拼接 活动的 body 查研观向 11.12
|
|
|
+ listImgToText := req.ListImgToText
|
|
|
+
|
|
|
+ if len(listImgToText) > 0 {
|
|
|
+ var errmsg string
|
|
|
+ req, err, errmsg = cygxService.MakeActivityReqText(listImgToText)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "识图建会失败!"
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if errmsg != "" {
|
|
|
+ br.Msg = "识图建会失败," + errmsg
|
|
|
+ br.ErrMsg = "识图建会失败," + errmsg
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
if req.Body == "" {
|
|
|
br.Msg = "内容不可为空"
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+ //return
|
|
|
//不限制人数的,强制改为全部客户可见
|
|
|
if req.LimitPeopleNum == 0 {
|
|
|
req.VisibleRange = 2
|
|
@@ -364,7 +384,6 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
|
|
|
}
|
|
|
itemPointsSet = itemResp
|
|
|
}
|
|
|
-
|
|
|
for k, v := range slice {
|
|
|
//如果内容不存在 时间:字段则不予处理
|
|
|
if strings.Contains(v, "时间:") || strings.Contains(v, "时间:") {
|
|
@@ -423,7 +442,14 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
|
|
|
item.IsYidongConduct = req.IsYidongConduct
|
|
|
item.IsCanOutboundCall = req.IsCanOutboundCall
|
|
|
item.IsNeedEmail = isNeedEmail
|
|
|
- item.SiginupDeadline = siginupDeadline
|
|
|
+
|
|
|
+ if len(listImgToText) > 0 {
|
|
|
+ resultTime := utils.StrTimeToTime(item.ActivityTime) //时间字符串格式转时间格式
|
|
|
+ item.SiginupDeadline = resultTime.AddDate(0, 0, -1).Format(utils.FormatDate) + " 15:30:00" //批量建会报名截止之前默认:活动前一天15:30:00
|
|
|
+ } else {
|
|
|
+ item.SiginupDeadline = siginupDeadline
|
|
|
+ }
|
|
|
+
|
|
|
if isResearchPoints == 1 {
|
|
|
item.IsResearchPoints = 1
|
|
|
}
|
|
@@ -624,7 +650,7 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
|
|
|
item.AdminName = activityInfo.AdminName
|
|
|
item.PublishDate = utils.StrTimeToTime(activityInfo.PublishDate)
|
|
|
}
|
|
|
- //音频
|
|
|
+ //音频 目前只有一个
|
|
|
itemVoice := new(cygx.CygxActivityVoice)
|
|
|
//var itemVoiceList []*cygx.CygxActivityVoice
|
|
|
if len(voiceList) > 0 {
|
|
@@ -633,6 +659,8 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
|
|
|
itemVoice.VoiceName = vo.Name
|
|
|
itemVoice.VoiceUrl = vo.Url
|
|
|
itemVoice.VoicePlaySeconds = vo.PlaySeconds
|
|
|
+ itemVoice.BackgroundImg = req.BackgroundImg
|
|
|
+ itemVoice.ShareImg = req.ShareImg
|
|
|
itemVoice.CreateTime = time.Now()
|
|
|
}
|
|
|
}
|
|
@@ -643,50 +671,58 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
|
|
|
itemVideo.ActivityId = activityId
|
|
|
itemVideo.VideoDuration = videoDetail.VideoDuration
|
|
|
itemVideo.VideoUrl = videoDetail.VideoUrl
|
|
|
+ itemVideo.BackgroundImg = req.BackgroundImg
|
|
|
+ itemVideo.ShareImg = req.ShareImg
|
|
|
itemVideo.ModifyDate = time.Now().Format(utils.FormatDateTime)
|
|
|
itemVideo.CreateTime = time.Now().Format(utils.FormatDateTime)
|
|
|
}
|
|
|
//删除原有的视频数据
|
|
|
//if itemVideo.VideoUrl != "" {
|
|
|
- videoDetail, err := cygx.GetCygxActivityVideoReqDetail(activityId)
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "GetCygxActivityVideoReqDetail,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
|
|
|
- return
|
|
|
- }
|
|
|
- if videoDetail != nil {
|
|
|
- go cygxService.UpdateResourceData(videoDetail.VideoId, "activityvideo", "delete", time.Now().Format(utils.FormatDateTime))
|
|
|
- }
|
|
|
+ //videoDetail, err := cygx.GetCygxActivityVideoReqDetail(activityId)
|
|
|
+ //if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ // br.Msg = "获取信息失败"
|
|
|
+ // br.ErrMsg = "GetCygxActivityVideoReqDetail,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
|
|
|
+ // return
|
|
|
//}
|
|
|
-
|
|
|
- //if itemVoice.VoiceUrl != "" {
|
|
|
- voiceReqList, err := cygx.GetCygxActivityVoiceReqList(activityId)
|
|
|
+ //if videoDetail != nil {
|
|
|
+ // go cygxService.UpdateResourceData(videoDetail.VideoId, "activityvideo", "delete", time.Now().Format(utils.FormatDateTime))
|
|
|
+ //}
|
|
|
+ //}
|
|
|
+ //处理音视频上传
|
|
|
+ err := cygxService.UpdateActivityVideoAndVoice(activityInfo, itemVoice, itemVideo)
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "GetCygxActivityVoiceReqList,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
|
|
|
+ br.ErrMsg = "UpdateActivityVideoAndVoice,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
|
|
|
return
|
|
|
}
|
|
|
- if len(voiceReqList) > 0 {
|
|
|
- for _, voice := range voiceReqList {
|
|
|
- go cygxService.UpdateResourceData(voice.ActivityVoiceId, "activityvoice", "delete", time.Now().Format(utils.FormatDateTime))
|
|
|
- }
|
|
|
- }
|
|
|
+ //if itemVoice.VoiceUrl != "" {
|
|
|
+ //voiceReqList, err := cygx.GetCygxActivityVoiceReqList(activityId)
|
|
|
+ //if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ // br.Msg = "获取信息失败"
|
|
|
+ // br.ErrMsg = "GetCygxActivityVoiceReqList,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ //if len(voiceReqList) > 0 {
|
|
|
+ // for _, voice := range voiceReqList {
|
|
|
+ // go cygxService.UpdateResourceData(voice.ActivityVoiceId, "activityvoice", "delete", time.Now().Format(utils.FormatDateTime))
|
|
|
+ // }
|
|
|
+ //}
|
|
|
//}
|
|
|
//如果活动信息有如下变更则做消息推送
|
|
|
- voiceIdNew, videoIdNew, err := cygx.EditActivity(item, activityInfo.PublishStatus, industrialActivityItemsList, subjectActivityItemsList, itemVoice, itemVideo, itemPointsSet)
|
|
|
+ err = cygx.EditActivity(item, activityInfo.PublishStatus, industrialActivityItemsList, subjectActivityItemsList, itemPointsSet)
|
|
|
if err != nil {
|
|
|
br.Msg = "操作失败"
|
|
|
br.ErrMsg = "操作失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- //更新活动音频
|
|
|
- if int(voiceIdNew) > 0 {
|
|
|
- go cygxService.UpdateResourceData(int(voiceIdNew), "activityvoice", "add", activityInfo.ActivityTime)
|
|
|
- }
|
|
|
- //更新活动视频
|
|
|
- if int(videoIdNew) > 0 {
|
|
|
- go cygxService.UpdateResourceData(int(videoIdNew), "activityvideo", "add", activityInfo.ActivityTime)
|
|
|
- }
|
|
|
+ ////更新活动音频
|
|
|
+ //if int(voiceIdNew) > 0 {
|
|
|
+ // go cygxService.UpdateResourceData(int(voiceIdNew), "activityvoice", "add", activityInfo.ActivityTime)
|
|
|
+ //}
|
|
|
+ ////更新活动视频
|
|
|
+ //if int(videoIdNew) > 0 {
|
|
|
+ // go cygxService.UpdateResourceData(int(videoIdNew), "activityvideo", "add", activityInfo.ActivityTime)
|
|
|
+ //}
|
|
|
|
|
|
errAct = err
|
|
|
if activityInfo.PublishStatus == 1 && activityInfo.ActivityTimeText != item.ActivityTimeText {
|
|
@@ -1099,6 +1135,11 @@ func (this *ActivityCoAntroller) Detail() {
|
|
|
}
|
|
|
if len(VoiceReqList) == 0 {
|
|
|
VoiceReqList = make([]*cygx.CygxActivityVoiceReq, 0)
|
|
|
+ } else {
|
|
|
+ for _, v := range VoiceReqList {
|
|
|
+ activityInfo.BackgroundImg = v.BackgroundImg
|
|
|
+ activityInfo.ShareImg = v.ShareImg
|
|
|
+ }
|
|
|
}
|
|
|
VideoDetail, err := cygx.GetCygxActivityVideoReqDetail(activityId)
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
@@ -1106,6 +1147,10 @@ func (this *ActivityCoAntroller) Detail() {
|
|
|
br.ErrMsg = "GetCygxActivityVideoReqDetail,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
|
|
|
return
|
|
|
}
|
|
|
+ if VideoDetail != nil {
|
|
|
+ activityInfo.BackgroundImg = VideoDetail.BackgroundImg
|
|
|
+ activityInfo.ShareImg = VideoDetail.ShareImg
|
|
|
+ }
|
|
|
if activityInfo.CustomerTypeIds != "" {
|
|
|
customerTypeIdslist := strings.Split(activityInfo.CustomerTypeIds, ",")
|
|
|
var permissionValueStr string
|
|
@@ -1148,6 +1193,20 @@ func (this *ActivityCoAntroller) Detail() {
|
|
|
if activityInfo.VisibleRange == 0 {
|
|
|
activityInfo.VisibleRange = 2
|
|
|
}
|
|
|
+
|
|
|
+ ////如果是已结束的活动,而且封面图片为空,那么就给一个默认的图片
|
|
|
+ //if activityInfo.ActiveState == 3 && activityInfo.BackgroundImg == "" {
|
|
|
+ // // 获取默认图配置 目前音频视频用的是同一个封面图,暂时不做区分处理
|
|
|
+ // audioMap, _, audioShareMap, _, err := cygxService.GetMicroRoadShowDefaultImgConfig()
|
|
|
+ // if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ // br.Msg = "获取信息失败"
|
|
|
+ // br.ErrMsg = "GetMicroRoadShowDefaultImgConfig,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // activityInfo.BackgroundImg = audioMap[activityInfo.ChartPermissionId]
|
|
|
+ // activityInfo.ShareImg = audioShareMap[activityInfo.ChartPermissionId]
|
|
|
+ //}
|
|
|
+
|
|
|
//activityInfo.CancelDeadlineType = cygxService.ActivityCancelDeadlineType(activityInfo) //处理活动取消报名截止时间类型展示
|
|
|
activityInfo.VoiceList = VoiceReqList
|
|
|
activityInfo.VideoDetail = VideoDetail
|
|
@@ -1474,3 +1533,99 @@ func (this *ActivityCoAntroller) DeadlineSet() {
|
|
|
br.Success = true
|
|
|
br.Data = list
|
|
|
}
|
|
|
+
|
|
|
+// @Title 根据图片获取建会信息接口
|
|
|
+// @Description 根据图片获取建会信息接口
|
|
|
+// @Param request body cygx.ActivityIdRep true "type json string"
|
|
|
+// @Success Ret=200
|
|
|
+// @router /activity/imgToText [post]
|
|
|
+func (this *ActivityCoAntroller) ImgToText() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ AdminUser := this.SysUser
|
|
|
+ if AdminUser == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var req cygx.AliyunOcrImgUrlReq
|
|
|
+ resp := new(cygx.AliyunOcrTextActivityListResp)
|
|
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ imgUrl := req.ImgUrl
|
|
|
+ if imgUrl == "" {
|
|
|
+ br.Msg = "请上传图片"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ ocrResp, err := services.AliOcrByImageToText(imgUrl)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "图片解析失败!"
|
|
|
+ br.ErrMsg = "图片解析失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(ocrResp.Ret) == 0 {
|
|
|
+ br.Msg = "图片解析失败!"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var titmeYMD string
|
|
|
+ var titmeHM string
|
|
|
+ var company string
|
|
|
+ var list []*cygx.AliyunOcrTextActivityResp
|
|
|
+ var mapTitmeYMD = make(map[int]string)
|
|
|
+ var mapTitmeHM = make(map[int]string)
|
|
|
+ var mapCompany = make(map[int]string)
|
|
|
+ var lineNum int
|
|
|
+ for k, v := range ocrResp.Ret {
|
|
|
+ if k == 0 && !strings.Contains(v.Word, "/") {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if strings.Contains(v.Word, "/") {
|
|
|
+ mapTitmeYMD[lineNum] = v.Word
|
|
|
+ titmeYMD = v.Word
|
|
|
+ }
|
|
|
+ if strings.Contains(v.Word, "AM") || strings.Contains(v.Word, "PM") {
|
|
|
+ mapTitmeHM[lineNum] = v.Word
|
|
|
+ titmeHM = v.Word
|
|
|
+ }
|
|
|
+ if strings.Contains(v.Word, "(") && strings.Contains(v.Word, ")") {
|
|
|
+ if mapTitmeYMD[lineNum] == "" {
|
|
|
+ mapTitmeYMD[lineNum] = mapTitmeYMD[lineNum-1]
|
|
|
+ }
|
|
|
+ titmeYMD = mapTitmeYMD[lineNum]
|
|
|
+ mapCompany[lineNum] = v.Word
|
|
|
+ company = v.Word
|
|
|
+ lineNum++
|
|
|
+
|
|
|
+ }
|
|
|
+ if titmeYMD != "" && titmeHM != "" && company != "" {
|
|
|
+ item := new(cygx.AliyunOcrTextActivityResp)
|
|
|
+ item.TitmeYMD = titmeYMD
|
|
|
+ item.TitmeHM = titmeHM
|
|
|
+ item.Company = company
|
|
|
+ list = append(list, item)
|
|
|
+ titmeYMD = ""
|
|
|
+ titmeHM = ""
|
|
|
+ company = ""
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range list {
|
|
|
+ v.TitmeYMD = cygxService.ConvertActivityTitmeYMD(v.TitmeYMD)
|
|
|
+ v.TitmeHM = cygxService.ConvertActivityTitmeHM(v.TitmeHM)
|
|
|
+ }
|
|
|
+ resp.List = list
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Data = resp
|
|
|
+ br.IsAddLog = true
|
|
|
+}
|