示例#1
0
 public function choiceTeacher()
 {
     $lid = Url::get('lid');
     $tid = Url::get('tid');
     $cid = Url::get('cid');
     if (intval($lid) <= 0 || intval($tid) <= 0 || intval($cid) <= 0) {
         echo 0;
         exit;
     }
     $teacher = User::get_teacher_lesson(User::id(), $lid);
     $lesson = Lessons::get_lesson($lid);
     if (empty($teacher['tid'])) {
         //Insert money to teacher
         $class = Classes::get_class($cid, true, true);
         $list_teacher = $class['teacher_price'];
         $price = 0;
         for ($i = 0; $i < count($list_teacher); $i++) {
             if ($list_teacher[$i]['tid'] == $tid) {
                 $price = $list_teacher[$i]['price'];
             }
         }
         $data = array('tid' => $tid, 'cid' => $cid, 'lid' => $lid, 'uid' => User::id(), 'price' => $price, 'time' => time());
         Classes::insert_teacher_price($data);
     }
     echo '/baigiang/' . $lesson['slug'] . '/' . $lesson['id'] . '/c/' . $cid . '.html';
     exit;
 }