xingzai 8 hónapja
szülő
commit
6592336fcc

+ 9 - 9
controllers/cygx/rai_serve.go

@@ -5,7 +5,6 @@ import (
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"hongze/hz_crm_api/controllers"
 	"hongze/hz_crm_api/models"
-	"hongze/hz_crm_api/models/company"
 	"hongze/hz_crm_api/models/cygx"
 	"hongze/hz_crm_api/utils"
 	"strings"
@@ -332,12 +331,6 @@ func (this *RaiServeCoAntroller) BillList() {
 		br.Msg = "请选择对应公司ID"
 		return
 	}
-	companyInfo, err := company.GetCompanyById(companyId)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,GetCompanyById:" + err.Error()
-		return
-	}
 	var condition string
 	var pars []interface{}
 	condition = " AND  company_id = ? "
@@ -369,8 +362,15 @@ func (this *RaiServeCoAntroller) BillList() {
 	page := paging.GetPaging(currentIndex, pageSize, total)
 	resp := new(cygx.CygxRaiServeBillListResp)
 	resp.Paging = page
-	resp.CompanyName = companyInfo.CompanyName
-	resp.List = list
+	if len(list) == 0 {
+		resp.List = make([]*cygx.CygxRaiServeBillResp, 0)
+	} else {
+		for _, v := range list {
+			v.Tag = "云计算、阿里云、华为云、移动&联通"
+		}
+		resp.List = list
+	}
+
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"

+ 21 - 20
controllers/cygx/user.go

@@ -677,7 +677,7 @@ func (this *UserController) TableList() {
 			{PermissionName: "搜索", Source: 7, TotalNum: countDetail.KeyWordNum},
 			{PermissionName: "音视频播放", Source: 9, TotalNum: countDetail.RoadshowVideoNum + countDetail.ActivityVideoNum + countDetail.ActivityVoiceNum},
 			{PermissionName: "首页标签点击", Source: 10, TotalNum: countDetail.TagNum},
-			{PermissionName: "交流反馈", Source: 14, TotalNum: countDetail.TagNum}}
+			{PermissionName: "交流反馈", Source: 14, TotalNum: countDetail.FeedbackNum}}
 		resp.List = List
 	} else {
 		countDetail, err := cygx.GetUserInteractionTableCountByYanXuan(userId)
@@ -777,25 +777,6 @@ func (this *UserController) TableDetail() {
 	var NoMeetingNum int
 	var list []*cygx.UserInteraction
 
-	//listTable := []*cygx.CygxUserTableRep{{PermissionName: "报告阅读列表", Source: 1, TotalNum: 10},
-	//	{PermissionName: "活动互动记录", Source: 2, TotalNum: 10},
-	//	{PermissionName: "收藏的报告", Source: 3, TotalNum: 10},
-	//	{PermissionName: "收藏图表", Source: 4, TotalNum: 10},
-	//	{PermissionName: "关注的产业", Source: 5, TotalNum: 10},
-	//	{PermissionName: "关注的作者", Source: 6, TotalNum: 10},
-	//	{PermissionName: "搜索", Source: 7, TotalNum: 10},
-	//	{PermissionName: "专项调研", Source: 8, TotalNum: 10},
-	//	{PermissionName: "音视频播放", Source: 9, TotalNum: 10},
-	//	{PermissionName: "首页标签点击", Source: 10, TotalNum: 10}}
-	//for _, v := range listTable {
-	//	if v.Source == source {
-	//		checkSource = true
-	//	}
-	//}
-	////默认类型1
-	//if !checkSource {
-	//	source = 1
-	//}
 	var total int
 	var condition string
 	var pars []interface{}
@@ -1233,6 +1214,26 @@ func (this *UserController) TableDetail() {
 				list[k].HttpUrl = utils.CYGX_MFYX_URL + "/column/view/" + strconv.Itoa(v.DepartmentId)
 			}
 		}
+	} else if source == 14 { //交流反馈
+		if startDate != "" {
+			startDate += " 00:00:00"
+			condition += ` AND r.create_time >= '` + startDate + `' `
+		}
+		if endDate != "" {
+			endDate += " 23:59:59"
+			condition += ` AND r.create_time <= '` + endDate + `' `
+		}
+		if wxUser.Mobile == "" {
+			wxUser.Mobile = wxUser.Email
+		}
+		condition += " 	AND (r.mobile = '" + wxUser.Mobile + "'  OR  r.email = '" + wxUser.Mobile + "')  "
+		total, list, err = cygx.GetCygxUserFeedback(condition, startSize, pageSize)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取用户阅读记录,Err:" + err.Error()
+			return
+		}
+
 	}
 	page := paging.GetPaging(currentIndex, pageSize, total)
 	resp := new(cygx.UserInteractionListResp)

