|
@@ -37,29 +37,25 @@ class User extends Api
|
|
|
public function _initialize()
|
|
|
{
|
|
|
parent::_initialize();
|
|
|
-
|
|
|
- if (!Config::get('fastadmin.usercenter')) {
|
|
|
- $this->error(__('User center already closed'));
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 会员中心
|
|
|
*/
|
|
|
- public function index()
|
|
|
+ /*public function index()
|
|
|
{
|
|
|
$this->success('', ['welcome' => $this->auth->nickname]);
|
|
|
- }
|
|
|
+ }*/
|
|
|
/**
|
|
|
* 获取美颜授权
|
|
|
*
|
|
|
*/
|
|
|
- public function getmeiyan()
|
|
|
+ /*public function getmeiyan()
|
|
|
{
|
|
|
$code = Db::name('Config')->where(['name'=>'meiyan'])->value('value');
|
|
|
$rs['code'] = $code;
|
|
|
$this->success('请求成功',$code);
|
|
|
- }
|
|
|
+ }*/
|
|
|
/**
|
|
|
* 会员登录
|
|
|
*
|
|
@@ -67,13 +63,16 @@ class User extends Api
|
|
|
* @param string $account 账号
|
|
|
* @param string $password 密码
|
|
|
*/
|
|
|
- public function login()
|
|
|
+ public function emaillogin()
|
|
|
{
|
|
|
$account = input('account');
|
|
|
$password = input('password');
|
|
|
if (!$account || !$password) {
|
|
|
$this->error(__('Invalid parameters'));
|
|
|
}
|
|
|
+ if (!Validate::is($account, 'email')) {
|
|
|
+ $this->error(__('Email is incorrect'));
|
|
|
+ }
|
|
|
$ret = $this->auth->login($account, $password);
|
|
|
if ($ret) {
|
|
|
$data = $this->userInfo('return');
|
|
@@ -82,6 +81,29 @@ class User extends Api
|
|
|
$this->error($this->auth->getError());
|
|
|
}
|
|
|
}
|
|
|
+ public function emailregister()
|
|
|
+ {
|
|
|
+ $account = input('account');
|
|
|
+ $captcha = input('captcha');
|
|
|
+ $password = input('password');
|
|
|
+ if (!$account || !$captcha || !$password) {
|
|
|
+ $this->error(__('Invalid parameters'));
|
|
|
+ }
|
|
|
+ if (!Validate::is($account, 'email')) {
|
|
|
+ $this->error(__('Email is incorrect'));
|
|
|
+ }
|
|
|
+ $extend = [
|
|
|
+ 'register_from' => input('register_from',''),
|
|
|
+ 'gender' => -1
|
|
|
+ ];
|
|
|
+ $ret = $this->auth->register('',$password,$account,'', $extend);
|
|
|
+ if ($ret) {
|
|
|
+ $data = $this->userInfo('return');
|
|
|
+ $this->success(__('Logged in successful'), $data);
|
|
|
+ } else {
|
|
|
+ $this->error($this->auth->getError());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -129,7 +151,7 @@ class User extends Api
|
|
|
'register_from' => input('register_from',''),
|
|
|
'gender' => -1
|
|
|
];
|
|
|
- $ret = $this->auth->register($mobile, Random::alnum(), '', $mobile, $extend);
|
|
|
+ $ret = $this->auth->register('', '', '', $mobile, $extend);
|
|
|
|
|
|
}
|
|
|
if ($ret) {
|
|
@@ -148,7 +170,7 @@ class User extends Api
|
|
|
* @param string $mobile 手机号
|
|
|
* @param string $captcha 验证码
|
|
|
*/
|
|
|
- public function mobilecheck()
|
|
|
+ /*public function mobilecheck()
|
|
|
{
|
|
|
$mobile = input('mobile');
|
|
|
$captcha = input('captcha');
|
|
@@ -164,7 +186,7 @@ class User extends Api
|
|
|
}
|
|
|
|
|
|
$this->success('验证通过');
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
/**
|
|
|
* 手机验证码注册
|
|
@@ -174,7 +196,7 @@ class User extends Api
|
|
|
* @param string $captcha 验证码
|
|
|
* @param string $gender 性别:1=男,0=女
|
|
|
*/
|
|
|
- public function mobileregister()
|
|
|
+ /*public function mobileregister()
|
|
|
{
|
|
|
$mobile = input('mobile');
|
|
|
$captcha = input('captcha');
|
|
@@ -221,14 +243,14 @@ class User extends Api
|
|
|
} else {
|
|
|
$this->error($this->auth->getError());
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 运营商一键登录
|
|
|
*/
|
|
|
- public function onLogin()
|
|
|
+ /*public function onLogin()
|
|
|
{
|
|
|
$accessToken = input('accessToken');// 运营商预取号获取到的token
|
|
|
$token = input('tokenT');// 易盾返回的token
|
|
@@ -302,12 +324,12 @@ class User extends Api
|
|
|
} else {
|
|
|
$this->error("登录失败,请用验证码方式登录!");
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
/**
|
|
|
* 运营商一键登录注册
|
|
|
*/
|
|
|
- public function onregister()
|
|
|
+ /*public function onregister()
|
|
|
{
|
|
|
$accessToken = input('accessToken');// 运营商预取号获取到的token
|
|
|
$token = input('tokenT');// 易盾返回的token
|
|
@@ -384,7 +406,7 @@ class User extends Api
|
|
|
} else {
|
|
|
$this->error("登录失败,请用验证码方式登录!");
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
//用户详细资料
|
|
|
public function userInfo($type = 1){
|
|
@@ -397,7 +419,7 @@ class User extends Api
|
|
|
|
|
|
|
|
|
//微信登录,预先假注册
|
|
|
- public function wechatlogin(){
|
|
|
+ /*public function wechatlogin(){
|
|
|
$code = input('code','');
|
|
|
if(!$code){
|
|
|
$this->error(__('Invalid parameters'));
|
|
@@ -457,7 +479,7 @@ class User extends Api
|
|
|
$this->success('获取信息成功', $userInfo);
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
/**
|
|
|
* 微信注册来的,绑定手机号
|
|
@@ -466,7 +488,7 @@ class User extends Api
|
|
|
* @param string $mobile 手机号
|
|
|
* @param string $captcha 验证码
|
|
|
*/
|
|
|
- public function wechatbindmobile()
|
|
|
+ /*public function wechatbindmobile()
|
|
|
{
|
|
|
$mobile = $this->request->param('mobile');
|
|
|
$captcha = $this->request->param('captcha');
|
|
@@ -528,7 +550,7 @@ class User extends Api
|
|
|
|
|
|
$this->success('success',$this->auth->getUserinfo());
|
|
|
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
|
|
@@ -911,7 +933,7 @@ class User extends Api
|
|
|
* @param string $mobile 手机号
|
|
|
* @param string $captcha 验证码
|
|
|
*/
|
|
|
- public function bindmobile()
|
|
|
+ /*public function bindmobile()
|
|
|
{
|
|
|
$user = $this->auth->getUser();
|
|
|
$mobile = $this->request->request('mobile');
|
|
@@ -948,7 +970,7 @@ class User extends Api
|
|
|
return false;
|
|
|
}
|
|
|
$this->success('success',$this->userInfo('return'));
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
/**
|
|
|
* 手机号注册来的,绑定微信
|
|
@@ -956,7 +978,7 @@ class User extends Api
|
|
|
* @ApiMethod (POST)
|
|
|
* @param string wechat_openid 微信openid
|
|
|
*/
|
|
|
- public function bindopenid()
|
|
|
+ /*public function bindopenid()
|
|
|
{
|
|
|
$user = $this->auth->getUser();
|
|
|
$wechat_openid = $this->request->request('wechat_openid');
|
|
@@ -976,7 +998,7 @@ class User extends Api
|
|
|
$user->save();
|
|
|
|
|
|
$this->success('success',$this->userInfo('return'));
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
|
|
@@ -1129,23 +1151,23 @@ class User extends Api
|
|
|
}
|
|
|
|
|
|
//修改用户活跃1
|
|
|
- public function useractive(){
|
|
|
+ /*public function useractive(){
|
|
|
$this->success('success');
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
//公众号获取openid
|
|
|
- public function getUserOpenid_gzh(){
|
|
|
+ /*public function getUserOpenid_gzh(){
|
|
|
$configValue = Service::getConfig('wechat');
|
|
|
|
|
|
$wechat = new Wechat($configValue['app_id'],$configValue['app_secret']);
|
|
|
$rs = $wechat->getOpenid();
|
|
|
$this->success('success',$rs);
|
|
|
- }
|
|
|
+ }*/
|
|
|
/**
|
|
|
* 微信内H5-JSAPI支付
|
|
|
*/
|
|
|
- public function jssdkBuildConfig() {
|
|
|
+ /*public function jssdkBuildConfig() {
|
|
|
$url = $this->request->request("url");
|
|
|
|
|
|
$configValue = Service::getConfig('wechat');
|
|
@@ -1153,19 +1175,19 @@ class User extends Api
|
|
|
|
|
|
$sign = $wechat->getSignPackage(urldecode($url));
|
|
|
$this->success("获取成功!",$sign);
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
//苹果账号登录
|
|
|
- public function ioslogin(){
|
|
|
+ /*public function ioslogin(){
|
|
|
$ios_openid = input('ios_openid','');
|
|
|
if (!$ios_openid) {
|
|
|
$this->error(__('Invalid parameters'));
|
|
|
}
|
|
|
|
|
|
$user = Db::name('user')->where(['ios_openid' => $ios_openid])->find();
|
|
|
- /*if (!$user) {
|
|
|
- $this->success('选择性别', ['code' => 5]);
|
|
|
- }*/
|
|
|
+// if (!$user) {
|
|
|
+// $this->success('选择性别', ['code' => 5]);
|
|
|
+// }
|
|
|
if ($user) {
|
|
|
if (!in_array($user->status,[1,2])) {
|
|
|
$this->error(__('Account is locked'));
|
|
@@ -1188,10 +1210,10 @@ class User extends Api
|
|
|
} else {
|
|
|
$this->error($this->auth->getError());
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
//苹果账号注册
|
|
|
- public function iosregiter(){
|
|
|
+ /*public function iosregiter(){
|
|
|
$ios_openid = input('ios_openid', '', 'trim');
|
|
|
$gender = input('gender', -1, 'intval'); //性别:1=男,0=女
|
|
|
if (!$ios_openid) {
|
|
@@ -1218,7 +1240,7 @@ class User extends Api
|
|
|
} else {
|
|
|
$this->error($this->auth->getError());
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
//注册完善资料
|
|
|
public function perfect_info() {
|