奖罚管理bug修改

master
zhengyongxing 5 years ago
parent 6d91ec7c60
commit be932b1ebd

@ -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;
}
?>

@ -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('请输入正确的金额');

Loading…
Cancel
Save