41 lines
		
	
	
		
			948 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
		
		
			
		
	
	
			41 lines
		
	
	
		
			948 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| 
								 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace app\api\controller\openapi;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * 本服务器openid:用户开放接口
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								class User extends Base
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * 初始化操作
							 | 
						||
| 
								 | 
							
								     * @access protected
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    protected function _initialize()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        parent::_initialize();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * @ApiTitle( 用户中心)
							 | 
						||
| 
								 | 
							
								     * @ApiSummary(用户中心)
							 | 
						||
| 
								 | 
							
								     * @ApiMethod(POST)
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "key", type = "string",required=false,description = "调用key")
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "encryption_data", type = "string",required=true,description = "加密数据")
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "sign", type = "string",required=true,description = "签名")
							 | 
						||
| 
								 | 
							
								     * @ApiReturn({
							 | 
						||
| 
								 | 
							
								     *
							 | 
						||
| 
								 | 
							
								     *})
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public function index()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        $user_id = 0;
							 | 
						||
| 
								 | 
							
								        $user = $this->auth->getUser();//登录用户
							 | 
						||
| 
								 | 
							
								        if($user)$user_id = $user['id'];
							 | 
						||
| 
								 | 
							
								        if(!$user_id) $this->error(__('请登录'));
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $this->success('请求成功',$user);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 |