浏览代码

新增报告模块

rdluck 4 年之前
父节点
当前提交
902bbf6418

+ 41 - 0
controllers/classify.go

@@ -0,0 +1,41 @@
+package controllers
+
+import "hongze/hongze_api/models"
+
+type ClassifyController struct {
+	BaseAuthController
+}
+
+// @Title 获取分类详情信息
+// @Description 获取分类详情信息接口
+// @Param   ClassifyId   query   int  true       "分类id"
+// @Success 200 {object} models.Banner
+// @router /detail [get]
+func (this *HomeController) Detail() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	classifyId, err := this.GetInt("ClassifyId")
+	if err != nil {
+		br.Msg = "参数获取失败"
+		br.ErrMsg = "参数获取失败,Err:" + err.Error()
+		return
+	}
+	if classifyId <= 0 {
+		br.Msg = "参数错误"
+		br.ErrMsg = "参数错误,分类id小于等于0"
+		return
+	}
+	item, err := models.GetClassifyById(classifyId)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取信息失败,Err:" + err.Error()
+		return
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取数据成功"
+	br.Data = item
+}

+ 25 - 3
controllers/home.go

@@ -12,7 +12,7 @@ type HomeController struct {
 
 // @Title 首页列表接口
 // @Description 首页列表接口
-// @Success 200 {object} models.ReportListResp
+// @Success 200 {object} models.HomeList
 // @router /list [get]
 func (this *HomeController) ListHome() {
 	br := new(models.BaseResponse).Init()
@@ -27,7 +27,7 @@ func (this *HomeController) ListHome() {
 		br.Ret = 408
 		return
 	}
-	list, err := services.HomeList(30809, 16)
+	list, err := services.HomeList(user.UserId, user.CompanyId)
 	if err != nil {
 		br.Msg = "获取数据失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
@@ -37,4 +37,26 @@ func (this *HomeController) ListHome() {
 	br.Success = true
 	br.Msg = "获取数据成功"
 	br.Data = list
-}
+}
+
+// @Title 首页列表接口
+// @Description 首页列表接口
+// @Success 200 {object} models.Banner
+// @router /banner [get]
+func (this *HomeController) ListBanner() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	list, err := models.GetHomeBannerList()
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取数据成功"
+	br.Data = list
+}

+ 355 - 0
controllers/report.go

@@ -0,0 +1,355 @@
+package controllers
+
+import (
+	"hongze/hongze_api/models"
+	"hongze/hongze_api/utils"
+	"html"
+	"strings"
+	"time"
+)
+
+//报告
+type ReportController struct {
+	BaseAuthController
+}
+
+// @Title 日评详情
+// @Description 日评详情接口
+// @Param   ReportId   query   int  true       "报告id"
+// @Success 200 {object} models.ReportDetailResp
+// @router /detail [get]
+func (this *ReportController) Detail() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,用户信息为空"
+		br.Ret = 408
+		return
+	}
+	var status int
+	var msg string
+	reportId, err := this.GetInt("ReportId")
+	if err != nil {
+		br.Msg = "参数获取失败"
+		br.ErrMsg = "参数获取失败,Err:" + err.Error()
+		return
+	}
+	if reportId <= 0 {
+		br.Msg = "参数错误"
+		br.ErrMsg = "参数错误,报告id小于等于0"
+		return
+	}
+	report, err := models.GetReportById(reportId)
+	if err != nil {
+		br.Msg = "获取报告详情失败"
+		br.ErrMsg = "获取报告详情失败,Err:" + err.Error()
+		return
+	}
+	if report == nil {
+		status = 1
+		msg = "报告不存在"
+	}
+	report.ContentSub = html.UnescapeString(report.ContentSub)
+	report.Content = html.UnescapeString(report.Content)
+	company, err := models.GetCompanyById(user.CompanyId)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		if err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取报告详情失败"
+			br.ErrMsg = "获取用户管理企业信息失败,Err:" + err.Error()
+			return
+		} else {
+			status = 2
+			msg = "您还未开通权限,如有需要请联系对口销售"
+			report.Content = report.ContentSub
+		}
+	}
+	if company == nil {
+		status = 2
+		msg = "您还未开通权限,如有需要请联系对口销售"
+		report.Content = report.ContentSub
+	} else {
+		if company.CompanyType == 3 || company.CompanyType == 4 {
+			status = 2
+			msg = "您还未开通权限,如有需要请联系对口销售"
+			report.Content = report.ContentSub
+		}
+	}
+	reportType := "rddp"
+	reportPermissionList, err := models.GetReportVarietyListByUserIdExt(user.UserId, reportType)
+	if err != nil {
+		if err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取报告详情失败"
+			br.ErrMsg = "获取用户管理企业信息失败,Err:" + err.Error()
+			return
+		} else {
+			status = 2
+			msg = "您还未开通权限,如有需要请联系对口销售"
+			report.Content = report.ContentSub
+		}
+	}
+	permissionMap := make(map[int]int)
+	for _, v := range reportPermissionList {
+		if _, ok := permissionMap[v.ReportChapterTypeId]; !ok {
+			permissionMap[v.ReportChapterTypeId] = v.ReportChapterTypeId
+		}
+	}
+	if _, ok := permissionMap[reportId]; !ok {
+		tips := ""
+		status = 2
+		report.Content = report.ContentSub
+		classifyNameSecond := report.ClassifyNameSecond
+		if strings.Contains(classifyNameSecond, "宏观商品复盘") ||
+			strings.Contains(classifyNameSecond, "股债日评") ||
+			strings.Contains(classifyNameSecond, "每日经济数据备忘录") {
+			tips = "宏观"
+		} else if strings.Contains(classifyNameSecond, "知白守黑日评") ||
+			strings.Contains(classifyNameSecond, "动力煤数据点评") {
+			tips = "黑色"
+		} else if strings.Contains(classifyNameSecond, "化里化外日评") ||
+			strings.Contains(classifyNameSecond, "EIA原油库存点评") ||
+			strings.Contains(classifyNameSecond, "苯乙烯数据点评") ||
+			strings.Contains(classifyNameSecond, "聚酯数据点评") {
+			tips = "化工"
+		} else if strings.Contains(classifyNameSecond, "有声有色日度闲篇") {
+			tips = "有色"
+		}
+		msg = "您还未开通" + tips + "权限,如有需要请联系对口销售"
+	}
+	resp := new(models.ReportDetailResp)
+	resp.Status = status
+	resp.Msg = msg
+	resp.Report = report
+	//新增阅读记录
+	if status == 0 {
+		record := new(models.ReportViewRecord)
+		record.UserId = user.UserId
+		record.ReportId = reportId
+		record.CreateTime = time.Now()
+		err = models.AddReportViewRecord(record)
+		if err != nil {
+			go utils.SendEmail(utils.APPNAME+"失败提醒", "新增报告阅读记录失败:Err:"+err.Error(), utils.EmailSendToUsers)
+		}
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title 日评列表
+// @Description 日评列表接口
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Param   ClassifyId   query   int  true       "分类id"
+// @Success 200 {object} models.ReportListResp
+// @router /list [get]
+func (this *ReportController) ListReport() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,用户信息为空"
+		br.Ret = 408
+		return
+	}
+
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+	classifyId, _ := this.GetInt("ClassifyId")
+	if classifyId <= 0 {
+		br.Msg = "参数错误"
+		br.ErrMsg = "参数错误,分类id小于等于0"
+		return
+	}
+
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = utils.StartIndex(currentIndex, pageSize)
+
+	total, err := models.GetReportListCount(classifyId)
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+
+	list, err := models.GetReportList(classifyId, startSize, pageSize)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	listLen := len(list)
+	for i := 0; i < listLen; i++ {
+		item := list[i]
+		list[i].Content = html.UnescapeString(item.Content)
+		list[i].ContentSub = html.UnescapeString(item.ContentSub)
+		count, err := models.GetReportPermission(user.UserId, item.ClassifyNameSecond)
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "判断报告是否拥有权限失败,Err:" + err.Error()
+			return
+		}
+		if count > 0 {
+			list[i].HasPermission = 1
+		}
+	}
+
+	page := models.GetPaging(currentIndex, pageSize, total)
+
+	resp := new(models.ReportListResp)
+	resp.Paging = page
+	resp.List = list
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title 新增报告浏览记录
+// @Description 新增报告浏览记录接口
+// @Param   ReportId   query   int  true       "报告id"
+// @Success 200 新增成功
+// @router /addUpdateLabel [post]
+func (this *HomeController) AddUpdateLabelReport() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,用户信息为空"
+		br.Ret = 408
+		return
+	}
+	reportId, err := this.GetInt("ReportId")
+	if err != nil {
+		br.Msg = "参数获取失败"
+		br.ErrMsg = "参数获取失败,Err:" + err.Error()
+		return
+	}
+	if reportId <= 0 {
+		br.Msg = "参数错误"
+		br.ErrMsg = "参数错误,报告id小于等于0"
+		return
+	}
+
+	record := new(models.ReportViewLog)
+	record.UserId = user.UserId
+	record.ReportId = reportId
+	record.CreateTime = time.Now()
+	err = models.AddReportViewLog(record)
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "新增成功"
+}
+
+// @Title 新增报告浏览记录
+// @Description 新增报告浏览记录接口
+// @Param   ReportId   query   int  true       "报告id"
+// @Success 200 新增成功
+// @router /addViewRecord [post]
+func (this *HomeController) AddViewRecordReport() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,用户信息为空"
+		br.Ret = 408
+		return
+	}
+	reportId, err := this.GetInt("ReportId")
+	if err != nil {
+		br.Msg = "参数获取失败"
+		br.ErrMsg = "参数获取失败,Err:" + err.Error()
+		return
+	}
+	if reportId <= 0 {
+		br.Msg = "参数错误"
+		br.ErrMsg = "参数错误,报告id小于等于0"
+		return
+	}
+	record := new(models.ReportViewRecord)
+	record.UserId = user.UserId
+	record.ReportId = reportId
+	record.CreateTime = time.Now()
+	err = models.AddReportViewRecord(record)
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "新增成功"
+}
+
+// @Title 新增音频阅读记录
+// @Description 新增音频阅读记录接口
+// @Param   ReportId   query   int  true       "报告id"
+// @Success 200 新增成功
+// @router /addAudioRecord [post]
+func (this *HomeController) AddAudioRecord() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,用户信息为空"
+		br.Ret = 408
+		return
+	}
+	reportId, err := this.GetInt("ReportId")
+	if err != nil {
+		br.Msg = "参数获取失败"
+		br.ErrMsg = "参数获取失败,Err:" + err.Error()
+		return
+	}
+	if reportId <= 0 {
+		br.Msg = "参数错误"
+		br.ErrMsg = "参数错误,报告id小于等于0"
+		return
+	}
+	record := new(models.ReportAudioRecord)
+	record.UserId = user.UserId
+	record.ReportId = reportId
+	record.CreateTime = time.Now()
+	err = models.AddReportAudioRecord(record)
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "新增成功"
+}

