mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-02-11 09:05:33 +00:00
过滤昵称特殊字符
This commit is contained in:
parent
c33f99a659
commit
eababc3fdf
@ -8,21 +8,34 @@
|
|||||||
namespace app\routine\controller;
|
namespace app\routine\controller;
|
||||||
|
|
||||||
use app\routine\model\user\User;
|
use app\routine\model\user\User;
|
||||||
|
use app\routine\model\user\WechatUser;
|
||||||
use service\JsonService;
|
use service\JsonService;
|
||||||
use think\Controller;
|
use think\Controller;
|
||||||
use think\Request;
|
use think\Request;
|
||||||
use think\Session;
|
|
||||||
|
|
||||||
class AuthController extends Controller
|
class AuthController extends Controller
|
||||||
{
|
{
|
||||||
public $userInfo = [];
|
protected $uid = 0;
|
||||||
|
protected $userInfo = [];
|
||||||
protected function _initialize()
|
protected function _initialize()
|
||||||
{
|
{
|
||||||
parent::_initialize();
|
parent::_initialize();
|
||||||
$uid = Request::instance()->get('uid',0);
|
|
||||||
$userInfo = User::get($uid);
|
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) {
|
||||||
if($userInfo) $userInfo->toArray();
|
if(!empty(input('openid'))){
|
||||||
else return JsonService::fail('没有获取用户UID');
|
$uid = WechatUser::openidTouid(input('openid'));
|
||||||
$this->userInfo = $userInfo;//根据uid获取用户信息
|
$userInfo = User::get($uid);
|
||||||
|
}else{
|
||||||
|
$uid = Request::instance()->get('uid',0);
|
||||||
|
$userInfo = User::get($uid);
|
||||||
|
}
|
||||||
|
if($userInfo) $userInfo->toArray();
|
||||||
|
else return JsonService::fail('没有获取用户UID');
|
||||||
|
$this->userInfo = $userInfo;//根据uid获取用户信息
|
||||||
|
} else {
|
||||||
|
echo "非法访问";exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -22,7 +22,7 @@ class RoutineUser extends ModelBasic
|
|||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function routineOauth($routine){
|
public static function routineOauth($routine){
|
||||||
$routineInfo['nickname'] = $routine['nickName'];//姓名
|
$routineInfo['nickname'] = filterEmoji($routine['nickName']);//姓名
|
||||||
$routineInfo['sex'] = $routine['gender'];//性别
|
$routineInfo['sex'] = $routine['gender'];//性别
|
||||||
$routineInfo['language'] = $routine['language'];//语言
|
$routineInfo['language'] = $routine['language'];//语言
|
||||||
$routineInfo['city'] = $routine['city'];//城市
|
$routineInfo['city'] = $routine['city'];//城市
|
||||||
|
|||||||
@ -35,6 +35,16 @@ class WechatUser extends ModelBasic
|
|||||||
return $openid;
|
return $openid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用openid获得uid
|
||||||
|
* @param $uid
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public static function openidTouid($openid)
|
||||||
|
{
|
||||||
|
return self::where('routine_openid',$openid)->value('uid');
|
||||||
|
}
|
||||||
|
|
||||||
public static function userTakeOrderGiveCoupon($uid)
|
public static function userTakeOrderGiveCoupon($uid)
|
||||||
{
|
{
|
||||||
$couponId = SystemConfigService::get('store_order_give_coupon');
|
$couponId = SystemConfigService::get('store_order_give_coupon');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user