12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- /**
- * Created by PhpStorm.
- * User: 中闽 < 1464674022@qq.com >
- * Date: 2019/12/5
- * Time: 17:44
- */
- namespace app\api\controller\base;
- /**
- * 登入鉴权的接口父类
- * Class Permissions
- * @package app\api\controller\base
- */
- class Permissions extends Base
- {
- protected $user;
- protected function _initialize()
- {
- $unionid = $this->request->param('unionid');
- if (!$unionid) {
- $openid = $this->request->param('openid');
- if (!$openid) {
- $this->json_error('请先登入');
- }
- $user = \app\common\model\User::get(['openid' => $openid]);
- if (!$user) {
- $this->json_error('账号不存在');
- }
- }
- $user = \app\common\model\User::get(['unionid' => $unionid]);
- if (!$user) {
- $this->json_error('账号不存在');
- }
- $this->user = $user;
- }
- }
|