123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?php
- namespace app\admin\controller\home;
- use app\admin\controller\BaseController;
- use app\admin\server\home\HomeBannerServer;
- class HomeBanner extends BaseController
- {
- /**
- * Notes:获取项目列表
- * @return \support\Response
- * User: YCP
- * Date: 2022/11/1
- */
- public function getBannerList()
- {
- $result = HomeBannerServer::getBannerList();
- return json_success($result, '成功');
- }
- /**
- * Notes:修改项目
- * @return \support\Response
- * User: YCP
- * Date: 2022/11/1
- */
- public function updateBanner()
- {
- $params = $this->request->post();
- $admin_id = $this->request->admin_id;
- $this->validateCheck('home\HomeBannerValidate',
- [
- 'banner_id' => $params['banner_id']?? '',
- 'banner_category_id' => $params['banner_category_id']?? '',
- 'banner_name' => $params['banner_name']?? '',
- 'banner_img' => $params['banner_img']?? '',
- ],
- 'update');
- $result = HomeBannerServer::updateBanner($params, $admin_id);
- return json_success($result, '修改成功');
- }
- /**
- * Notes:删除项目
- * @return \support\Response
- * User: YCP
- * Date: 2022/11/1
- */
- public function delBanner()
- {
- $banner_id = $this->request->get('banner_id');
- $admin_id = $this->request->admin_id;
- $this->validateCheck('home\HomeBannerValidate', ['banner_id' => $banner_id], 'info');
- $result = HomeBannerServer::delBanner($banner_id,$admin_id);
- if ($result){
- return json_success($result, '删除成功');
- }else{
- throw new \Exception('删除失败!');
- }
- }
- /**
- * Notes:添加项目
- * @return \support\Response
- * User: YCP
- * Date: 2022/11/1
- */
- public function addBanner()
- {
-
- $params = $this->request->post();
- $admin_id = $this->request->admin_id;
- $this->validateCheck('home\HomeBannerValidate',
- [
- 'banner_category_id' => $params['banner_category_id']?? '',
- 'banner_name' => $params['banner_name']?? '',
- 'banner_img' => $params['banner_img']?? '',
- ],
- 'create');
- $result = HomeBannerServer::insertBanner($params, $admin_id);
- return json_success($result, '添加成功');
- }
- /**
- * Notes:查询项目详情
- * @return \support\Response
- * User: YCP
- * Date: 2022/11/1
- */
- public function bannerInfo()
- {
- $banner_id = $this->request->get('banner_id');
- $this->validateCheck('home\HomeBannerValidate', ['banner_id' => $banner_id], 'info');
- $result = HomeBannerServer::bannerInfo($banner_id);
- return json_success($result, '成功');
- }
- }
|