Browse Source

fix:阅读条数

zqbao 9 months ago
parent
commit
6e24cb7b36
2 changed files with 3 additions and 2 deletions
  1. 2 1
      models/user.go
  2. 1 1
      models/user_read_record.go

+ 2 - 1
models/user.go

@@ -139,7 +139,8 @@ func GetUserList(condition string, pars []interface{}, startSize, pageSize int)
 }
 
 func GetUserListByConditonSort(condition, sortConditon string, pars []interface{}, startSize, pageSize int) (items []*UserView, err error) {
-	sql := `SELECT u.*, su.sys_real_name AS seller_name FROM user AS u
+	sql := `SELECT u.*, su.sys_real_name AS seller_name, TIMESTAMPDIFF(DAY, NOW(), valid_end_time) AS rest_day
+	FROM user AS u
 	LEFT JOIN sys_user AS su
 	ON u.seller_id = su.sys_user_id
 	WHERE 1=1 AND (u.phone IS NOT NULL OR u.email IS NOT NULL) `

+ 1 - 1
models/user_read_record.go

@@ -55,7 +55,7 @@ func GetUserReadRecordByUserId(userId int, condition string, pars []interface{},
 
 func GetUserReadRecordCountByUserId(userId int, condition string, pars []interface{}) (count int, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT COUNT(*) AS count
+	sql := `SELECT COUNT(DISTINCT ur.user_read_record_id) AS count
 	  	FROM user_read_record AS ur
 		LEFT JOIN user_read_permission2 AS urp2
 		ON ur.user_read_record_id = urp2.user_read_record_id