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.
114 lines
3.2 KiB
114 lines
3.2 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\adminapi\controller\salary;
|
|
|
|
use core\base\BaseAdminController;
|
|
use app\service\admin\salary\SalaryService;
|
|
|
|
|
|
/**
|
|
* 工资控制器
|
|
* Class Salary
|
|
* @package app\adminapi\controller\salary
|
|
*/
|
|
class Salary extends BaseAdminController
|
|
{
|
|
/**
|
|
* 获取工资列表
|
|
* @return \think\Response
|
|
*/
|
|
public function lists(){
|
|
$data = $this->request->params([
|
|
["staff_id",""],
|
|
["department_id",""],
|
|
["payment_status",""],
|
|
["created_at",["",""]]
|
|
]);
|
|
return success((new SalaryService())->getPage($data));
|
|
}
|
|
|
|
/**
|
|
* 工资详情
|
|
* @param int $id
|
|
* @return \think\Response
|
|
*/
|
|
public function info(int $id){
|
|
return success((new SalaryService())->getInfo($id));
|
|
}
|
|
|
|
/**
|
|
* 添加工资
|
|
* @return \think\Response
|
|
*/
|
|
public function add(){
|
|
$data = $this->request->params([
|
|
["staff_id",0],
|
|
["department_id",0],
|
|
["base_salary",0.00],
|
|
["performance_bonus",0.00],
|
|
["deductions",0.00],
|
|
["other_subsidies",0.00],
|
|
["payment_status",""],
|
|
["payment_method",""],
|
|
["remarks",""],
|
|
["salary_month","2025-05-22 18:20:42"],
|
|
|
|
]);
|
|
$this->validate($data, 'app\validate\salary\Salary.add');
|
|
$id = (new SalaryService())->add($data);
|
|
return success('ADD_SUCCESS', ['id' => $id]);
|
|
}
|
|
|
|
/**
|
|
* 工资编辑
|
|
* @param $id 工资id
|
|
* @return \think\Response
|
|
*/
|
|
public function edit(int $id){
|
|
$data = $this->request->params([
|
|
["staff_id",0],
|
|
["department_id",0],
|
|
["base_salary",0.00],
|
|
["performance_bonus",0.00],
|
|
["deductions",0.00],
|
|
["other_subsidies",0.00],
|
|
["payment_status",""],
|
|
["payment_method",""],
|
|
["remarks",""],
|
|
["salary_month","2025-05-22 18:20:42"],
|
|
|
|
]);
|
|
$this->validate($data, 'app\validate\salary\Salary.edit');
|
|
(new SalaryService())->edit($id, $data);
|
|
return success('EDIT_SUCCESS');
|
|
}
|
|
|
|
/**
|
|
* 工资删除
|
|
* @param $id 工资id
|
|
* @return \think\Response
|
|
*/
|
|
public function del(int $id){
|
|
(new SalaryService())->del($id);
|
|
return success('DELETE_SUCCESS');
|
|
}
|
|
|
|
|
|
public function getPersonnelAll(){
|
|
return success(( new SalaryService())->getPersonnelAll());
|
|
}
|
|
|
|
public function getDepartmentsAll(){
|
|
return success(( new SalaryService())->getDepartmentsAll());
|
|
}
|
|
|
|
}
|
|
|