add-plan-out_time_order

This commit is contained in:
lccsw
2022-04-19 15:44:10 +08:00
parent 1b4f36623f
commit 9fd9770b3c
3 changed files with 42 additions and 4 deletions
+36
View File
@@ -214,4 +214,40 @@ class Order extends CI_Controller{
}
}
//过期未支付订单
public function out_time(){
if(time()<=strtotime('2022-04-20 00:00:00')){ //2022-4-20后开始执行
exit;
}
$s_time = date('Y-m-d 00:00:00',strtotime("-1 day"));//昨天开始时间
$e_time = date('Y-m-d 23:59:59',strtotime("-1 day"));//昨天结束时间
$last_id_key = "out_time_receiver_order_id";
$redis = &load_cache();
$last_id = $redis->get($last_id_key);
$where = [
'c_time<=' => strtotime($e_time),
'c_time>=' => strtotime($s_time),
'status' => 0
];
$last_id && $where['id>'] = $last_id;
$rows = $this->receiver_orders_v2_model->select($where,'id asc',1,30);
if($rows){
foreach($rows as $key=>$val){
$if_pay = $this->app_liche_orders_model->count(['o_id'=>$val['id'],'status'=>1]);
if(!$if_pay){ //不存在已支付订单
$this->receiver_orders_v2_model->update(['status'=>-1],['id'=>$val['id']]);
$this->app_liche_orders_model->update(['status'=>-1],['o_id'=>$val['id']]);
debug_log("订单过期:".$val['id'],$this->log_file,$this->log_dir);
}
$do_last_id = $val['id'];
}
$redis->save($last_id_key,$do_last_id,2*24*60*60);
}else{
debug_log("订单过期执行完毕",$this->log_file,$this->log_dir);
}
}
}
+1
View File
@@ -39,6 +39,7 @@ class Plan extends CI_Controller
$plan[] = array('url' => base_url(array('plan', 'biz', 'settle')), 'interval' => 1);
$plan[] = array('url' => base_url(array('plan', 'order', 'up_old_status')), 'interval' => 30); //更新旧订单状态
$plan[] = array('url' => base_url(array('plan', 'order', 'order_time')), 'interval' => 10); //未支付订单过期
$this->plan = $plan;
}
+5 -4
View File
@@ -78,7 +78,8 @@ class CusorderV2 extends Wxapp{
$c_credit = $this->input_param('credit');
$delry_time = $this->input_param('delry_time');
$finance_id = $this->input_param('finance_id');
$inten_money = floatval($this->input_param('inten_money'));//意向金
//$inten_money = floatval($this->input_param('inten_money'));//意向金
$inten_money = 0;
$disc_money = floatval($this->input_param('disc_money'));//优惠金额
$disc_fine_money = floatval($this->input_param('disc_fine_money'));//精品优惠金额
$if_fine = $this->input_param('if_fine');
@@ -114,9 +115,9 @@ class CusorderV2 extends Wxapp{
if($deposit<2000){
throw new Exception('定金不得少于2000', ERR_PARAMS_ERROR);
}
if($inten_money > $deposit){
throw new Exception('意向金不得高于定金', ERR_PARAMS_ERROR);
}
//if($inten_money >= $deposit){
// throw new Exception('意向金不得高于定金', ERR_PARAMS_ERROR);
//}
$biz = $this->biz_model->get(['id'=>$row['biz_id']],'city_id,type');
$car_row = $this->auto_cars_model->get(['brand_id'=>$series_row['brand_id'],'s_id'=>$series_row['id'],'v_id'=>$v_id],'',$biz['city_id']);