MobileMall.php 809 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace app\api\controller;
  3. /**
  4. *
  5. *
  6. * ----------------------------------------------------------------------------
  7. *
  8. * 控制器
  9. */
  10. class MobileMall extends MobileHome
  11. {
  12. public function initialize()
  13. {
  14. parent::initialize();
  15. }
  16. /**
  17. * 通过 key 获取 用户ID
  18. * @return int
  19. */
  20. protected function getMemberIdIfExists()
  21. {
  22. $key = input('post.key');
  23. if (empty($key)) {
  24. $key = input('get.key');
  25. }
  26. $mbusertoken_model = model('mbusertoken');
  27. $mb_user_token_info = $mbusertoken_model->getMbusertokenInfoByToken($key);
  28. if (empty($mb_user_token_info)) {
  29. return 0;
  30. }
  31. return $mb_user_token_info['member_id'];
  32. }
  33. }