Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
3 个修改的文件
包含
25 行增加
和
25 行删除
| @@ -314,17 +314,17 @@ class PrivateController extends BaseController | @@ -314,17 +314,17 @@ class PrivateController extends BaseController | ||
| 314 | $product = Product::where(['status' => Product::STATUS_ON])->where('created_at', '>=', $date)->pluck('route'); | 314 | $product = Product::where(['status' => Product::STATUS_ON])->where('created_at', '>=', $date)->pluck('route'); |
| 315 | $news = News::where(['status' => News::STATUS_ONE])->where('release_at', '>', $date)->pluck('url'); | 315 | $news = News::where(['status' => News::STATUS_ONE])->where('release_at', '>', $date)->pluck('url'); |
| 316 | $blog = Blog::where(['status' => Blog::STATUS_ONE])->where('release_at', '>', $date)->pluck('url'); | 316 | $blog = Blog::where(['status' => Blog::STATUS_ONE])->where('release_at', '>', $date)->pluck('url'); |
| 317 | - $keyword = Keyword::where('created_at', '>', $date)->pluck('route'); | 317 | +// $keyword = Keyword::where('created_at', '>', $date)->pluck('route'); |
| 318 | 318 | ||
| 319 | // 组装链接 | 319 | // 组装链接 |
| 320 | foreach ($product as $item) { | 320 | foreach ($product as $item) { |
| 321 | $url = 'https://' . $domain . '/' . $item; | 321 | $url = 'https://' . $domain . '/' . $item; |
| 322 | array_push($result, $url); | 322 | array_push($result, $url); |
| 323 | } | 323 | } |
| 324 | - foreach ($keyword as $item) { | ||
| 325 | - $url = 'https://' . $domain . '/' . $item; | ||
| 326 | - array_push($result, $url); | ||
| 327 | - } | 324 | +// foreach ($keyword as $item) { |
| 325 | +// $url = 'https://' . $domain . '/' . $item; | ||
| 326 | +// array_push($result, $url); | ||
| 327 | +// } | ||
| 328 | foreach ($news as $item) { | 328 | foreach ($news as $item) { |
| 329 | $url = 'https://' . $domain . '/news/' . $item; | 329 | $url = 'https://' . $domain . '/news/' . $item; |
| 330 | array_push($result, $url); | 330 | array_push($result, $url); |
| @@ -105,10 +105,8 @@ class DetailController extends BaseController | @@ -105,10 +105,8 @@ class DetailController extends BaseController | ||
| 105 | public function saveDetail(DetailLogic $logic){ | 105 | public function saveDetail(DetailLogic $logic){ |
| 106 | $this->request->validate([ | 106 | $this->request->validate([ |
| 107 | 'product_id'=>'required', | 107 | 'product_id'=>'required', |
| 108 | - 'data'=>'required', | ||
| 109 | ],[ | 108 | ],[ |
| 110 | 'product_id.required' => '产品id不能为空', | 109 | 'product_id.required' => '产品id不能为空', |
| 111 | - 'data.required' => 'data不能为空', | ||
| 112 | ]); | 110 | ]); |
| 113 | $data = $logic->saveDetail(); | 111 | $data = $logic->saveDetail(); |
| 114 | $this->response('success',Code::SUCCESS,$data); | 112 | $this->response('success',Code::SUCCESS,$data); |
| @@ -51,27 +51,29 @@ class DetailLogic extends BaseLogic | @@ -51,27 +51,29 @@ class DetailLogic extends BaseLogic | ||
| 51 | * @time :2024/11/13 9:30 | 51 | * @time :2024/11/13 9:30 |
| 52 | */ | 52 | */ |
| 53 | public function saveDetail(){ | 53 | public function saveDetail(){ |
| 54 | - try { | ||
| 55 | - foreach ($this->param['data'] as $data){ | ||
| 56 | - foreach ($data as $v){ | ||
| 57 | - $save_data = [ | ||
| 58 | - 'sort'=>$v['sort'], | ||
| 59 | - 'column_id'=>$v['column_id'], | ||
| 60 | - 'product_id'=>$this->param['product_id'], | ||
| 61 | - 'text_type'=>$v['text_type'], | ||
| 62 | - 'title'=>$v['title'] ?? '', | ||
| 63 | - 'content'=>json_encode($v['content'] ?? []), | ||
| 64 | - 'css'=>json_encode($v['css'] ?? []), | ||
| 65 | - ]; | ||
| 66 | - if(isset($v['id']) && !empty($v['id'])){ | ||
| 67 | - $this->edit($save_data,['id'=>$v['id']]); | ||
| 68 | - }else{ | ||
| 69 | - $this->model->add($save_data); | 54 | + if(!empty($data)){ |
| 55 | + try { | ||
| 56 | + foreach ($this->param['data'] as $data){ | ||
| 57 | + foreach ($data as $v){ | ||
| 58 | + $save_data = [ | ||
| 59 | + 'sort'=>$v['sort'], | ||
| 60 | + 'column_id'=>$v['column_id'], | ||
| 61 | + 'product_id'=>$this->param['product_id'], | ||
| 62 | + 'text_type'=>$v['text_type'], | ||
| 63 | + 'title'=>$v['title'] ?? '', | ||
| 64 | + 'content'=>json_encode($v['content'] ?? []), | ||
| 65 | + 'css'=>json_encode($v['css'] ?? []), | ||
| 66 | + ]; | ||
| 67 | + if(isset($v['id']) && !empty($v['id'])){ | ||
| 68 | + $this->edit($save_data,['id'=>$v['id']]); | ||
| 69 | + }else{ | ||
| 70 | + $this->model->add($save_data); | ||
| 71 | + } | ||
| 70 | } | 72 | } |
| 71 | } | 73 | } |
| 74 | + }catch (\Exception $e){ | ||
| 75 | + $this->fail('保存失败,请联系管理员.错误:'.$e->getMessage()); | ||
| 72 | } | 76 | } |
| 73 | - }catch (\Exception $e){ | ||
| 74 | - $this->fail('保存失败,请联系管理员.错误:'.$e->getMessage()); | ||
| 75 | } | 77 | } |
| 76 | return $this->success(['product_id'=>$this->param['product_id']]); | 78 | return $this->success(['product_id'=>$this->param['product_id']]); |
| 77 | } | 79 | } |
-
请 注册 或 登录 后发表评论