|
@@ -8,6 +8,8 @@ import (
|
|
|
"eta/eta_api/models/report"
|
|
|
"eta/eta_api/models/report_approve"
|
|
|
"eta/eta_api/models/system"
|
|
|
+ "eta/eta_api/models/yb"
|
|
|
+ "eta/eta_api/services/alarm_msg"
|
|
|
"eta/eta_api/utils"
|
|
|
"fmt"
|
|
|
"html"
|
|
@@ -1655,3 +1657,37 @@ func FilterShareUrl() web.FilterFunc {
|
|
|
utils.ApiLog.Info(fmt.Sprintf("原始请求为:%s, 已修改请求路径为:%s?%s", path, newPath, q.Encode()))
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+// ResetMiniProgramReportDetailCover 重置小程序报告封面
|
|
|
+func ResetMiniProgramReportDetailCover(reportId int) (err error) {
|
|
|
+ if utils.MYSQL_WEEKLY_URL == `` {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ tips := fmt.Sprintf("ResetMiniProgramReportDetailCover-重置小程序报告封面失败, %v", err)
|
|
|
+ utils.FileLog.Info(tips)
|
|
|
+ alarm_msg.SendAlarmMsg(tips, 2)
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ ob := new(yb.YbPosterResource)
|
|
|
+ cond := fmt.Sprintf(` AND path LIKE 'reportDetailCover?ReportId=%d&%%'`, reportId)
|
|
|
+ pars := make([]interface{}, 0)
|
|
|
+ list, e := ob.GetItemsByCondition(cond, pars, []string{"id"}, "")
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("获取报告海报失败, %v", e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(list) == 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var removeIds []int
|
|
|
+ for _, v := range list {
|
|
|
+ removeIds = append(removeIds, v.Id)
|
|
|
+ }
|
|
|
+ if e = ob.RemovePosters(removeIds); e != nil {
|
|
|
+ err = fmt.Errorf("清除报告海报失败, %v", e)
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|