You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<?php
namespace App\Admin\Controllers;
use AlibabaCloud\Client\AlibabaCloud;use AlibabaCloud\Client\Exception\ClientException;use AlibabaCloud\Client\Exception\ServerException;use Dcat\Admin\Controllers\AdminController;use Graze\GuzzleHttp\JsonRpc\Client;use Illuminate\Support\Facades\Log;
class Test extends AdminController{ public function sentSms() { $params = [ 'RegionId' => "cn-shenzhen", 'PhoneNumbers' => "13481194554", 'SignName' => "��������", 'TemplateCode' => "SMS_201720790", 'TemplateParam' => json_encode(['name'=>'DESION','money'=>999]), ]; AlibabaCloud::accessKeyClient(env('OSS_ACCESS_ID'),env('OSS_ACCESS_SECRET')) ->regionId('cn-shenzhen') ->asDefaultClient();
try { $result = AlibabaCloud::rpc() ->product('Dysmsapi') ->version('2017-05-25') ->action('SendSms') ->method('POST') ->host('dysmsapi.aliyuncs.com') ->options([ 'query' => $params ]) ->request(); dd($result); }catch (ClientException $e){ echo $e->getErrorMessage() . PHP_EOL; }catch (ServerException $e){ echo $e->getErrorMessage() . PHP_EOL; } }
public function testRpc() { $client = Client::factory(env('RPC_SITE_HOST')); $request = $client->request(uniqid(),'/alisms/sent', [ 'phone' => 13481194554, 'template'=>'SMS_201720790', 'templateParams'=> json_encode(['name'=>"[DESION]",'money'=>'200Ԫ']), ]); $response = $client->send($request); $result = json_decode($response->getBody()->getContents()); if ($result->result->Code != 'OK') { $msg = $result->result->Message; Log::error('���Ͷ���ʧ��', ['Message'=>$msg]); } return $response->getBody()->getContents(); }public function getOrderDetail() { $oid = request()->get('oid'); $order = ImsCjdcOrderMain::where('id',$oid)->first(); return $order; }
}
|