fix(park):修正园区信息检索。

This commit is contained in:
徐涛
2023-06-08 22:23:56 +08:00
parent 2f17853dc0
commit 2d17bd5f0d
2 changed files with 10 additions and 4 deletions

View File

@@ -40,9 +40,15 @@ func (pr _ParkRepository) ListAllParks(uid string) ([]*model.Park, error) {
ctx, cancel := global.TimeoutContext()
defer cancel()
var parks []*model.Park
var parks = make([]*model.Park, 0)
parkQuerySql, parkParams, _ := pr.ds.
From("park").
Select(
"id", "user_id", "name", "area", "tenement_quantity", "capacity", "category",
"meter_04kv_type", "region", "address", "contact", "phone", "enabled", "price_policy", "tax_rate",
"basic_pooled", "adjust_pooled", "loss_pooled", "public_pooled", "created_at", "last_modified_at",
"deleted_at",
).
Where(
goqu.I("user_id").Eq(uid),
goqu.I("deleted_at").IsNull(),
@@ -160,7 +166,7 @@ func (pr _ParkRepository) RetrieveParkDetail(pid string) (*model.Park, error) {
}
// 获取园区对应的用户ID
func (pr _ParkRepository) RetrieveParkbelongs(pid string) (string, error) {
func (pr _ParkRepository) RetrieveParkBelongs(pid string) (string, error) {
pr.log.Info("获取园区对应的用户ID", zap.String("pid", pid))
if uid, err := cache.RetrieveEntity[string]("park_belongs", pid); err == nil && uid != nil {
pr.log.Info("已经从缓存获取到了园区对应的用户ID。")