获取商店物品信息
(thing string)
| 668 | |
| 669 | // 获取商店物品信息 |
| 670 | func (sql *fishdb) getStoreThingInfo(thing string) (thingInfos []store, err error) { |
| 671 | sql.Lock() |
| 672 | defer sql.Unlock() |
| 673 | thingInfo := store{} |
| 674 | err = sql.db.Create("store", &thingInfo) |
| 675 | if err != nil { |
| 676 | return |
| 677 | } |
| 678 | count, err := sql.db.Count("store") |
| 679 | if err != nil { |
| 680 | return |
| 681 | } |
| 682 | if count == 0 { |
| 683 | return |
| 684 | } |
| 685 | if !sql.db.CanFind("store", "WHERE Name = ?", thing) { |
| 686 | return |
| 687 | } |
| 688 | err = sql.db.FindFor("store", &thingInfo, "WHERE Name = ?", func() error { |
| 689 | thingInfos = append(thingInfos, thingInfo) |
| 690 | return nil |
| 691 | }, thing) |
| 692 | return |
| 693 | } |
| 694 | |
| 695 | // 获取商店物品信息 |
| 696 | func (sql *fishdb) checkStoreFor(thing store, number int) (ok bool, err error) { |