|
@@ -3098,7 +3098,6 @@ Loop:
|
|
|
// @Param TxtType query int true "类型0全部,1权益,2ficc"
|
|
|
// @Param PageSize query int true "每页数据条数"
|
|
|
// @Param LastViewTime query string true "最近一次的阅读时间,没有的话,那就是获取最新数据"
|
|
|
-// @Param CompanyId query int true "客户id"
|
|
|
// @Success 200 {object} company.ViewReportListResp
|
|
|
// @router /view/report/list [get]
|
|
|
func (this *CompanyUserController) ViewReportList() {
|
|
@@ -3118,8 +3117,7 @@ func (this *CompanyUserController) ViewReportList() {
|
|
|
txtType, _ := this.GetInt("TxtType")
|
|
|
pageSize, _ := this.GetInt("PageSize")
|
|
|
lastViewTime := this.GetString("LastViewTime")
|
|
|
- companyId, _ := this.GetInt("CompanyId")
|
|
|
- if userId <= 0 && companyId <= 0 {
|
|
|
+ if userId <= 0 {
|
|
|
br.Msg = "参数错误"
|
|
|
return
|
|
|
}
|
|
@@ -6263,3 +6261,97 @@ func (this *CompanyUserController) UpadteUserYanxuanPermission() {
|
|
|
br.Success = true
|
|
|
br.Msg = "操作成功"
|
|
|
}
|
|
|
+
|
|
|
+// ListByReport
|
|
|
+// @Title 联系人列表
|
|
|
+// @Description 联系人列表接口
|
|
|
+// @Param PageSize query int true "每页数据条数"
|
|
|
+// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
+// @Param CompanyId query int true "公司id,必填"
|
|
|
+// @Param SortParam query int false "排序字段:1-点击量;2-点击时间"
|
|
|
+// @Param SortType query int false "排序方式:1-倒序;2-正序"
|
|
|
+// @Success 200 {object} company.CompanyUserListResp
|
|
|
+// @router /user/listByReport [get]
|
|
|
+func (this *CompanyUserController) ListByReport() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ sysUser := this.SysUser
|
|
|
+ if sysUser == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ pageSize, _ := this.GetInt("PageSize")
|
|
|
+ currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
+ companyId, _ := this.GetInt("CompanyId")
|
|
|
+
|
|
|
+ sortParam, _ := this.GetInt("SortParam", 2)
|
|
|
+ sortType, _ := this.GetInt("SortType", 1)
|
|
|
+
|
|
|
+ if companyId <= 0 {
|
|
|
+ br.Msg = "请选择客户"
|
|
|
+ br.ErrMsg = "客户参数错误"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var startSize int
|
|
|
+ if pageSize <= 0 {
|
|
|
+ pageSize = utils.PageSize20
|
|
|
+ }
|
|
|
+ if currentIndex <= 0 {
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
+ startSize = paging.StartIndex(currentIndex, pageSize)
|
|
|
+
|
|
|
+ var order string
|
|
|
+ sortArr := []int{1, 2}
|
|
|
+ if utils.InArrayByInt(sortArr, sortParam) && utils.InArrayByInt(sortArr, sortType) {
|
|
|
+ pMap := map[int]string{1: "ficc_view_total", 2: "ficc_last_view_time"}
|
|
|
+ tMap := map[int]string{1: "DESC", 2: "ASC"}
|
|
|
+ order = fmt.Sprintf(` ORDER BY %s %s`, pMap[sortParam], tMap[sortType])
|
|
|
+ }
|
|
|
+
|
|
|
+ total, err := company.GetCompanyUserCount(companyId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取数据总数失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ list, err := company.GetCompanyUserListByReport(companyId, startSize, pageSize, order)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ respList := make([]*company.CompanyViewResp, 0)
|
|
|
+ for i := range list {
|
|
|
+ v := &company.CompanyViewResp{
|
|
|
+ UserId: int(list[i].UserId),
|
|
|
+ UserName: list[i].RealName,
|
|
|
+ Mobile: list[i].Mobile,
|
|
|
+ Email: list[i].Email,
|
|
|
+ ViewTotal: list[i].FiccViewTotal,
|
|
|
+ LastViewTime: list[i].FiccLastViewTime.Format(utils.FormatDateTime),
|
|
|
+ }
|
|
|
+ if v.LastViewTime == "0001-01-01 00:00:00" {
|
|
|
+ v.LastViewTime = ""
|
|
|
+ }
|
|
|
+ respList = append(respList, v)
|
|
|
+ }
|
|
|
+
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
+ resp := &company.CompanyViewPageListResp{
|
|
|
+ Paging: page,
|
|
|
+ List: respList,
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|