1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace web\pc\controller\v8;
- use web\common\controller\WebBaseController;
- use huo\controller\member\Member;
- use huolib\sms\Sms;
- use huolib\sms\SmsType;
- use huolib\status\MemberStatus;
- class SmsController extends WebBaseController {
- public function __construct() {
- parent::__construct();
- }
-
- public function send() {
- $_mobile = $this->request->param('mobile', '');
- $_smstype = $this->request->param('smstype', '');
- if (SmsType::SMS_REG == $_smstype) {
-
- $_chk_rs = (new Member())->checkMobile($_mobile);
- if (true == $_chk_rs) {
- $_code = MemberStatus::PHONE_IS_REG;
- $this->error(MemberStatus::getMsg($_code), [], $_code);
- }
- }
- $_rdata = (new Sms())->send($_mobile, $_smstype);
- if ($_rdata['code'] != MemberStatus::NO_ERROR) {
- return [
- 'error' => 1,
- 'msg' => $_rdata['msg']
- ];
- }
- return [
- 'error' => 0,
- 'msg' => '发送成功'
- ];
- }
- }
|