智慧教务系统
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.
 
 
 
 
 
 

105 lines
2.9 KiB

<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\service;
use core\base\BaseAdminController;
use app\service\admin\service\ServiceService;
/**
* 服务控制器
* Class Service
* @package app\adminapi\controller\service
*/
class Service extends BaseAdminController
{
/**
* 获取服务列表
* @return \think\Response
*/
public function lists(){
$data = $this->request->params([
["service_name",""],
["service_type",""],
["status",""]
]);
return success((new ServiceService())->getPage($data));
}
/**
* 服务详情
* @param int $id
* @return \think\Response
*/
public function info(int $id){
return success((new ServiceService())->getInfo($id));
}
/**
* 添加服务
* @return \think\Response
*/
public function add(){
$data = $this->request->params([
["service_name",""],
["preview_image_url",""],
["description",""],
["service_type",""],
["execution_rules",""],
["staff_reminder",0],
["customer_reminder",0],
["customer_confirmation",0],
["customer_feedback",""],
["status",""],
]);
$this->validate($data, 'app\validate\service\Service.add');
$id = (new ServiceService())->add($data);
return success('ADD_SUCCESS', ['id' => $id]);
}
/**
* 服务编辑
* @param $id 服务id
* @return \think\Response
*/
public function edit(int $id){
$data = $this->request->params([
["service_name",""],
["preview_image_url",""],
["description",""],
["service_type",""],
["execution_rules",""],
["staff_reminder",0],
["customer_reminder",0],
["customer_confirmation",0],
["customer_feedback",""],
["status",""],
]);
$this->validate($data, 'app\validate\service\Service.edit');
(new ServiceService())->edit($id, $data);
return success('EDIT_SUCCESS');
}
/**
* 服务删除
* @param $id 服务id
* @return \think\Response
*/
public function del(int $id){
(new ServiceService())->del($id);
return success('DELETE_SUCCESS');
}
}