'mobile', 'temp_id'=>'number' ]; HelperService::diffParam($param_list,$this->post); $smsService = new SmsService(); $res = $smsService->sendCode($this->post['mobile'],$this->post['temp_id']); if($res['status'] === false){ $this->returnJson($res,400,'sms fail'); } $this->returnJson($res); } /** * 批量发送短信接口 */ public function sendBatchCode(){ $param_list = [ 'recipients'=>'array', 'temp_id'=>'number' ]; HelperService::diffParam($param_list,$this->post); $smsService = new SmsService(); $res = $smsService->sendBatchCode($this->post['recipients'],$this->post['temp_id']); $this->returnJson($res); } /** * 批量发送短信状态 */ public function sendReportCode(){ $smsService = new SmsService(); $res = $smsService->sendReportCode(); if($res['status'] === false){ $this->returnJson($res,400,'sms fail'); } $this->returnJson($res); } /** * 发送短信模板消息 */ public function sendMessage(){ $param_list = [ 'mobile'=>'mobile', 'temp_id'=>'number' ]; HelperService::diffParam($param_list,$this->post); $smsService = new SmsService(); $res = $smsService->sendMessage($this->post['mobile'],$this->post['temp_id'],$this->post['temp_params']); $this->returnJson($res); } /** * 验证短信接口 */ public function checkCode(){ $param_list = [ 'code'=>'number', 'msg_id'=>'string' ]; HelperService::diffParam($param_list,$this->post); $smsService = new SmsService(); $res = $smsService->checkCode($this->post['code'],$this->post['msg_id']); if($res) { $this->returnJson($res); }else{ $this->returnJson('',400,'error'); } } }