Ver Fonte

UserCompanyBasic/info接口优化

wufeng há 2 anos atrás
pai
commit
78f735135f
1 ficheiros alterados com 5 adições e 2 exclusões
  1. 5 2
      app/controller/UserCompanyBasic.php

+ 5 - 2
app/controller/UserCompanyBasic.php

@@ -315,11 +315,11 @@ class UserCompanyBasic extends BaseController
 
         $list = Db::name('account')
             ->alias('a')
-            ->field('a.id,a.username,a.mobile,a.source,a.status,b.nickname,b.sex,b.email,a.addtime,a.updatetime,c.itemid,d.name item_name')
+            ->field('a.id,a.username,a.mobile,a.source,a.status,b.nickname,b.sex,b.email,a.addtime,a.updatetime,c.itemid,d.name item_name,d.companyNo item_companyNo')
             ->leftJoin('user b', 'a.id=b.account_id')
             ->leftJoin('account_item c', 'c.account_id=a.id')
             ->leftJoin('company_item d', 'd.id=c.itemid')
-            ->append(['plat', 'company_relaton'])
+            ->append(['plat', 'company_relaton','item_list'])
 //            ->withAttr('plat', function ($val, $da) {
 //                return Db::name('account_plat')
 //                    ->alias('a')
@@ -332,6 +332,9 @@ class UserCompanyBasic extends BaseController
                     ->where(['account_id' => $da['id'], 'is_del' => 0, 'status' => 1])
                     ->column('companyCode,companyName,company_type,is_main,status');
             })
+            ->withAttr('item_list',function($val,$da){
+                return get_part($da['itemid'] ?? 0);
+            })
             ->where(['a.id' => $id, 'a.is_del' => 0])
             ->findOrEmpty();
         if (empty($list)) return json_show(1004, '未找到用户信息');