all(), [ 'account' => 'required|numeric', 'sign' => 'required|numeric', 'mobile' => 'required|size:11', 'content' => 'required', 'templateId' => 'required', ], [ 'account.required' => '短息渠道账号不能为空', 'sign.required' => '签名id不能为空', 'mobile.required' => 'mobile不能为空', 'mobile.size' => 'mobile长度必须是11位', 'content.required' => 'content不能为空', 'templateId.required' => 'templateId不能为空', ]); if ($validator->fails()) { return $validator->errors()->all(); } $account = $request->input('account'); //短信平台账号 153132952 $sign = $request->input('sign'); //签名id 17522 $mobile = $request->input('mobile'); //接受者手机号 $content = $request->input('content'); //短信内容, 验证码 $templateId = $request->input('templateId'); //模板id 29070 $TrSmsModel = new TrSms(); $result = $TrSmsModel->singleSend($account, $sign, $mobile, $content, $templateId); return $result; } //短信群发 public function multiSms(Request $request) { //验参 $validator = Validator::make($request->all(), [ 'account' => 'required|numeric', 'sign' => 'required|numeric', 'mobile' => 'required', 'content' => 'required', ], [ 'account.required' => '短息渠道账号不能为空', 'sign.required' => '签名id不能为空', 'mobile.required' => 'mobile不能为空', 'content.required' => 'content不能为空', ]); if ($validator->fails()) { return $validator->errors()->all(); } $account = $request->input('account');//153132952 $sign = $request->input('sign'); //17522 $mobile = $request->input('mobile');//13522199350 $content = $request->input('content'); $templateId = $request->input('templateId'); //29070 $scheduleSendTime = $request->input('scheduleSendTime'); $TrSmsModel = new TrSms(); $result = $TrSmsModel->multiSend($account, $sign, $mobile, $content, $templateId, $scheduleSendTime); return $result; } //短信模板 public function templateList(Request $request) { //验参 $validator = Validator::make($request->all(), [ 'account' => 'required|numeric', ], [ 'account.required' => '短息渠道账号不能为空', ]); if ($validator->fails()) { return $validator->errors()->all(); } $account = $request->input('account');//153132952 $TrSmsModel = new TrSms(); $result = $TrSmsModel->templateList($account); return $result; } //短信签名 public function signList(Request $request) { //验参 $validator = Validator::make($request->all(), [ 'account' => 'required|numeric', ], [ 'account.required' => '短息渠道账号不能为空', ]); if ($validator->fails()) { return $validator->errors()->all(); } $account = $request->input('account');//153132952 $TrSmsModel = new TrSms(); $result = $TrSmsModel->signList($account); return $result; } //语音验证码 public function voiceCode(Request $request) { //验参 $validator = Validator::make($request->all(), [ 'account' => 'required|numeric', 'mobile' => 'required', 'voiceCode' => 'required', ], [ 'account.required' => '短息渠道账号不能为空', 'mobile.required' => 'mobile不能为空', 'voiceCode.required' => 'voiceCode不能为空', ]); if ($validator->fails()) { return $validator->errors()->all(); } $account = $request->input('account');//153132952 $mobile = $request->input('mobile'); $voiceCode = $request->input('voiceCode'); $TrSmsModel = new TrSms(); $result = $TrSmsModel->voiceCode($account, $mobile, $voiceCode); return $result; } }