From d45abf2adb15e6c4fb7bd19b289eef6909f33b47 Mon Sep 17 00:00:00 2001 From: qinzongqing Date: Mon, 10 Apr 2023 16:12:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=A1=A8=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/Oauth2Controller.php | 40 ++++++++++++++-------------- app/models/Accesstoken.php | 2 +- app/models/Appinfo.php | 4 +-- app/models/Refreshtoken.php | 4 +-- app/models/Tempcode.php | 4 +-- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/app/controllers/Oauth2Controller.php b/app/controllers/Oauth2Controller.php index cce547a..5c4fa69 100644 --- a/app/controllers/Oauth2Controller.php +++ b/app/controllers/Oauth2Controller.php @@ -54,9 +54,9 @@ class Oauth2Controller extends ControllerBase{ //准备判断appid是否有效 $appid = $request_arr['appid']; //查询接口信息 - $appinfo = Appinfo::findFirst("AppId = '$appid' AND Enable = 0"); + $app_info = AppInfo::findFirst("AppId = '$appid' AND Enable = 0"); //如果未查询到接口信息 - if(empty($appinfo)){ + if(empty($app_info)){ //告知用户找不到app配置信息,appid无效,err detail:找不到app配置信息 $rs['errmsg'] = "找不到app配置信息,appid无效,err detail:找不到app配置信息"; $rs['errcode'] = 40036; @@ -65,16 +65,16 @@ class Oauth2Controller extends ControllerBase{ //如果有查询到接口信息 else{ //获取上次请求日期 - $last_req_time = $appinfo->LastReqTime; + $last_req_time = $app_info->LastReqTime; $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; + $today_req_times = $app_info->TodayReqTimes; //获取接口请求次数限制 - $day_max_req_times = $appinfo->DayMaxReqTimes; + $day_max_req_times = $app_info->DayMaxReqTimes; //如果上次请求日期是当天日期 if($last_req_date==$current_date){ //如果当天请求次数已达到接口请求次数限制 @@ -108,12 +108,12 @@ class Oauth2Controller extends ControllerBase{ //如果以上判断都通过 if(empty($rs['errcode'])){ //准备更新当天请求次数 - $appinfo->LastModifiedTime = $current_datetime; + $app_info->LastModifiedTime = $current_datetime; //更新字段 - $appinfo->TodayReqTimes = $today_req_times; - $appinfo->LastReqTime = $current_date; + $app_info->TodayReqTimes = $today_req_times; + $app_info->LastReqTime = $current_date; //如果更新失败 - if(!($appinfo->save())){ + if(!($app_info->save())){ //告知用户系统繁忙,请稍候再试 $rs['errmsg'] = "系统繁忙,请稍候再试"; $rs['errcode'] = -1; @@ -122,26 +122,26 @@ class Oauth2Controller extends ControllerBase{ //如果更新成功 else{ //查询当前接口今天是否有生成过code - $tempcode = Tempcode::findFirst("AppId = '$appid'"); + $temp_code = TempCode::findFirst("AppId = '$appid'"); //如果当前接口过去未生成过code - if(empty($tempcode)){ + if(empty($temp_code)){ //准备新增临时code - $tempcode = new Tempcode(); - $tempcode->AppId = $appid; - $tempcode->CreateTime = $current_datetime; - $tempcode->LastModifiedTime = $current_datetime; + $temp_code = new TempCode(); + $temp_code->AppId = $appid; + $temp_code->CreateTime = $current_datetime; + $temp_code->LastModifiedTime = $current_datetime; } //如果当前接口过去有生成过code else{ //准备更新临时code - $tempcode->LastModifiedTime = $current_datetime; + $temp_code->LastModifiedTime = $current_datetime; } //更新字段 - $tempcode->Code = $code = $this->_get_act_code(32); - $tempcode->IsUsed = 0; - $tempcode->ExpireTime = date("Y-m-d H:i:s", $current_time+300); + $temp_code->Code = $code = $this->_get_act_code(32); + $temp_code->IsUsed = 0; + $temp_code->ExpireTime = date("Y-m-d H:i:s", $current_time+300); //如果保存失败 - if(!($tempcode->save())){ + if(!($temp_code->save())){ //告知用户系统繁忙,请稍候再试 $rs['errmsg'] = "系统繁忙,请稍候再试"; $rs['errcode'] = -1; diff --git a/app/models/Accesstoken.php b/app/models/Accesstoken.php index c9b31dd..530cf2f 100644 --- a/app/models/Accesstoken.php +++ b/app/models/Accesstoken.php @@ -3,7 +3,7 @@ * AccessToken表 * @author QZQ */ -class Accesstoken extends ModelBase{ +class AccessToken extends ModelBase{ public function initialize(){ $this->setSource("smsapioauth2_accesstoken"); diff --git a/app/models/Appinfo.php b/app/models/Appinfo.php index df98588..7eebb7d 100644 --- a/app/models/Appinfo.php +++ b/app/models/Appinfo.php @@ -1,9 +1,9 @@ setSource("smsapioauth2_appinfo"); diff --git a/app/models/Refreshtoken.php b/app/models/Refreshtoken.php index f3c209a..535fffb 100644 --- a/app/models/Refreshtoken.php +++ b/app/models/Refreshtoken.php @@ -1,9 +1,9 @@ setSource("smsapioauth2_refreshtoken"); diff --git a/app/models/Tempcode.php b/app/models/Tempcode.php index 332d4a7..df67270 100644 --- a/app/models/Tempcode.php +++ b/app/models/Tempcode.php @@ -1,9 +1,9 @@ setSource("smsapioauth2_tempcode");