作者 lyh
@@ -612,6 +612,7 @@ class ProjectUpdate extends Command @@ -612,6 +612,7 @@ class ProjectUpdate extends Command
612 'module_id' => $custom_info['id'], 612 'module_id' => $custom_info['id'],
613 'category_id' => $category_id, 613 'category_id' => $category_id,
614 'content' => $item['content'] ?? '', 614 'content' => $item['content'] ?? '',
  615 + 'sort' => $item['sort'] ?? 0,
615 'image' => $new_img, 616 'image' => $new_img,
616 'created_at' => $item['post_time'] ?? date('Y-m-d H:i:s'), 617 'created_at' => $item['post_time'] ?? date('Y-m-d H:i:s'),
617 'updated_at' => $item['post_time'] ?? date('Y-m-d H:i:s'), 618 'updated_at' => $item['post_time'] ?? date('Y-m-d H:i:s'),
@@ -628,6 +629,7 @@ class ProjectUpdate extends Command @@ -628,6 +629,7 @@ class ProjectUpdate extends Command
628 'name' => $item['title'], 629 'name' => $item['title'],
629 'category_id' => $category_id, 630 'category_id' => $category_id,
630 'content' => $item['content'] ?? '', 631 'content' => $item['content'] ?? '',
  632 + 'sort' => $item['sort'] ?? 0,
631 'image' => $new_img 633 'image' => $new_img
632 ], ['id' => $id]); 634 ], ['id' => $id]);
633 } 635 }
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Api; @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Api;
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 use App\Models\Product\Product; 6 use App\Models\Product\Product;
7 use App\Services\ProjectServer; 7 use App\Services\ProjectServer;
  8 +use App\Utils\LogUtils;
8 use Illuminate\Http\Request; 9 use Illuminate\Http\Request;
9 use Illuminate\Support\Arr; 10 use Illuminate\Support\Arr;
10 11
@@ -31,13 +32,15 @@ class ProductController extends BaseController @@ -31,13 +32,15 @@ class ProductController extends BaseController
31 } 32 }
32 33
33 try { 34 try {
34 - $gallery = Product::where('status', Product::STATUS_ON)->whereNotNull('gallery')->inRandomOrder()->value('gallery');  
35 - $gallery = array_map(function ($item) use ($project) {  
36 - return getImageUrl($item, $project['storage_type'], $project['project_location']);  
37 - }, Arr::pluck($gallery, 'url')); 35 + $info = Product::where('status', Product::STATUS_ON)->whereNotNull('gallery')->inRandomOrder()->select(['title', 'seo_mate', 'gallery'])->first();
  36 + $info['gallery'] = array_map(function ($item) use ($project) {
  37 + $item['url'] = getImageUrl($item['url'], $project['storage_type'], $project['project_location']);
  38 + return $item;
  39 + }, $info['gallery']);
38 } catch (\Exception $e) { 40 } catch (\Exception $e) {
39 - $gallery = []; 41 + LogUtils::error('Project Id: ' . $project_id . ' getProductImages error:' . $e->getMessage());
  42 + $info = [];
40 } 43 }
41 - $this->response('success', Code::SUCCESS, $gallery); 44 + $this->response('success', Code::SUCCESS, $info);
42 } 45 }
43 } 46 }
@@ -251,11 +251,11 @@ class DomainInfoLogic extends BaseLogic @@ -251,11 +251,11 @@ class DomainInfoLogic extends BaseLogic
251 foreach ($output as $line){ 251 foreach ($output as $line){
252 if($line){ 252 if($line){
253 $checkA = strpos($line, $server_info['host']) !== false; 253 $checkA = strpos($line, $server_info['host']) !== false;
254 - }  
255 - }  
256 if($checkA){ 254 if($checkA){
257 return $domain; 255 return $domain;
258 } 256 }
  257 + }
  258 + }
259 259
260 //是否cname 260 //是否cname
261 $process = new Process(['nslookup', '-qt=cname', $domain]); 261 $process = new Process(['nslookup', '-qt=cname', $domain]);
@@ -264,11 +264,10 @@ class DomainInfoLogic extends BaseLogic @@ -264,11 +264,10 @@ class DomainInfoLogic extends BaseLogic
264 foreach ($output as $line){ 264 foreach ($output as $line){
265 if($line){ 265 if($line){
266 $checkCname = (strpos($line, $server_info['init_domain']) !== false); 266 $checkCname = (strpos($line, $server_info['init_domain']) !== false);
267 - }  
268 - }  
269 if($checkCname){ 267 if($checkCname){
270 return $domain; 268 return $domain;
271 - 269 + }
  270 + }
272 } 271 }
273 return false; 272 return false;
274 } 273 }