|
@@ -7,6 +7,7 @@ use App\Models\CmsContentTemplateSet;
|
|
|
use App\Models\CmsSubjectProduct;
|
|
|
use App\Models\CmsSubject;
|
|
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
|
|
+use Tymon\JWTAuth\Facades\JWTAuth;
|
|
|
|
|
|
class CmsContentTemplateSetRepository {
|
|
|
public function __construct(CmsContentTemplateSet $cmsContentTemplateSet,CmsContentTemplate $cmsContentTemplate,CmsSubjectProduct $cmsSubjectProduct,CmsSubject $cmsSubject) {
|
|
@@ -72,7 +73,7 @@ class CmsContentTemplateSetRepository {
|
|
|
$show_type = $this->cmsSubject->select('show_type')->where('id', $rules['link_url'])->first();
|
|
|
$product = $this->cmsSubjectProduct->where('subject_id', $rules['link_url'])->orderBy('sort', 'asc')->get();
|
|
|
$pro_array = $product->toArray();
|
|
|
- $res_id = implode(",", array_column($pro_array, 'id'));
|
|
|
+ $res_id = implode(",", array_column($pro_array, 'product_id'));
|
|
|
$new_rule[$k]['product_id'] = $res_id;
|
|
|
$new_rule[$k]['subject_id'] = $rules['link_url'];
|
|
|
$new_rule[$k]['show_type'] = $show_type->show_type ?? '';
|
|
@@ -103,4 +104,33 @@ class CmsContentTemplateSetRepository {
|
|
|
public function getTemplate($cityId){
|
|
|
return $this->cmsContentTemplate->select('title','apply_type')->where(['city_id'=>$cityId,'is_open'=>1])->orderBy('apply_type','asc')->get();
|
|
|
}
|
|
|
+
|
|
|
+ public function productList($request)
|
|
|
+ {
|
|
|
+ $area_type = '';
|
|
|
+ if ($request['area_type'] == 'floor'){
|
|
|
+ $area_type = 2;
|
|
|
+ }
|
|
|
+ $template_set = $this->cmsContentTemplateSet->select('rule')->where(['area_type'=>$area_type,'id'=>$request['id']])->first();
|
|
|
+ $template_array = json_decode($template_set->rule,true);
|
|
|
+
|
|
|
+ $product = $this->cmsSubjectProduct->where('subject_id', $template_array['link_url'])->orderBy('sort', 'asc')->get();
|
|
|
+ $pro_array = $product->toArray();
|
|
|
+ $res_id = implode(",", array_column($pro_array, 'product_id'));
|
|
|
+
|
|
|
+ try {
|
|
|
+ $sign = generateSign([], config('customer.app_secret'));
|
|
|
+ $url = config("customer.user-service-url").'/api/honmeProduct';
|
|
|
+// $url = '192.168.33.127:8080/honmeProduct';
|
|
|
+ $url = 'https://api.dev.caihongxingqiu.com/product/honmeProduct';
|
|
|
+ $array = [
|
|
|
+ 'json' => ['sign' => $sign,'ids' => $res_id], 'query' => [], 'http_errors' => false,'headers'=>['Authorization'=>"Bearer ".JWTAuth::getToken()]
|
|
|
+ ];
|
|
|
+
|
|
|
+ return http($url,$array);
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|