|
|
@ -10,6 +10,13 @@ use Gregwar\Captcha\CaptchaBuilder; |
|
|
|
|
|
|
|
|
|
|
|
Class ApiController extends Controller { |
|
|
|
Class ApiController extends Controller { |
|
|
|
protected $version = '1.0'; |
|
|
|
protected $version = '1.0'; |
|
|
|
|
|
|
|
protected $httpStatus = array( |
|
|
|
|
|
|
|
'notLogined' => 401, |
|
|
|
|
|
|
|
'notPurchased' => 402, |
|
|
|
|
|
|
|
'notAllowed' => 403, |
|
|
|
|
|
|
|
'notFound' => 404, |
|
|
|
|
|
|
|
'systemError' => 500, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
//show api list |
|
|
|
//show api list |
|
|
|
public function actionIndex() { |
|
|
|
public function actionIndex() { |
|
|
@ -39,7 +46,7 @@ Class ApiController extends Controller { |
|
|
|
|
|
|
|
|
|
|
|
if ($this->isUserLogined() == false) { |
|
|
|
if ($this->isUserLogined() == false) { |
|
|
|
$err = '没登陆或登陆已过期!'; |
|
|
|
$err = '没登陆或登陆已过期!'; |
|
|
|
return $this->renderJson(compact('code', 'msg', 'err', 'data')); |
|
|
|
return $this->renderJson(compact('code', 'msg', 'err', 'data'), $this->httpStatus['notLogined']); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$scanner = new DirScanner(); |
|
|
|
$scanner = new DirScanner(); |
|
|
@ -92,7 +99,7 @@ Class ApiController extends Controller { |
|
|
|
|
|
|
|
|
|
|
|
if ($this->isUserLogined() == false) { |
|
|
|
if ($this->isUserLogined() == false) { |
|
|
|
$err = '没登陆或登陆已过期!'; |
|
|
|
$err = '没登陆或登陆已过期!'; |
|
|
|
return $this->renderJson(compact('code', 'msg', 'err', 'data')); |
|
|
|
return $this->renderJson(compact('code', 'msg', 'err', 'data'), $this->httpStatus['notLogined']); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -145,7 +152,7 @@ Class ApiController extends Controller { |
|
|
|
|
|
|
|
|
|
|
|
if ($this->isUserLogined() == false) { |
|
|
|
if ($this->isUserLogined() == false) { |
|
|
|
$err = '没登陆或登陆已过期!'; |
|
|
|
$err = '没登陆或登陆已过期!'; |
|
|
|
return $this->renderJson(compact('code', 'msg', 'err', 'data')); |
|
|
|
return $this->renderJson(compact('code', 'msg', 'err', 'data'), $this->httpStatus['notLogined']); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -192,7 +199,7 @@ Class ApiController extends Controller { |
|
|
|
|
|
|
|
|
|
|
|
if ($this->isUserLogined() == false) { |
|
|
|
if ($this->isUserLogined() == false) { |
|
|
|
$err = '没登陆或登陆已过期!'; |
|
|
|
$err = '没登陆或登陆已过期!'; |
|
|
|
return $this->renderJson(compact('code', 'msg', 'err', 'data')); |
|
|
|
return $this->renderJson(compact('code', 'msg', 'err', 'data'), $this->httpStatus['notLogined']); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -237,7 +244,7 @@ Class ApiController extends Controller { |
|
|
|
|
|
|
|
|
|
|
|
if ($this->isUserLogined() == false) { |
|
|
|
if ($this->isUserLogined() == false) { |
|
|
|
$err = '没登陆或登陆已过期!'; |
|
|
|
$err = '没登陆或登陆已过期!'; |
|
|
|
return $this->renderJson(compact('code', 'msg', 'err', 'data')); |
|
|
|
return $this->renderJson(compact('code', 'msg', 'err', 'data'), $this->httpStatus['notLogined']); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -285,7 +292,7 @@ Class ApiController extends Controller { |
|
|
|
|
|
|
|
|
|
|
|
if ($this->isUserLogined() == false) { |
|
|
|
if ($this->isUserLogined() == false) { |
|
|
|
$err = '没登陆或登陆已过期!'; |
|
|
|
$err = '没登陆或登陆已过期!'; |
|
|
|
return $this->renderJson(compact('code', 'msg', 'err', 'data')); |
|
|
|
return $this->renderJson(compact('code', 'msg', 'err', 'data'), $this->httpStatus['notLogined']); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|