From 21e9d1324123aca7faca59990e0f3cfe33db2b95 Mon Sep 17 00:00:00 2001 From: wangmingqing Date: Mon, 29 May 2023 16:25:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/config/consts.php | 11 +++- app/config/router.php | 96 ++++++++++++++++++++++++++++ app/controllers/Oauth2Controller.php | 4 +- 3 files changed, 106 insertions(+), 5 deletions(-) diff --git a/app/config/consts.php b/app/config/consts.php index de842a7..d8c5da1 100644 --- a/app/config/consts.php +++ b/app/config/consts.php @@ -71,11 +71,16 @@ else{ define("WE_SURL_API_TIFFANY_TOKEN", "TH3UOn1Z4p7aJFS5q8eE6Kmt9xWQsocw"); //数据库连接 + // define("MYSQL_CONNECT_HOST", "rds0yslqyg1iuze8txux545.mysql.rds.aliyuncs.com"); + // define("MYSQL_CONNECT_USERNAME", "tiffany"); + // define("MYSQL_CONNECT_PASSWORD", "50iRVc5EZURndwf5"); + // define("MYSQL_CONNECT_DBNAME", "sms"); + define("MYSQL_CONNECT_HOST", "rds0yslqyg1iuze8txux545.mysql.rds.aliyuncs.com"); - define("MYSQL_CONNECT_USERNAME", "tiffany"); - define("MYSQL_CONNECT_PASSWORD", "50iRVc5EZURndwf5"); + define("MYSQL_CONNECT_USERNAME", "sms"); + define("MYSQL_CONNECT_PASSWORD", "F1js6Dk3ehi"); define("MYSQL_CONNECT_DBNAME", "sms"); - + //REDIS DB define("REDIS_DB_NUMBER", 30); } diff --git a/app/config/router.php b/app/config/router.php index f705148..989063f 100644 --- a/app/config/router.php +++ b/app/config/router.php @@ -22,6 +22,54 @@ if(!empty($_SERVER['HTTP_HOST']) && (preg_match("@weapp\.wemediacn@", strtolower "params"=>3 ) ); + + $router->add( + "/smsoauth2_qa/api/oauth2/code", + array( + "controller" => 'oauth2' , + "action" => 'code', + ) + ); + + $router->add( + "/smsoauth2_qa/api/oauth2/accesstoken", + array( + "controller" => 'oauth2' , + "action" => 'accesstoken', + ) + ); + + $router->add( + "/smsoauth2_qa/api/sms/send", + array( + "controller" => 'sms' , + "action" => 'send', + ) + ); + + $router->add( + "/smsoauth2_qa/api/sms/authcode", + array( + "controller" => 'sms' , + "action" => 'authcode', + ) + ); + + $router->add( + "/smsoauth2_qa/api/sms/query_reports", + array( + "controller" => 'sms' , + "action" => 'query_reports', + ) + ); + + $router->add( + "/smsoauth2_qa/api/urls/shorturl", + array( + "controller" => 'urls' , + "action" => 'shorturl', + ) + ); } } @@ -34,6 +82,54 @@ else{ "params"=>3 ) ); + + $router->add( + "/smsoauth2/api/oauth2/code", + array( + "controller" => 'oauth2' , + "action" => 'code', + ) + ); + + $router->add( + "/smsoauth2/api/oauth2/accesstoken", + array( + "controller" => 'oauth2' , + "action" => 'accesstoken', + ) + ); + + $router->add( + "/smsoauth2/api/sms/send", + array( + "controller" => 'sms' , + "action" => 'send', + ) + ); + + $router->add( + "/smsoauth2/api/sms/authcode", + array( + "controller" => 'sms' , + "action" => 'authcode', + ) + ); + + $router->add( + "/smsoauth2/api/sms/query_reports", + array( + "controller" => 'sms' , + "action" => 'query_reports', + ) + ); + + $router->add( + "/smsoauth2/api/urls/shorturl", + array( + "controller" => 'urls' , + "action" => 'shorturl', + ) + ); } $router->handle( diff --git a/app/controllers/Oauth2Controller.php b/app/controllers/Oauth2Controller.php index 5f6539a..68c8654 100644 --- a/app/controllers/Oauth2Controller.php +++ b/app/controllers/Oauth2Controller.php @@ -18,13 +18,13 @@ class Oauth2Controller extends ControllerBase{ */ function testAction(){ //$url = "http://wxapp.wemediacn.com/smsoauth2_qa/api/oauth2/code"; - //$url = "http://127.0.0.1/tiffany/api/oauth2/code?qaz=wsx"; + // $url = "http://127.0.0.1/tiffany/api/oauth2/code?qaz=wsx"; //$url = "http://wxapp.wemediacn.com/smsoauth2_qa/api/oauth2/accesstoken"; $url = "http://127.0.0.1/tiffany/api/oauth2/accesstoken?qaz=wsx"; $post_arr = array(); $post_arr['appid'] = "0e355010-67b9-4aa6-a53f-c92c972094a7"; $post_arr['appsecrect'] = "b82015bd-8d4c-4df8-87a8-c25477a8976f"; - $post_arr['code'] = "6a85462f61370131826d00e89efe8643"; + $post_arr['code'] = "734fcd9ed0681461faa1eace9583e0d1"; $post_json = json_encode($post_arr); $result = $this->__http_post_request($url, $post_json, true); print_r($result); die;