123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <?php
- namespace app\admin\controller\life;
- use app\admin\controller\BaseController;
- use app\admin\server\life\BookServer;
- class Book extends BaseController
- {
- /**
- * Notes:获取万悦书院课程列表
- * @return \support\Response
- * User: ZQ
- * Date: 2022/10/14
- */
- public function getBookList()
- {
- [$page, $limit] = $this->getPage();
- $keywords = $this->request->get('keywords');
- $result = BookServer::getBookList($page, $limit, $keywords);
- return json_success($result, '成功');
- }
- /**
- * Notes:获取所有课程
- * @return \support\Response
- * User: ZQ
- * Date: 2022/10/14
- */
- public function getBookAll()
- {
- $result = BookServer::getBookAll();
- return json_success($result, '成功');
- }
- /**
- * Notes:修改万悦书院
- * @return \support\Response
- * User: ZQ
- * Date: 2022/10/09
- */
- public function updateBook()
- {
- $life_book_id = $this->request->post('life_book_id');
- $life_book_name = $this->request->post('life_book_name');
- $life_book_title = $this->request->post('life_book_title');
- $life_book_time = $this->request->post('life_book_time');
- $life_book_week = $this->request->post('life_book_week');
- $life_book_category_id = $this->request->post('life_book_category_id');
- $life_book_teacher_id = $this->request->post('life_book_teacher_id');
- $life_book_num = $this->request->post('life_book_num');
- $life_book_long = $this->request->post('life_book_long','');
- $life_book_week = $this->request->post('life_book_week','');
- $life_book_status = $this->request->post('life_book_status');
- $life_book_img = $this->request->post('life_book_img');
- $life_book_type = $this->request->post('life_book_type');
- $admin_id = $this->request->admin_id;
- $this->validateCheck('life\BookValidate', ['life_book_id'=>$life_book_id,'life_book_name'=>$life_book_name,'life_book_title'=>$life_book_title,'life_book_time'=>$life_book_time,'life_book_category_id'=>$life_book_category_id,'life_book_teacher_id'=>$life_book_teacher_id,'life_book_num'=>$life_book_num,'life_book_status'=>$life_book_status,'life_book_img'=>$life_book_img,'life_book_type'=>$life_book_type], 'update');
- $result = BookServer::updateBook($life_book_id, $life_book_name, $life_book_title, $life_book_time, $life_book_category_id, $life_book_teacher_id, $life_book_num, $life_book_status, $life_book_img, $life_book_type, $life_book_long, $life_book_week, $admin_id);
- return json_success($result, '修改成功');
- }
- /**
- * Notes:删除课程
- * @return \support\Response
- * User: ZQ
- * Date: 2022/9/13
- */
- public function delBook()
- {
- $life_book_id = $this->request->get('life_book_id');
- $admin_id = $this->request->admin_id;
- $this->validateCheck('life\BookValidate', ['life_book_id' => $life_book_id], 'info');
- $result = BookServer::delBook($life_book_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 addBook()
- {
- $life_book_name = $this->request->post('life_book_name');
- $life_book_title = $this->request->post('life_book_title');
- $life_book_time = $this->request->post('life_book_time');
- $life_book_week = $this->request->post('life_book_week');
- $life_book_category_id = $this->request->post('life_book_category_id');
- $life_book_teacher_id = $this->request->post('life_book_teacher_id');
- $life_book_num = $this->request->post('life_book_num');
- $life_book_long = $this->request->post('life_book_long','');
- $life_book_week = $this->request->post('life_book_week','');
- $life_book_status = $this->request->post('life_book_status');
- $life_book_img = $this->request->post('life_book_img');
- $life_book_type = $this->request->post('life_book_type');
- $admin_id = $this->request->admin_id;
- $this->validateCheck('life\BookValidate', ['life_book_name'=>$life_book_name,'life_book_title'=>$life_book_title,'life_book_time'=>$life_book_time,'life_book_category_id'=>$life_book_category_id,'life_book_teacher_id'=>$life_book_teacher_id,'life_book_num'=>$life_book_num,'life_book_status'=>$life_book_status,'life_book_img'=>$life_book_img,'life_book_type'=>$life_book_type], 'create');
- $result = BookServer::insertBook($life_book_name, $life_book_title, $life_book_time, $life_book_category_id, $life_book_teacher_id, $life_book_num, $life_book_status, $life_book_img, $life_book_type, $life_book_long, $life_book_week, $admin_id);
- return json_success($result, '添加成功');
- }
- /**
- * Notes:查询课程详情
- * @return \support\Response
- * User: ZQ
- * Date: 2022/9/13
- */
- public function bookInfo()
- {
- $life_book_id = $this->request->get('life_book_id');
- $this->validateCheck('life\BookValidate', ['life_book_id' => $life_book_id], 'info');
- $result = BookServer::bookInfo($life_book_id);
- return json_success($result, '成功');
- }
- /**
- * Notes:课程上架下架
- * @return \support\Response
- * User: ZQ
- * Date: 2022/10/09
- */
- public function updateStatus()
- {
- $life_book_id = $this->request->get('life_book_id');
- $life_book_status = $this->request->get('life_book_status');
- $this->validateCheck('life\BookValidate', ['life_book_id' => $life_book_id], 'info');
- $result = BookServer::updateStatus($life_book_id, $life_book_status);
- return json_success($result, '修改成功');
- }
- }
|