User.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * 服务提供者
  5. * User: qissen
  6. * Date: 2017/6/7
  7. * Time: 7:36
  8. * 注意调用顺序,checkClientType,checkData必须先调用,才可以验证其他
  9. */
  10. namespace app\core\service;
  11. use app\core\model\User as Model;
  12. use think\Cache;
  13. use tool\Common;
  14. class User
  15. {
  16. //发送验证码,手机号
  17. public static function getUserByToken($token, $osType) {
  18. if(!$token) {
  19. return false;
  20. }
  21. $user = false;
  22. if($osType == 1 || $osType == 2) {
  23. $user = Model::with(['userAccount'])->where([
  24. 'token'=>$token
  25. ])->find();
  26. if($user['tokenOverTime'] < THINK_START_TIME) {
  27. return false;
  28. }
  29. }
  30. else if($osType == 3){
  31. $user = Model::with(['userAccount'])->where([
  32. 'tokenPc'=>$token
  33. ])->find();
  34. if($user['tokenOverTimePc'] < THINK_START_TIME) {
  35. return false;
  36. }
  37. }
  38. else if($osType == 4){
  39. $user = Model::with(['userAccount'])->where([
  40. 'tokenWap'=>$token
  41. ])->find();
  42. if($user['tokenOverTimeWap'] < THINK_START_TIME) {
  43. return false;
  44. }
  45. }
  46. return $user;
  47. }
  48. public static function introduceUser($fromUser, $toUser) {
  49. //引导奖励
  50. }
  51. }