status.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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_push;
  10. use member_info;
  11. use fcode;
  12. use push_helper;
  13. class status extends IPusher
  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_present()
  32. {
  33. if($this->mem_info->order_num() > 0) {
  34. return false;
  35. }
  36. if($this->mem_info->first_present() > 0) {
  37. return false;
  38. }
  39. $result = fcode\present_manager::instance()->fetch($this->mem_info->mobile(),null);
  40. if($result == false) return false;
  41. $fcode = $result['fcode'];
  42. $this->mod_member->editMember(['member_id' => $this->member_id],['first_present' => intval($fcode['fc_id'])]);
  43. push_helper::first_present($this->member_id,$fcode);
  44. return true;
  45. }
  46. private function check_bonus()
  47. {
  48. return true;
  49. }
  50. private function check_fcode()
  51. {
  52. return true;
  53. }
  54. }