fuwencai 1 anno fa
parent
commit
ce7b29b584
2 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 1 1
      services/model/stdlib.go
  2. 1 1
      services/userlib/userDocService.go

+ 1 - 1
services/model/stdlib.go

@@ -64,7 +64,7 @@ type UserDoc struct {
 	Cost            string    `json:"cost" gorm:"column:cost"`
 }
 type UserDocRes struct {
-	ID              int       `json:"id" form:"id" gorm:"id"`
+	ID              int       `json:"id" form:"id" gorm:"primaryKey"`
 	CreateAt        time.Time `json:"create_at" gorm:"create_at"` //标签autoCreateTime设置如果字段名字不为CreatAt时候自动插入当前时间
 	UpdateAt        time.Time `json:"update_at" gorm:"update_at"`
 	DeletedAt       time.Time `json:"delete_at" gorm:"column:delete_at"`

+ 1 - 1
services/userlib/userDocService.go

@@ -356,7 +356,7 @@ func UserDocsList(in *userlib.UserDocsRequest) ([]*model.UserDocRes, int64, bool
 		case int64(1):
 			//收藏的
 			err := docRpcUtil.GetJyDocsDB().Table("user_doc").Raw("SELECT count(*) FROM jydocs.user_doc ud inner join doc d on (ud.docId=d.id)  where ud.userId=? and ud.isCollection=1 and ud.appId=? and d.isDelete=0 ", in.UserId, in.AppId).Count(&count)
-			err = docRpcUtil.GetJyDocsDB().Table("user_doc").Raw("SELECT ud.create_at,ud.update_at,ud.docCategory,ud.isDownload,ud.isCollection,d.price as cost,d.docTags,d.docFileType,d.docName,d.docFileSuffix,d.docFileSize,d.docPageSize,d.docSummary,d.source,d.productType,d.id FROM jydocs.user_doc ud inner join doc d on (ud.docId=d.id)  where ud.userId=? and ud.isCollection=1 and ud.appId=? and d.isDelete=0   order by create_at desc  limit ?,?", in.UserId, in.AppId, startIndex, in.PageSize).Find(&data)
+			err = docRpcUtil.GetJyDocsDB().Table("user_doc").Raw("SELECT ud.create_at,ud.update_at,ud.docCategory,ud.isDownload,ud.isCollection,d.price as cost,d.docTags,d.docFileType,d.docName,d.docFileSuffix,d.docFileSize,d.docPageSize,d.docSummary,d.source,d.productType,ud.docId FROM jydocs.user_doc ud inner join doc d on (ud.docId=d.id)  where ud.userId=? and ud.isCollection=1 and ud.appId=? and d.isDelete=0   order by create_at desc  limit ?,?", in.UserId, in.AppId, startIndex, in.PageSize).Find(&data)
 			if err.Error != nil {
 				log.Println("查询收藏记录失败:", err)
 				msg = "查询收藏记录失败"