+ 25 - 0
models/banner.go

@@ -0,0 +1,25 @@
+package models
+
+import (
+	"rdluck_tools/orm"
+	"time"
+)
+
+type Banner struct {
+	Id           int       `orm:"column(id);pk"`
+	ClassifyId   int       `description:"分类id"`
+	ImageUrl     string    `description:"图片路径"`
+	BannerType   int       `description:"类型 1:轮播图,2:头部海报"`
+	CreateTime   time.Time `description:"创建时间"`
+	ModifyTime   time.Time `description:"修改时间"`
+	ClassifyName string    `description:"分类名称"`
+	JumpUrl      string    `description:"跳转地址"`
+}
+//获取轮播图列表
+func GetHomeBannerList() (items []*Banner, err error) {
+	sql := ` SELECT * FROM banner WHERE banner_type=1 ORDER BY modify_time DESC `
+	o := orm.NewOrm()
+	o.Using("rddp")
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}

+ 8 - 1
models/classify.go

@@ -1,6 +1,7 @@
 package models
 
 import (
+	"rdluck_tools/orm"
 	"time"
 )
 
@@ -13,4 +14,10 @@ type Classify struct {
 	ModifyTime   time.Time `description:"修改时间"`
 	Abstract     string    `description:"简介"`
 	Descript     string    `description:"描述"`
-}
+}
+
+func GetClassifyById(classifyId int) (item *Classify, err error) {
+	sql := ` SELECT * FROM classify WHERE id = ?  `
+	err = orm.NewOrm().Raw(sql, classifyId).QueryRow(&item)
+	return
+}

