调整表名

This commit is contained in:
qinzongqing 2023-04-10 16:12:59 +08:00
parent 1e41961950
commit d45abf2adb
5 changed files with 27 additions and 27 deletions

View File

@ -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;

View File

@ -3,7 +3,7 @@
* AccessToken表
* @author QZQ
*/
class Accesstoken extends ModelBase{
class AccessToken extends ModelBase{
public function initialize(){
$this->setSource("smsapioauth2_accesstoken");

View File

@ -1,9 +1,9 @@
<?php
/**
* Appinfo表
* AppInfo表
* @author QZQ
*/
class Appinfo extends ModelBase{
class AppInfo extends ModelBase{
public function initialize(){
$this->setSource("smsapioauth2_appinfo");

View File

@ -1,9 +1,9 @@
<?php
/**
* Refreshtoken表
* RefreshToken表
* @author QZQ
*/
class Refreshtoken extends ModelBase{
class RefreshToken extends ModelBase{
public function initialize(){
$this->setSource("smsapioauth2_refreshtoken");

View File

@ -1,9 +1,9 @@
<?php
/**
* Tempcode表
* TempCode表
* @author QZQ
*/
class Tempcode extends ModelBase{
class TempCode extends ModelBase{
public function initialize(){
$this->setSource("smsapioauth2_tempcode");