|
@@ -2917,7 +2917,6 @@ Loop:
|
|
|
// @Param UserId query int true "用户id"
|
|
|
// @Param TxtType query int true "类型0全部,1权益,2ficc"
|
|
|
// @Param PageSize query int true "每页数据条数"
|
|
|
-// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
// @Param LastViewTime query string true "最近一次的阅读时间,没有的话,那就是获取最新数据"
|
|
|
// @Success 200 {object} company.ViewReportListResp
|
|
|
// @router /view/report/list [get]
|
|
@@ -2937,21 +2936,15 @@ func (this *CompanyUserController) ViewReportList() {
|
|
|
userId, _ := this.GetInt("UserId")
|
|
|
txtType, _ := this.GetInt("TxtType")
|
|
|
pageSize, _ := this.GetInt("PageSize")
|
|
|
- currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
lastViewTime := this.GetString("LastViewTime")
|
|
|
if userId <= 0 {
|
|
|
br.Msg = "参数错误"
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
- var startSize int
|
|
|
+ // 默认20条数据
|
|
|
if pageSize <= 0 {
|
|
|
pageSize = utils.PageSize20
|
|
|
}
|
|
|
- if currentIndex <= 0 {
|
|
|
- currentIndex = 1
|
|
|
- }
|
|
|
- startSize = paging.StartIndex(currentIndex, pageSize)
|
|
|
|
|
|
item, err := models.GetWxUserByUserId(userId)
|
|
|
if err != nil {
|
|
@@ -2988,14 +2981,18 @@ func (this *CompanyUserController) ViewReportList() {
|
|
|
basePars = append(basePars, item.Email)
|
|
|
}
|
|
|
|
|
|
+ // 阅读记录汇总数
|
|
|
+ total := item.FiccViewTotal + item.RaiViewTotal
|
|
|
switch txtType {
|
|
|
case 1:
|
|
|
baseCondition = ` AND source = ? `
|
|
|
basePars = append(basePars, 4)
|
|
|
+ total = item.FiccViewTotal
|
|
|
// 权益
|
|
|
case 2: // ficc
|
|
|
baseCondition = ` AND source in (?,?,?) `
|
|
|
basePars = append(basePars, 1, 2, 3)
|
|
|
+ total = item.RaiViewTotal
|
|
|
}
|
|
|
|
|
|
// 开始实际的查询
|
|
@@ -3006,7 +3003,7 @@ func (this *CompanyUserController) ViewReportList() {
|
|
|
condition += `AND create_time < ?`
|
|
|
pars = append(pars, lastViewTime)
|
|
|
|
|
|
- total, items, err := obj.GetViewReportList(lastViewTimeT.Year(), condition, pars, startSize, pageSize)
|
|
|
+ total, items, err := obj.GetViewReportList(lastViewTimeT.Year(), condition, pars, pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.Msg = "获取失败,Err:" + err.Error()
|
|
@@ -3023,7 +3020,7 @@ func (this *CompanyUserController) ViewReportList() {
|
|
|
secondCondition += `AND create_time < ?`
|
|
|
secondPars = append(secondPars, lastViewTime)
|
|
|
|
|
|
- _, items, err := obj.GetViewReportList(lastViewTimeT.Year(), secondCondition, secondPars, 0, int(total)-pageSize)
|
|
|
+ _, items, err := obj.GetViewReportList(lastViewTimeT.Year(), secondCondition, secondPars, int(total)-pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.Msg = "获取失败,Err:" + err.Error()
|
|
@@ -3167,7 +3164,7 @@ func (this *CompanyUserController) ViewReportList() {
|
|
|
}
|
|
|
resp := new(company.ViewReportListResp)
|
|
|
resp.List = list
|
|
|
- resp.Total = len(list)
|
|
|
+ resp.Total = total
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Msg = "获取成功"
|