浏览代码

add:添加研报和图表的收藏模块

zqbao 10 月之前
父节点
当前提交
983ae0640c

+ 190 - 4
controllers/my_chart.go

@@ -4,19 +4,24 @@ import (
 	"encoding/json"
 	"eta/eta_mini_api/models"
 	"eta/eta_mini_api/models/request"
+	"eta/eta_mini_api/models/response"
+	"eta/eta_mini_api/utils"
+	"time"
+
+	"github.com/rdlucklib/rdluck_tools/paging"
 )
 
 type MyChartController struct {
 	BaseAuthController
 }
 
-// @Title List
-// @Description create users
+// @Title 收藏图表
+// @Description 收藏图表
 // @Param   PageSize   query   int  true       "每页数据条数"
 // @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
 // @Success 200 {object} models.BaseResponse
 // @Failure 403 {object} models.BaseResponse
-// @router /collect [get]
+// @router /collect [post]
 func (this *MyChartController) Collect() {
 	br := new(models.BaseResponse).Init()
 	defer func() {
@@ -27,7 +32,63 @@ func (this *MyChartController) Collect() {
 	var req request.MyChartCollectReq
 	if err := json.Unmarshal(this.Ctx.Input.RequestBody, &req); err != nil {
 		br.Msg = "参数解析失败"
-		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	user := this.User
+	if user.Status != 2 {
+		br.Msg = "用户没有权限收藏"
+		return
+	}
+	count, err := models.GetMyChartCount(user.UserId, req.UniqueCode)
+	if err != nil {
+		br.Msg = "收藏失败"
+		br.ErrMsg = "查询收藏数量失败,Err:" + err.Error()
+		return
+	}
+	if count > 0 {
+		br.Msg = "该图表已收藏,请重新刷新页面"
+		return
+	}
+	myChart := &models.MyChart{
+		UserId:       user.UserId,
+		UserRealName: user.RealName,
+		UniqueCode:   req.UniqueCode,
+		ChartImage:   req.ChartImage,
+		ChartName:    req.ChartName,
+		CreateTime:   time.Now(),
+		ModifyTime:   time.Now(),
+	}
+	err = myChart.Insert()
+	if err != nil {
+		br.Msg = "收藏失败"
+		br.ErrMsg = "收藏失败,Err:" + err.Error()
+		return
+	}
+
+	br.Msg = "收藏成功"
+	br.Success = true
+	br.Ret = 200
+}
+
+// @Title 取消收藏
+// @Description 取消收藏
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Success 200 {object} models.BaseResponse
+// @Failure 403 {object} models.BaseResponse
+// @router /collectCancel [post]
+func (this *MyChartController) CollectCancel() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	var req request.MyChartCollectCancelReq
+	if err := json.Unmarshal(this.Ctx.Input.RequestBody, &req); err != nil {
+		br.Msg = "参数解析失败"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
 		return
 	}
 	user := this.User
@@ -35,5 +96,130 @@ func (this *MyChartController) Collect() {
 		br.Msg = "用户没有权限收藏"
 		return
 	}
+	count, err := models.GetMyChartCount(user.UserId, req.UniqueCode)
+	if err != nil {
+		br.Msg = "取消收藏失败"
+		br.ErrMsg = "获取收藏信息失败,Err:" + err.Error()
+		return
+	}
+	if count == 0 {
+		br.Msg = "该图表已取消收藏,请重新刷新页面"
+		return
+	}
+	err = models.DeleteMyChart(user.UserId, req.UniqueCode)
+	if err != nil {
+		br.Msg = "取消收藏失败"
+		br.ErrMsg = "取消收藏失败,Err:" + err.Error()
+		return
+	}
+
+	br.Msg = "取消收藏成功"
+	br.Success = true
+	br.Ret = 200
+}
 
+// @Title List
+// @Description create users
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Success 200 {object} models.BaseResponse
+// @Failure 403 {object} models.BaseResponse
+// @router /list [get]
+func (this *MyChartController) List() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+
+	if pageSize <= 0 {
+		pageSize = 30
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+
+	user := this.User
+	if user.Status != 2 {
+		br.Msg = "用户没有收藏权限"
+		return
+	}
+	total, err := models.GetMyChartListCountById(user.UserId)
+	if err != nil {
+		br.Msg = "查询收藏数量失败"
+		br.ErrMsg = "查询收藏数量失败,Err:" + err.Error()
+		return
+	}
+
+	resp := new(response.MyChartListResp)
+	if total == 0 {
+		br.Data = resp
+		br.Msg = "暂无数据"
+		br.Ret = 200
+		br.Success = true
+		return
+	}
+	startSize := utils.StartIndex(currentIndex, pageSize)
+	items, err := models.GetMyChartListById(user.UserId, startSize, pageSize)
+	if err != nil {
+		br.Msg = "查询收藏失败"
+		br.ErrMsg = "查询收藏失败,Err:" + err.Error()
+		return
+	}
+
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp.List = items
+	resp.Paging = page
+
+	br.Data = resp
+	br.Msg = "查询成功"
+	br.Success = true
+	br.Ret = 200
+}
+
+// @Title IsCollect
+// @Description create users
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Success 200 {object} models.BaseResponse
+// @Failure 403 {object} models.BaseResponse
+// @router /isCollect [post]
+func (this *MyChartController) IsCollect() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	var req request.MyChartIsCollectReq
+	if err := json.Unmarshal(this.Ctx.Input.RequestBody, &req); err != nil {
+		br.Msg = "参数解析失败"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+
+	user := this.User
+	if user.Status != 2 {
+		br.Msg = "用户没有权限收藏"
+		return
+	}
+	count, err := models.GetMyChartCount(user.UserId, req.UniqueCode)
+	if err != nil {
+		br.Msg = "查询收藏数量失败"
+		br.ErrMsg = "查询收藏数量失败,Err:" + err.Error()
+		return
+	}
+	resp := new(response.MyChartIsCollectResp)
+	if count > 0 {
+		resp.IsCollect = true
+	} else {
+		resp.IsCollect = false
+	}
+	br.Data = resp
+	br.Msg = "查询成功"
+	br.Success = true
+	br.Ret = 200
 }

+ 240 - 0
controllers/my_report.go

@@ -0,0 +1,240 @@
+package controllers
+
+import (
+	"encoding/json"
+	"eta/eta_mini_api/models"
+	"eta/eta_mini_api/models/request"
+	"eta/eta_mini_api/models/response"
+	"eta/eta_mini_api/services"
+	"eta/eta_mini_api/utils"
+	"fmt"
+	"time"
+
+	"github.com/rdlucklib/rdluck_tools/paging"
+)
+
+type MyReportController struct {
+	BaseAuthController
+}
+
+// @Title 获取我的报告列表
+// @Description 获取我的报告列表
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Success 200 {object} models.MyReportResp
+// @router /list [get]
+func (this *MyReportController) List() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		if err := recover(); err != nil {
+			fmt.Println(err)
+		}
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+
+	if pageSize <= 0 {
+		pageSize = utils.PageSize30
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	if user.Status != 2 {
+		br.Msg = "该用户没有收藏权限"
+		return
+	}
+	total, err := models.GetMyReportListCountByUserId(user.UserId)
+	if err != nil {
+		br.Msg = "获取我的报告列表失败"
+		br.ErrMsg = "获取我的报告列表失败,系统异常,Err:" + err.Error()
+		return
+	}
+	resp := new(response.MyReportListResp)
+	if total == 0 {
+		br.Data = resp
+		br.Msg = "暂无数据"
+		br.Ret = 200
+		br.Success = true
+		return
+	}
+	startSize := utils.StartIndex(currentIndex, pageSize)
+	reportList, err := models.GetMyReportListByUserId(user.UserId, startSize, pageSize)
+	if err != nil {
+		br.Msg = "获取我的报告列表失败"
+		br.ErrMsg = "获取我的报告列表失败,系统异常,Err:" + err.Error()
+		return
+	}
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp.List = reportList
+	resp.Page = page
+
+	br.Data = resp
+	br.Success = true
+	br.Msg = "获取我的报告列表成功"
+	br.Ret = 200
+}
+
+// @Title IsCollect
+// @Description create users
+// @Param   request	body request.ReportRecordReq true "type json string"
+// @Success 200 {object} models.BaseResponse
+// @Failure 403 {object} models.BaseResponse
+// @router /isCollect [post]
+func (this *MyReportController) IsCollect() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	var req request.MyReportCollectReq
+	if err := json.Unmarshal(this.Ctx.Input.RequestBody, &req); err != nil {
+		br.Msg = "参数解析失败"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+
+	user := this.User
+	if user.Status != 2 {
+		br.Msg = "用户没有权限收藏"
+		return
+	}
+	count, err := models.GetMyReportByUserIdAndReportId(user.UserId, req.ReportId)
+	if err != nil {
+		br.Msg = "查询收藏数量失败"
+		br.ErrMsg = "查询收藏数量失败,Err:" + err.Error()
+		return
+	}
+	resp := new(response.MyReportIsCollectResp)
+	if count > 0 {
+		resp.IsCollect = true
+	} else {
+		resp.IsCollect = false
+	}
+	br.Data = resp
+	br.Msg = "查询成功"
+	br.Success = true
+	br.Ret = 200
+}
+
+// @Title 收藏研报
+// @Description 收藏研报
+// @Success 200 {object} models.BaseResponse
+// @Failure 403 {object} models.BaseResponse
+// @router /collect [post]
+func (this *MyReportController) Collect() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	var req request.MyReportCollectReq
+	if err := json.Unmarshal(this.Ctx.Input.RequestBody, &req); err != nil {
+		br.Msg = "参数解析失败"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	user := this.User
+	if user.Status != 2 {
+		br.Msg = "用户没有权限收藏"
+		return
+	}
+	count, err := models.GetMyReportByUserIdAndReportId(user.UserId, req.ReportId)
+	if err != nil {
+		br.Msg = "收藏失败"
+		br.ErrMsg = "查询收藏数量失败,Err:" + err.Error()
+		return
+	}
+	if count > 0 {
+		br.Msg = "该研报已收藏,请重新刷新页面"
+		return
+	}
+	reportResp, err := services.GetReportDetail(req.ReportId, user.UserId)
+	if err != nil {
+		br.Msg = "收藏失败"
+		br.ErrMsg = "获取研报详情失败,Err:" + err.Error()
+
+	}
+	if reportResp.Ret != 200 {
+		br.Msg = "收藏失败"
+		br.ErrMsg = "获取研报详情失败,Err:" + reportResp.ErrMsg
+		return
+	}
+	report := reportResp.Data.Report
+	publishTime, err := time.Parse(utils.FormatDateTime, report.PublishTime)
+	if err != nil {
+		br.Msg = "时间格式不对"
+		return
+	}
+	myChart := &models.MyReport{
+		UserId:      user.UserId,
+		ReportId:    req.ReportId,
+		Title:       report.Title,
+		Abstract:    report.Abstract,
+		Author:      report.Author,
+		PublishTime: publishTime,
+		Stage:       report.Stage,
+		CreateTime:  time.Now(),
+	}
+	err = myChart.Insert()
+	if err != nil {
+		br.Msg = "收藏失败"
+		br.ErrMsg = "收藏失败,Err:" + err.Error()
+		return
+	}
+
+	br.Msg = "收藏成功"
+	br.Success = true
+	br.Ret = 200
+}
+
+// @Title 取消收藏
+// @Description 取消收藏
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Success 200 {object} models.BaseResponse
+// @Failure 403 {object} models.BaseResponse
+// @router /collectCancel [post]
+func (this *MyReportController) CollectCancel() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	var req request.MyReportCollectReq
+	if err := json.Unmarshal(this.Ctx.Input.RequestBody, &req); err != nil {
+		br.Msg = "参数解析失败"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	user := this.User
+	if user.Status != 2 {
+		br.Msg = "用户没有权限收藏"
+		return
+	}
+	count, err := models.GetMyReportByUserIdAndReportId(user.UserId, req.ReportId)
+	if err != nil {
+		br.Msg = "取消收藏失败"
+		br.ErrMsg = "获取收藏信息失败,Err:" + err.Error()
+		return
+	}
+	if count == 0 {
+		br.Msg = "该研报已取消收藏,请重新刷新页面"
+		return
+	}
+	err = models.DeleteMyReportByUserIdAndReportId(user.UserId, req.ReportId)
+	if err != nil {
+		br.Msg = "取消收藏失败"
+		br.ErrMsg = "取消收藏失败,Err:" + err.Error()
+		return
+	}
+
+	br.Msg = "取消收藏成功"
+	br.Success = true
+	br.Ret = 200
+}

+ 2 - 0
models/db.go

@@ -35,6 +35,8 @@ func init() {
 	// register model
 	orm.RegisterModel(
 		new(MsgCode),
+		new(MyChart),
+		new(MyReport),
 		new(User),
 		new(WxToken),
 		new(UserTemplateRecord),

+ 39 - 8
models/my_chart.go

@@ -1,21 +1,52 @@
 package models
 
-import "time"
+import (
+	"time"
+
+	"github.com/beego/beego/v2/client/orm"
+)
 
 type MyChart struct {
-	MyChartID    int       `description:"我的图表ID"`
-	ChartInfoID  int       `description:"图表id"`   // 图表ID
+	MyChartId    int       `orm:"pk" description:"我的图表ID"`
 	ChartName    string    `description:"图表名称"`   // 图表名称
 	UniqueCode   string    `description:"图表唯一编码"` // 图表唯一编码
 	ChartImage   string    `description:"图表图片"`   // 图表图片
-	UserID       int       `description:"用户ID"`
-	UserRealName string    `description:"用户真实姓名"`      // 真实姓名
-	SellerID     int       `description:"销售id(管理员id)"` // 用户ID
-	ReportID     int       `description:"报告id"`        // 报告ID(从哪个报告收藏的)
+	UserId       int       `description:"用户ID"`
+	UserRealName string    `description:"用户真实姓名"` // 真实姓名
 	CreateTime   time.Time `description:"创建时间"`
 	ModifyTime   time.Time `description:"修改时间"`
 }
 
-func (m *MyChart) Insert() {
+func (m *MyChart) Insert() (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(m)
+	return
+}
+
+func GetMyChartCount(userId int, uniqueCode string) (count int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT COUNT(*) AS count FROM my_chart WHERE user_id=? AND unique_code=?`
+	err = o.Raw(sql, userId, uniqueCode).QueryRow(&count)
+	return
+}
+
+func GetMyChartListCountById(userId int) (count int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT COUNT(*) AS count FROM my_chart WHERE user_id=? `
+	err = o.Raw(sql, userId).QueryRow(&count)
+	return
+}
+
+func GetMyChartListById(userId int, startSize, pageSize int) (items []*MyChart, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM my_chart WHERE user_id=? ORDER BY create_time LIMIT ?,?`
+	_, err = o.Raw(sql, userId, startSize, pageSize).QueryRows(&items)
+	return
+}
 
+func DeleteMyChart(userId int, uniqueCode string) (err error) {
+	o := orm.NewOrm()
+	sql := `DELETE FROM my_chart WHERE user_id=? AND unique_code=?`
+	_, err = o.Raw(sql, userId, uniqueCode).Exec()
+	return
 }

+ 53 - 0
models/my_report.go

@@ -0,0 +1,53 @@
+package models
+
+import (
+	"time"
+
+	"github.com/beego/beego/v2/client/orm"
+)
+
+type MyReport struct {
+	MyReportId  int       `orm:"pk" description:"id"`
+	ReportId    int       `description:"报告id"`
+	UserId      int       `description:"用户id"`
+	Title       string    `description:"标题"`
+	Abstract    string    `description:"摘要"`
+	Author      string    `description:"作者"`
+	PublishTime time.Time `description:"发布时间"`
+	Stage       int       `description:"期数"`
+	CreateTime  time.Time `description:"创建时间"`
+}
+
+func (m *MyReport) Insert() (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(m)
+	return
+}
+
+func GetMyReportByUserIdAndReportId(userId, reportId int) (count int, err error) {
+	o := orm.NewOrm()
+	sql := "SELECT COUNT(*) AS count FROM my_report WHERE user_id = ? AND report_id = ?"
+	err = o.Raw(sql, userId, reportId).QueryRow(&count)
+	return
+}
+
+func DeleteMyReportByUserIdAndReportId(userId, reportId int) (err error) {
+	o := orm.NewOrm()
+	sql := "DELETE FROM my_report WHERE user_id = ? AND report_id = ?"
+	_, err = o.Raw(sql, userId, reportId).Exec()
+	return
+}
+
+func GetMyReportListCountByUserId(userId int) (count int, err error) {
+	o := orm.NewOrm()
+	sql := "SELECT COUNT(*) AS count FROM my_report WHERE user_id = ?"
+	err = o.Raw(sql, userId).QueryRow(&count)
+	return
+}
+
+func GetMyReportListByUserId(userId, startSize, pageSize int) (items []*MyReport, err error) {
+	o := orm.NewOrm()
+	sql := "SELECT * FROM my_report WHERE user_id = ? ORDER BY create_time DESC LIMIT ?, ?"
+	_, err = o.Raw(sql, userId, startSize, pageSize).QueryRows(&items)
+	return
+}

+ 10 - 3
models/request/my_chart.go

@@ -1,7 +1,14 @@
 package request
 
 type MyChartCollectReq struct {
-	UniqueCode      string `json:"unique_code" form:"unique_code"`
-	ReportId        int    `json:"report_id" form:"report_id"`
-	ReportChapterId int    `json:"report_chapter_id" form:"report_chapter_id"`
+	ChartName  string `description:"图表名称"`   // 图表名称
+	UniqueCode string `description:"图表唯一编码"` // 图表唯一编码
+	ChartImage string `description:"图表图片"`   // 图表图片
+}
+type MyChartCollectCancelReq struct {
+	UniqueCode string `description:"图表唯一编码"` // 图表唯一编码
+}
+
+type MyChartIsCollectReq struct {
+	UniqueCode string `description:"图表唯一编码"` // 图表唯一编码
 }

+ 5 - 0
models/request/my_report.go

@@ -0,0 +1,5 @@
+package request
+
+type MyReportCollectReq struct {
+	ReportId int `description:"报告id"`
+}

+ 16 - 0
models/response/my_chart.go

@@ -0,0 +1,16 @@
+package response
+
+import (
+	"eta/eta_mini_api/models"
+
+	"github.com/rdlucklib/rdluck_tools/paging"
+)
+
+type MyChartIsCollectResp struct {
+	IsCollect bool `description:"是否收藏"`
+}
+
+type MyChartListResp struct {
+	List   []*models.MyChart  `description:"图表列表"`
+	Paging *paging.PagingItem `description:"分页信息"`
+}

+ 16 - 0
models/response/my_report.go

@@ -0,0 +1,16 @@
+package response
+
+import (
+	"eta/eta_mini_api/models"
+
+	"github.com/rdlucklib/rdluck_tools/paging"
+)
+
+type MyReportListResp struct {
+	List []*models.MyReport
+	Page *paging.PagingItem
+}
+
+type MyReportIsCollectResp struct {
+	IsCollect bool
+}

+ 63 - 0
routers/commentsRouter.go

@@ -47,6 +47,69 @@ func init() {
         beego.ControllerComments{
             Method: "Collect",
             Router: `/collect`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["eta/eta_mini_api/controllers:MyChartController"] = append(beego.GlobalControllerRouter["eta/eta_mini_api/controllers:MyChartController"],
+        beego.ControllerComments{
+            Method: "CollectCancel",
+            Router: `/collectCancel`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["eta/eta_mini_api/controllers:MyChartController"] = append(beego.GlobalControllerRouter["eta/eta_mini_api/controllers:MyChartController"],
+        beego.ControllerComments{
+            Method: "IsCollect",
+            Router: `/isCollect`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["eta/eta_mini_api/controllers:MyChartController"] = append(beego.GlobalControllerRouter["eta/eta_mini_api/controllers:MyChartController"],
+        beego.ControllerComments{
+            Method: "List",
+            Router: `/list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["eta/eta_mini_api/controllers:MyReportController"] = append(beego.GlobalControllerRouter["eta/eta_mini_api/controllers:MyReportController"],
+        beego.ControllerComments{
+            Method: "Collect",
+            Router: `/collect`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["eta/eta_mini_api/controllers:MyReportController"] = append(beego.GlobalControllerRouter["eta/eta_mini_api/controllers:MyReportController"],
+        beego.ControllerComments{
+            Method: "CollectCancel",
+            Router: `/collectCancel`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["eta/eta_mini_api/controllers:MyReportController"] = append(beego.GlobalControllerRouter["eta/eta_mini_api/controllers:MyReportController"],
+        beego.ControllerComments{
+            Method: "IsCollect",
+            Router: `/isCollect`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["eta/eta_mini_api/controllers:MyReportController"] = append(beego.GlobalControllerRouter["eta/eta_mini_api/controllers:MyReportController"],
+        beego.ControllerComments{
+            Method: "List",
+            Router: `/list`,
             AllowHTTPMethods: []string{"get"},
             MethodParams: param.Make(),
             Filters: nil,

+ 10 - 0
routers/router.go

@@ -38,6 +38,16 @@ func init() {
 				&controllers.ChartController{},
 			),
 		),
+		beego.NSNamespace("/mychart",
+			beego.NSInclude(
+				&controllers.MyChartController{},
+			),
+		),
+		beego.NSNamespace("/myreport",
+			beego.NSInclude(
+				&controllers.MyReportController{},
+			),
+		),
 		beego.NSNamespace("/chart_perimission",
 			beego.NSInclude(
 				&controllers.ChartPermissionController{},