master
elf 8 months ago
parent 83616c37ff
commit 33a3179405

@ -793,25 +793,29 @@ class MemberController extends ThinkController
public function changeprelname() public function changeprelname()
{ {
if (preg_match('/^([\xe4-\xe9][\x80-\xbf]{2}){2,4}$/', $_POST['real_name'])) { $realName = trim($_POST['real_name']);
//重复判断 if (strpos($realName, '·') === false) {
$map['id'] = $_POST['id']; if (!preg_match('/^([\xe4-\xe9][\x80-\xbf]{2}){2,4}$/', $realName)) {
$pro = M("User", "tab_") $this->ajaxReturn(array("status" => 0, "msg" => "真实姓名输入错误"));
->where($map) return;
->setField('real_name', $_POST['real_name']);
if ($pro !== false) {
addOperationLog(array(
"op_type"=>1,
"key"=>get_user_account($_POST['id']).'的真实姓名修改为:'.$_POST['real_name'],
"url"=>U("Member/edit",array("id"=>$_POST['id'])),
"menu"=>"用户-玩家组-玩家列表-编辑-真实姓名修改",
));
$this->ajaxReturn(array("status" => 1, "msg" => "真实姓名修改成功"));
} else {
$this->ajaxReturn(array("status" => 0, "msg" => "真实姓名修改失败"));
} }
}
//重复判断
$map['id'] = $_POST['id'];
$pro = M("User", "tab_")
->where($map)
->setField('real_name', $realName);
if ($pro !== false) {
addOperationLog(array(
"op_type"=>1,
"key"=>get_user_account($_POST['id']).'的真实姓名修改为:'.$realName,
"url"=>U("Member/edit",array("id"=>$_POST['id'])),
"menu"=>"用户-玩家组-玩家列表-编辑-真实姓名修改",
));
$this->ajaxReturn(array("status" => 1, "msg" => "真实姓名修改成功"));
} else { } else {
$this->ajaxReturn(array("status" => 0, "msg" => "真实姓名输入错误")); $this->ajaxReturn(array("status" => 0, "msg" => "真实姓名修改失败"));
} }
} }

@ -380,11 +380,16 @@
value: '' value: ''
}, function (real_name) { }, function (real_name) {
var jsid = $('#selfid').val(); var jsid = $('#selfid').val();
var realName = /^[\u4E00-\u9FA5]{2,4}$/; if (real_name.indexOf('·') > 0) {
if(!realName.test(real_name)){
layer.msg("真实姓名填写有误"); } else {
return false; var realName = /^[\u4E00-\u9FA5]{2,4}$/;
if(!realName.test(real_name)){
layer.msg("真实姓名填写有误");
return false;
}
} }
$.ajax({ $.ajax({
url: '{:U("changeprelname")}', url: '{:U("changeprelname")}',
type: 'post', type: 'post',

Loading…
Cancel
Save