|
@@ -34,6 +34,50 @@ class vr_orderModel extends Model
|
|
|
return $order_info;
|
|
|
}
|
|
|
|
|
|
+ public function getOrderInfoForNotify($condition = array(), $fields = '*', $master = false,$lock=false)
|
|
|
+ {
|
|
|
+ $part_calcer = function ($sub_period, $add_period)
|
|
|
+ {
|
|
|
+ //查询30天的订单
|
|
|
+ $miner = function ($time) use ($sub_period) {
|
|
|
+ return strtotime(date('Y-m-d', $time)) - $sub_period;
|
|
|
+ };
|
|
|
+ $maxer = function ($time) use ($add_period) {
|
|
|
+ return $time + $add_period;
|
|
|
+ };
|
|
|
+ $namer = function ($time) {
|
|
|
+ return 'p' . date('Ym', $time);
|
|
|
+ };
|
|
|
+
|
|
|
+ if (defined('DB_PARTIONED') && DB_PARTIONED)
|
|
|
+ {
|
|
|
+ $now = time();
|
|
|
+ $a = $namer($miner($now));
|
|
|
+ $b = $namer($maxer($now));
|
|
|
+
|
|
|
+ if ($a != $b) {
|
|
|
+ return [$a, $b];
|
|
|
+ } else {
|
|
|
+ return $a;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ };
|
|
|
+ $part = $part_calcer(3600 * 12, 3600);
|
|
|
+ $order_info = $this->table('vr_order')->partition($part)->field($fields)->where($condition)->master($master)->lock($lock)->find();
|
|
|
+ if (empty($order_info)) {
|
|
|
+ $order_info = $this->table('vr_order')->field($fields)->where($condition)->master($master)->lock($lock)->find();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(empty($order_info)) {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return $order_info;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 新增订单
|
|
|
* @param array $data
|