作者 lyh

gx

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