|
@@ -16,7 +16,7 @@ use app\common\library\Wechat;
|
|
|
*/
|
|
|
class User extends Api
|
|
|
{
|
|
|
- protected $noNeedLogin = ['login', 'mobilelogin', 'wechatlogin', 'bindmobile','register', 'resetpwd', 'changeemail', 'changemobile', 'third'];
|
|
|
+ protected $noNeedLogin = ['login', 'mobilelogin', 'tvuser_login', 'wechatlogin', 'bindmobile','register', 'resetpwd', 'changeemail', 'changemobile', 'third'];
|
|
|
protected $noNeedRight = '*';
|
|
|
|
|
|
public function _initialize()
|
|
@@ -213,6 +213,49 @@ class User extends Api
|
|
|
|
|
|
}
|
|
|
|
|
|
+ //电视盒子用户登录。
|
|
|
+ public function tvuser_login(){
|
|
|
+ $tv_userid = input('tv_userid','');
|
|
|
+ $tv_mobile = input('tv_mobile','');
|
|
|
+ $tv_signtime = input('tv_signtime','');
|
|
|
+ $tv_sign = input('tv_sign','');
|
|
|
+ if(empty($tv_userid) || empty($tv_mobile) || empty($tv_signtime) || empty($tv_sign)){
|
|
|
+ $this->error('登录参数缺失');
|
|
|
+ }
|
|
|
+
|
|
|
+ //验签
|
|
|
+ $salt = 'be7bcf1499b0fec801406f6aafbd04c4';
|
|
|
+ $get_sign = md5(md5($tv_userid) . $tv_signtime . $salt);
|
|
|
+ if($tv_sign != $get_sign){
|
|
|
+ $this->error('验签失败');
|
|
|
+ }
|
|
|
+ if(time() - $tv_signtime > 300){
|
|
|
+ //测试临时屏蔽
|
|
|
+ $this->error('验签过期');
|
|
|
+ }
|
|
|
+
|
|
|
+ //找到用户
|
|
|
+ $user = Db::name('user')->where('tv_userid',$tv_userid)->find();
|
|
|
+ if ($user) {
|
|
|
+ /*if ($user['status'] == -1) {
|
|
|
+ $this->error('账号已注销');
|
|
|
+ }
|
|
|
+ if ($user['status'] != 1) {
|
|
|
+ $this->error(__('Account is locked'));
|
|
|
+ }*/
|
|
|
+ //如果已经有账号则直接登录
|
|
|
+ $ret = $this->auth->direct($user['id']);
|
|
|
+ } else {
|
|
|
+ $extend = ['tv_mobile'=>$tv_mobile];
|
|
|
+ $ret = $this->auth->tv_register($tv_userid,$extend);
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($ret) {
|
|
|
+ $this->success(__('Logged in successful'), $this->auth->getUserinfo_simple());
|
|
|
+ } else {
|
|
|
+ $this->error($this->auth->getError());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//用户详细资料
|
|
|
public function userInfo(){
|