| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- namespace mobile\controllers;
- use common\services\xhCategoryService;
- use common\services\xhArticleCategoryService;
- use common\services\xhArticleService;
- use Yii;
- use yii\web\Controller;
- use yii\filters\AccessControl;
- use yii\helpers\Json;
- use common\components\weixinUtil;
- use common\components\stringUtil;
- use common\components\configDict;
- use common\components\util;
- class ArticleController extends MobileendController
- {
- public $withoutLogin = ['article','article-list'];
- public function actionArticleList()
- {
- $this->layout = 'goodsMain';
- $get = Yii::$app->request->get();
- $id = isset($get['id']) ? $get['id'] : 0;
- $category = xhCategoryService::getById($id);
- $categoryName = $category['categoryName'];
- $merchantId = $category['merchantId'];
- $relation = xhArticleCategoryService::getAllByCondition(['merchantId' =>$merchantId,'cId' => $id]);
- $this->webTitle = $categoryName;//标题
- return $this->render('articleList',['category' => $category,'relation' => $relation]);
- }
- public function actionArticleDetail()
- {
- $this->layout = 'goodsMain';
- $get = Yii::$app->request->get();
- $id = isset($get['id']) ? $get['id'] : 0;
- $article = xhArticleService::getById($id);
- if(isset($get['cId'])){
- $category = xhCategoryService::getById($get['cId']);
- $categoryName = $category['categoryName'];
- $this->webTitle = $categoryName;
- }
- $this->webTitle = $article['title'];
- return $this->render('articleDetail',array('article' => $article));
- }
- }
|