129 lines
3.9 KiB
PHP
129 lines
3.9 KiB
PHP
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||
// +----------------------------------------------------------------------
|
||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||
// | 开源版本可自由商用,可去除界面版权logo
|
||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||
// | 访问官网:https://www.likeadmin.cn
|
||
// | likeadmin团队 版权所有 拥有最终解释权
|
||
// +----------------------------------------------------------------------
|
||
// | author: likeadminTeam
|
||
// +----------------------------------------------------------------------
|
||
|
||
namespace app\adminapi\logic;
|
||
|
||
|
||
use app\common\model\ProjectCommissionDetail;
|
||
use app\common\logic\BaseLogic;
|
||
use think\facade\Db;
|
||
|
||
|
||
/**
|
||
* ProjectCommissionDetail逻辑
|
||
* Class ProjectCommissionDetailLogic
|
||
* @package app\adminapi\logic
|
||
*/
|
||
class ProjectCommissionDetailLogic extends BaseLogic
|
||
{
|
||
|
||
|
||
/**
|
||
* @notes 添加
|
||
* @param array $params
|
||
* @return bool
|
||
* @author likeadmin
|
||
* @date 2024/02/23 09:48
|
||
*/
|
||
public static function add(array $params): bool
|
||
{
|
||
Db::startTrans();
|
||
try {
|
||
ProjectCommissionDetail::create([
|
||
'project_commission_id' => $params['project_commission_id'],
|
||
'engineer' => $params['engineer'],
|
||
'engineer_id' => $params['engineer_id'],
|
||
'task_name' => $params['task_name'],
|
||
'task_type' => $params['task_type'],
|
||
'professional_type' => $params['professional_type'],
|
||
'zj_amount' => $params['zj_amount'],
|
||
'sk_amount' => $params['sk_amount'],
|
||
'tc_rate' => $params['tc_rate'],
|
||
'tc_amount' => $params['tc_amount'],
|
||
'pay_amount' => $params['pay_amount'],
|
||
'remark' => $params['remark'],
|
||
'other_fee' => $params['other_fee'],
|
||
]);
|
||
|
||
Db::commit();
|
||
return true;
|
||
} catch (\Exception $e) {
|
||
Db::rollback();
|
||
self::setError($e->getMessage());
|
||
return false;
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 编辑
|
||
* @param array $params
|
||
* @return bool
|
||
* @author likeadmin
|
||
* @date 2024/02/23 09:48
|
||
*/
|
||
public static function edit(array $params): bool
|
||
{
|
||
Db::startTrans();
|
||
try {
|
||
ProjectCommissionDetail::where('id', $params['id'])->update([
|
||
'engineer' => $params['engineer'],
|
||
'engineer_id' => $params['engineer_id'],
|
||
'task_name' => $params['task_name'],
|
||
'task_type' => $params['task_type'],
|
||
'professional_type' => $params['professional_type'],
|
||
'zj_amount' => $params['zj_amount'],
|
||
'sk_amount' => $params['sk_amount'],
|
||
'tc_rate' => $params['tc_rate'],
|
||
'tc_amount' => $params['tc_amount'],
|
||
'pay_amount' => $params['pay_amount'],
|
||
'remark' => $params['remark'],
|
||
'other_fee' => $params['other_fee'],
|
||
]);
|
||
|
||
Db::commit();
|
||
return true;
|
||
} catch (\Exception $e) {
|
||
Db::rollback();
|
||
self::setError($e->getMessage());
|
||
return false;
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 删除
|
||
* @param array $params
|
||
* @return bool
|
||
* @author likeadmin
|
||
* @date 2024/02/23 09:48
|
||
*/
|
||
public static function delete(array $params): bool
|
||
{
|
||
return ProjectCommissionDetail::destroy($params['id']);
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取详情
|
||
* @param $params
|
||
* @return array
|
||
* @author likeadmin
|
||
* @date 2024/02/23 09:48
|
||
*/
|
||
public static function detail($params): array
|
||
{
|
||
return ProjectCommissionDetail::findOrEmpty($params['id'])->toArray();
|
||
}
|
||
} |