作者 lyh

gx

... ... @@ -35,29 +35,22 @@ class NavLogic extends BaseLogic
*/
public function navSave()
{
DB::beginTransaction();
try {
if(!empty($this->param['location'])){
if($this->param['location'] == 'header'){
$this->param['group_id'] = BNavGroup::DEFAULT_HEADER_ID;
}
if($this->param['location'] == 'footer'){
$this->param['group_id'] = BNavGroup::DEFAULT_FOOTER_ID;
}
if(!empty($this->param['location'])){
if($this->param['location'] == 'header'){
$this->param['group_id'] = BNavGroup::DEFAULT_HEADER_ID;
}
$this->param['image'] = str_replace_url(isset($this->param['image']) ? $this->param['image'] : '');
$this->param['remark_image'] = str_replace_url(isset($this->param['remark_image']) ? $this->param['remark_image'] : '');
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->handleEditParam();//验证是否可编辑分类
$this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$this->param['project_id'] = $this->user['project_id'];
$this->model->add($this->param);
if($this->param['location'] == 'footer'){
$this->param['group_id'] = BNavGroup::DEFAULT_FOOTER_ID;
}
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('error');
}
$this->param['image'] = str_replace_url(isset($this->param['image']) ? $this->param['image'] : '');
$this->param['remark_image'] = str_replace_url(isset($this->param['remark_image']) ? $this->param['remark_image'] : '');
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->handleEditParam();//验证是否可编辑分类
$this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$this->param['project_id'] = $this->user['project_id'];
$this->model->add($this->param);
}
//编辑菜单后,通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NAV, 'route'=>'all']);
... ...
... ... @@ -35,6 +35,7 @@ class NavRequest extends FormRequest
// 'group_id' => ['required','integer'],
'pid' => ['required','integer'],
'name' => ['required','max:100'],
'url' => ['required'],
];
return $rule;
}
... ... @@ -49,6 +50,7 @@ class NavRequest extends FormRequest
'pid.integer' => '上级选择错误',
'name.required' => '名称必须',
'name.max' => '名称不能超过100个字符',
'url.required' => '链接不能为空',
];
}
}
... ...
... ... @@ -21,7 +21,8 @@ class SyncService extends BaseService
{
/**
* 同步信息到表单系统
* TODO 项目已经上线 && 已经有正式域名 && 用户设置收件邮箱或者手机号码
* TODO 已经有正式域名
* 项目已经上线 && 已经有正式域名 && 用户设置收件邮箱或者手机号码
* @param int $project_id
* @return mixed
*/
... ... @@ -32,18 +33,17 @@ class SyncService extends BaseService
// 项目信息
$project = Project::with('deploy_build')->with('deploy_optimize')->where(['id'=>$project_id])->first();
// 收件设置信息
ProjectServer::useProject($project_id);
$receive = WebSettingReceiving::where(['project_id' => $project_id])->get();
// 不满足条件 不同步到表单系统
if (FALSE == in_array($project->type, [Project::TYPE_TWO, Project::TYPE_THREE]) || empty($project->deploy_optimize->domain) || $receive->isEmpty()) {
if (empty($project->deploy_optimize->domain)) {
return false;
}
// 生产域名
$domain = (new DomainInfo())->getDomain($project->deploy_optimize->domain);
// 收件设置信息
ProjectServer::useProject($project_id);
$receive = WebSettingReceiving::where(['project_id' => $project_id])->get();
// 处理收件信息
$email = $phone = [];
foreach ($receive as $value) {
... ...