diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 52ae4ab44..bf22be7ba 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -2135,5 +2135,42 @@ function getPromoteGameRatio($promoteID = 0, $relationGameId = 0, $amount=0, $ti } return $ratio; } +//验证账号 +function checkAccount($type,$account) { + +// $type = I('type'); +// $account = I('account'); + + $map = []; + $map['account'] = $account; + + if ($type == 1) { + + $result = M('promote','tab_')->field('account')->where($map)->find(); + + } else { + $result = M('user','tab_')->field('account')->where($map)->find(); + } + + if ($result) { + return 1; + } else { + return 0; + } + + } +//去重函数 +function a_array_unique($array){ + $out = array(); + + foreach ($array as $key=>$value) { + if (!in_array($value, $out)){ + $out[$key] = $value; + } + } + + $out = array_values($out); + return $out; + } ?> diff --git a/Application/Admin/Controller/StatementMangementController.class.php b/Application/Admin/Controller/StatementMangementController.class.php index 4cc3d58f8..4714782a8 100644 --- a/Application/Admin/Controller/StatementMangementController.class.php +++ b/Application/Admin/Controller/StatementMangementController.class.php @@ -294,11 +294,19 @@ class StatementMangementController extends ThinkController if ($accounts) { foreach ($accounts as $index => $account) { - $data['accounts'][] = array_merge(['account'=>$account], ['user_type'=>$user_types[$index]]); + + if (checkAccount($user_types[$index],$account)==1) { + $data['accounts'][] = array_merge(['account'=>$account], ['user_type'=>$user_types[$index]]); + } else { + return $this->error('账号'.$account.'不存在,请重新输入'); + } +// $data['accounts'][] = array_merge(['account'=>$account], ['user_type'=>$user_types[$index]]); } } else { $data['accounts'] = []; } + $data['accounts']=a_array_unique($data['accounts']); +// dump($data['accounts']);die(); $data['accounts'] = json_encode($data['accounts']); if (!is_numeric(I('money'))) { return $this->error('请输入正确的金额');