Browse Source

添加用户 产品ID 返回

kobe6258 4 months ago
parent
commit
164db1daba
3 changed files with 4 additions and 1 deletions
  1. 1 0
      controllers/product.go
  2. 2 1
      models/user.go
  3. 1 0
      services/product.go

+ 1 - 0
controllers/product.go

@@ -491,6 +491,7 @@ func (this *ProductController) ProductList() {
 	var ListView []*services.ProductView
 	for _, product := range List {
 		view := &services.ProductView{
+			Id:            product.Id,
 			ProductName:   product.Title,
 			ProductType:   CNProductMap[product.Type],
 			PublishedTime: product.CreatedTime.Format(time.DateTime),

+ 2 - 1
models/user.go

@@ -32,6 +32,7 @@ func (u User) FillUserInfo(user *TemplateUser) UserView {
 }
 
 type UserView struct {
+	Id            int
 	RealName      string `description:"姓名"`
 	Mobile        string `description:"手机号码"`
 	FollowingGzh  bool
@@ -52,7 +53,7 @@ func GetPageOfficialUserList(condition string, pars []interface{}, sortStr strin
 	}
 	total = len(officialIds)
 	idCondition := " and tus.id in (" + utils.GetOrmReplaceHolder(len(officialIds)) + ")"
-	sql := `SELECT us.real_name as real_name, tus.mobile,tus.following_gzh,tus.created_time,tus.read_count,tus.last_read_time,tus.account_status  FROM template_users tus LEFT JOIN (select real_name,template_user_id from users) us on us.template_user_id=tus.id WHERE  1=1`
+	sql := `SELECT us.id as id, us.real_name as real_name, tus.mobile,tus.following_gzh,tus.created_time,tus.read_count,tus.last_read_time,tus.account_status  FROM template_users tus LEFT JOIN (select id, real_name,template_user_id from users) us on us.template_user_id=tus.id WHERE  1=1`
 	sql = sql + idCondition
 	if condition != "" {
 		sql += condition

+ 1 - 0
services/product.go

@@ -159,6 +159,7 @@ func GetUnsetProductByCondition(productType string, ids []int, sortCondition str
 }
 
 type ProductView struct {
+	Id            int
 	ProductName   string
 	SourceId      int
 	ProductType   string