作者 lyh

gx

... ... @@ -59,12 +59,13 @@ class SyncProject extends Command
}
if($data['data']['order_type'] == '首次'){
$data['data']['type'] = 1; //建站进程中
ProjectLogic::instance()->sync($data['data']);
}
if($data['data']['order_type'] == '续费'){
$data['data']['type'] = 4; //续费记录单
ProjectLogic::instance()->renewSync($data['data']);
}
// @file_put_contents(storage_path('logs/lyh_error.log'), var_export($data['data'], true) . PHP_EOL, FILE_APPEND);
ProjectLogic::instance()->sync($data['data']);
$item->status = NoticeLog::STATUS_SUCCESS;
$item->save();
}catch (\Exception $e){
... ...
... ... @@ -36,12 +36,6 @@ class ServerConfigLogic extends BaseLogic
*/
public function serviceConfigList($map,$page,$row,$order = 'id',$filed = ['*']){
$lists = $this->model->lists($map,$page,$row,$order,$filed);
if(!empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
$v['project_title'] = (new Project())->read(['id'=>$v['project_id']])['title'];
$lists['list'][$k] = $v;
}
}
return $this->success($lists);
}
... ... @@ -69,11 +63,6 @@ class ServerConfigLogic extends BaseLogic
*/
public function serviceConfigSave()
{
$project = new Project();
$project_list = $project->read(['id'=>$this->param['project_id']]);
if($project_list === false){
$this->fail('项目不存在或者已经删除');
}
DB::beginTransaction();
try {
//保存配置
... ... @@ -81,7 +70,7 @@ class ServerConfigLogic extends BaseLogic
$this->param['updated_at'] = date('Y-m-d H:i:s');
$this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$this->add($project);
$this->model->add($this->param);
}
//初始化数据库
DB::commit();
... ... @@ -92,31 +81,6 @@ class ServerConfigLogic extends BaseLogic
return $this->success();
}
/**
* @remark :添加数据
* @name :add
* @author :lyh
* @method :post
* @time :2023/8/4 17:17
*/
public function add(&$project){
//查询当前项目是否已设置
$info = $this->model->read(['project_id'=>$this->param['project_id'],'type'=>$this->param['type']]);
if($info !== false){
$this->fail('当前项目已设置'.$this->param['type'] == 1?'服务器':'数据库');
}
$this->param['created_at'] = date('Y-m-d H:i:s');
$this->param['updated_at'] = $this->param['created_at'];
$res = $this->model->insertGetId($this->param);
if ($this->param['type'] == ServerConfig::TYPE_SERVER) {
$data['serve_id'] = $res;
}else{
$data['mysql_id'] = $res;
//$this->initializationMysql($this->param);
}
$project->edit($data,['id'=>$this->param['project_id']]);
return true;
}
/**
* @remark :初始化数据库
... ...
... ... @@ -286,6 +286,7 @@ class ProjectLogic extends BaseLogic
}
$data = [
'title' => $title,
'api_no'=> $param['id'],
'company' => $param['company_name'],
'lead_name' => $param['principal_name'],
'mobile' => $param['principal_mobile'],
... ...