+ 3 - 1
models/db.go

@@ -34,6 +34,8 @@ func init() {
 
 	//注册对象
 	orm.RegisterModel(
-
+		new(ReportAudioRecord),
+		new(ReportViewLog),
+		new(ReportViewRecord),
 	)
 }

+ 1 - 0
models/home.go

@@ -67,3 +67,4 @@ func ListHome(userId, maxPermission, userPermission int, permissionStr string) (
 	}
 	return
 }
+

+ 66 - 0
models/paging.go

@@ -0,0 +1,66 @@
+package models
+
+import "hongze/hongze_admin/utils"
+
+type PagingReq struct {
+	CurrentIndex  int  `description:"当前页页码"`
+	PageSize      int  `description:"每页数据条数,如果不传,默认每页20条"`
+}
+
+type PagingItem struct {
+	IsStart       bool `description:"是否首页"`
+	IsEnd         bool `description:"是否最后一页"`
+	PreviousIndex int  `description:"上一页页码"`
+	NextIndex     int  `description:"下一页页码"`
+	CurrentIndex  int  `description:"当前页页码"`
+	Pages         int  `description:"总页数"`
+	Totals        int  `description:"总数据量"`
+	PageSize      int  `description:"每页数据条数"`
+}
+
+func GetPaging(currentIndex,pageSize,total int)(item *PagingItem)  {
+	if pageSize<=0 {
+		pageSize=utils.PageSize20
+	}
+	if currentIndex<=0 {
+		currentIndex=1
+	}
+	item=new(PagingItem)
+	item.PageSize=pageSize
+	item.Totals=total
+	item.CurrentIndex=currentIndex
+
+	if total<=0 {
+		item.IsStart=true
+		item.IsEnd=true
+		return
+	}
+	pages:=utils.PageCount(total,pageSize)
+	item.Pages=pages
+	if pages<=1 {
+		item.IsStart=true
+		item.IsEnd=true
+		item.PreviousIndex=1
+		item.NextIndex=1
+		return
+	}
+	if pages == currentIndex {
+		item.IsStart=false
+		item.IsEnd=true
+		item.PreviousIndex=currentIndex-1
+		item.NextIndex=currentIndex
+		return
+	}
+	if currentIndex==1 {
+		item.IsStart=true
+		item.IsEnd=false
+		item.PreviousIndex=1
+		item.NextIndex=currentIndex+1
+		return
+	}
+	item.IsStart=false
+	item.IsEnd=false
+	item.PreviousIndex=currentIndex-1
+	item.NextIndex=currentIndex+1
+	return
+}

