| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 | <?phpnamespace app\api\controller;use app\common\controller\Api;use app\common\library\Keyworld;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');        $is_hidden = input('is_hidden',0);        $images_arr = explode(',',$images);        if(count($images_arr) > 9){            $this->error('最多只能传9张图片');        }        //关键字替换        $info = Keyworld::sensitive($info);        $data = [            'user_id' => $this->auth->id,            'category' => $category,            'info' => $info,            'images' => $images,            'is_hidden' => $is_hidden,            '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);    }}
 |