作者 lyh

gx

@@ -59,12 +59,13 @@ class SyncProject extends Command @@ -59,12 +59,13 @@ class SyncProject extends Command
59 } 59 }
60 if($data['data']['order_type'] == '首次'){ 60 if($data['data']['order_type'] == '首次'){
61 $data['data']['type'] = 1; //建站进程中 61 $data['data']['type'] = 1; //建站进程中
  62 + ProjectLogic::instance()->sync($data['data']);
62 } 63 }
63 if($data['data']['order_type'] == '续费'){ 64 if($data['data']['order_type'] == '续费'){
64 $data['data']['type'] = 4; //续费记录单 65 $data['data']['type'] = 4; //续费记录单
  66 + ProjectLogic::instance()->renewSync($data['data']);
65 } 67 }
66 // @file_put_contents(storage_path('logs/lyh_error.log'), var_export($data['data'], true) . PHP_EOL, FILE_APPEND); 68 // @file_put_contents(storage_path('logs/lyh_error.log'), var_export($data['data'], true) . PHP_EOL, FILE_APPEND);
67 - ProjectLogic::instance()->sync($data['data']);  
68 $item->status = NoticeLog::STATUS_SUCCESS; 69 $item->status = NoticeLog::STATUS_SUCCESS;
69 $item->save(); 70 $item->save();
70 }catch (\Exception $e){ 71 }catch (\Exception $e){
@@ -36,12 +36,6 @@ class ServerConfigLogic extends BaseLogic @@ -36,12 +36,6 @@ class ServerConfigLogic extends BaseLogic
36 */ 36 */
37 public function serviceConfigList($map,$page,$row,$order = 'id',$filed = ['*']){ 37 public function serviceConfigList($map,$page,$row,$order = 'id',$filed = ['*']){
38 $lists = $this->model->lists($map,$page,$row,$order,$filed); 38 $lists = $this->model->lists($map,$page,$row,$order,$filed);
39 - if(!empty($lists['list'])){  
40 - foreach ($lists['list'] as $k => $v){  
41 - $v['project_title'] = (new Project())->read(['id'=>$v['project_id']])['title'];  
42 - $lists['list'][$k] = $v;  
43 - }  
44 - }  
45 return $this->success($lists); 39 return $this->success($lists);
46 } 40 }
47 41
@@ -69,11 +63,6 @@ class ServerConfigLogic extends BaseLogic @@ -69,11 +63,6 @@ class ServerConfigLogic extends BaseLogic
69 */ 63 */
70 public function serviceConfigSave() 64 public function serviceConfigSave()
71 { 65 {
72 - $project = new Project();  
73 - $project_list = $project->read(['id'=>$this->param['project_id']]);  
74 - if($project_list === false){  
75 - $this->fail('项目不存在或者已经删除');  
76 - }  
77 DB::beginTransaction(); 66 DB::beginTransaction();
78 try { 67 try {
79 //保存配置 68 //保存配置
@@ -81,7 +70,7 @@ class ServerConfigLogic extends BaseLogic @@ -81,7 +70,7 @@ class ServerConfigLogic extends BaseLogic
81 $this->param['updated_at'] = date('Y-m-d H:i:s'); 70 $this->param['updated_at'] = date('Y-m-d H:i:s');
82 $this->model->edit($this->param,['id'=>$this->param['id']]); 71 $this->model->edit($this->param,['id'=>$this->param['id']]);
83 }else{ 72 }else{
84 - $this->add($project); 73 + $this->model->add($this->param);
85 } 74 }
86 //初始化数据库 75 //初始化数据库
87 DB::commit(); 76 DB::commit();
@@ -92,31 +81,6 @@ class ServerConfigLogic extends BaseLogic @@ -92,31 +81,6 @@ class ServerConfigLogic extends BaseLogic
92 return $this->success(); 81 return $this->success();
93 } 82 }
94 83
95 - /**  
96 - * @remark :添加数据  
97 - * @name :add  
98 - * @author :lyh  
99 - * @method :post  
100 - * @time :2023/8/4 17:17  
101 - */  
102 - public function add(&$project){  
103 - //查询当前项目是否已设置  
104 - $info = $this->model->read(['project_id'=>$this->param['project_id'],'type'=>$this->param['type']]);  
105 - if($info !== false){  
106 - $this->fail('当前项目已设置'.$this->param['type'] == 1?'服务器':'数据库');  
107 - }  
108 - $this->param['created_at'] = date('Y-m-d H:i:s');  
109 - $this->param['updated_at'] = $this->param['created_at'];  
110 - $res = $this->model->insertGetId($this->param);  
111 - if ($this->param['type'] == ServerConfig::TYPE_SERVER) {  
112 - $data['serve_id'] = $res;  
113 - }else{  
114 - $data['mysql_id'] = $res;  
115 - //$this->initializationMysql($this->param);  
116 - }  
117 - $project->edit($data,['id'=>$this->param['project_id']]);  
118 - return true;  
119 - }  
120 84
121 /** 85 /**
122 * @remark :初始化数据库 86 * @remark :初始化数据库
@@ -286,6 +286,7 @@ class ProjectLogic extends BaseLogic @@ -286,6 +286,7 @@ class ProjectLogic extends BaseLogic
286 } 286 }
287 $data = [ 287 $data = [
288 'title' => $title, 288 'title' => $title,
  289 + 'api_no'=> $param['id'],
289 'company' => $param['company_name'], 290 'company' => $param['company_name'],
290 'lead_name' => $param['principal_name'], 291 'lead_name' => $param['principal_name'],
291 'mobile' => $param['principal_mobile'], 292 'mobile' => $param['principal_mobile'],