|
...
|
...
|
@@ -6,9 +6,16 @@ use App\Enums\Common\Code; |
|
|
|
use App\Enums\Common\Common;
|
|
|
|
use App\Http\Controllers\Aside\BaseController;
|
|
|
|
use App\Http\Logic\Aside\Manage\MenuLogic;
|
|
|
|
use App\Models\Domain\DomainInfo;
|
|
|
|
use App\Models\Inquiry\InquiryData;
|
|
|
|
use App\Models\Manage\Manage;
|
|
|
|
use App\Models\Product\Keyword;
|
|
|
|
use App\Models\Product\Product;
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Models\RouteMap\RouteMap;
|
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
use Illuminate\Support\Facades\Hash;
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -96,4 +103,55 @@ class IndexController extends BaseController |
|
|
|
$this->response('success');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :根据关键字获取产品主图
|
|
|
|
* @name :getKeywordList
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/2/23 16:28
|
|
|
|
*/
|
|
|
|
public function getKeywordImage(){
|
|
|
|
$arr = explode('/',trim(str_replace('https://', '', $this->param['url']),'/'));
|
|
|
|
if(empty($arr) || !is_array($arr)){
|
|
|
|
$this->response('当前项目不存在..',Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
$domainModel = new DomainInfo();
|
|
|
|
$domainInfo = $domainModel->read(['domain'=>$arr[0]]);
|
|
|
|
if($domainInfo === false){
|
|
|
|
$this->response('当前项目不存在.',Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
ProjectServer::useProject($domainInfo['project_id']);
|
|
|
|
$routeMapModel = new RouteMap();
|
|
|
|
$routeInfo = $routeMapModel->read(['route'=>$arr[1]]);
|
|
|
|
if($domainInfo === false){
|
|
|
|
$this->response('当前路由不存在.',Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
$keywordModel = new Keyword();
|
|
|
|
$keywordInfo = $keywordModel->read(['id'=>$routeInfo['source_id']]);
|
|
|
|
$count = Product::where('keyword_id','like' ,'%,'.$keywordInfo['id'].',%')->count();
|
|
|
|
$productModel = new Product();
|
|
|
|
if($count < 5){
|
|
|
|
$productList = $productModel->list([],'sort',['thumb','title'],'desc',7);
|
|
|
|
//获取7个产品主图
|
|
|
|
}else{
|
|
|
|
$productList = $productModel->list(['keyword_id'=>['like','%,'.$keywordInfo['id'].',%']],['thumb','title'],'desc',7);
|
|
|
|
}
|
|
|
|
$product_image = [];
|
|
|
|
foreach ($productList as $k => $v){
|
|
|
|
$product_image[]['title'] = $v['title'];
|
|
|
|
if(!empty($v['thumb']) && !empty($v['thumb']['url'])){
|
|
|
|
$product_image[]['image'] = '';
|
|
|
|
$product_image[]['image'] = getImageUrl($v['thumb']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$data = [
|
|
|
|
'title'=>$keywordInfo['title'],
|
|
|
|
'keyword_title'=>$keywordInfo['keyword_title'],
|
|
|
|
'keyword_content'=>$keywordInfo['keyword_content'],
|
|
|
|
'product_list'=>$product_image
|
|
|
|
];
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
$this->response('success',Code::SUCCESS,$data);
|
|
|
|
}
|
|
|
|
|
|
|
|
} |
...
|
...
|
|