|
@@ -105,10 +105,23 @@ class refill_orderModel extends Model
|
|
return $this->table('refill_detail')->where(['mchid' => $mchid,'mch_order' => $mch_order])->update($datas);
|
|
return $this->table('refill_detail')->where(['mchid' => $mchid,'mch_order' => $mch_order])->update($datas);
|
|
}
|
|
}
|
|
|
|
|
|
- public function exist($mchid,$mch_order)
|
|
|
|
- {
|
|
|
|
- $item = $this->table('refill_detail')->where(['mchid' => $mchid,'mch_order' => $mch_order])->select();
|
|
|
|
- return !empty($item);
|
|
|
|
|
|
+ public function exist($mchid, $mch_order, $scope = false)
|
|
|
|
+ {
|
|
|
|
+ $miner = function ($time) {
|
|
|
|
+ return strtotime(date('Y-m-d',$time)) - 86400 * 15;
|
|
|
|
+ };
|
|
|
|
+ $maxer = function ($time) {
|
|
|
|
+ return $time + 3600;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ $cond = ['mchid' => $mchid,'mch_order' => $mch_order];
|
|
|
|
+ if($scope) {
|
|
|
|
+ $now = time();
|
|
|
|
+ $cond['order_time'] = [['egt', $miner($now)], ['elt', $maxer($now)], 'and'];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $items = $this->table('refill_detail')->field('detail_id')->where($cond)->select();
|
|
|
|
+ return !empty($items);
|
|
}
|
|
}
|
|
|
|
|
|
public function getAllOrders($condition)
|
|
public function getAllOrders($condition)
|