allocatr/application/admin/controller/salary/Detail.php
2025-06-05 15:46:42 +08:00

58 lines
1.2 KiB
PHP

<?php
namespace app\admin\controller\salary;
use app\common\controller\Backend;
use think\Db;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 工资详情
*
* @icon fa fa-circle-o
*/
class Detail extends Backend
{
/**
* Detail模型对象
* @var \app\admin\model\salary\Detail
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\salary\Detail;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function calc_total($total, $type, $value){
if ($type == 1) {
return $total + $value;
}
if ($type == 2) {
return $total - $value;
}
return $total;
}
public function clean_number($num): string {
return rtrim(rtrim(number_format($num, 10, '.', ''), '0'), '.');
}
}