正在显示
1 个修改的文件
包含
29 行增加
和
1 行删除
| @@ -9,6 +9,8 @@ use App\Http\Requests\Bside\News\NewsRequest; | @@ -9,6 +9,8 @@ use App\Http\Requests\Bside\News\NewsRequest; | ||
| 9 | use App\Models\News\News as NewsModel; | 9 | use App\Models\News\News as NewsModel; |
| 10 | use App\Models\News\NewsCategory; | 10 | use App\Models\News\NewsCategory; |
| 11 | use App\Models\RouteMap\RouteMap; | 11 | use App\Models\RouteMap\RouteMap; |
| 12 | +use App\Models\Template\BTemplate; | ||
| 13 | +use App\Models\Template\Setting; | ||
| 12 | use App\Models\User\User; | 14 | use App\Models\User\User; |
| 13 | 15 | ||
| 14 | 16 | ||
| @@ -33,19 +35,45 @@ class NewsController extends BaseController | @@ -33,19 +35,45 @@ class NewsController extends BaseController | ||
| 33 | $lists = $lists->toArray(); | 35 | $lists = $lists->toArray(); |
| 34 | // //获取当前项目的所有分类 | 36 | // //获取当前项目的所有分类 |
| 35 | $data = $this->getCategoryList(); | 37 | $data = $this->getCategoryList(); |
| 38 | + //获取当前用户选择的模版 | ||
| 39 | + $templateSettingModel = new Setting(); | ||
| 40 | + $info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]); | ||
| 36 | $user = new User(); | 41 | $user = new User(); |
| 37 | foreach ($lists['list'] as $k => $v){ | 42 | foreach ($lists['list'] as $k => $v){ |
| 38 | $v['category_name'] = $this->categoryName($v['category_id'],$data); | 43 | $v['category_name'] = $this->categoryName($v['category_id'],$data); |
| 39 | $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS,$v['id']); | 44 | $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS,$v['id']); |
| 40 | $v['image_link'] = getImageUrl($v['image']); | 45 | $v['image_link'] = getImageUrl($v['image']); |
| 41 | $v['operator_name'] = $user->getName($v['operator_id']); | 46 | $v['operator_name'] = $user->getName($v['operator_id']); |
| 47 | + $v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']); | ||
| 42 | $lists['list'][$k] = $v; | 48 | $lists['list'][$k] = $v; |
| 43 | } | 49 | } |
| 44 | } | 50 | } |
| 45 | $this->response('success',Code::SUCCESS,$lists); | 51 | $this->response('success',Code::SUCCESS,$lists); |
| 46 | } | 52 | } |
| 47 | 53 | ||
| 48 | - | 54 | + /** |
| 55 | + * @remark :查看产品是否已装修 | ||
| 56 | + * @name :getProductIsRenovation | ||
| 57 | + * @author :lyh | ||
| 58 | + * @method :post | ||
| 59 | + * @time :2023/9/13 14:02 | ||
| 60 | + */ | ||
| 61 | + public function getProductIsRenovation($info,$id){ | ||
| 62 | + if($info !== false){ | ||
| 63 | + $webTemplateModel = new BTemplate(); | ||
| 64 | + $param = [ | ||
| 65 | + 'source'=>4, | ||
| 66 | + 'project_id'=>$this->user['project_id'], | ||
| 67 | + 'source_id'=>$id, | ||
| 68 | + 'template_id'=>$info['template_id'] | ||
| 69 | + ]; | ||
| 70 | + $templateInfo = $webTemplateModel->read($param); | ||
| 71 | + if($templateInfo !== false){ | ||
| 72 | + return 1; | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + return 0; | ||
| 76 | + } | ||
| 49 | 77 | ||
| 50 | /** | 78 | /** |
| 51 | * @remark :处理列表返回参数 | 79 | * @remark :处理列表返回参数 |
-
请 注册 或 登录 后发表评论