备份提交
This commit is contained in:
parent
0fa3305acd
commit
0a99f80c67
@ -18,6 +18,7 @@ class Oauth2Controller extends ControllerBase{
|
|||||||
function testAction(){
|
function testAction(){
|
||||||
$url = "http://wxapp.wemediacn.com/smsoauth2_qa/api/oauth2/code";
|
$url = "http://wxapp.wemediacn.com/smsoauth2_qa/api/oauth2/code";
|
||||||
$post_arr = array();
|
$post_arr = array();
|
||||||
|
//$post_arr['appid'] = 111;
|
||||||
$post_arr['appid'] = "0e355010-67b9-4aa6-a53f-c92c972094a7";
|
$post_arr['appid'] = "0e355010-67b9-4aa6-a53f-c92c972094a7";
|
||||||
$post_json = json_encode($post_arr);
|
$post_json = json_encode($post_arr);
|
||||||
$result = $this->__http_post_request($url, $post_json, true);
|
$result = $this->__http_post_request($url, $post_json, true);
|
||||||
@ -29,7 +30,50 @@ class Oauth2Controller extends ControllerBase{
|
|||||||
* http://127.0.0.1/tiffany/api/oauth2/code?qaz=wsx
|
* http://127.0.0.1/tiffany/api/oauth2/code?qaz=wsx
|
||||||
*/
|
*/
|
||||||
function codeAction(){
|
function codeAction(){
|
||||||
echo "111"; die;
|
//如果未获取到请求数据
|
||||||
|
if(empty($this->request->getPost())){
|
||||||
|
//告知用户系统繁忙,请稍候再试
|
||||||
|
$rs['errcode'] = -1;
|
||||||
|
$rs['errmsg'] = "系统繁忙,请稍候再试";
|
||||||
|
$rs['data'] = null;
|
||||||
|
}
|
||||||
|
//如果有获取到请求数据
|
||||||
|
else{
|
||||||
|
//准备获取appid
|
||||||
|
$request_arr = json_decode($this->request->getPost(), true);
|
||||||
|
//如果未获取到appid
|
||||||
|
if(empty($request_arr['appid'])){
|
||||||
|
//告知用户参数错误 error detail:appid is empty;
|
||||||
|
$rs['errcode'] = 61451;
|
||||||
|
$rs['errmsg'] = "参数错误 error detail:appid is empty;";
|
||||||
|
$rs['data'] = null;
|
||||||
|
}
|
||||||
|
//如果有获取到appid
|
||||||
|
else{
|
||||||
|
//准备判断appid是否有效
|
||||||
|
$appid = $request_arr['appid'];
|
||||||
|
//查询接口信息
|
||||||
|
$appinfo = Appinfo::findFirst("Appid = '$appid' AND Enable = 0");
|
||||||
|
//如果未查询到接口信息
|
||||||
|
if(empty($appinfo)){
|
||||||
|
//告知用户找不到app配置信息,appid无效,err detail:找不到app配置信息
|
||||||
|
$rs['errcode'] = 40036;
|
||||||
|
$rs['errmsg'] = "找不到app配置信息,appid无效,err detail:找不到app配置信息";
|
||||||
|
$rs['data'] = null;
|
||||||
|
}
|
||||||
|
//如果有查询到接口信息
|
||||||
|
else{
|
||||||
|
//获取上次请求日期
|
||||||
|
$last_req_time = $appinfo->LastReqTime;
|
||||||
|
$last_req_date = date("Y-m-d", strtotime($last_req_time));
|
||||||
|
//
|
||||||
|
//准备更新请求次数
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//返回结果
|
||||||
|
echo json_encode($rs, JSON_UNESCAPED_UNICODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
* AccessToken表
|
* AccessToken表
|
||||||
* @author QZQ
|
* @author QZQ
|
||||||
*/
|
*/
|
||||||
class Smsapioauth2Accesstoken extends AppModel{
|
class Accesstoken extends AppModel{
|
||||||
|
|
||||||
public function initialize(){
|
public function initialize(){
|
||||||
$this->setSource("smsapioauth2_accesstoken");
|
$this->setSource("smsapioauth2_accesstoken");
|
||||||
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* AccessToken表
|
* Appinfo表
|
||||||
* @author QZQ
|
* @author QZQ
|
||||||
*/
|
*/
|
||||||
class Smsapioauth2Appinfo extends AppModel{
|
class Appinfo extends AppModel{
|
||||||
|
|
||||||
public function initialize(){
|
public function initialize(){
|
||||||
$this->setSource("smsapioauth2_appinfo");
|
$this->setSource("smsapioauth2_appinfo");
|
||||||
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* AccessToken表
|
* Refreshtoken表
|
||||||
* @author QZQ
|
* @author QZQ
|
||||||
*/
|
*/
|
||||||
class Smsapioauth2Refreshtoken extends AppModel{
|
class Refreshtoken extends AppModel{
|
||||||
|
|
||||||
public function initialize(){
|
public function initialize(){
|
||||||
$this->setSource("smsapioauth2_refreshtoken");
|
$this->setSource("smsapioauth2_refreshtoken");
|
||||||
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* AccessToken表
|
* Tempcode表
|
||||||
* @author QZQ
|
* @author QZQ
|
||||||
*/
|
*/
|
||||||
class Smsapioauth2Tempcode extends AppModel{
|
class Tempcode extends AppModel{
|
||||||
|
|
||||||
public function initialize(){
|
public function initialize(){
|
||||||
$this->setSource("smsapioauth2_tempcode");
|
$this->setSource("smsapioauth2_tempcode");
|
||||||
Loading…
Reference in New Issue
Block a user