1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- /**
- * MemberController.php UTF-8
- * 玩家接口
- *
- * @date : 2018/1/16 16:48
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace api\apple\controller\v8;
- use api\common\controller\AppleApiBaseController;
- use huo\controller\member\FindPwd;
- use huo\controller\member\Member;
- use huolib\sms\Sms;
- use huolib\sms\SmsType;
- use huolib\status\MemberStatus;
- class SmsController extends AppleApiBaseController {
- public function _initialize() {
- parent::_initialize();
- }
- /**
- * 发送短信
- * http://doc.1tsdk.com/138?page_id=2911
- * 【域名】/v8/sms/send
- */
- public function smsSend() {
- $_sms_data = get_val($this->rq_data, 'sms', []);
- $_mobile = get_val($_sms_data, 'mobile', '');
- $_type = get_val($_sms_data, 'type', SmsType::SMS_ID_VERIFY);
- if (SmsType::SMS_FIND_PWD == $_type) {
- $_chk_rs = (new FindPwd())->checkMobile($_mobile);
- if (MemberStatus::NO_ERROR != $_chk_rs['code']) {
- $this->error($_chk_rs['msg'], [], $_chk_rs['code']);
- }
- }
- if (SmsType::SMS_REG == $_type) {
- /* 判断手机号是否已注册 */
- $_chk_rs = (new Member())->checkMobile($_mobile);
- if (true == $_chk_rs) {
- $_code = MemberStatus::PHONE_IS_REG;
- $this->error(MemberStatus::getMsg($_code), [], $_code);
- }
- }
- $_rs = (new Sms())->send($_mobile, $_type);
- if (MemberStatus::NO_ERROR == $_rs['code']) {
- $this->success($_rs['msg'], $_rs['data'], $_rs['code']);
- }
- $this->error($_rs['msg'], $_rs['data'], $_rs['code']);
- }
- /**
- * 验证手机验证码
- * http://docapi.huosdk.com/html/web/controller/share/share.html#5adb27e8e6e766131ddb1a7d
- * 【域名】/sms/verify
- */
- public function check() {
- $_sms_data = $this->rq_data['sms'];
- $_mobile = $_sms_data['mobile'];
- $_type = $_sms_data['type'];
- $_code = $_sms_data['code'];
- /* 校验短信是否正确 */
- $_sms_rs = (new Sms())->check($_mobile, $_code, $_type);
- if (MemberStatus::NO_ERROR != $_sms_rs['code']) {
- $this->error($_sms_rs['msg'], [], $_sms_rs['code']);
- }
- $this->success($_sms_rs['msg'], [], $_sms_rs['code']);
- }
- }
|