备份提交

This commit is contained in:
qinzongqing 2023-04-10 15:24:40 +08:00
parent 0a99f80c67
commit 17b38485fd

View File

@ -66,9 +66,45 @@ class Oauth2Controller extends ControllerBase{
//获取上次请求日期 //获取上次请求日期
$last_req_time = $appinfo->LastReqTime; $last_req_time = $appinfo->LastReqTime;
$last_req_date = date("Y-m-d", strtotime($last_req_time)); $last_req_date = date("Y-m-d", strtotime($last_req_time));
// //获取当前时间及当天日期
$current_time = time();
$current_datetime = date("Y-m-d H:i:s", $current_time);
$current_date = date("Y-m-d", $current_time);
//获取上次请求日期所在日的请求次数
$today_req_times = $appinfo->TodayReqTimes;
//获取接口请求次数限制
$day_max_req_times = $appinfo->DayMaxReqTimes;
//如果上次请求日期是当天日期
if($last_req_date==$current_date){
//如果当天请求次数已达到接口请求次数限制
if($today_req_times>=$day_max_req_times){
//告知用户request today reached the request limit,err detail:超过请求上限限制
$rs['errcode'] = 80102;
$rs['errmsg'] = "request today reached the request limit,err detail:超过请求上限限制";
$rs['data'] = null;
}
//如果当天请求次数尚未达到接口请求次数限制
else{
}
}
//如果上次请求日期不是当天日期
else{
//如果接口请求次数限制不大于0
if($day_max_req_times<=0){
//告知用户request today reached the request limit,err detail:超过请求上限限制
$rs['errcode'] = 80102;
$rs['errmsg'] = "request today reached the request limit,err detail:超过请求上限限制";
$rs['data'] = null;
}
}
//如果以上判断都通过
if(empty($rs['errcode'])){
//开启事务
$this->db->begin();
//准备更新请求次数 //准备更新请求次数
}
} }
} }
} }