|
@@ -20,7 +20,7 @@ import (
|
|
|
// LatestNews 研报首页最新资讯
|
|
|
func LatestNews(c *gin.Context) {
|
|
|
reqChartPermissionId := c.DefaultQuery("chart_permission_id", "")
|
|
|
- if reqChartPermissionId == ""{
|
|
|
+ if reqChartPermissionId == "" {
|
|
|
response.Fail("请输入权限ID", c)
|
|
|
return
|
|
|
}
|
|
@@ -31,7 +31,7 @@ func LatestNews(c *gin.Context) {
|
|
|
}
|
|
|
userinfo := userService.GetInfoByClaims(c)
|
|
|
|
|
|
- list,err := pc.GetLatestReportList(userinfo, chartPermissionId)
|
|
|
+ list, err := pc.GetLatestReportList(userinfo, chartPermissionId)
|
|
|
if err != nil {
|
|
|
response.Fail("获取报告失败", c)
|
|
|
return
|
|
@@ -49,13 +49,13 @@ func LatestNews(c *gin.Context) {
|
|
|
|
|
|
// Banner 上新公告banner图
|
|
|
func Banner(c *gin.Context) {
|
|
|
- var resp pcModels.LatestReleaseResp
|
|
|
- activityItem,err := yb_activity.GetLatestActivity()
|
|
|
+ var resp pcModels.LatestReleaseResp
|
|
|
+ activityItem, err := yb_activity.GetLatestActivity()
|
|
|
if err != nil {
|
|
|
response.Fail(err.Error(), c)
|
|
|
return
|
|
|
}
|
|
|
- reportItem,err := report.GetLatestReport()
|
|
|
+ reportItem, err := report.GetLatestReport()
|
|
|
if err != nil {
|
|
|
response.Fail(err.Error(), c)
|
|
|
return
|
|
@@ -124,6 +124,7 @@ func ClassifyDetail(c *gin.Context) {
|
|
|
// ClassifyDetailBanner 专栏详情banner图
|
|
|
func ClassifyDetailBanner(c *gin.Context) {
|
|
|
reqReportId := c.DefaultQuery("reportId", "")
|
|
|
+ classifyName := c.DefaultQuery("classify_name_first", "")
|
|
|
if reqReportId == "" {
|
|
|
response.Fail("请输入二级分类标识", c)
|
|
|
return
|
|
@@ -133,31 +134,53 @@ func ClassifyDetailBanner(c *gin.Context) {
|
|
|
response.Fail("报告ID格式有误", c)
|
|
|
return
|
|
|
}
|
|
|
- reportInfo, err := report.GetByReportId(reportId)
|
|
|
- if err != nil {
|
|
|
- response.Fail("报告查询出错", c)
|
|
|
- return
|
|
|
- }
|
|
|
- if reportInfo.Id == 0 {
|
|
|
- response.Fail("报告不存在", c)
|
|
|
- return
|
|
|
- }
|
|
|
|
|
|
- if reportInfo.State != 2 {
|
|
|
- response.Fail("报告未发布", c)
|
|
|
- return
|
|
|
- }
|
|
|
+ var bannerResp *pcModels.DetailBannerResp
|
|
|
+ if classifyName == "周报" || classifyName == "晨报" {
|
|
|
+ chapterItem, err := report_chapter.GetLatestChapterByClassifyName(classifyName)
|
|
|
+ if err != nil {
|
|
|
+ response.Fail("查询最新一期晨周报失败"+err.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp := &pcModels.DetailBannerResp{
|
|
|
+ ReportId: chapterItem.ReportId,
|
|
|
+ Stage: chapterItem.Stage,
|
|
|
+ ImgUrl: "",
|
|
|
+ }
|
|
|
+ bannerResp = resp
|
|
|
+ } else {
|
|
|
+ reportInfo, err := report.GetByReportId(reportId)
|
|
|
+ if err != nil {
|
|
|
+ response.Fail("报告查询出错", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if reportInfo.Id == 0 {
|
|
|
+ response.Fail("报告不存在", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
- classifyInfo, err := classify.GetByClassifyId(reportInfo.ClassifyIdSecond)
|
|
|
- if err != nil {
|
|
|
- response.Fail("分类查询出错", c)
|
|
|
- return
|
|
|
+ if reportInfo.State != 2 {
|
|
|
+ response.Fail("报告未发布", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ reportItem, err := report.GetLatestReportByClassifyName(classifyName)
|
|
|
+ if err != nil {
|
|
|
+ response.Fail("获取报告详情失败"+err.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp := &pcModels.DetailBannerResp{
|
|
|
+ ReportId: reportItem.ReportId,
|
|
|
+ Stage: reportItem.Stage,
|
|
|
+ ImgUrl: "",
|
|
|
+ }
|
|
|
+ bannerResp = resp
|
|
|
}
|
|
|
- response.OkData("查询成功", classifyInfo, c)
|
|
|
+ response.OkData("查询成功", bannerResp, c)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-// Recommend 专栏详情页更多推荐
|
|
|
+// Recommend 报告详情页更多推荐
|
|
|
func Recommend(c *gin.Context) {
|
|
|
reqReportId := c.DefaultQuery("reportId", "")
|
|
|
classifyName := c.DefaultQuery("classify_name_first", "")
|
|
@@ -189,7 +212,7 @@ func Recommend(c *gin.Context) {
|
|
|
}
|
|
|
recommendResp = append(recommendResp, resp)
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
reportInfo, err := report.GetByReportId(reportId)
|
|
|
if err != nil {
|
|
|
response.Fail("报告查询出错", c)
|
|
@@ -267,21 +290,21 @@ func CustomerComment(c *gin.Context) {
|
|
|
// @Router /pc/getSunCode [post]
|
|
|
func GetSunCode(c *gin.Context) {
|
|
|
var req services.SunCodeReq
|
|
|
- if c.ShouldBind(&req) != nil{
|
|
|
+ if c.ShouldBind(&req) != nil {
|
|
|
response.Fail("参数异常", c)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
var sunCodeUrl string
|
|
|
//先查,查不到再去生成上传
|
|
|
- item,err := yb_pc_suncode.GetYbPcSunCode(req.CodeScene, req.CodePage)
|
|
|
+ item, err := yb_pc_suncode.GetYbPcSunCode(req.CodeScene, req.CodePage)
|
|
|
sunCodeUrl = item.SuncodeURL
|
|
|
- if err != nil && err != utils.ErrNoRow{
|
|
|
+ if err != nil && err != utils.ErrNoRow {
|
|
|
response.Fail(err.Error(), c)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if sunCodeUrl == ""{
|
|
|
+ if sunCodeUrl == "" {
|
|
|
sunCodeUrl, err = services.PcCreateAndUploadSunCode(req.CodeScene, req.CodePage)
|
|
|
if err != nil {
|
|
|
response.Fail(err.Error(), c)
|