Browse Source

提建议

lizhen_gitee 8 months ago
parent
commit
3a202657bb

+ 47 - 0
application/api/controller/worker/Feedback.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace app\api\controller\worker;
+
+use app\common\controller\Api;
+use think\Db;
+/**
+ * 提建议
+ */
+class Feedback extends Api
+{
+    protected $noNeedLogin = ['addone'];
+    protected $noNeedRight = ['*'];
+
+    public function addone(){
+        $content = input('content','');
+        $images  = input('images','');
+
+        if(empty($content)){
+            //$this->error('内容不能为空');
+        }
+
+        if(!empty($images) && strpos($images,',')){
+            if(count(explode(',',$images)) > 8){
+                $this->error('一次最多只能上传9张图片');
+            }
+        }
+
+        $data = [
+            'worker_id' => $this->auth->id,
+            'content' => $content,
+            'images' => $images,
+            'createtime' => time(),
+            'updatetime' => time(),
+        ];
+
+        $id = Db::name('worker_feedback')->insertGetId($data);
+        $this->success();
+    }
+
+    //我提出的建议
+    public function lists(){
+        $list = Db::name('worker_feedback')->where('worker_id',$this->auth->id)->order('id desc')->autopage()->select();
+        $list = list_domain_image($list,['images']);
+        $this->success('success',$list);
+    }
+}

+ 3 - 0
application/api/controller/worker/Jishuguifan.php

@@ -84,4 +84,7 @@ class Jishuguifan extends Api
 
         $this->success(1, $rs);
     }
+
+    //收藏功能
+    //下载功能
 }