非管理员数据加密显示

master
zhengchanglong 5 years ago
parent 9a2a7df2e6
commit c6b8f99b6e

@ -3,6 +3,7 @@
namespace Admin\Controller;
use Sdk\Controller\AgeController;
use Think\Log;
use User\Api\MemberApi as MemberApi;
use Org\WeixinSDK\Weixin;
@ -937,11 +938,31 @@ class MemberController extends ThinkController
}
}
public function changeprelname()
{
if (preg_match('/^([\xe4-\xe9][\x80-\xbf]{2}){2,4}$/', $_POST['real_name'])) {
//重复判断
$map['id'] = $_POST['id'];
$pro = M("User", "tab_")
->where($map)
->setField('real_name', $_POST['real_name']);
if ($pro !== false) {
$this->ajaxReturn(array("status" => 1, "msg" => "真实姓名修改成功"));
} else {
$this->ajaxReturn(array("status" => 0, "msg" => "真实姓名修改失败"));
}
} else {
$this->ajaxReturn(array("status" => 0, "msg" => "真实姓名输入错误"));
}
}
public function changepidcard()
{
if (preg_match('/^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/', $_POST['idcard'])) {
//重复判断
$where['idcard'] = $_POST['idcard'];
//$where['idcard'] = $_POST['idcard'];
/*$user = M('User', 'tab_')->where($where)->field('id,account')->find();
if ($user) {
$this->ajaxReturn(array("status" => 0, "msg" => "该身份证号码已被" . $user['account'] . "(" . $user['id'] . ")绑定"));

@ -99,19 +99,21 @@
<case value="3">未成年</case>
<default />意外数据
</switch>
</span>
<span class="notice-text">需玩家认证真实姓名和身份证号码</span>
</td>
</span><span class="notice-text">需玩家认证真实姓名和身份证号码</span></td>
</tr>
<tr>
<td class="l">真实姓名</td>
<td class="r">
<if condition="$data['real_name'] eq null">
<input type="text" class="txt" name="real_name" value="">
<input type="text" class="txt" value="" readonly>
<else/>
<input type="text" class="txt" name="real_name" value="{$data['real_name']}">
<if condition="$is_admin eq true ">
<input type="text" class="txt" value="{$data['real_name']}" readonly>
<else />
<input type="text" class="txt" value="{$data['real_name']|encryptRealName}" readonly>
</if>
</if>
<span id="relname" class="table_click"><span class="table_click_text inner-click-text">点击修改</span></span>
</td>
</tr>
<tr>
@ -366,6 +368,41 @@
});
});
$("#relname").click(function () {
layer.prompt({
formType: 3,
title: "请输入真实姓名",
value: ''
}, function (real_name) {
var jsid = $('#selfid').val();
var realName = /^[\u4E00-\u9FA5]{2,4}$/;
if(!realName.test(real_name)){
layer.msg("真实姓名填写有误");
return false;
}
$.ajax({
url: '{:U("changeprelname")}',
type: 'post',
dataType: 'json',
data: {real_name:real_name,id:jsid},
success: function (data) {
if (data.status > 0) {
layer.msg(data.msg);
setTimeout(function(){
self.location.reload(true);
},1500);
} else {
layer.msg(data.msg)
}
},
error: function () {
alert("服务器故障!");
}
});
});
});
$("#idcard").click(function () {
layer.prompt({
formType: 3,

Loading…
Cancel
Save