+ 117 - 0
models/report.go

@@ -1,5 +1,122 @@
 package models
 
+import (
+	"rdluck_tools/orm"
+	"time"
+)
+
 type Report struct {
+	Id                 int       `description:"报告Id"`
+	AddType            int       `description:"新增方式:1:新增报告,2:继承报告"`
+	ClassifyIdFirst    int       `description:"一级分类id"`
+	ClassifyNameFirst  string    `description:"一级分类名称"`
+	ClassifyIdSecond   int       `description:"二级分类id"`
+	ClassifyNameSecond string    `description:"二级分类名称"`
+	Title              string    `description:"标题"`
+	Abstract           string    `description:"摘要"`
+	Author             string    `description:"作者"`
+	Frequency          string    `description:"频度"`
+	CreateTime         string    `description:"创建时间"`
+	ModifyTime         time.Time `description:"修改时间"`
+	State              int       `description:"1:未发布,2:已发布"`
+	PublishTime        string    `description:"发布时间"`
+	Stage              int       `description:"期数"`
+	MsgIsSend          int       `description:"消息是否已发送,0:否,1:是"`
+	Content            string    `description:"内容"`
+	VideoUrl           string    `description:"音频文件URL"`
+	VideoName          string    `description:"音频文件名称"`
+	VideoPlaySeconds   string    `description:"音频播放时长"`
+	ContentSub         string    `description:"内容前两个章节"`
+}
 
