*********************************************************/ ************************背包相关函数***********************/ *********************************************************/ 获取用户背包信息
(uid int64)
| 429 | |
| 430 | // 获取用户背包信息 |
| 431 | func (sql *fishdb) getUserPack(uid int64) (thingInfos []article, err error) { |
| 432 | sql.Lock() |
| 433 | defer sql.Unlock() |
| 434 | userInfo := article{} |
| 435 | err = sql.db.Create(strconv.FormatInt(uid, 10)+"Pack", &userInfo) |
| 436 | if err != nil { |
| 437 | return |
| 438 | } |
| 439 | count, err := sql.db.Count(strconv.FormatInt(uid, 10) + "Pack") |
| 440 | if err != nil { |
| 441 | return |
| 442 | } |
| 443 | if count == 0 { |
| 444 | return |
| 445 | } |
| 446 | err = sql.db.FindFor(strconv.FormatInt(uid, 10)+"Pack", &userInfo, "ORDER by Type, Name, Other ASC", func() error { |
| 447 | thingInfos = append(thingInfos, userInfo) |
| 448 | return nil |
| 449 | }) |
| 450 | return |
| 451 | } |
| 452 | |
| 453 | // 获取用户物品信息 |
| 454 | func (sql *fishdb) getUserThingInfo(uid int64, thing string) (thingInfos []article, err error) { |