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

176 lines
4.9 KiB

<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\stat_hour;
use core\base\BaseAdminController;
use app\service\admin\stat_hour\StatHourService;
/**
* 小时统计控制器
* Class StatHour
* @package app\adminapi\controller\stat_hour
*/
class StatHour extends BaseAdminController
{
/**
* 获取小时统计列表
* @return \think\Response
*/
public function lists(){
$data = $this->request->params([
["addon",""],
["field",""],
["field_total",""],
["year",""],
["month",""],
["day",""],
["start_time",""],
["last_time",""],
["hour_0",""],
["hour_1",""],
["hour_2",""],
["hour_3",""],
["hour_4",""],
["hour_5",""],
["hour_6",""],
["hour_7",""],
["hour_8",""],
["hour_9",""],
["hour_10",""],
["hour_11",""],
["hour_12",""],
["hour_13",""],
["hour_14",""],
["hour_15",""],
["hour_16",""],
["hour_17",""],
["hour_18",""],
["hour_19",""],
["hour_20",""],
["hour_21",""],
["hour_22",""],
["hour_23",""]
]);
return success((new StatHourService())->getPage($data));
}
/**
* 小时统计详情
* @param int $id
* @return \think\Response
*/
public function info(int $id){
return success((new StatHourService())->getInfo($id));
}
/**
* 添加小时统计
* @return \think\Response
*/
public function add(){
$data = $this->request->params([
["addon",""],
["field",""],
["field_total",0.00],
["year",0],
["month",0],
["day",0],
["start_time",0],
["last_time",0],
["hour_0",0.00],
["hour_1",0.00],
["hour_2",0.00],
["hour_3",0.00],
["hour_4",0.00],
["hour_5",0.00],
["hour_6",0.00],
["hour_7",0.00],
["hour_8",0.00],
["hour_9",0.00],
["hour_10",0.00],
["hour_11",0.00],
["hour_12",0.00],
["hour_13",0.00],
["hour_14",0.00],
["hour_15",0.00],
["hour_16",0.00],
["hour_17",0.00],
["hour_18",0.00],
["hour_19",0.00],
["hour_20",0.00],
["hour_21",0.00],
["hour_22",0.00],
["hour_23",0.00]
]);
$this->validate($data, 'app\validate\stat_hour\StatHour.add');
$id = (new StatHourService())->add($data);
return success('ADD_SUCCESS', ['id' => $id]);
}
/**
* 小时统计编辑
* @param $id 小时统计id
* @return \think\Response
*/
public function edit(int $id){
$data = $this->request->params([
["addon",""],
["field",""],
["field_total",0.00],
["year",0],
["month",0],
["day",0],
["start_time",0],
["last_time",0],
["hour_0",0.00],
["hour_1",0.00],
["hour_2",0.00],
["hour_3",0.00],
["hour_4",0.00],
["hour_5",0.00],
["hour_6",0.00],
["hour_7",0.00],
["hour_8",0.00],
["hour_9",0.00],
["hour_10",0.00],
["hour_11",0.00],
["hour_12",0.00],
["hour_13",0.00],
["hour_14",0.00],
["hour_15",0.00],
["hour_16",0.00],
["hour_17",0.00],
["hour_18",0.00],
["hour_19",0.00],
["hour_20",0.00],
["hour_21",0.00],
["hour_22",0.00],
["hour_23",0.00]
]);
$this->validate($data, 'app\validate\stat_hour\StatHour.edit');
(new StatHourService())->edit($id, $data);
return success('EDIT_SUCCESS');
}
/**
* 小时统计删除
* @param $id 小时统计id
* @return \think\Response
*/
public function del(int $id){
(new StatHourService())->del($id);
return success('DELETE_SUCCESS');
}
}