+type ReportList struct {
+	Id                 int       `description:"报告Id"`
+	AddType            int       `description:"新增方式:1:新增报告,2:继承报告"`
+	ClassifyIdFirst    int       `description:"一级分类id"`
+	ClassifyNameFirst  string    `description:"一级分类名称"`
+	ClassifyIdSecond   int       `description:"二级分类id"`
+	ClassifyNameSecond string    `description:"二级分类名称"`
+	Title              string    `description:"标题"`
+	Abstract           string    `description:"摘要"`
+	Author             string    `description:"作者"`
+	Frequency          string    `description:"频度"`
+	CreateTime         string    `description:"创建时间"`
+	ModifyTime         time.Time `description:"修改时间"`
+	State              int       `description:"1:未发布,2:已发布"`
+	PublishTime        string    `description:"发布时间"`
+	Stage              int       `description:"期数"`
+	MsgIsSend          int       `description:"消息是否已发送,0:否,1:是"`
+	Content            string    `description:"内容"`
+	VideoUrl           string    `description:"音频文件URL"`
+	VideoName          string    `description:"音频文件名称"`
+	VideoPlaySeconds   string    `description:"音频播放时长"`
+	ContentSub         string    `description:"内容前两个章节"`
+	HasPermission      int       `description:"是否拥有报告权限,1:拥有,0:没有"`
 }
