songxingwei 2 年之前
父節點
當前提交
dcc9dbf883
共有 2 個文件被更改,包括 8 次插入0 次删除
  1. 3 0
      app/data/model/DataPoolTalent.php
  2. 5 0
      app/data/service/UserAdminService.php

+ 3 - 0
app/data/model/DataPoolTalent.php

@@ -31,5 +31,8 @@ class DataPoolTalent extends Model
     public function getZzImagesArrAttr($_,$model){
         return array_filter(explode(',',$model['zz_imgs']));
     }
+    public function getZhichengnameAttr($_,$model){
+        return DataZhicheng::mk()->where('id',$model['zc_id'])->value('name');
+    }
 
 }

+ 5 - 0
app/data/service/UserAdminService.php

@@ -2,8 +2,10 @@
 
 namespace app\data\service;
 
+use app\data\model\DataPoolTalent;
 use app\data\model\DataUser;
 use app\data\model\DataUserToken;
+use app\data\model\DataZhicheng;
 use think\admin\Exception;
 use think\admin\Service;
 
@@ -88,6 +90,9 @@ class UserAdminService extends Service
             ->with(['pooltalent','maintenance','shipyard','merchants'])
             ->findOrEmpty();
         if ($user->isEmpty()) throw new Exception('用户还没有注册!');
+        if ($user['pooltalent']){
+            $user['pooltalent']['zcname'] = DataZhicheng::mk()->where('id',$user['pooltalent']['zc_id'])->value('name');
+        }
         // 用户认证令牌处理
         $map = ['uuid' => $uuid, 'type' => $type];
         if (!($access = DataUserToken::mk()->where($map)->find())) {