status.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: stanley-king
  5. * Date: 2017/11/2
  6. * Time: 上午9:44
  7. */
  8. //todo 送首单礼品,活动推荐,红包,F码过期提醒,邀请,购物奖励
  9. namespace async;
  10. use member_info;
  11. use fcode;
  12. use push_helper;
  13. class status extends IAsync
  14. {
  15. private $member_id;
  16. private $mod_member;
  17. private $mem_info;
  18. public function __construct($member_id)
  19. {
  20. $this->member_id = $member_id;
  21. $this->mod_member = Model('member');
  22. $mem_info = $this->mod_member->getMemberInfoByID($member_id);
  23. $this->mem_info = new member_info($mem_info);
  24. }
  25. public function run()
  26. {
  27. if($this->check_present()) return;
  28. if($this->check_bonus()) return;
  29. if($this->check_fcode()) return;
  30. }
  31. private function check_version()
  32. {
  33. $ver_code = $_SESSION['client_version'];
  34. if($_SESSION['client_type'] == 'ios')
  35. {
  36. $cur_ver = $GLOBALS['setting_config']['mobile_ios_version'];
  37. $cur_ver = intval($cur_ver * 100 + 0.5);
  38. $ver_code = intval($ver_code * 100 + 0.5);
  39. if($ver_code < $cur_ver) {
  40. $url = $GLOBALS['setting_config']['mobile_ios'];
  41. $tips = $GLOBALS['setting_config']['mobile_update_tips'];
  42. $artips = explode('#',$tips);
  43. $tips = implode("\n",$artips);
  44. }
  45. }
  46. elseif($_SESSION['client_type'] == 'android')
  47. {
  48. $cur_ver = $GLOBALS['setting_config']['mobile_apk_version'];
  49. $cur_ver = intval($cur_ver * 100 + 0.5);
  50. $ver_code = intval($ver_code * 100 + 0.5);
  51. if($ver_code < $cur_ver) {
  52. $url = $GLOBALS['setting_config']['mobile_apk'];
  53. $tips = $GLOBALS['setting_config']['mobile_update_tips'];
  54. $artips = explode('#',$tips);
  55. $tips = implode("\n",$artips);
  56. }
  57. }
  58. return false;
  59. }
  60. private function check_present()
  61. {
  62. if($this->mem_info->order_num() > 0) {
  63. return false;
  64. }
  65. if($this->mem_info->first_present() > 0) {
  66. return false;
  67. }
  68. $result = fcode\present_manager::instance()->fetch($this->mem_info->mobile(),null);
  69. if($result == false) return false;
  70. $fcode = $result['fcode'];
  71. $this->mod_member->editMember(['member_id' => $this->member_id],['first_present' => intval($fcode['fc_id'])]);
  72. push_helper::first_present($this->member_id,$fcode);
  73. return true;
  74. }
  75. private function check_bonus()
  76. {
  77. return false;
  78. }
  79. private function check_fcode()
  80. {
  81. return false;
  82. }
  83. }