|
...
|
...
|
@@ -9,6 +9,8 @@ use App\Http\Requests\Bside\News\NewsRequest; |
|
|
|
use App\Models\News\News as NewsModel;
|
|
|
|
use App\Models\News\NewsCategory;
|
|
|
|
use App\Models\RouteMap\RouteMap;
|
|
|
|
use App\Models\Template\BTemplate;
|
|
|
|
use App\Models\Template\Setting;
|
|
|
|
use App\Models\User\User;
|
|
|
|
|
|
|
|
|
|
...
|
...
|
@@ -33,19 +35,45 @@ class NewsController extends BaseController |
|
|
|
$lists = $lists->toArray();
|
|
|
|
// //获取当前项目的所有分类
|
|
|
|
$data = $this->getCategoryList();
|
|
|
|
//获取当前用户选择的模版
|
|
|
|
$templateSettingModel = new Setting();
|
|
|
|
$info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
|
|
|
|
$user = new User();
|
|
|
|
foreach ($lists['list'] as $k => $v){
|
|
|
|
$v['category_name'] = $this->categoryName($v['category_id'],$data);
|
|
|
|
$v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS,$v['id']);
|
|
|
|
$v['image_link'] = getImageUrl($v['image']);
|
|
|
|
$v['operator_name'] = $user->getName($v['operator_id']);
|
|
|
|
$v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']);
|
|
|
|
$lists['list'][$k] = $v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->response('success',Code::SUCCESS,$lists);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :查看产品是否已装修
|
|
|
|
* @name :getProductIsRenovation
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/9/13 14:02
|
|
|
|
*/
|
|
|
|
public function getProductIsRenovation($info,$id){
|
|
|
|
if($info !== false){
|
|
|
|
$webTemplateModel = new BTemplate();
|
|
|
|
$param = [
|
|
|
|
'source'=>4,
|
|
|
|
'project_id'=>$this->user['project_id'],
|
|
|
|
'source_id'=>$id,
|
|
|
|
'template_id'=>$info['template_id']
|
|
|
|
];
|
|
|
|
$templateInfo = $webTemplateModel->read($param);
|
|
|
|
if($templateInfo !== false){
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :处理列表返回参数
|
...
|
...
|
|