update
This commit is contained in:
parent
e51d9ed831
commit
69dff92c93
@ -12,26 +12,26 @@
|
|||||||
// | author: likeadminTeam
|
// | author: likeadminTeam
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
namespace app\adminapi\logic\project;
|
namespace app\adminapi\logic\project;
|
||||||
|
|
||||||
|
|
||||||
use app\common\model\auth\Admin;
|
use app\common\logic\BaseLogic;
|
||||||
use app\common\model\custom\Custom;
|
use app\common\model\auth\Admin;
|
||||||
use app\common\model\custom\CustomContacts;
|
use app\common\model\custom\Custom;
|
||||||
use app\common\model\custom\CustomerDemand;
|
use app\common\model\custom\CustomContacts;
|
||||||
use app\common\model\project\Project;
|
use app\common\model\custom\CustomerDemand;
|
||||||
use app\common\model\project\ProjectEstimate;
|
use app\common\model\project\Project;
|
||||||
use app\common\logic\BaseLogic;
|
use app\common\model\project\ProjectEstimate;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目概算逻辑
|
* 项目概算逻辑
|
||||||
* Class ProjectEstimateLogic
|
* Class ProjectEstimateLogic
|
||||||
* @package app\adminapi\logic\project
|
* @package app\adminapi\logic\project
|
||||||
*/
|
*/
|
||||||
class ProjectEstimateLogic extends BaseLogic
|
class ProjectEstimateLogic extends BaseLogic
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,7 +41,7 @@ class ProjectEstimateLogic extends BaseLogic
|
|||||||
* @author likeadmin
|
* @author likeadmin
|
||||||
* @date 2023/11/24 21:42
|
* @date 2023/11/24 21:42
|
||||||
*/
|
*/
|
||||||
public static function add(array $params,$admin_id): bool
|
public static function add(array $params, $admin_id): bool
|
||||||
{
|
{
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
@ -56,7 +56,7 @@ class ProjectEstimateLogic extends BaseLogic
|
|||||||
'technician' => $params['technician'] ?? 0,
|
'technician' => $params['technician'] ?? 0,
|
||||||
'estimate_amount' => $params['estimate_amount'] ?? 0,
|
'estimate_amount' => $params['estimate_amount'] ?? 0,
|
||||||
'ask' => $params['ask'] ?? '',
|
'ask' => $params['ask'] ?? '',
|
||||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||||
'add_user' => $admin_id,
|
'add_user' => $admin_id,
|
||||||
'update_user' => $admin_id,
|
'update_user' => $admin_id,
|
||||||
]);
|
]);
|
||||||
@ -77,7 +77,7 @@ class ProjectEstimateLogic extends BaseLogic
|
|||||||
* @author likeadmin
|
* @author likeadmin
|
||||||
* @date 2023/11/24 21:42
|
* @date 2023/11/24 21:42
|
||||||
*/
|
*/
|
||||||
public static function edit(array $params,$admin_id): bool
|
public static function edit(array $params, $admin_id): bool
|
||||||
{
|
{
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
@ -92,7 +92,7 @@ class ProjectEstimateLogic extends BaseLogic
|
|||||||
'technician' => $params['technician'] ?? 0,
|
'technician' => $params['technician'] ?? 0,
|
||||||
'estimate_amount' => $params['estimate_amount'] ?? 0,
|
'estimate_amount' => $params['estimate_amount'] ?? 0,
|
||||||
'ask' => $params['ask'] ?? '',
|
'ask' => $params['ask'] ?? '',
|
||||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||||
'update_user' => $admin_id,
|
'update_user' => $admin_id,
|
||||||
'update_time' => time(),
|
'update_time' => time(),
|
||||||
]);
|
]);
|
||||||
@ -132,16 +132,17 @@ class ProjectEstimateLogic extends BaseLogic
|
|||||||
$data = ProjectEstimate::field($field)->findOrEmpty($params['id']);
|
$data = ProjectEstimate::field($field)->findOrEmpty($params['id']);
|
||||||
$data['estimate_source_text'] = $data->estimate_source_text;
|
$data['estimate_source_text'] = $data->estimate_source_text;
|
||||||
$data['invoice_type_text'] = $data->invoice_type_text;
|
$data['invoice_type_text'] = $data->invoice_type_text;
|
||||||
$project = Project::field('name,project_code,custom_id')->where('id',$data['project_id'])->findOrEmpty();
|
$project = Project::field('name,project_code,custom_id')->where('id', $data['project_id'])->findOrEmpty();
|
||||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
$custom = Custom::field('name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||||
$demand = CustomerDemand::field('theme')->where('id',$data['customer_demand_id'])->findOrEmpty();
|
$demand = CustomerDemand::field('theme,recording_time')->where('id', $data['customer_demand_id'])->findOrEmpty();
|
||||||
$contract = CustomContacts::field('name,phone')->where('id',$data['contact_id'])->findOrEmpty();
|
$contract = CustomContacts::field('name,phone')->where('id', $data['contact_id'])->findOrEmpty();
|
||||||
$technician = Admin::field('name')->where('id',$data['technician'])->findOrEmpty();
|
$technician = Admin::field('name')->where('id', $data['technician'])->findOrEmpty();
|
||||||
$admin = Admin::where('id','in',[$data['add_user'],$data['update_user']])->column('name','id');
|
$admin = Admin::where('id', 'in', [$data['add_user'], $data['update_user']])->column('name', 'id');
|
||||||
$data['project_name'] = $project['name'];
|
$data['project_name'] = $project['name'];
|
||||||
$data['project_code'] = $project['project_code'];
|
$data['project_code'] = $project['project_code'];
|
||||||
$data['custom_name'] = $custom['name'];
|
$data['custom_name'] = $custom['name'];
|
||||||
$data['customer_demand_name'] = $demand['theme'];
|
$data['customer_demand_name'] = $demand['theme'];
|
||||||
|
$data['recording_time'] = $demand['recording_time'];
|
||||||
$data['contact_name'] = $contract['name'];
|
$data['contact_name'] = $contract['name'];
|
||||||
$data['contact_phone'] = $contract['phone'];
|
$data['contact_phone'] = $contract['phone'];
|
||||||
$data['technician_name'] = $technician['name'];
|
$data['technician_name'] = $technician['name'];
|
||||||
@ -149,4 +150,4 @@ class ProjectEstimateLogic extends BaseLogic
|
|||||||
$data['update_user_name'] = $admin[$data['update_user']];
|
$data['update_user_name'] = $admin[$data['update_user']];
|
||||||
return $data->toArray();
|
return $data->toArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user