Ver Fonte

检查供应商是否开通账号优化,不传供应商返回所有

wufeng há 2 anos atrás
pai
commit
ecca301fc9
1 ficheiros alterados com 9 adições e 2 exclusões
  1. 9 2
      app/controller/UserInfo.php

+ 9 - 2
app/controller/UserInfo.php

@@ -771,11 +771,18 @@ class UserInfo extends BaseController
 
         $supplierNos = $this->request->post('supplierNo', '', 'trim');
 
+        $where = [
+            ['a.is_del', '=', 0],
+            ['a.status', '=', 1],
+            ['b.level', '=', 3],
+            ['a.companyCode', 'like', 'QS%']
+        ];
+        if ($supplierNos !== '') $where[] = ['a.companyCode', 'in', $supplierNos];
+
         $list = Db::name('account_company')
             ->alias('a')
             ->leftJoin('account b', 'b.id=a.account_id')
-            ->where(['a.companyCode' => $supplierNos, 'a.is_del' => 0, 'a.status' => 1, 'b.level' => 3])
-            ->whereLike('a.companyCode', 'QS%')
+            ->where($where)
             ->column('a.account_id', 'a.companyCode');
 
         return json_show(0, '获取供应商账号开通情况成功', $list);