فهرست منبع

增加会员信息关联

moonsflyer 8 ماه پیش
والد
کامیت
45f44f7fe8

+ 1 - 1
app/api/lists/service/ServiceLists.php

@@ -87,7 +87,7 @@ class ServiceLists extends BaseApiDataLists implements ListsSearchInterface
             ->where($this->queryWhere())
             ->where($this->searchWhere)
             ->orderRaw($orderRaw)
-            ->append(['type_desc','cate_desc','area_desc','images'])
+            ->append(['type_desc','cate_desc','area_desc','images','user'])
             ->limit($this->limitOffset, $this->limitLength)
             ->select()->toArray();
 

+ 1 - 1
app/api/logic/ServiceLogic.php

@@ -121,7 +121,7 @@ class ServiceLogic extends BaseLogic
             $where[]=['user_id','=',$user_id];
             $where[]=['type','=',$params['type']];
 
-            $serviceInfo = UserService::where($where) ->append(['type_desc','cate_desc','area_desc','images','pay_info'])->findOrEmpty();
+            $serviceInfo = UserService::where($where) ->append(['type_desc','cate_desc','area_desc','images','pay_info','user'])->findOrEmpty();
 
             if($serviceInfo->isEmpty()){
                 $status = -1;

+ 4 - 3
app/common/model/agricultural_machinery/UserService.php

@@ -19,6 +19,7 @@ use app\common\model\BaseModel;
 use app\common\model\asset\AssetArea;
 use app\common\model\recharge\RechargeOrder;
 use app\common\service\FileService;
+use app\common\model\User\User;
 use think\model\concern\SoftDelete;
 
 /**
@@ -34,14 +35,14 @@ class UserService extends BaseModel
 
 
     /**
-     * @notes 关联文章
+     * @notes 关联用户
      * @return \think\model\relation\HasMany
      * @author 段誉
      * @date 2022/10/19 16:59
      */
-    public function article()
+    public function user()
     {
-        return $this->hasMany(Article::class, 'cid', 'id');
+        return $this->hasOne(User::class, 'id', 'user_id')->field('id,nickname,avatar');
     }
 
     /**