getCartList('db', array('buyer_id' => $buyer)); //查看购物车信息 $course = []; foreach ($cart_list as $val) { $goods = $goods_model->getGoodsInfo(['goods_id' =>$val['goods_id']]); //计算倒计时 if ($goods['enroll_start_date'] != 'Self-paced') { $enroll = strtotime($goods['enroll_start_date']); $diff = $enroll - time(); if ($diff <= 0) { $day = 0; } else { $day = ceil(($diff / 86400)); } } else { $day = 0; } // var_dump($goods);die; $course[] = [ 'goods_id' => $val['goods_id'], 'goods_name' => $goods['goods_name'], 'code' => $goods['goods_serial'], 'school' => $goods['ke_simple_college'], 'class' => 'alt c1', 'status' => 'Unpaid', 'desc' => 'Please submit payment to enroll', 'enroll_start_date' => $goods['enroll_start_date'], 'enroll_end_date' => $goods['enroll_end_date'], 'ke_start_time' => $goods['ke_start_time'], 'day' => $day, ]; } //查看订单信息 $order_model = model('order'); $condition = array(); $condition[]=array('buyer_id','=',session('member_id')); $condition[]=array('order_state', '=', 20); //查看学生信息 $memberinfo = Db::name('memberinfo')->where(['member_id' => session('member_id')])->find(); if ($memberinfo['is_submit'] != 1) { $html_class = 'alt c2'; $html_status = "Submit information"; $html_desc = "To enroll successfully, students must complete all profile information"; } else { $html_class = 'alt c3'; $html_status = "Application received"; $html_desc = "Application received. Please await email confirmation. It usually takes 3 business days after enrollment starts"; } $send = []; $order_list = $order_model->getOrderList($condition, 100, '*', 'order_id desc','', array('order_common','order_goods','ppintuanorder')); foreach ($order_list as $val) { //查询是否is_enroll $is_enroll = $val['is_enroll']; //查询订单商品 $goods = $order_model->getOrdergoodsList(['order_id' => $val['order_id']]); foreach ($goods as $good) { $info = $goods_model->getGoodsInfo(['goods_id' =>$good['goods_id']]); if ($info['enroll_start_date'] != 'Self-paced') { $enroll = strtotime($info['enroll_start_date']); $diff = $enroll - time(); if ($diff <= 0) { $day = 0; } else { $day = ceil(($diff / 86400)); } } else { $day = 0; } //查询是否enroll if ($is_enroll == 1) { $html_class = 'alt c4'; $html_status = "Enrolled"; $html_desc = "Congratulations! You will receive a confirmation email with course details from the course-offering school"; //查询是否开课 $ke_start_time = strtotime($info['ke_start_time']); $curr = strtotime(date('Y-m-d')); if ($curr >= $ke_start_time) { $html_class = 'alt c2'; $html_status = "Course has started"; $html_desc = "The course has begun"; } } $send[] = [ 'goods_id' => $good['goods_id'], 'goods_name' => $info['goods_name'], 'code' => $info['goods_serial'], 'school' => $info['ke_simple_college'], 'class' => $html_class, 'status' => $html_status, 'desc' => $html_desc, 'enroll_start_date' => $info['enroll_start_date'], 'enroll_end_date' => $info['enroll_end_date'], 'ke_start_time' => $info['ke_start_time'], 'day' => $day, ]; } } View::assign('membercourse', array_merge($course, $send)); return View::fetch($this->template_dir.'index'); } }