Bladeren bron

批量添加账号记录表加筛选状态字段

wufeng 2 jaren geleden
bovenliggende
commit
243b88ad80
2 gewijzigde bestanden met toevoegingen van 8 en 7 verwijderingen
  1. 1 1
      app/admin/controller/Account.php
  2. 7 6
      app/admin/logic/AccountLogic.php

+ 1 - 1
app/admin/controller/Account.php

@@ -83,7 +83,7 @@ class Account extends BaseController
     //批量添加账户列表
     public function batchLog()
     {
-        $param = $this->request->only(['page' => 1, 'size' => 10, 'company_title' => '', 'card_title' => ''], 'post');
+        $param = $this->request->only(['page' => 1, 'size' => 10, 'company_title' => '', 'card_title' => '', 'status' => ''], 'post');
 
         return AccountLogic::batchLog($param);
     }

+ 7 - 6
app/admin/logic/AccountLogic.php

@@ -43,7 +43,7 @@ class AccountLogic extends BaseLogic
 
         $rs = AccountModel::field('id,username')
             ->where('is_del', CommonModel::$del_normal)
-            ->where('username', $username_prefix.$data['username'])
+            ->where('username', $username_prefix . $data['username'])
             ->findOrEmpty()
             ->isEmpty();
         if (!$rs) return json_show(CommonModel::$error_param, '该账号已存在');
@@ -111,12 +111,12 @@ class AccountLogic extends BaseLogic
     //批量添加账户
     public static function batchAdd(array $data = []): Json
     {
-        $rs = AccountBatchLogModel::create(array_merge($data,[
-                'status'=>AccountBatchLogModel::$status_wait_handle,
-                'addtime'=>date('Y-m-d H:i:s'),
-            ]))->save();
+        $rs = AccountBatchLogModel::create(array_merge($data, [
+            'status' => AccountBatchLogModel::$status_wait_handle,
+            'addtime' => date('Y-m-d H:i:s'),
+        ]))->save();
 
-        return $rs?json_show(CommonModel::$success,'批量添加账户成功'):json_show(CommonModel::$error_param,'批量添加账户失败');
+        return $rs ? json_show(CommonModel::$success, '批量添加账户成功') : json_show(CommonModel::$error_param, '批量添加账户失败');
 
     }
 
@@ -136,6 +136,7 @@ class AccountLogic extends BaseLogic
         $where = [];
         if ($data['company_title'] != '') $where[] = ['b.title', 'like', '%' . $data['company_title'] . '%'];
         if ($data['card_title'] != '') $where[] = ['c.title', 'like', '%' . $data['card_title'] . '%'];
+        if ($data['status'] != '') $where[] = ['a.status', '=', $data['status']];
 
         $count = Db::name('account_batch_log')
             ->alias('a')