Completed
Pull Request — master (#1)
by graychen
05:06
created
src/controllers/DefaultController.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
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.
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
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
                 ],
Please login to merge, or discard this patch.
src/models/Post.php 2 patches
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -2,10 +2,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         };
Please login to merge, or discard this patch.
src/views/default/view.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
             ],
Please login to merge, or discard this patch.
src/views/default/index.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
                     }
Please login to merge, or discard this patch.