refill_order.model.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. use const mtopcard\PetroChinaCard;
  3. use const mtopcard\PhoneCard;
  4. use const mtopcard\SinopecCard;
  5. defined('InShopNC') or exit('Access Invalid!');
  6. class refill_orderModel extends Model
  7. {
  8. public function getOrderInfo($condition = [], $fields = '*', $master = false, $lock = false)
  9. {
  10. $order_info = $this->table('refill_order')->field($fields)->where($condition)->order('')->master($master)->lock($lock)->find();
  11. if (empty($order_info)) {
  12. return [];
  13. }
  14. return $order_info;
  15. }
  16. public function add_refill($params)
  17. {
  18. return $this->table('refill_order')->insert($params);
  19. }
  20. public function edit($order_id,$data)
  21. {
  22. return $this->table('refill_order')->where(['order_id' => $order_id])->update($data);
  23. }
  24. public function getMerchantOrderList($condition, $pagesize = '', $field = '*', $order = 'refill_order.order_id desc', $limit = '')
  25. {
  26. $list = $this->table('refill_order,vr_order')->field($field)
  27. ->where($condition)->join('inner')->on('refill_order.order_id=vr_order.order_id')->page($pagesize)->order($order)->limit($limit)->select();
  28. if (empty($list)) return [];
  29. return $list;
  30. }
  31. public function getOrderStatsList($condition, $pagesize = '', $field = '*', $order = 'time_stamp desc', $limit = '')
  32. {
  33. $list = $this->table('refill_stats')->field($field)
  34. ->where($condition)->page($pagesize)->order($order)->limit($limit)->select();
  35. if (empty($list)) return [];
  36. return $list;
  37. }
  38. public function first_item()
  39. {
  40. return $this->table('refill_order')->field('order_time')->where(['order_id' => ['gt',0]])->order('order_id asc')->find();
  41. }
  42. }