OrderAnnualFeeModel.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace app\common\model;
  3. class OrderAnnualFeeModel extends BaseModel
  4. {
  5. protected $table = 'erp_order_annual_fee';
  6. protected function genSchema(array $schema)
  7. {
  8. // TODO: Implement genSchema() method.
  9. }
  10. public function fetchByOrderIds($order_ids, $is_pay = 0) {
  11. return $this->where('is_delete', 0)
  12. ->where('order_id', 'in', $order_ids)
  13. ->where('is_pay', '=', $is_pay)
  14. ->select()->toArray();
  15. }
  16. public function fetchByAdviser($admin_id, $text = null, $start_time = null, $end_time = null, $page = 1, $size = 10) {
  17. $where = [
  18. ['is_delete', '=', 0],
  19. ['is_pay', '=', 0],
  20. ['adviser_1_id', '=', $admin_id],
  21. ];
  22. if ($text) array_push($where, ['customer_name|customer_mobile', 'like', "%".$text."%"]);
  23. if ($start_time) array_push($where, ['order_create_time', '>=', $start_time]);
  24. if ($end_time) array_push($where, ['order_create_time', '<=', $end_time]);
  25. return $this->where($where)
  26. ->page($page)
  27. ->paginate($size);
  28. }
  29. }