You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
2.4 KiB
89 lines
2.4 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace addon\hygl\app\adminapi\controller\advertising;
|
|
|
|
use core\base\BaseAdminController;
|
|
use addon\hygl\app\service\admin\advertising\AdvertisingService;
|
|
|
|
|
|
/**
|
|
* 广告管理控制器
|
|
* Class Advertising
|
|
* @package addon\hygl\app\adminapi\controller\advertising
|
|
*/
|
|
class Advertising extends BaseAdminController
|
|
{
|
|
/**
|
|
* 获取广告管理列表
|
|
* @return \think\Response
|
|
*/
|
|
public function lists(){
|
|
$data = $this->request->params([
|
|
|
|
]);
|
|
return success((new AdvertisingService())->getPage($data));
|
|
}
|
|
|
|
/**
|
|
* 广告管理详情
|
|
* @param int $id
|
|
* @return \think\Response
|
|
*/
|
|
public function info(int $id){
|
|
return success((new AdvertisingService())->getInfo($id));
|
|
}
|
|
|
|
/**
|
|
* 添加广告管理
|
|
* @return \think\Response
|
|
*/
|
|
public function add(){
|
|
$data = $this->request->params([
|
|
["img_url",""],
|
|
["skip_url",""],
|
|
["sort",0],
|
|
|
|
]);
|
|
$this->validate($data, 'addon\hygl\app\validate\advertising\Advertising.add');
|
|
$id = (new AdvertisingService())->add($data);
|
|
return success('ADD_SUCCESS', ['id' => $id]);
|
|
}
|
|
|
|
/**
|
|
* 广告管理编辑
|
|
* @param $id 广告管理id
|
|
* @return \think\Response
|
|
*/
|
|
public function edit(int $id){
|
|
$data = $this->request->params([
|
|
["img_url",""],
|
|
["skip_url",""],
|
|
["sort",0],
|
|
|
|
]);
|
|
$this->validate($data, 'addon\hygl\app\validate\advertising\Advertising.edit');
|
|
(new AdvertisingService())->edit($id, $data);
|
|
return success('EDIT_SUCCESS');
|
|
}
|
|
|
|
/**
|
|
* 广告管理删除
|
|
* @param $id 广告管理id
|
|
* @return \think\Response
|
|
*/
|
|
public function del(int $id){
|
|
(new AdvertisingService())->del($id);
|
|
return success('DELETE_SUCCESS');
|
|
}
|
|
|
|
|
|
}
|
|
|