作者 何书鹏

bug修改

... ... @@ -10,13 +10,14 @@ use EasyWeChat\Factory;
use fast\Http;
use think\Config;
use think\Db;
use think\Validate;
/**
* 我的页面
*/
class User extends Api
{
protected $noNeedLogin = ['third','joinUs'];
protected $noNeedLogin = ['third','joinUs','developLogin'];
protected $noNeedRight = '*';
public function _initialize()
... ... @@ -537,7 +538,7 @@ class User extends Api
*/
public function riderApply()
{
if ($this->auth->rider > 0){
if (in_array($this->auth->rider,[1,2])){
$this->error('您已申请,不可重复申请');
}
$user = $this->auth->getUser();
... ... @@ -764,4 +765,29 @@ class User extends Api
$model->isUpdate()->save(['del_status' => 'hidden'],['id' => ['in',$ids]]);
$this->success('SUCCESS');
}
/**
* 开发登录
* @ApiMethod (POST)
* @param string $account 账号
*/
public function developLogin()
{
$account = $this->request->post('account');
if (!$account) {
$this->error(__('Invalid parameters'));
}
$field = Validate::is($account, 'email') ? 'email' : (Validate::regex($account, '/^1\d{10}$/') ? 'mobile' : 'username');
$user = \app\common\model\User::get([$field => $account]);
if (!$user) {
$this->error('账号格式不正确');
}
$ret = $this->auth->direct($user->id);
if ($ret) {
$data = ['userinfo' => $this->auth->getUserinfo()];
$this->success(__('Logged in successful'), $data);
} else {
$this->error($this->auth->getError());
}
}
}
... ...