SmsController.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * SmsController.php UTF-8
  4. *
  5. *
  6. * @date : 2018/5/28 16:56
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : luowei <lw@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace api\cfloat\controller;
  13. use api\common\controller\CFloatBaseController;
  14. use huo\controller\member\Bind;
  15. use huolib\sms\SmsType;
  16. class SmsController extends CFloatBaseController {
  17. public function _initialize() {
  18. parent::_initialize();
  19. $this->checkLogin();
  20. }
  21. /**
  22. * Client浮点发送短信
  23. * http://doc.1tsdk.com/138?page_id=3284
  24. * 【域名】/cfloat/sms/send
  25. */
  26. public function index() {
  27. $_param = $this->rq_data;
  28. $_sms_data = get_val($_param, 'sms', []);
  29. $_mobile = get_val($_sms_data, 'mobile', '');
  30. $_type = get_val($_sms_data, 'type', SmsType::SMS_ID_VERIFY);
  31. $_bind_class = new Bind();
  32. $_rdata = $_bind_class->smsSend($_mobile, $_type);
  33. return $this->returnData($_rdata);
  34. }
  35. /**
  36. * 用户密保信息
  37. * http://doc.1tsdk.com/138?page_id=3399
  38. * 【域名】/cfloat/bind/info
  39. */
  40. public function info() {
  41. $_mem_id = $this->mem_id;
  42. $_rdata = (new Bind())->getBindInfo($_mem_id);
  43. return $this->returnData($_rdata);
  44. }
  45. /**
  46. * 校验原有手机
  47. * http://doc.1tsdk.com/138?page_id=3400
  48. * 【域名】/cfloat/sms/checkold
  49. */
  50. public function verifyOldMobile() {
  51. $_sms_data = get_val($this->rq_data, 'sms', []);
  52. $_mobile = get_val($_sms_data, 'mobile', '');
  53. $_type = get_val($_sms_data, 'type', SmsType::SMS_ID_VERIFY);
  54. $_code = get_val($_sms_data, 'code', '');
  55. $_bind_class = new Bind();
  56. $_rdata = $_bind_class->checkOldMobile($_mobile, $_code, $_type);
  57. return $this->returnData($_rdata);
  58. }
  59. /**
  60. * 绑定手机
  61. * http://doc.1tsdk.com/138?page_id=3401
  62. * 【域名】/cfloat/mobile/bind
  63. */
  64. public function bindPost() {
  65. $_sms_data = get_val($this->rq_data, 'sms', []);
  66. $_mobile = get_val($_sms_data, 'mobile', '');
  67. $_type = get_val($_sms_data, 'type', SmsType::SMS_ID_VERIFY);
  68. $_code = get_val($_sms_data, 'code', '');
  69. $_mem_rq = $this->setMemData();
  70. $_bind_class = new Bind();
  71. $_rdata = $_bind_class->bindPost($this->mem_id, $_mobile, $_code, $_type, $_mem_rq->getPassword());
  72. return $this->returnData($_rdata);
  73. }
  74. }