|
@@ -3,7 +3,8 @@
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
use app\common\controller\Api;
|
|
|
-
|
|
|
+use Aws\Sns\SnsClient;
|
|
|
+use Aws\Exception\AwsException;
|
|
|
/**
|
|
|
* 示例接口
|
|
|
*/
|
|
@@ -38,6 +39,29 @@ class Demo extends Api
|
|
|
'msg':'返回成功'
|
|
|
})
|
|
|
*/
|
|
|
+
|
|
|
+ public function test1(){
|
|
|
+ $SnSclient = new SnsClient([
|
|
|
+ 'profile' => 'default',
|
|
|
+ 'region' => 'us-east-1',
|
|
|
+ 'version' => '2010-03-31'
|
|
|
+ ]);
|
|
|
+
|
|
|
+ $subscription_token = 'arn:aws:sns:us-east-1:111122223333:MyTopic:123456-abcd-12ab-1234-12ba3dc1234a';
|
|
|
+ $topic = 'arn:aws:sns:us-east-1:111122223333:MyTopic';
|
|
|
+
|
|
|
+ try {
|
|
|
+ $result = $SnSclient->confirmSubscription([
|
|
|
+ 'Token' => $subscription_token,
|
|
|
+ 'TopicArn' => $topic,
|
|
|
+ ]);
|
|
|
+ var_dump($result);
|
|
|
+ } catch (AwsException $e) {
|
|
|
+ // output error message if fails
|
|
|
+ error_log($e->getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function test(){
|
|
|
$out_trade_no = createUniqueNo('Test');
|
|
|
$money = '1';
|
|
@@ -98,37 +122,4 @@ class Demo extends Api
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 需要登录的接口
|
|
|
- *
|
|
|
- */
|
|
|
- public function test2()
|
|
|
- {
|
|
|
- $url = 'https://api.hit-pay.com/v1/payment-requests';
|
|
|
- $data = [
|
|
|
- 'amount' => 1,
|
|
|
- //'payment_method' => ['paynow_online', 'card', 'wechat', 'alipay', 'grabpay', 'fave_duit', 'shopback', 'atome'],
|
|
|
- 'currency' => 'SGD',
|
|
|
- //'webhook' => '',
|
|
|
- ];
|
|
|
-
|
|
|
- $header = array(
|
|
|
- 'X-BUSINESS-API-KEY' => '096a06e94fb1e0a8b015485bb76ef5dd63c167679297e07331a687327bd8b12e',
|
|
|
- 'Content-Type' => 'application/x-www-form-urlencoded',
|
|
|
- 'X-Requested-With' => 'XMLHttpRequest'
|
|
|
- );
|
|
|
-
|
|
|
- $rs = curl_post($url,$data,$header);
|
|
|
- dump($rs);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 需要登录且需要验证有相应组的权限
|
|
|
- *
|
|
|
- */
|
|
|
- public function test3()
|
|
|
- {
|
|
|
- $this->success('返回成功', ['action' => 'test3']);
|
|
|
- }
|
|
|
-
|
|
|
}
|