/** * 检查用户是否存在 * * @param strint $user 用户标识 uid|phone|uname|email * @return array * @author Medz Seven <*****@*****.**> **/ public function hasUser($user, $isUid = false) { if ($isUid) { $users = Models\User::existent()->audit()->byUid($user)->get(); } elseif (MedzValidator::isEmail($user)) { $users = Models\User::existent()->audit()->byEmail($user)->get(); } else { $users = Models\User::existent()->audit()->where('uid', '=', intval($user))->orWhere('uname', '=', EmojiFormat::en($user))->orWhere('phone', '=', EmojiFormat::en($user))->get(); } return $users; }
public function setIntroAttribute($intro) { $this->attributes['intro'] = EmojiFormat::en($intro); }
/** * 格式化Emoji * 该方法兼容以前使用的地方~如果开发需要,请按照下面示例,使用新的依赖包。 * * @param bool $type true为将emoji格式化为代码,false为将代码格式化为emoji * @param string|array 数据,如果数数组,就递归,解析多维内部数据 * @return string * @author Seven Du <*****@*****.**> **/ function formatEmoji($type = false, $data) { if ($type) { return \Medz\Component\EmojiFormat::en($data); } return \Medz\Component\EmojiFormat::de($data); }
protected static function enEmoji($data) { return EmojiFormat::en($data); }