浏览代码

Merge remote-tracking branch 'origin/yijia' into yijia

yijia
xubinxcode 2 年前
父节点
当前提交
a9205c04f5
共有 1 个文件被更改,包括 13 次插入13 次删除
  1. +13
    -13
      addons/unishop/controller/Base.php

+ 13
- 13
addons/unishop/controller/Base.php 查看文件

@@ -41,19 +41,19 @@ class Base extends Api
* @param int $millisecond
*/
public function limitVisit($millisecond = 200) {
$millisecond = $this->request->request('millisecond', $millisecond);
// 限制200毫秒 防止1秒两刀 (双击甚至三击,同一时间导致接口请求两次以上)
$action = $this->request->action();
if (!in_array($action, $this->frequently) && $this->auth && $this->auth->isLogin() && $millisecond > 0) {
$controller = $this->request->controller();
if (Cache::has($controller.'_'.$action.'_'.$this->auth->id)) {
if (Cache::get($controller.'_'.$action.'_'.$this->auth->id) + $millisecond > \addons\unishop\model\Config::getMillisecond()) {
$this->error(__('Frequent interface requests'));
}
}
Cache::set($controller.'_'.$action.'_'.$this->auth->id, \addons\unishop\model\Config::getMillisecond(), 1);
}
// $millisecond = $this->request->request('millisecond', $millisecond);
//
// // 限制200毫秒 防止1秒两刀 (双击甚至三击,同一时间导致接口请求两次以上)
// $action = $this->request->action();
// if (!in_array($action, $this->frequently) && $this->auth && $this->auth->isLogin() && $millisecond > 0) {
// $controller = $this->request->controller();
// if (Cache::has($controller.'_'.$action.'_'.$this->auth->id)) {
// if (Cache::get($controller.'_'.$action.'_'.$this->auth->id) + $millisecond > \addons\unishop\model\Config::getMillisecond()) {
// $this->error(__('Frequent interface requests'));
// }
// }
// Cache::set($controller.'_'.$action.'_'.$this->auth->id, \addons\unishop\model\Config::getMillisecond(), 1);
// }
}

/**


正在加载...
取消
保存