diff --git a/admin/controllers/app/liche/Main.php b/admin/controllers/app/liche/Main.php index afac57e4..f66d0209 100644 --- a/admin/controllers/app/liche/Main.php +++ b/admin/controllers/app/liche/Main.php @@ -270,4 +270,46 @@ class Main extends HD_Controller echo "do end"; } } + //更新尾款订单状态 + public function get_up(){ + $this->load->model('apporder/order_purchase_model'); + $this->load->model('app/liche/app_liche_orders_model'); + $this->load->model('receiver/order/receiver_orders_model'); + + $oid = $this->input->get('oid'); + $page = $this->input->get('page'); + $size = $this->input->get('size'); + $lk = $this->input->get('lk'); + + !$page && $page = 1; + !$size && $size = 10; + + if ($lk) { + $where = []; + $oid && $where['o_id'] = $oid; + $rows = $this->app_liche_orders_model->select($where, 'id desc', $page, $size); + print_r($rows); + exit; + } + + $where = [ + 'type' => 3 + ]; + $total = $this->app_liche_orders_model->count($where); + $rows = $this->app_liche_orders_model->select($where,'id asc',$page,$size); + if($rows){ + $oids = ""; + foreach($rows as $key => $val){ + $money = $this->app_liche_orders_model->sum('total_price',['pid'=>$val['id']]); + if($money['total_price']>0 && $money['total_price']>=$val['total_price']){ + $this->app_liche_orders_model->update(['status'=>1],['id'=>$val['id']]); + $oids .= ','.$val['o_id']; + } + } + echo $oids; + echo "do finish,total:{$total},剩余:" . ($total - $page * $size); + }else{ + echo "do end"; + } + } }