...
|
...
|
@@ -215,6 +215,7 @@ class Auth |
|
|
|
|
|
$userModel = new \app\admin\model\User();
|
|
|
$where = ['openid'=>$result['openid']];
|
|
|
$result['nickname'] = $this->emoji_encode($result['nickname']);
|
|
|
$ret = $userModel->where($where)->find();
|
|
|
if ($ret) {
|
|
|
$userModel->where($where)->update($result);
|
...
|
...
|
@@ -650,4 +651,27 @@ class Auth |
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
//表情转字符
|
|
|
public function emoji_encode($str){
|
|
|
$strEncode = '';
|
|
|
$length = mb_strlen($str,'utf-8');
|
|
|
for ($i=0; $i < $length; $i++) {
|
|
|
$_tmpStr = mb_substr($str,$i,1,'utf-8');
|
|
|
if(strlen($_tmpStr) >= 4){
|
|
|
$strEncode .= '[[EMOJI:'.rawurlencode($_tmpStr).']]';
|
|
|
}else{
|
|
|
$strEncode .= $_tmpStr;
|
|
|
}
|
|
|
}
|
|
|
return $strEncode;
|
|
|
}
|
|
|
|
|
|
//字符转表情
|
|
|
public function emoji_decode($str){
|
|
|
$strDecode = preg_replace_callback('|\[\[EMOJI:(.*?)\]\]|', function ($matches) {
|
|
|
return rawurldecode($matches[1]);
|
|
|
}, $str);
|
|
|
return $strDecode;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|