更新内核,API接口开发的一些尝试,后期会增加API接口开发这块
This commit is contained in:
@@ -8,10 +8,30 @@
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\api\controller;
|
||||
use app\common\controller\User;
|
||||
|
||||
class Index extends Api{
|
||||
use think\Request;
|
||||
|
||||
public function index(){
|
||||
class Index extends Base {
|
||||
|
||||
public $apiAuth = true;
|
||||
// 允许访问的请求类型
|
||||
protected $restMethodList = 'get|post|';
|
||||
|
||||
/**
|
||||
* get的响应
|
||||
* @param Request $request
|
||||
* @return mixed
|
||||
*/
|
||||
public function getResponse(Request $request) {
|
||||
return $this->sendError(1001, 'THIS IS GET', 400);
|
||||
}
|
||||
|
||||
/**
|
||||
* post的响应
|
||||
* @param Request $request
|
||||
* @return mixed
|
||||
*/
|
||||
public function postResponse(Request $request) {
|
||||
return $this->sendSuccess('THIS IS POST');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user