BindController.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. /**
  3. * BindController.php UTF-8
  4. * h5 手机版定
  5. *
  6. * @date : 2018/4/27 21:50
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : liuhongliang <lhl@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace api\float\controller;
  13. use api\common\controller\FloatBaseController;
  14. use huo\controller\member\Bind;
  15. use huolib\sms\SmsType;
  16. use huolib\tool\StrUtils;
  17. class BindController extends FloatBaseController {
  18. public function _initialize() {
  19. parent::_initialize();
  20. $this->checkLogin();
  21. }
  22. /**
  23. * h5wap 绑定手机
  24. * http://doc.1tsdk.com/138?page_id=3137
  25. *
  26. * 【域名】/wap/user/bind/mobile
  27. *
  28. * @return mixed
  29. */
  30. public function bindMobile() {
  31. $_bind_class = new Bind();
  32. $_mobile = $_bind_class->getHasBindMobile($this->mem_id);
  33. $this->assign('CheckOk', $_bind_class->getCheckOk());
  34. if (!empty($_mobile)) {
  35. /* 已绑定手机 */
  36. $_mobile = StrUtils::encryptPhone($_mobile);
  37. /* 显示已绑定手机页面 */
  38. $this->assign('mobile', $_mobile);
  39. if ($_bind_class->getCheckOk()) {
  40. /* 去绑定手机页面 */
  41. return $this->fetch('bind/bind');
  42. } else {
  43. return $this->fetch('bind/check');
  44. }
  45. } else {
  46. /* 显示未绑定手机页面 */
  47. return $this->fetch('bind/bind');
  48. }
  49. }
  50. /**
  51. * H5WAP-发送短信
  52. * http://doc.1tsdk.com/138?page_id=3230
  53. * 【域名】/wap/sms/send
  54. */
  55. public function smsSend() {
  56. $_sms_data = get_val($this->rq_data, 'sms', []);
  57. $_mobile = get_val($_sms_data, 'mobile', '');
  58. $_type = get_val($_sms_data, 'type', SmsType::SMS_ID_VERIFY);
  59. $_bind_class = new Bind();
  60. $_rdata = $_bind_class->smsSend($_mobile, $_type);
  61. return $this->returnData($_rdata);
  62. }
  63. /**
  64. * 校验原有手机
  65. * http://doc.1tsdk.com/138?page_id=3231
  66. * 【域名】/wap/sms/checkold
  67. *
  68. */
  69. public function verifyOldMobile() {
  70. $_sms_data = get_val($this->rq_data, 'sms', []);
  71. $_mobile = get_val($_sms_data, 'mobile', '');
  72. $_type = get_val($_sms_data, 'type', SmsType::SMS_ID_VERIFY);
  73. $_code = get_val($_sms_data, 'code', '');
  74. $_bind_class = new Bind();
  75. $_rdata = $_bind_class->checkOldMobile($_mobile, $_code, $_type);
  76. return $this->returnData($_rdata);
  77. }
  78. /**
  79. * 绑定手机
  80. * http://doc.1tsdk.com/138?page_id=3232
  81. * 【域名】/wap/mobile/bind
  82. */
  83. public function bindPost() {
  84. $_sms_data = get_val($this->rq_data, 'sms', []);
  85. $_mobile = get_val($_sms_data, 'mobile', '');
  86. $_type = get_val($_sms_data, 'type', SmsType::SMS_ID_VERIFY);
  87. $_code = get_val($_sms_data, 'code', '');
  88. $_mem_rq = $this->setMemData();
  89. $_bind_class = new Bind();
  90. $_rdata = $_bind_class->bindPost($this->mem_id, $_mobile, $_code, $_type, $_mem_rq->getPassword());
  91. return $this->returnData($_rdata);
  92. }
  93. }