Bladeren bron

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

yijia
xubinxcode 2 jaren geleden
bovenliggende
commit
a9205c04f5
1 gewijzigde bestanden met toevoegingen van 13 en 13 verwijderingen
  1. +13
    -13
      addons/unishop/controller/Base.php

+ 13
- 13
addons/unishop/controller/Base.php Bestand weergeven

@@ -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);
// }
}

/**


Laden…
Annuleren
Opslaan