|
@@ -129,12 +129,12 @@ class Api
|
|
|
$this->error(__('Please login first'), null, 401);
|
|
|
}
|
|
|
// 判断是否需要验证权限
|
|
|
- if (!$this->auth->match($this->noNeedRight)) {
|
|
|
+ /*if (!$this->auth->match($this->noNeedRight)) {
|
|
|
// 判断控制器和方法判断是否有对应权限
|
|
|
if (!$this->auth->check($path)) {
|
|
|
$this->error(__('You have no permission'), null, 403);
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
} else {
|
|
|
// 如果有传递token才验证是否登录状态
|
|
|
if ($token) {
|
|
@@ -173,6 +173,9 @@ class Api
|
|
|
*/
|
|
|
protected function success($msg = '', $data = null, $code = 1, $type = null, array $header = [])
|
|
|
{
|
|
|
+ if($msg == 1){
|
|
|
+ $msg = 'success';
|
|
|
+ }
|
|
|
if(empty($msg)){
|
|
|
$msg = '操作成功';
|
|
|
}
|
|
@@ -411,6 +414,12 @@ class Api
|
|
|
$redis = new Redis();
|
|
|
$redisconfig = config("redis");
|
|
|
$redis->connect($redisconfig["host"], $redisconfig["port"]);
|
|
|
+ if ($redisconfig['redis_pwd']) {
|
|
|
+ $redis->auth($redisconfig['redis_pwd']);
|
|
|
+ }
|
|
|
+ if($redisconfig['redis_selectdb'] > 0){
|
|
|
+ $redis->select($redisconfig['redis_selectdb']);
|
|
|
+ }
|
|
|
$check = $redis->exists($key);
|
|
|
if ($check) {
|
|
|
$redis->incr($key);
|