diff --git a/Application/Common/Common/extend.php b/Application/Common/Common/extend.php index 6a50765dc..79d5ba2c7 100644 --- a/Application/Common/Common/extend.php +++ b/Application/Common/Common/extend.php @@ -833,7 +833,15 @@ function Status_recovery($msg){ if (empty($str)) {return $title;} $find = array('%webname%','%gamename%','%newsname%','%giftname%','%gametype%', '%catetitle%', '%gamedevice%'); - $replace = array($title,$array['game_name'],$array['news_title'],$array['giftbag_name'],$array['game_type_name'],$array['cate_title'],$array['game_device']); + $replace = array( + $title, + $array['game_name'] ?? '', + $array['news_title'] ?? '', + $array['giftbag_name'] ?? '', + $array['game_type_name'] ?? '', + $array['cate_title'] ?? '', + $array['game_device'] ?? '' + ); $str = str_replace($find,$replace,$str); return preg_replace('/((-|_)+)?((%[0-9A-Za-z_]*%)|%+)((-|_)+)?/','',$str); diff --git a/Application/Home/Controller/TestingResourceController.class.php b/Application/Home/Controller/TestingResourceController.class.php index 496e2fa65..564f08db1 100644 --- a/Application/Home/Controller/TestingResourceController.class.php +++ b/Application/Home/Controller/TestingResourceController.class.php @@ -23,7 +23,6 @@ class TestingResourceController extends BaseController $conditions = []; $subConditions = [ - '_string' => 'user_id = tab_user_play_info.user_id', 'promote_id' => $loginPromote['id'], ]; @@ -34,8 +33,8 @@ class TestingResourceController extends BaseController $subConditions['create_time'] = ['elt', strtotime($createTimeEnd . ' 23:59:59')]; } - $subSql = M('testing_user', 'tab_')->field(['1'])->where($subConditions)->select(false); - $strCondition = 'exists (' . $subSql . ')'; + $subSql = M('testing_user', 'tab_')->field(['user_id'])->where($subConditions)->select(false); + $strCondition = 'user_id in (' . $subSql . ')'; if ($account) { $user = M('user', 'tab_')->field(['id'])->where('account like ' . $account . '%')->find(); @@ -69,7 +68,7 @@ class TestingResourceController extends BaseController if (count($roles) > 0) { $users = M('user', 'tab_')->field(['id', 'phone'])->where(['id' => ['in', $userIds]])->select(); $uesrs = index_by_column('id', $users); - $bindings = M('testing_binding', 'tab_')->field()->where(['role_id' => ['in', $roleIds]])->select(); + $bindings = M('testing_binding', 'tab_')->where(['role_id' => ['in', $roleIds]])->select(); $bindings = index_by_column('role_id', $bindings); $bindingRoleIds = array_column($bindings, 'bind_role_id'); if (count($bindings) > 0) { @@ -115,12 +114,13 @@ class TestingResourceController extends BaseController { $loginPromote = $this->getLoginPromote(); $accountsStr = trim(I('accounts', ''), ','); - if ($accountsStr = '') { + if ($accountsStr == '') { return $this->ajaxReturn(['status' => 0, 'message' => '请输入测试资源账号']); } $accounts = explode(',', $accountsStr); $accounts = array_unique($accounts); $existAccounts = M('testing_user', 'tab_')->where(['user_account' => ['in', $accounts]])->getField('user_account', true); + $existAccounts = $existAccounts ?? []; $existCount = count($existAccounts); $newAccounts = array_diff($accounts, $existAccounts); $errorCount = 0; @@ -145,7 +145,7 @@ class TestingResourceController extends BaseController $successCount ++; } } - return $this->ajaxReturn(['status' => 1, 'message' => '请输入测试资源账号', 'data' => [ + return $this->ajaxReturn(['status' => 1, 'message' => '请求成功', 'data' => [ 'errorCount' => $errorCount, 'successCount' => $successCount, 'existCount' => $existCount, @@ -196,6 +196,15 @@ class TestingResourceController extends BaseController } public function apply() + { + $records = []; + $pagination = ''; + $this->assign('records', $records); + $this->assign('pagination', $pagination); + $this->display(); + } + + public function doApply() { $records = I('records', []); $batchNo = ''; diff --git a/Application/Home/View/default/TestingResource/apply.html b/Application/Home/View/default/TestingResource/apply.html new file mode 100644 index 000000000..f1e997459 --- /dev/null +++ b/Application/Home/View/default/TestingResource/apply.html @@ -0,0 +1,96 @@ + + + + + + + + + \ No newline at end of file diff --git a/Application/Home/View/default/TestingResource/index.html b/Application/Home/View/default/TestingResource/index.html index 8803d252b..76a91aa4f 100644 --- a/Application/Home/View/default/TestingResource/index.html +++ b/Application/Home/View/default/TestingResource/index.html @@ -156,7 +156,7 @@

-
@@ -259,7 +259,7 @@
- 确定 + 确定
@@ -293,19 +293,36 @@ timepicker: false }); + $('#apply').click(function () { + var title = '添加测试资源申请' + var url = "{:U('TestingResource/apply')}" + + layer.open({ + title: title, + type: 2, + content: [url , 'no'], + area: ['1000px', '550px'], + zIndex: 250, + scrollbar: false, + }) + }) + $('#add').click(function () { var box = $('#add-box') layer.open({ title: '新增测试账号', type: 1, content: box, - area: ['600px', '330px'], + area: ['800px', '330px'], zIndex: 250, }) }); $('#add-submit').on({ click: function () { + var box = $('#add-box') + var accounts = box.find('[name=accounts]').val() + console.log(accounts) $.ajax({ async: false, url: "{:U('addTestingUsers')}", @@ -314,12 +331,18 @@ data: { accounts: accounts }, success: function (result) { if (result.status == 0) { - layer.msg(result.msg); + layer.msg(result.message); } else { - layer.msg('修改成功'); - setTimeout(function () { + var message = '成功' + result.data.successCount + '个, 失败' + result.data.errorCount + '个, 已存在' + result.data.existCount + '个。' + layer.confirm(message, { + btn: ['确定'] //按钮 + }, function(){ + location.reload(); + }) + // layer.msg(result.message); + /* setTimeout(function () { location.reload(); - }, 1000); + }, 1000); */ } }, error: function () {