isAjax()) { $param = request()->get(); $limit = $param['limit'] ?? 10; $feedback = new Feedback(); $where = []; if (isset($param['look']) && !empty($param['look'])) { switch ($param['look']) { case 'unLook': $where[] = ['is_look', '=', 0]; break; case 'look': $where[] = ['is_look', '=', 1]; break; default: break; } } $sort = $param['sort'] == 'asc' ? 'asc' : 'desc'; $list = $feedback->getPaginateList($where, ['*'], ['id' => $sort], [], $limit); return $this->success(dataReturn(0, '获取成功', $list)); } return view('feedback/feedbackIndex'); } public function submit() { $user = admin(); $feedback = new Feedback(); $post = request()->get(); if (empty($post["message"]) || empty($post["contact"])) { return $this->success(dataReturn(-1, '请登录或输入完整的信息')); } $post['ip'] = get_client_ip(); $post['admin_id'] = $user['id']; $post['name'] = $user['name']; $post['create_times'] = date('Y-m-d H:i:s'); if ($feedback->insertOne($post)) { return $this->success(dataReturn(0, '提交成功')); } else { return $this->success(dataReturn(-1, '系统繁忙,提交失败')); } } public function dispose() { $feedback = new Feedback(); $post = request()->post(); $feedback->where('id', $post['id']) ->update([ 'is_look' => 1, 'remark' => $post['remark'], 'look_time' => date('Y-m-d H:i:s'), 'look_name' => admin()['name'], 'look_admin_id' => admin()['id'] ]); if ($feedback) { return $this->success(dataReturn(0, '处理成功')); } else { return $this->success(dataReturn(-1, '系统繁忙,处理失败')); } } }