|
...
|
...
|
@@ -133,11 +133,11 @@ class ProductController extends BaseController |
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!empty($v['video'])){
|
|
|
|
$v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
|
|
|
|
$v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location'],$this->user['file_cdn'] ?? 0);
|
|
|
|
$v['video']['video_image'] = getImageUrl($v['video']['video_image'] ?? '',$this->user['storage_type'] ?? 0,$this->user['project_location']);
|
|
|
|
}
|
|
|
|
if(!empty($v['files']) && !empty($v['files']['url'])){
|
|
|
|
$v['files']['url'] = getFileUrl($v['files']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
|
|
|
|
$v['files']['url'] = getFileUrl($v['files']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location'],$this->user['file_cdn'] ?? 0);
|
|
|
|
}
|
|
|
|
return $this->success($v);
|
|
|
|
}
|
|
...
|
...
|
@@ -167,6 +167,29 @@ class ProductController extends BaseController |
|
|
|
if(!empty($this->param['start_at']) && !empty($this->param['end_at'])){
|
|
|
|
$query->where('created_at', '>=' ,$this->param['start_at'].' 00:00:00')->where('created_at', '<=' ,$this->param['end_at'].' 59:59:59');
|
|
|
|
}
|
|
|
|
$this->param['featured_status'] = $this->param['featured_status'] ?? 0;
|
|
|
|
if($this->param['featured_status'] != Category::STATUS_ACTIVE) {
|
|
|
|
$cateModel = new Category();
|
|
|
|
$featured_ids = $cateModel->where('title', 'like', 'Featured%')->pluck('id')->toArray();
|
|
|
|
if(!empty($featured_ids)){
|
|
|
|
$status = [];
|
|
|
|
if(isset($this->map['status'])){
|
|
|
|
$status = ['status'=>$this->map['status']];
|
|
|
|
}
|
|
|
|
$cateList = $cateModel->list($status,'id',['id','pid']);
|
|
|
|
//获取当前的子集
|
|
|
|
$featured_arr = [];
|
|
|
|
foreach ($featured_ids as $id){
|
|
|
|
$featured_arr = array_merge($featured_arr,array_unique(_get_all_sub($id,$cateList)));
|
|
|
|
}
|
|
|
|
if(!empty($featured_arr)){
|
|
|
|
$cateRelated = new CategoryRelated();
|
|
|
|
$product_ids = $cateRelated->whereIn('cate_id',$featured_arr)->pluck('product_id')->unique()->toArray();
|
|
|
|
$query = $query->whereNotIn('id',$product_ids);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return $query;
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -356,9 +379,9 @@ class ProductController extends BaseController |
|
|
|
foreach ($arr1 as $k1=>$v1){
|
|
|
|
$v1 = (array)$v1;
|
|
|
|
if(isset($v1['url'])){
|
|
|
|
$v1['url'] = getFileUrl($v1['url'],$this->user['storage_type'],$this->user['project_location']);
|
|
|
|
$v1['url'] = getFileUrl($v1['url'],$this->user['storage_type'],$this->user['project_location'],$this->user['file_cdn'] ?? 0);
|
|
|
|
}else{
|
|
|
|
$v1 = getFileUrl($v1,$this->user['storage_type'],$this->user['project_location']);
|
|
|
|
$v1 = getFileUrl($v1,$this->user['storage_type'],$this->user['project_location'],$this->user['file_cdn'] ?? 0);
|
|
|
|
}
|
|
|
|
$arr1[$k1] = $v1;
|
|
|
|
}
|
|
...
|
...
|
@@ -422,6 +445,11 @@ class ProductController extends BaseController |
|
|
|
* @time :2023/8/21 18:33
|
|
|
|
*/
|
|
|
|
public function getStatusNumber(ProductLogic $logic){
|
|
|
|
$this->request->validate([
|
|
|
|
'featured_status'=>'numeric',
|
|
|
|
],[
|
|
|
|
'featured_status.numeric' => 'numeric为数字',
|
|
|
|
]);
|
|
|
|
$data = $logic->getStatusNumber();
|
|
|
|
$this->response('success',Code::SUCCESS,$data);
|
|
|
|
}
|
|
...
|
...
|
@@ -536,10 +564,9 @@ class ProductController extends BaseController |
|
|
|
$setNumModel = new SettingNum();
|
|
|
|
$info = $setNumModel->read(['type'=>$setNumModel::TYPE_PRODUCT_SORT]);
|
|
|
|
if($info === false){
|
|
|
|
$info = [];
|
|
|
|
}else{
|
|
|
|
$info['data'] = json_decode($info['data']);
|
|
|
|
$this->response('success');
|
|
|
|
}
|
|
|
|
$info['data'] = json_decode($info['data']);
|
|
|
|
$this->response('success',Code::SUCCESS,$info);
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -580,4 +607,21 @@ class ProductController extends BaseController |
|
|
|
}
|
|
|
|
$this->response('success',Code::SUCCESS,$productInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :搜索分类参数
|
|
|
|
* @name :searchCategory
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/7/9 14:48
|
|
|
|
*/
|
|
|
|
public function getSearchCategoryList(ProductLogic $logic){
|
|
|
|
$this->request->validate([
|
|
|
|
'featured_status'=>'numeric',
|
|
|
|
],[
|
|
|
|
'featured_status.numeric' => 'numeric为数字',
|
|
|
|
]);
|
|
|
|
$data = $logic->getSearchCategoryList();
|
|
|
|
$this->response('success',Code::SUCCESS,$data);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|