MCPcopy Create free account
hub / github.com/TruthHun/DocHub / DoesCollect

Function DoesCollect

models/Models.go:511–525  ·  view source on GitHub ↗

是否已收藏文档 @param did 文档id,即document id @param uid 用户id @return bool bool值,true表示已收藏,否则未收藏

(did, uid int)

Source from the content-addressed store, hash-verified

509//@param uid 用户id
510//@return bool bool值,true表示已收藏,否则未收藏
511func DoesCollect(did, uid int) bool {
512 if uid == 0 {
513 return false
514 }
515 var params []orm.Params
516 sql := fmt.Sprintf("select c.Id from %v cf left join %v c on c.cid=cf.id where c.Did=? and cf.Uid=? limit 1", GetTableCollectFolder(), GetTableCollect())
517 rows, err := orm.NewOrm().Raw(sql, did, uid).Values(&params)
518 if err != nil {
519 helper.Logger.Error(err.Error())
520 }
521 if rows > 0 && err == nil {
522 return true
523 }
524 return false
525}
526
527//检查数据库是否存在
528//@param host 数据库地址

Callers

nothing calls this directly

Calls 2

GetTableCollectFolderFunction · 0.85
GetTableCollectFunction · 0.85

Tested by

no test coverage detected