|
@@ -278,4 +278,33 @@ class DiagnosisOrder extends BaseModel
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 自动确认
|
|
|
+ * @return void
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\DbException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ */
|
|
|
+ public static function automatic_confirmation()
|
|
|
+ {
|
|
|
+ $order = DiagnosisOrder::where('status', 2)->where('after_sales', 0)->select();
|
|
|
+ if (count($order) > 0)
|
|
|
+ {
|
|
|
+ foreach ($order as $item)
|
|
|
+ {
|
|
|
+ $time = $item['up_time'] + (86400 * 7); // 上传时间的七天后
|
|
|
+ if (time() > $time){
|
|
|
+ // 大于七天自动完成
|
|
|
+ DiagnosisOrder::where('id', $item['id'])->update(['status' => 3]);
|
|
|
+ $user = User::where('uid', $item['order_receiving'])->find();
|
|
|
+ UserBill::income('完成订单佣金', $item['order_receiving'], 'now_money', 'brokerage', $item['commission'], '', $user['brokerage_price']+$item['commission'], '完成订单佣金');
|
|
|
+ User::where('uid', $item['order_receiving'])->inc('brokerage_price', $item['commission'])->update();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|