|
...
|
...
|
@@ -7,6 +7,7 @@ use App\Helper\Translate; |
|
|
|
use App\Models\Product\Category;
|
|
|
|
use App\Models\Product\CategoryRelated;
|
|
|
|
use App\Models\Product\Product;
|
|
|
|
use App\Models\Project\ProjectAiSetting;
|
|
|
|
use App\Models\RouteMap\RouteMap;
|
|
|
|
use App\Services\CosService;
|
|
|
|
use App\Services\ProjectServer;
|
|
...
|
...
|
@@ -251,4 +252,30 @@ class ProductController extends BaseController |
|
|
|
|
|
|
|
return $suggestions;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 搜索给AI博客 产品推荐用
|
|
|
|
* 全文搜索 产品标题
|
|
|
|
* @author zbj
|
|
|
|
* @date 2025/5/8
|
|
|
|
*/
|
|
|
|
public function searchProductToAiBlog(Request $request){
|
|
|
|
$mch_id = $request->input('mch_id');
|
|
|
|
$key = $request->input('key');
|
|
|
|
$keyword = $request->input('keyword');
|
|
|
|
|
|
|
|
if(!$keyword){
|
|
|
|
$this->response('关键词不能为空', Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
$project_id = ProjectAiSetting::where('mch_id', $mch_id)->where('key', $key)->value('project_id');
|
|
|
|
if($project_id){
|
|
|
|
$this->response('项目不存在', Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
ProjectServer::useProject($project_id);
|
|
|
|
|
|
|
|
$product = Product::whereFullText('title', $keyword)->inRandomOrder()->select(['title', 'intro', 'thumb'])->first();
|
|
|
|
|
|
|
|
$this->response('success', Code::SUCCESS, $product?:[]);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|