作者 lyh

gx

@@ -196,24 +196,24 @@ class VideoTask extends Command @@ -196,24 +196,24 @@ class VideoTask extends Command
196 /** 196 /**
197 * 关键词聚合页-推荐&热门产品 197 * 关键词聚合页-推荐&热门产品
198 */ 198 */
199 - public function getRecommendAndHotProducts($project,$route): ?array 199 + public function getRecommendAndHotProducts($project_id,$route): ?array
200 { 200 {
201 $productIds = []; 201 $productIds = [];
202 - $productKeyword = Keyword::where("project_id",$project->id)->where("route",$route)->first(); 202 + $productKeyword = Keyword::where("project_id",$project_id)->where("route",$route)->first();
203 if (!empty($productKeyword)){ 203 if (!empty($productKeyword)){
204 - $productsQuery = Product::where("project_id", $project->id)->where("status",1)->where("keyword_id","like","%,".$productKeyword->id.",%")->limit(7)->get(); 204 + $productsQuery = Product::where("project_id", $project_id)->where("status",1)->where("keyword_id","like","%,".$productKeyword->id.",%")->limit(7)->get();
205 if (!empty($productsQuery)){ 205 if (!empty($productsQuery)){
206 foreach ($productsQuery as $item){ 206 foreach ($productsQuery as $item){
207 $productIds[] = $item->id; 207 $productIds[] = $item->id;
208 } 208 }
209 if (count($productIds)<7){ 209 if (count($productIds)<7){
210 - $randomData = Product::where("project_id", $project->id)->where("status",1)->whereNotIn('id', $productIds)->inRandomOrder()->take(13-count($productIds))->get(); 210 + $randomData = Product::where("project_id", $project_id)->where("status",1)->whereNotIn('id', $productIds)->inRandomOrder()->take(13-count($productIds))->get();
211 $products = $productsQuery->merge($randomData); 211 $products = $productsQuery->merge($randomData);
212 }else{ 212 }else{
213 $products = $productsQuery; 213 $products = $productsQuery;
214 } 214 }
215 }else{ 215 }else{
216 - $products = Product::where("project_id", $project->id)->where("status",1)->inRandomOrder()->take(13)->get(); 216 + $products = Product::where("project_id", $project_id)->where("status",1)->inRandomOrder()->take(13)->get();
217 } 217 }
218 } 218 }
219 $data = []; 219 $data = [];
@@ -7,6 +7,8 @@ use App\Enums\Common\Code; @@ -7,6 +7,8 @@ use App\Enums\Common\Code;
7 use App\Http\Logic\Aside\LoginLogic; 7 use App\Http\Logic\Aside\LoginLogic;
8 use App\Models\Domain\DomainInfo; 8 use App\Models\Domain\DomainInfo;
9 use App\Models\Manage\Manage; 9 use App\Models\Manage\Manage;
  10 +use App\Models\Product\Keyword;
  11 +use App\Models\Product\Product;
10 use App\Models\Project\Project; 12 use App\Models\Project\Project;
11 use App\Models\Sms\SmsLog; 13 use App\Models\Sms\SmsLog;
12 use App\Rules\Mobile; 14 use App\Rules\Mobile;