作者 lyh

gx

... ... @@ -56,7 +56,7 @@ class BaseController extends Controller
if(is_array($v)){
$this->getParam();
}else{
if(empty($v)){
if(empty($v) && ($v != 0)){
unset($this->param[$k]);
}
$this->getMap($k,$v);
... ...
... ... @@ -101,6 +101,7 @@ class ProjectController extends BaseController
*/
public function save(ProjectRequest $request, ProjectLogic $logic)
{
$request->validated();
$logic->save($this->param);
$this->response('success');
}
... ...
... ... @@ -35,6 +35,12 @@ class DomainInfoLogic extends BaseLogic
if(isset($this->param['id']) && !empty($this->param['id'])){
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$data = $this->getDomainInfo($this->param['domain']);
if(!empty($data['domain_start_time']) && !empty($data['domain_end_time'])){
$this->param['domain_start_time'] = $data['domain_start_time'];
$this->param['domain_end_time'] = $data['domain_end_time'];
}
$rs = $this->model->add($this->param);
}
if($rs === false){
... ... @@ -82,6 +88,13 @@ class DomainInfoLogic extends BaseLogic
* @time :2023/8/1 15:43
*/
public function editDomainStatus(){
//查看当前域名是否有项目在使用
if($this->param['status'] != $this->model::STATUS_ONE){
$info = $this->model->read(['id'=>$this->param['id']]);
if($info === false){
$this->fail('当前域名有项目正在使用中');
}
}
$rs = $this->model->edit(['status'=>$this->param['status']],['id'=>$this->param['id']]);
if($rs === false){
$this->fail('error');
... ...
... ... @@ -15,6 +15,7 @@ use App\Models\Channel\Channel;
use App\Models\Channel\User;
use App\Models\Channel\Zone;
use App\Models\Devops\ServerConfig;
use App\Models\Domain\DomainInfo;
use App\Models\Inquiry\InquirySet;
use App\Models\Manage\Manage;
use App\Models\News\News;
... ... @@ -48,6 +49,8 @@ class ProjectLogic extends BaseLogic
{
parent::setWith(['payment', 'deploy_build', 'deploy_optimize','online_check']);
var_dump($map);
die();
$list = parent::getList($map, $sort, ['id', 'title', 'mysql_id' ,'channel','cooperate_date' ,'type', 'created_at'], $limit);
$managerLogic = new ManageLogic();
foreach ($list['list'] as &$item){
... ... @@ -152,6 +155,9 @@ class ProjectLogic extends BaseLogic
if(isset($param['mysql_id']) && !empty($param['mysql_id'])){
$this->initializationMysql($res['id']);
}
if(isset($param['serve_id']) && !empty($param['serve_id'])){
$this->updateServe($param['serve_id']);
}
DB::commit();
}catch (\Exception $e){
DB::rollBack();
... ... @@ -174,7 +180,20 @@ class ProjectLogic extends BaseLogic
ProjectServer::createDatabase($project);
//创建表
ProjectServer::initTable($project);
return true;
return $this->success();
}
/**
* @remark :更新服务器为已使用
* @name :updateServe
* @author :lyh
* @method :post
* @time :2023/8/28 10:50
*/
public function updateServe($serve_id){
$domainModel = new DomainInfo();
$domainModel->edit(['status'=>$domainModel::STATUS_ONE],['id'=>$serve_id]);
return $this->success();
}
/**
* @remark :验证域名
... ...
... ... @@ -57,12 +57,12 @@ class ServiceLogic extends BaseLogic
*/
public function serviceSave(){
//删除以前的配置
// try {
try {
$this->model->del(['type'=>1]);
$this->model->insert($this->param['data']);
// }catch (\Exception $e){
// $this->fail('error');
// }
}catch (\Exception $e){
$this->fail('error');
}
return $this->success();
}
... ...
... ... @@ -30,6 +30,6 @@ class ServerConfig extends Base
const TYPE_MYSQL = 2;
const TYPE_REDIS = 3;
const STATUS_ONE = 1;
}
... ...
... ... @@ -14,6 +14,8 @@ use App\Models\Base;
*/
class DomainInfo extends Base
{
const STATUS_ONE = 1;
public $btAction = [
'create_site' => '/site?action=AddSite',
];
... ...