+ 2 - 1
models/cygx/cygx_user.go

@@ -1134,6 +1134,7 @@ type GetUserInteractionTableCountResp struct {
 	YanxuanSpecialNum        int `description:"研选专栏阅读数量"`
 	YanxuanSpecialCollectNum int `description:"研选专栏收藏数量"`
 	YanxuanSpecialFollowNum  int `description:"研选专栏作者关注数量"`
+	FeedbackNum              int `description:"交流反馈数量"`
 }
 
 // 用户互动总数统计
@@ -1154,7 +1155,7 @@ func GetUserInteractionTableCount(uid int) (item *GetUserInteractionTableCountRe
 			( SELECT COUNT( 1 ) FROM cygx_activity_video_history AS h  INNER JOIN cygx_activity_video as v ON v.video_id = h.video_id WHERE  h.user_id = ?  ) AS activity_video_num,
 			( SELECT COUNT( 1 ) FROM cygx_activity_voice_history AS h  INNER JOIN cygx_activity_voice as v ON v.activity_id = h.activity_id WHERE  h.user_id = ?  ) AS activity_voice_num,
 			( SELECT COUNT(1) FROM cygx_tag_history as h INNER JOIN cygx_tag AS b ON h.tag_id = b.tag_id WHERE h.user_id = ?  ) AS tag_num,
-			( SELECT COUNT(1) FROM cygx_user_feedback as h WHERE h.user_id = ?  ) AS tag_num,
+			( SELECT COUNT(1) FROM cygx_user_feedback as h WHERE h.user_id = ?  ) AS feedback_num
 			FROM  dual `
 	err = o.Raw(sql, uid, uid, uid, uid, uid, uid, uid, uid, uid, uid, uid, uid, uid).QueryRow(&item)
 	return

+ 2 - 3
models/cygx/rai_serve_bill.go

@@ -91,9 +91,8 @@ type CygxRaiServeBillResp struct {
 }
 
 type CygxRaiServeBillListResp struct {
-	CompanyName string             `comment:"公司名称"`
-	Paging      *paging.PagingItem `description:"分页数据"`
-	List        []*CygxRaiServeBillResp
+	Paging *paging.PagingItem `description:"分页数据"`
+	List   []*CygxRaiServeBillResp
 }
 
 func GetCygxRaiServeBillCount(condition string, pars []interface{}) (count int, err error) {

+ 51 - 1
models/cygx/user_feedback.go

@@ -2,6 +2,7 @@ package cygx
 
 import (
 	"github.com/beego/beego/v2/client/orm"
+	"strconv"
 	"time"
 )
 
@@ -56,7 +57,7 @@ func DeleteCygxUserFeedback(userFeedbackId int) (err error) {
 func GetCygxUserFeedbackListByUserId(userId int) (items []*CygxUserFeedbackResp, err error) {
 	o := orm.NewOrmUsingDB("hz_cygx")
 	sql := `SELECT * FROM cygx_user_feedback WHERE  user_id = ? `
-	sql += `  ORDER BY user_feedback_id DESC  LIMIT  100 `
+	sql += `  ORDER BY user_feedback_id DESC  LIMIT  1000 `
 	_, err = o.Raw(sql, userId).QueryRows(&items)
 	return
 }
@@ -64,3 +65,52 @@ func GetCygxUserFeedbackListByUserId(userId int) (items []*CygxUserFeedbackResp,
 type CygxCygxUserFeedbackResp struct {
 	List []*CygxUserFeedbackResp
 }
+
+func GetCygxUserFeedbackList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxOrderResp, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `SELECT *
+			FROM
+			cygx_user_feedback
+			WHERE 1 = 1 ` + condition
+	sql += ` LIMIT ?,?  `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+// 获取数量
+func GetCygxUserFeedbackCount(condition string, pars []interface{}) (count int, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_user_feedback WHERE   1= 1  ` + condition
+	err = o.Raw(sqlCount, pars).QueryRow(&count)
+	return
+}
+
+// 用户阅读记录列表
+func GetCygxUserFeedback(condition string, startSize, pageSize int) (total int, items []*UserInteraction, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	var sql string
+	sql += ` 	SELECT
+			r.content as  title,
+			r.user_id,
+		    r.mobile ,
+			r.real_name,
+			r.company_id,
+			r.company_name,
+			r.create_time
+		FROM
+			cygx_user_feedback AS r
+		WHERE 1 = 1 ` + condition
+
+	totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
+	err = o.Raw(totalSql).QueryRow(&total)
+	if err != nil {
+		return
+	}
+
+	sql += ` ORDER BY create_time DESC, department_id DESC   `
+	if startSize > 0 || pageSize > 0 {
+		sql += ` LIMIT ` + strconv.Itoa(startSize) + "," + strconv.Itoa(pageSize)
+	}
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}