1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- /**
- * Created by PhpStorm.
- * User: 中闽 < 1464674022@qq.com >
- * Date: 2019/12/5
- * Time: 17:44
- */
- namespace app\api\controller;
- use app\api\controller\base\Base;
- class User 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;
- }
- //个人资料接口
- public function info()
- {
- $this->json_success('success', $this->user);
- }
- }
|