Ver Fonte

供应商升级添加公司抬头字段
新增接口getCompanyList

wufeng há 2 anos atrás
pai
commit
dc9e3876a5
3 ficheiros alterados com 41 adições e 5 exclusões
  1. 12 5
      app/controller/Headquarters.php
  2. 28 0
      app/controller/UserInfo.php
  3. 1 0
      route/app.php

+ 12 - 5
app/controller/Headquarters.php

@@ -340,12 +340,17 @@ class Headquarters extends BaseController
     {
         $companyNo = $this->request->filter('trim')->post('code');
 
-        $res = Db::name('headquarters')
+        $res_1 = Db::name('headquarters')
             ->where('is_del', 0)
             ->whereIn('code', $companyNo)
             ->column('name', 'code');
 
-        return json_show(0, '请求成功', $res);
+        $res_2 = Db::name('headquarters')
+            ->where('is_del', 0)
+            ->whereIn('relation_code', $companyNo)
+            ->column('name', 'relation_code');
+
+        return json_show(0, '请求成功', array_merge($res_1, $res_2));
     }
 
 
@@ -488,6 +493,7 @@ class Headquarters extends BaseController
                     'invoice_mobile' => $param['mobile'],
                     'invoice_bank' => $param['inv_bank'],
                     'invoice_bankNo' => $param['inv_bankNo'],
+                    'invoice_title' => $param['invoice_title'],
                     'updatetime' => date("Y-m-d H:i:s"),
                 ]);
 
@@ -626,7 +632,7 @@ class Headquarters extends BaseController
             ->where(['a.code' => $code, 'a.is_del' => 0])
             ->findOrEmpty();
 
-        if (empty($info)) return json_show(1002, "未找到数据");
+        if (empty($info)) return json_show(1002, "未找到供应商数据");
         return json_show(0, '获取成功', $info);
     }
 
@@ -724,8 +730,7 @@ class Headquarters extends BaseController
     //供应商升级成业务公司
     public function supplerUpgrade()
     {
-
-        $post = $this->request->only(['code', 'inv_bank', 'inv_bankNo', 'inv_addr', 'mobile', 'uid', 'uname'], 'post', 'trim');
+        $post = $this->request->only(['code', 'inv_bank', 'inv_bankNo', 'inv_addr', 'mobile', 'uid', 'uname','invoice_title'], 'post', 'trim');
 
         $val = Validate::rule([
             'code|供应商编码' => 'require',
@@ -733,6 +738,7 @@ class Headquarters extends BaseController
             'inv_bankNo|银行卡号' => 'require|number',
             'inv_addr|联系地址' => 'require|max:255',
             'mobile|联系电话' => 'require',
+            'invoice_title|公司抬头' => 'require',
         ]);
 
         if ($val->check($post) == false) return json_show(1004, $val->getError());
@@ -782,6 +788,7 @@ class Headquarters extends BaseController
                     'addr' => $res['addr'],
                     'inv_scope' => $res['scope'],
                     'license_img' => $res['license_img'],
+                    'invoice_title' => $post['invoice_title'],
                     'status' => 1,
                     'is_del' => 0,
                     'addtime' => $date,

+ 28 - 0
app/controller/UserInfo.php

@@ -708,4 +708,32 @@ class UserInfo extends BaseController
 
     }
 
+
+    //获取用户所绑定的公司列表
+    public function getCompanyList(){
+
+        $post = $this->request->only(["uid" => 0, "companyCode" => "","companyName" => "", "page" => 1, "size" => 20], "post", "trim");
+
+        $where=[['a.is_del','=',0],['a.account_id','=',$post['uid']]];
+        if($post['companyCode']!='') $where[]=['a.companyCode','like','%'.$post['companyCode'].'%'];
+        if($post['companyName']!='') $where[]=['a.companyName','like','%'.$post['companyName'].'%'];
+
+        $count = Db::name('account_company')
+            ->alias('a')
+            ->where($where)
+            ->count('a.id');
+
+        $list = Db::name('account_company')
+            ->alias('a')
+            ->field('a.*,b.level')
+            ->where($where)
+            ->leftJoin('account b','b.id=a.account_id')
+            ->order(['a.id' => 'asc'])
+            ->page(intval($post['page']), intval($post['size']))
+            ->select()
+            ->toArray();
+
+        return json_show(0, '获取用户所绑定的公司列表成功', ['count' => $count, 'list' => $list]);
+    }
+
 }

+ 1 - 0
route/app.php

@@ -28,6 +28,7 @@ Route::rule('useradd', 'UserInfo/userAdd');
 Route::rule('userDelete', 'UserInfo/userDelete');
 Route::rule('userlistbycompany', 'UserInfo/UserListByCompany');
 Route::rule('passSetByPassword', 'UserInfo/passSetByPassword');
+Route::rule('get_company_list', 'UserInfo/getCompanyList');
 
 //【公司账号管理】
 Route::rule('userCompanyBasicAdd', 'UserCompanyBasic/add');