12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- package report
- import (
- "github.com/gin-gonic/gin"
- "hongze/hongze_yb/controller/response"
- "hongze/hongze_yb/logic/report"
- "hongze/hongze_yb/services/user"
- "strconv"
- )
- func GetResearchReportInfo(c *gin.Context) {
- userInfo := user.GetInfoByClaims(c)
- researchReportIdStr := c.DefaultQuery("research_report_id", "")
- if researchReportIdStr == "" {
- response.Fail("请传入报告id", c)
- return
- }
- researchReportId, tmpErr := strconv.Atoi(researchReportIdStr)
- if tmpErr != nil {
- response.Fail("报告id异常", c)
- return
- }
- reportInfo, hasPermission, err := report.GetResearchReportInfo(uint64(researchReportId), userInfo.UserID)
- if err != nil {
- response.Fail("获取报告失败", c)
- return
- }
- if !hasPermission {
- response.Fail("无权限", c)
- return
- }
- response.OkData("获取成功", reportInfo, c)
- }
- func GetResearchReportChapter(c *gin.Context) {
- userInfo := user.GetInfoByClaims(c)
- researchReportTypeIdStr := c.DefaultQuery("research_report_type_id", "")
- if researchReportTypeIdStr == "" {
- response.Fail("请传入报告章节id", c)
- return
- }
- researchReportId, tmpErr := strconv.Atoi(researchReportTypeIdStr)
- if tmpErr != nil {
- response.Fail("报告章节id异常", c)
- return
- }
- reportInfo, hasPermission, err := report.GetResearchReportTypeContentInfo(uint64(researchReportId), userInfo.UserID)
- if err != nil {
- response.Fail("获取报告章节失败", c)
- return
- }
- if !hasPermission {
- response.Fail("无权限", c)
- return
- }
- response.OkData("获取成功", reportInfo, c)
- }
|