123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <?php
- namespace app\admin\controller\life;
- use app\admin\controller\BaseController;
- use app\admin\server\life\BookCourseServer;
- class BookCourse extends BaseController
- {
- /**
- * Notes:获取万悦书院课程目录列表
- * @return \support\Response
- * User: ZQ
- * Date: 2022/10/14
- */
- public function getBookCourseList()
- {
- [$page, $limit] = $this->getPage();
- $keywords = $this->request->get('keywords');
- $result = BookCourseServer::getBookCourseList($page, $limit, $keywords);
- return json_success($result, '成功');
- }
- /**
- * Notes:获取所有课程目录
- * @return \support\Response
- * User: ZQ
- * Date: 2022/10/14
- */
- public function getBookCourseAll()
- {
- $result = BookCourseServer::getBookCourseAll();
- return json_success($result, '成功');
- }
- /**
- * Notes:修改万悦书院
- * @return \support\Response
- * User: ZQ
- * Date: 2022/10/09
- */
- public function updateBookCourse()
- {
- $course_id = $this->request->post('course_id');
- $course_name = $this->request->post('course_name');
- $course_time = $this->request->post('course_time');
- $course_book_id = $this->request->post('course_book_id');
- $course_price = $this->request->post('course_price');
- $course_status = $this->request->post('course_status');
- $admin_id = $this->request->admin_id;
- $this->validateCheck('life\BookCourseValidate', ['course_id'=>$course_id,'course_name'=>$course_name,'course_time'=>$course_time,'course_book_id'=>$course_book_id,'course_price'=>$course_price,'course_status'=>$course_status], 'update');
- $result = BookCourseServer::updateBookCourse($course_id, $course_name, $course_time, $course_book_id, $course_price, $course_status, $admin_id);
- return json_success($result, '修改成功');
- }
- /**
- * Notes:删除课程目录
- * @return \support\Response
- * User: ZQ
- * Date: 2022/9/13
- */
- public function delBookCourse()
- {
- $course_id = $this->request->get('course_id');
- $admin_id = $this->request->admin_id;
- $this->validateCheck('life\BookCourseValidate', ['course_id' => $course_id], 'info');
- $result = BookCourseServer::delBookCourse($course_id,$admin_id);
- if ($result){
- return json_success($result, '删除成功');
- }else{
- throw new \Exception('删除失败!');
- }
- }
- /**
- * Notes:添加课程目录
- * @return \support\Response
- * User: ZQ
- * Date: 2022/9/13
- */
- public function addBookCourse()
- {
- $course_name = $this->request->post('course_name');
- $course_time = $this->request->post('course_time');
- $course_book_id = $this->request->post('course_book_id');
- $course_price = $this->request->post('course_price');
- $course_status = $this->request->post('course_status');
- $admin_id = $this->request->admin_id;
- $this->validateCheck('life\BookCourseValidate', ['course_name'=>$course_name,'course_time'=>$course_time,'course_book_id'=>$course_book_id,'course_price'=>$course_price,'course_status'=>$course_status], 'create');
- $result = BookCourseServer::insertBookCourse($course_name, $course_time, $course_book_id, $course_price, $course_status, $admin_id);
- return json_success($result, '添加成功');
- }
- /**
- * Notes:查询课程目录详情
- * @return \support\Response
- * User: ZQ
- * Date: 2022/9/13
- */
- public function courseInfo()
- {
- $course_id = $this->request->get('course_id');
- $this->validateCheck('life\BookCourseValidate', ['course_id' => $course_id], 'info');
- $result = BookCourseServer::courseInfo($course_id);
- return json_success($result, '成功');
- }
- /**
- * Notes:课程目录上架下架
- * @return \support\Response
- * User: ZQ
- * Date: 2022/10/09
- */
- public function updateStatus()
- {
- $course_id = $this->request->get('course_id');
- $course_status = $this->request->get('course_status');
- $this->validateCheck('life\BookCourseValidate', ['course_id' => $course_id], 'info');
- $result = BookCourseServer::updateStatus($course_id, $course_status);
- return json_success($result, '修改成功');
- }
- }
|