zhanggucheng 3 years ago
parent a0e269bf4f
commit 4b285af104

@ -482,6 +482,22 @@ class TestingResourceRepository
];
}
private function encodeStr($str)
{
# 判断字符串长度
$length = strlen($str);
if ($length == 1) {
# 长度为 1 前后拼接 * 号
$newStr = $str.'*'.rand(1,6);
}else{
# 长度超过1随机插入 * 号
$newStr = substr_replace($str,str_repeat('*',$length/2),ceil($length/2),$length).mb_substr($str,$length-2,$length,"utf-8");
// str_repeat('*',$length/2) 星号重复字符长度的一半长度
// ceil($length/2) 算出从第几个字符开始
}
return $newStr;
}
public function makeTestingRoleRecords($roles)
{
$result = $this->statByRoles($roles);
@ -553,11 +569,11 @@ class TestingResourceRepository
'server_name' => $role['server_name'],
'server_id' => $role['server_id'],
'role_id' => $role['role_id'],
'user_account' => $role['user_account'],
'user_account' => $this->encodeStr($role['user_account']),
'user_phone' => $user ? $user['phone'] : '',
'role_name' => $role['role_name'],
'binding_id' => $binding ? $binding['id'] : 0,
'bind_user_account' => $bindingRole ? $bindingRole['user_account'] : '',
'bind_user_account' => $bindingRole ? $this->encodeStr($bindingRole['user_account']) : '',
'bind_role_name' => $bindingRole ? $bindingRole['role_name'] : '',
'base_quota' => $gameSetting ? $gameSetting['base_quota'] : 0,
'other_quota' => intval($role['testing_other_quota']),

Loading…
Cancel
Save