|
@@ -0,0 +1,52 @@
|
|
|
|
+<?php
|
|
|
|
+
|
|
|
|
+namespace app\api\controller;
|
|
|
|
+
|
|
|
|
+use app\common\controller\Api;
|
|
|
|
+use think\Db;
|
|
|
|
+/**
|
|
|
|
+ * 智能助手 提交反馈
|
|
|
|
+ */
|
|
|
|
+class Feedback extends Api
|
|
|
|
+{
|
|
|
|
+ protected $noNeedLogin = ['category'];
|
|
|
|
+ protected $noNeedRight = ['*'];
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //分类
|
|
|
|
+ public function category(){
|
|
|
|
+ $list = Db::name('feedback_category')->field('id, name')->where('status',1)->order('weigh', 'desc')->select();
|
|
|
|
+
|
|
|
|
+ $this->success(1,$list);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function submit(){
|
|
|
|
+ $category = input('category','','trim');
|
|
|
|
+ $info = input('info','','trim');
|
|
|
|
+ $images = input('images','','trim');
|
|
|
|
+
|
|
|
|
+ $data = [
|
|
|
|
+ 'user_id' => $this->auth->id,
|
|
|
|
+ 'category' => $category,
|
|
|
|
+ 'info' => $info,
|
|
|
|
+ 'images' => $images,
|
|
|
|
+ 'createtime' => time(),
|
|
|
|
+ 'updatetime' => time(),
|
|
|
|
+ ];
|
|
|
|
+ $id = Db::name('feedback')->insertGetId($data);
|
|
|
|
+
|
|
|
|
+ $this->success('提交成功', $id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function lists(){
|
|
|
|
+ $status = input('status',0);
|
|
|
|
+ $where = [
|
|
|
|
+ 'user_id' => $this->auth->id,
|
|
|
|
+ 'status' => $status,
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ $list = Db::name('feedback')->where($where)->order('id desc')->autopage()->select();
|
|
|
|
+ $list = list_domain_image($list,['images']);
|
|
|
|
+ $this->success(1, $list);
|
|
|
|
+ }
|
|
|
|
+}
|