index.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. use Flc\Alidayu\Client;
  3. use Flc\Alidayu\App;
  4. use Flc\Alidayu\Requests\AlibabaAliqinFcSmsNumSend;
  5. use Flc\Alidayu\Requests\AlibabaAliqinFcTtsNumSinglecall;
  6. use Flc\Alidayu\Requests\AlibabaAliqinFcVoiceNumSinglecall;
  7. use Flc\Alidayu\Requests\AlibabaAliqinFcSmsNumQuery;
  8. use Flc\Alidayu\Requests\AlibabaAliqinFcFlowGrade;
  9. use Flc\Alidayu\Requests\AlibabaAliqinFcVoiceNumDoublecall;
  10. use Flc\Alidayu\Requests\AlibabaAliqinFcFlowCharge;
  11. use Flc\Alidayu\Requests\AlibabaAliqinFcFlowQuery;
  12. use Flc\Alidayu\Requests\AlibabaAliqinFcFlowChargeProvince;
  13. use Flc\Alidayu\Requests\IRequest;
  14. //require __DIR__ . '/../vendor/autoload.php';
  15. require __DIR__ . '/../autoload.php';
  16. // 配置信息
  17. $config = [
  18. 'app_key' => '*****',
  19. 'app_secret' => '************',
  20. 'sandbox' => true, // 是否为沙箱环境,默认false
  21. ];
  22. // $client = new Client(new App($config));
  23. // // 短信发送 passed
  24. // $req = new AlibabaAliqinFcSmsNumSend;
  25. // $req->setRecNum('13312311231')
  26. // ->setSmsParam([
  27. // 'number' => rand(100000, 999999)
  28. // ])
  29. // ->setSmsFreeSignName('叶子坑')
  30. // ->setSmsTemplateCode('SMS_15105357');
  31. Client::configure($config); // 只需定义一次
  32. $rs = Client::request('alibaba.aliqin.fc.sms.num.send', function (IRequest $req) {
  33. $req->setRecNum('13312311231')
  34. ->setSmsParam([
  35. 'number' => rand(100000, 999999)
  36. ])
  37. ->setSmsFreeSignName('叶子坑')
  38. ->setSmsTemplateCode('SMS_15105357');
  39. });
  40. print_r($rs);
  41. // 文本转语音通知 passed
  42. // $req = new AlibabaAliqinFcTtsNumSinglecall;
  43. // $req->setCalledNum('13312311231')
  44. // ->setTtsParam([
  45. // 'username' => 'admin',
  46. // 'time' => date('Y-m-d'),
  47. // 'client' => '微网站'
  48. // ])
  49. // ->setCalledShowNum('051482043270')
  50. // ->setTtsCode('TTS_15230020');
  51. // 语音通知 passed
  52. // $req = new AlibabaAliqinFcVoiceNumSinglecall;
  53. // $req->setCalledNum('13312311231')
  54. // ->setCalledShowNum('051482043270')
  55. // ->setVoiceCode('08559b5f-0573-4e30-89ca-b82a9f4b94f8.wav');
  56. // 短信发送记录查询 passed
  57. // $req = new AlibabaAliqinFcSmsNumQuery;
  58. // $req->setBizId('')
  59. // ->setRecNum('13312311231')
  60. // ->setQueryDate('20160920')
  61. // ->setCurrentPage(1)
  62. // ->setPageSize(10);
  63. // 流量直充档位表 passed
  64. // $req = new AlibabaAliqinFcFlowGrade;
  65. // 多方通话 ---
  66. // $req = new AlibabaAliqinFcVoiceNumDoublecall;
  67. // $req->setCallerNum('13312311231')
  68. // ->setCallerShowNum('13312311231')
  69. // ->setCalledNum('13312311231')
  70. // ->setCalledShowNum('13312311231');
  71. // 流量直充 ---
  72. // $req = new AlibabaAliqinFcFlowCharge;
  73. // $req->setPhoneNum('13312311231')
  74. // ->setGrade('50')
  75. // ->setOutRechargeId('111111');
  76. // 流量直充 ---
  77. // $req = new AlibabaAliqinFcFlowQuery;
  78. // $req->setOutId('111111');
  79. // 流量直充分省接口 ---
  80. // $req = new AlibabaAliqinFcFlowChargeProvince;
  81. // $req->setPhoneNum('13312311231')
  82. // ->setGrade('50')
  83. // ->setOutRechargeId('111111');
  84. // print_r($req->getParams());
  85. // print_r($client->execute($req));