[更新]去除Emoji表情处理(MySQL转用utf8mb4)

This commit is contained in:
Anyon 2019-07-18 14:05:40 +08:00
parent c86e088e2d
commit 5a920eb13a
7 changed files with 4 additions and 26 deletions

View File

@ -47,15 +47,4 @@ class Member extends Controller
$query->dateBetween('create_at')->order('id desc')->page();
}
/**
* 数据列表处理
* @param array $data
*/
protected function _page_filter(&$data = [])
{
foreach ($data as &$vo) {
$vo['nickname'] = emoji_decode($vo['nickname']);
}
}
}

View File

@ -66,7 +66,6 @@ class Order extends Controller
$vo['list'][] = $goods;
}
foreach ($memberList as $member) if ($member['id'] === $vo['mid']) {
$member['nickname'] = emoji_decode($member['nickname']);
$vo['member'] = $member;
}
}

View File

@ -71,7 +71,6 @@ class Member extends Controller
$where = ['id' => $this->mid, 'openid' => $this->openid];
$this->member = Db::name('StoreMember')->where($where)->find();
if (empty($this->member)) $this->error('无效的会员信息,请重新登录授权!');
$this->member['nickname'] = emoji_decode($this->member['nickname']);
// 会员当前已经领取次数
$where = [['mid', 'eq', $this->mid], ['status', 'in', ['2', '3', '4', '5']]];
$this->member['times_used'] = Db::name('StoreOrder')->where($where)->count();

View File

@ -75,7 +75,7 @@ class Wechat extends Controller
data_save('StoreMember', [
'openid' => $result['openId'],
'headimg' => $result['avatarUrl'],
'nickname' => emoji_encode($result['nickName']),
'nickname' => $result['nickName'],
], 'openid');
$result['member'] = Db::name('StoreMember')->where(['openid' => $result['openId']])->find();
$this->success('小程序加密数据解密成功!', $result);

View File

@ -38,10 +38,10 @@ class Center extends Member
$data['headimg'] = $this->request->post('headimg');
}
if ($this->request->has('nickname', 'post', true)) {
$data['nickname'] = emoji_encode($this->request->post('nickname'));
$data['nickname'] = $this->request->post('nickname');
}
if ($this->request->has('username', 'post', true)) {
$data['username'] = emoji_encode($this->request->post('username'));
$data['username'] = $this->request->post('username');
}
if (empty($data)) $this->error('没有需要修改的数据哦!');
if (data_save('StoreMember', array_merge($data, ['id' => $this->mid]), 'id') !== false) {

View File

@ -64,9 +64,6 @@ class Fans extends Controller
foreach (explode(',', $user['tagid_list']) as $tagid) {
if (isset($tags[$tagid])) $user['tags'][] = $tags[$tagid];
}
foreach (['country', 'province', 'city', 'nickname', 'remark'] as $k) {
if (isset($user[$k])) $user[$k] = emoji_decode($user[$k]);
}
}
}

View File

@ -41,9 +41,6 @@ class FansService
if (isset($user['tagid_list']) && is_array($user['tagid_list'])) {
$user['tagid_list'] = is_array($user['tagid_list']) ? join(',', $user['tagid_list']) : '';
}
foreach (['country', 'province', 'city', 'nickname', 'remark'] as $k) {
isset($user[$k]) && $user[$k] = emoji_encode($user[$k]);
}
if ($appid !== '') $user['appid'] = $appid;
unset($user['privilege'], $user['groupid']);
return data_save('WechatFans', $user, 'openid');
@ -59,10 +56,7 @@ class FansService
*/
public static function get($openid)
{
$user = Db::name('WechatFans')->where(['openid' => $openid])->find();
foreach (['country', 'province', 'city', 'nickname', 'remark'] as $k) {
isset($user[$k]) && $user[$k] = emoji_decode($user[$k]);
}
return Db::name('WechatFans')->where(['openid' => $openid])->find();
return $user;
}