123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?php
- // +----------------------------------------------------------------------
- // | Niucloud-admin 企业快速开发的saas管理平台
- // +----------------------------------------------------------------------
- // | 官方网址:https://www.niucloud.com
- // +----------------------------------------------------------------------
- // | niucloud团队 版权所有 开源版本可自由商用
- // +----------------------------------------------------------------------
- // | Author: Niucloud Team
- // +----------------------------------------------------------------------
- namespace app\adminapi\controller\diy;
- use app\dict\diy\AdvPositionDict;
- use app\service\admin\diy\AdvService;
- use core\base\BaseAdminController;
- use think\Response;
- /**
- * 广告管理
- * Class Nav
- * @package app\adminapi\controller\web
- */
- class Adv extends BaseAdminController
- {
- /**
- * 广告位
- * @return \think\Response
- */
- public function advPosition(){
- return success(AdvPositionDict::getAdvPosition());
- }
- /**
- * 获取广告分页列表
- * @return \think\Response
- */
- public function pages(){
- $data = $this->request->params([
- ['ap_key', '']
- ]);
- return success((new AdvService())->getPage($data));
- }
- /**
- * 获取广告列表
- * @return \think\Response
- */
- public function lists(){
- $data = $this->request->params([
- ['ap_key', '']
- ]);
- return success((new AdvService())->getList($data));
- }
- /**
- * 广告详情
- * @param int $id
- * @return \think\Response
- */
- public function info(int $id){
- return success((new AdvService())->getInfo($id));
- }
- /**
- * 添加广告
- * @return \think\Response
- */
- public function add(){
- $data = $this->request->params([
- ['ap_key', ''],
- ['adv_title', ''],
- ['adv_url', ''],
- ['adv_image', ''],
- ['slide_sort', 0],
- ['background', '#FFFFFF'],
- ]);
- $id = (new AdvService())->add($data);
- return success('ADD_SUCCESS', ['id' => $id]);
- }
- /**
- * 广告编辑
- * @param $id 广告id
- * @return \think\Response
- */
- public function edit($id){
- $data = $this->request->params([
- ['ap_key', ''],
- ['adv_title', ''],
- ['adv_url', ''],
- ['adv_image', ''],
- ['slide_sort', 0],
- ['background', '#FFFFFF'],
- ]);
- (new AdvService())->edit($id, $data);
- return success('EDIT_SUCCESS');
- }
- /**
- * 广告删除
- * @param int $id
- * @return Response
- */
- public function del(int $id){
- (new AdvService())->del($id);
- return success('DELETE_SUCCESS');
- }
- }
|