LewaimaiStaff.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. class LewaimaiStaff {
  3. //设置二维码推广下单的用户
  4. public static function UpdateStaffTicketWaimaiNum($lewaimai_customer_id)
  5. {
  6. $lewaimaicustomerModel = LewaimaiCustomer::model()->findByPk($lewaimai_customer_id);
  7. if (!$lewaimaicustomerModel)
  8. {
  9. return ;
  10. }
  11. $openid = $lewaimaicustomerModel->openid;
  12. $staffticketcustomerModel = StaffTicketCustomer::model()->find("openid = '" . $openid . "'");
  13. if (!$staffticketcustomerModel)
  14. {
  15. return ;
  16. }
  17. //如果找到了,那么就加次数
  18. $staffticketcustomerModel->waimai_num += 1;
  19. $staffticketcustomerModel->order_num += 1;
  20. if (!$staffticketcustomerModel->update())
  21. {
  22. LewaimaiDebug::LogModelError($staffticketcustomerModel);
  23. return ;
  24. }
  25. $ticket_id = $staffticketcustomerModel->ticket_id;
  26. $staffticketModel = StaffTicket::model()->findByPk($ticket_id);
  27. if (!$staffticketModel)
  28. {
  29. return ;
  30. }
  31. $staffticketModel->waimai_num += 1;
  32. $staffticketModel->order_num += 1;
  33. if (!$staffticketModel->update())
  34. {
  35. return ;
  36. }
  37. }
  38. public static function UpdateStaffTicketPaotuiNum($lewaimai_customer_id)
  39. {
  40. $lewaimaicustomerModel = LewaimaiCustomer::model()->findByPk($lewaimai_customer_id);
  41. if (!$lewaimaicustomerModel)
  42. {
  43. return ;
  44. }
  45. $openid = $lewaimaicustomerModel->openid;
  46. $staffticketcustomerModel = StaffTicketCustomer::model()->find("openid = '" . $openid . "'");
  47. if (!$staffticketcustomerModel)
  48. {
  49. return ;
  50. }
  51. //如果找到了,那么就加次数
  52. $staffticketcustomerModel->paotui_num += 1;
  53. $staffticketcustomerModel->order_num += 1;
  54. if (!$staffticketcustomerModel->update())
  55. {
  56. LewaimaiDebug::LogModelError($staffticketcustomerModel);
  57. return ;
  58. }
  59. $ticket_id = $staffticketcustomerModel->ticket_id;
  60. $staffticketModel = StaffTicket::model()->findByPk($ticket_id);
  61. if (!$staffticketModel)
  62. {
  63. return ;
  64. }
  65. $staffticketModel->paotui_num += 1;
  66. $staffticketModel->order_num += 1;
  67. if (!$staffticketModel->update())
  68. {
  69. return ;
  70. }
  71. }
  72. }