| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
- class LewaimaiStaff {
- //设置二维码推广下单的用户
- public static function UpdateStaffTicketWaimaiNum($lewaimai_customer_id)
- {
- $lewaimaicustomerModel = LewaimaiCustomer::model()->findByPk($lewaimai_customer_id);
- if (!$lewaimaicustomerModel)
- {
- return ;
- }
-
- $openid = $lewaimaicustomerModel->openid;
- $staffticketcustomerModel = StaffTicketCustomer::model()->find("openid = '" . $openid . "'");
- if (!$staffticketcustomerModel)
- {
- return ;
- }
-
- //如果找到了,那么就加次数
- $staffticketcustomerModel->waimai_num += 1;
- $staffticketcustomerModel->order_num += 1;
- if (!$staffticketcustomerModel->update())
- {
- LewaimaiDebug::LogModelError($staffticketcustomerModel);
-
- return ;
- }
-
- $ticket_id = $staffticketcustomerModel->ticket_id;
- $staffticketModel = StaffTicket::model()->findByPk($ticket_id);
- if (!$staffticketModel)
- {
- return ;
- }
-
- $staffticketModel->waimai_num += 1;
- $staffticketModel->order_num += 1;
- if (!$staffticketModel->update())
- {
- return ;
- }
- }
-
- public static function UpdateStaffTicketPaotuiNum($lewaimai_customer_id)
- {
- $lewaimaicustomerModel = LewaimaiCustomer::model()->findByPk($lewaimai_customer_id);
- if (!$lewaimaicustomerModel)
- {
- return ;
- }
-
- $openid = $lewaimaicustomerModel->openid;
- $staffticketcustomerModel = StaffTicketCustomer::model()->find("openid = '" . $openid . "'");
- if (!$staffticketcustomerModel)
- {
- return ;
- }
-
- //如果找到了,那么就加次数
- $staffticketcustomerModel->paotui_num += 1;
- $staffticketcustomerModel->order_num += 1;
- if (!$staffticketcustomerModel->update())
- {
- LewaimaiDebug::LogModelError($staffticketcustomerModel);
-
- return ;
- }
-
- $ticket_id = $staffticketcustomerModel->ticket_id;
- $staffticketModel = StaffTicket::model()->findByPk($ticket_id);
- if (!$staffticketModel)
- {
- return ;
- }
-
- $staffticketModel->paotui_num += 1;
- $staffticketModel->order_num += 1;
- if (!$staffticketModel->update())
- {
- return ;
- }
- }
- }
|