@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | /** |
33 | 33 | * Lists all Post models. |
34 | - * @return mixed |
|
34 | + * @return string |
|
35 | 35 | */ |
36 | 36 | public function actionIndex() |
37 | 37 | { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * Displays a single Post model. |
54 | 54 | * @param integer $id |
55 | - * @return mixed |
|
55 | + * @return string |
|
56 | 56 | */ |
57 | 57 | public function actionView($id) |
58 | 58 | { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * Deletes an existing Post model. |
103 | 103 | * If deletion is successful, the browser will be redirected to the 'index' page. |
104 | 104 | * @param integer $id |
105 | - * @return mixed |
|
105 | + * @return \yii\web\Response |
|
106 | 106 | */ |
107 | 107 | public function actionDelete($id) |
108 | 108 | { |
@@ -7,7 +7,6 @@ |
||
7 | 7 | use yii\data\ActiveDataProvider; |
8 | 8 | use yii\web\Controller; |
9 | 9 | use yii\web\NotFoundHttpException; |
10 | -use yii\filters\VerbFilter; |
|
11 | 10 | |
12 | 11 | /** |
13 | 12 | * PostController implements the CRUD actions for Post model. |
@@ -21,7 +21,7 @@ |
||
21 | 21 | 'upload' => [ |
22 | 22 | 'class' => 'kucha\ueditor\UEditorAction', |
23 | 23 | 'config' => [ |
24 | - "imageUrlPrefix" => Yii::$app->request->hostInfo,//图片访问路径前缀 |
|
24 | + "imageUrlPrefix" => Yii::$app->request->hostInfo, //图片访问路径前缀 |
|
25 | 25 | "imagePathFormat" => "/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", //上传保存路径 |
26 | 26 | "imageRoot" => Yii::getAlias("@webroot"), |
27 | 27 | ], |
@@ -2,10 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace zacksleo\yii2\post\models; |
4 | 4 | |
5 | -use common\helpers\files\File; |
|
6 | -use Yii; |
|
7 | 5 | use yii\helpers\Url; |
8 | -use yii\web\UploadedFile; |
|
9 | 6 | use yii\behaviors\TimestampBehavior; |
10 | 7 | use zacksleo\yii2\post\Module; |
11 | 8 | use zacksleo\yii2\post\behaviors\UploadBehavior; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | public function fields() |
97 | 97 | { |
98 | 98 | $fields = parent::fields(); |
99 | - $fields['img'] = function ($fields) { |
|
99 | + $fields['img'] = function($fields) { |
|
100 | 100 | $path = str_replace('api/uploads/', '', $this->getUploadUrl('img')); |
101 | 101 | if (isset($_ENV['API_HOST'])) { |
102 | 102 | $url = $_ENV['API_HOST'] . 'files/' . $path; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } |
106 | 106 | return $url; |
107 | 107 | }; |
108 | - $fields['url'] = function ($fields) { |
|
108 | + $fields['url'] = function($fields) { |
|
109 | 109 | $url = $_ENV['APP_HOST'] . 'post/view' . "?id=" . $fields['id']; |
110 | 110 | return $url; |
111 | 111 | }; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | "height" => "84", |
36 | 36 | ] |
37 | 37 | ], |
38 | - 'value' => function ($model) { |
|
38 | + 'value' => function($model) { |
|
39 | 39 | return $model->getImgUrl(); |
40 | 40 | } |
41 | 41 | ], |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | 'order', |
44 | 44 | [ |
45 | 45 | 'attribute' => 'status', |
46 | - 'value' => function ($model) { |
|
46 | + 'value' => function($model) { |
|
47 | 47 | return Post::getStatusList()[$model->status]; |
48 | 48 | } |
49 | 49 | ], |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | "height" => "84", |
38 | 38 | ] |
39 | 39 | ], |
40 | - 'value' => function ($model) { |
|
40 | + 'value' => function($model) { |
|
41 | 41 | return $model->getImgUrl(); |
42 | 42 | } |
43 | 43 | ], |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | ['class' => 'yii\grid\ActionColumn', |
48 | 48 | 'template' => '{view} {update} {delete} {up} {url}', |
49 | 49 | 'buttons' => [ |
50 | - 'up' => function ($url, $model, $key) { |
|
50 | + 'up' => function($url, $model, $key) { |
|
51 | 51 | if ($model->status == Post::STATUS_ACTIVE) { |
52 | 52 | $span = Html::tag('a id="status_' . $model->id . '" class="glyphicon glyphicon-remove color-blue" title="' . Module::t('post', 'offline') . '" onclick="setStatus(' . $model->id . ',0)"></a'); |
53 | 53 | return Html::a($span, '#'); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | return Html::a($span, '#'); |
57 | 57 | } |
58 | 58 | }, |
59 | - 'url' => function ($url, $model, $key) { |
|
59 | + 'url' => function($url, $model, $key) { |
|
60 | 60 | $span = Html::tag('a class="glyphicon glyphicon-link color-blue cp" title="复制链接" data-clipboard-text="' . $model->url . '"></a'); |
61 | 61 | return Html::a($span, '#'); |
62 | 62 | } |