获取商店信息
()
| 645 | |
| 646 | // 获取商店信息 |
| 647 | func (sql *fishdb) getStoreInfo() (thingInfos []store, err error) { |
| 648 | sql.Lock() |
| 649 | defer sql.Unlock() |
| 650 | thingInfo := store{} |
| 651 | err = sql.db.Create("store", &thingInfo) |
| 652 | if err != nil { |
| 653 | return |
| 654 | } |
| 655 | count, err := sql.db.Count("store") |
| 656 | if err != nil { |
| 657 | return |
| 658 | } |
| 659 | if count == 0 { |
| 660 | return |
| 661 | } |
| 662 | err = sql.db.FindFor("store", &thingInfo, "ORDER by Type, Name, Price ASC", func() error { |
| 663 | thingInfos = append(thingInfos, thingInfo) |
| 664 | return nil |
| 665 | }) |
| 666 | return |
| 667 | } |
| 668 | |
| 669 | // 获取商店物品信息 |
| 670 | func (sql *fishdb) getStoreThingInfo(thing string) (thingInfos []store, err error) { |