+
+type ReportListResp struct {
+	List   []*ReportList
+	Paging *PagingItem `description:"分页数据"`
+}
+
+func GetReportListCount(classifyId int) (count int, err error) {
+	o := orm.NewOrm()
+	o.Using("rddp")
+	sql := ` SELECT COUNT(1) AS count FROM report WHERE 1=1 AND state=2 AND classify_id_second=? `
+	err = o.Raw(sql, classifyId).QueryRow(&count)
+	return
+}
+
+func GetReportList(classifyId, startSize, pageSize int) (items []*ReportList, err error) {
+	o := orm.NewOrm()
+	o.Using("rddp")
+	sql := ` SELECT * FROM report WHERE state=2 AND classify_id_second=? ORDER BY  publish_time DESC LIMIT ?,? `
+	_, err = o.Raw(sql, classifyId, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+func GetReportPermission(userId int, classifyNameSecond string) (count int, err error) {
+	o := orm.NewOrm()
+	sql := ` SELECT COUNT(1) AS count
+            FROM company_report_permission AS crp
+            INNER JOIN  chart_permission_chapter_mapping AS cpcm ON crp.chart_permission_id = cpcm.chart_permission_id
+            INNER JOIN chart_permission_search_key_word_mapping AS cskwm ON cskwm.chart_permission_id=crp.chart_permission_id
+            INNER JOIN wx_user wu ON wu.company_id = crp.company_id
+            WHERE wu.user_id = ?
+            AND cpcm.research_type = 'rddp'
+			AND cskwm.from='rddp'
+			AND cskwm.key_word=? `
+	err = o.Raw(sql, userId, classifyNameSecond).QueryRow(&count)
+	return
+}
+
+func GetReportById(reportId int) (item *Report, err error) {
+	o := orm.NewOrm()
+	o.Using("rddp")
+	sql := `SELECT * FROM report WHERE id=?`
+	err = o.Raw(sql, reportId).QueryRow(&item)
+	return
+}
+
+type ReportVarietyList struct {
+	ReportChapterTypeId int
+}
+
+func GetReportVarietyListByUserIdExt(userId int, reportType string) (list []*ReportVarietyList, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT cpcm.report_chapter_type_id
+            FROM company_report_permission crp
+            INNER JOIN  chart_permission_chapter_mapping cpcm ON crp.chart_permission_id = cpcm.chart_permission_id
+            INNER JOIN wx_user wu ON wu.company_id = crp.company_id
+            WHERE wu.user_id = ?
+            AND cpcm.research_type = ?
+            GROUP BY cpcm.report_chapter_type_id`
+	_, err = o.Raw(sql, userId, reportType).QueryRows(&list)
+	return
+}
+
+type ReportDetailResp struct {
+	Report *Report  `description:"报告"`
+	Status int  `description:"状态:0:正常展示,1:报告不存在,2:无权限"`
+	Msg string `description:"提示信息"`
+}

+ 21 - 0
models/report_audio_record.go

@@ -0,0 +1,21 @@
+package models
+
+import (
+	"rdluck_tools/orm"
+	"time"
+)
+
+type 	ReportAudioRecord struct {
+	Id         int       `orm:"column(id);pk"`
+	UserId     int       `description:"用户id"`
+	ReportId   int       `description:"报告id"`
+	CreateTime time.Time `description:"创建时间"`
+}
+
+//添加报告音频阅读记录
+func AddReportAudioRecord(item *ReportAudioRecord) (err error) {
+	o := orm.NewOrm()
+	o.Using("rddp")
+	_, err = o.Insert(item)
+	return
+}

+ 21 - 0
models/report_view_log.go

@@ -0,0 +1,21 @@
+package models
+
+import (
+	"rdluck_tools/orm"
+	"time"
+)
+
+type ReportViewLog struct {
+	Id         int       `orm:"column(id);pk"`
+	UserId     int       `description:"用户id"`
+	ReportId   int       `description:"报告id"`
+	CreateTime time.Time `description:"创建时间"`
+}
+
+//添加报告阅读记录
+func AddReportViewLog(item *ReportViewLog) (err error) {
+	o := orm.NewOrm()
+	o.Using("rddp")
+	_, err = o.Insert(item)
+	return
+}

+ 21 - 0
models/report_view_record.go

@@ -0,0 +1,21 @@
+package models
+
+import (
+	"rdluck_tools/orm"
+	"time"
+)
+
+type ReportViewRecord struct {
+	Id         int       `orm:"column(id);pk"`
+	UserId     int       `description:"用户id"`
+	ReportId   int       `description:"报告id"`
+	CreateTime time.Time `description:"创建时间"`
+}
+
+//添加报告阅读记录
+func AddReportViewRecord(item *ReportViewRecord) (err error) {
+	o := orm.NewOrm()
+	o.Using("rddp")
+	_, err = o.Insert(item)
+	return
+}

+ 10 - 0
routers/router.go

@@ -28,6 +28,16 @@ func init() {
 				&controllers.HomeController{},
 			),
 		),
+		beego.NSNamespace("/report",
+			beego.NSInclude(
+				&controllers.ReportController{},
+			),
+		),
+		beego.NSNamespace("/classify",
+			beego.NSInclude(
+				&controllers.ClassifyController{},
+			),
+		),
 	)
 	beego.AddNamespace(ns)
 }