regionId($aliSms['regionid']) ->asDefaultClient(); $result = AlibabaCloud::rpc() ->product($aliSms['product']) ->version('2017-05-25') ->action('SendSms') ->method('POST') ->host($aliSms['host']) ->options([ 'query' => [ 'RegionId' => $aliSms['regionid'], 'PhoneNumbers' => $tel, 'SignName' => $signName ?: $aliSms['sign_name'], 'TemplateCode' => $template, 'TemplateParam' => $templateParams, ], ]) ->request(); return $result->toArray(); } catch (ClientException $e) { $this->log->event('alisms', ['alisms_error_ClientException' => $e->getErrorMessage(), 'tel' => $tel, 'template' => json_encode($templateParams)]); throw new ErrorCodeException(ErrorCode::SMS_SEND_FAILURE); } catch (ServerException $e) { $this->log->event('alisms', ['alisms_error_ServerException' => $e->getErrorMessage(), 'tel' => $tel, 'template' => json_encode($templateParams)]); throw new ErrorCodeException(ErrorCode::SMS_SEND_FAILURE); } catch (Exception $e) { $this->log->event('alisms', ['alisms_error_Exception' => $e->getErrorMessage(), 'tel' => $tel, 'template' => json_encode($templateParams)]); throw new ErrorCodeException(ErrorCode::SMS_SEND_FAILURE); } } public function check() { // TODO: Implement check() method. } public function undo() { // TODO: Implement undo() method. } public function doVerifyCode($tel, $code) { $params = ['code' => $code]; return $this->do($tel, SmsTemplateCode::ALI_VERIFY_CODE, json_encode($params)); } public function checkVerifyCode($tel, $code) { // TODO: Implement checkVerifyCode() method. } public function undoVerifyCode($tel, $code) { // TODO: Implement removeVerifyCode() method. } public function doCommunityFinancial($userId, $money) { $csInfo = CsInfo::query()->where(['admin_user_id' => $userId])->first(); $market = Market::query()->where(['id' => $csInfo->market_id])->first(); $params = ['user_name' => $csInfo->name, 'market_name' => $market->name, 'money' => $money]; return $this->do($csInfo->phone, SmsTemplateCode::ALI_COMMUNITY_FINANCIAL, json_encode($params)); } public function doWithdrawFail($storeName, $money, $errorCode, $errorCodeDes) { // 微信接口提示商户名称:${store_name},提现金额:${money}元,失败原因:${note}。 $params = ['store_name' => $storeName, 'money' => $money, 'note' => '(公司账户)'.$errorCodeDes]; return $this->do('18077798210', SmsTemplateCode::ALI_PAY_FOR_WITHDRAW_FAIL, json_encode($params)); } }