作者 lyh

gx

... ... @@ -13,6 +13,7 @@ use App\Http\Logic\Aside\BaseLogic;
use App\Models\Project\DeployBuild;
use App\Models\Project\Project;
use App\Models\Project\ProjectRenew;
use App\Models\Project\RenewLog;
use Illuminate\Support\Facades\DB;
class RenewLogic extends BaseLogic
... ... @@ -77,13 +78,10 @@ class RenewLogic extends BaseLogic
}
DB::beginTransaction();
try {
$this->model->edit(['project_id'=>$this->param['id'],'operator_id'=>$this->manager['id']],['id'=>$this->param['renew_id']]);
$project = new Project();
$project->edit(['extend_type'=>0],['id'=>$this->param['id']]);
$deployBuild = new DeployBuild();
$deployBuild->edit(
['service_duration'=>DB::raw('service_duration + ' . $info['service_duration']),
'plan'=>$info['plan']], ['project_id'=>$this->param['id']]);
$this->model->edit(['project_id'=>$this->param['id'],'operator_id'=>$this->manager['id'],'status'=>1],['id'=>$this->param['renew_id']]);
$this->saveLog($this->param['renew_id'],$this->param['service_duration'],$this->param['plan'],$info['amount'],$info['api_no'],$this->param['id']);
$this->updateProject($this->param['id']);
$this->updateProjectBuild($this->param['id'],$this->param['service_duration'],$this->param['plan']);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
... ... @@ -106,4 +104,62 @@ class RenewLogic extends BaseLogic
}
return $this->success();
}
/**
* @remark :关联续费单生成一条日志
* @name :saveLog
* @author :lyh
* @method :post
* @time :2023/9/27 16:29
*/
public function saveLog($renew_id,$service_duration,$plan,$amount,$api_no,$project_id){
$data = [
'renew_id'=>$renew_id,
'service_duration'=>$service_duration,
'plan'=>$plan,
'amount'=>$amount,
'api_no'=>$api_no,
'project_id'=>$project_id,
'operator_id'=>$this->manager['id']
];
$renewLogModel = new RenewLog();
return $renewLogModel->add($data);
}
/**
* @remark :更新项目部署信息
* @name :updateProjectBuild
* @author :lyh
* @method :post
* @time :2023/9/27 16:32
*/
public function updateProjectBuild($id,$service_duration,$plan){
$deployBuild = new DeployBuild();
return $deployBuild->edit(
[
'service_duration'=>DB::raw('service_duration + ' . $service_duration),
'plan'=>$plan
],
[
'project_id'=>$id
]);
}
/**
* @remark :更新项目
* @name :updateProject
* @author :lyh
* @method :post
* @time :2023/9/27 16:35
*/
public function updateProject($id,$type){
$project = new Project();
return $project->edit([
'extend_type'=>0,
'type'=>$type
],[
'id'=>$id
]);
}
}
... ...
<?php
/**
* @remark :
* @name :RenewLog.php
* @author :lyh
* @method :post
* @time :2023/9/27 16:39
*/
namespace App\Models\Project;
use App\Models\Base;
/**
* @remark :续费记录单日志
* @name :RenewLog
* @author :lyh
* @method :post
* @time :2023/9/27 16:40
*/
class RenewLog extends Base
{
protected $table = 'gl_project_renew_log';
}
... ...