public function run() { $content = $this->getDataItem('content', ''); $contact = $this->getDataItem('contact', ''); if (empty($content)) { return $this->errorLog(ResultStatus::POST_BODY_PARAM_ERROR, '内容不能为空!'); } $this->verifyUserAuth(false); $feedback = new UserFeedback(); $feedback->user_id = $this->getUserAuth() ? $this->getUserAuth()->userId : 0; $feedback->feedback_content = $content; $feedback->feedback_contact = $contact; if ($feedback->save()) { $this->setResult(['success' => 1, 'message' => '反馈成功!']); } else { $this->databaseErrorLog($feedback); } }
/** * 用户反馈列表 * @date: 2016年1月6日 * @author: chenxiaolin */ public function userFeedbackAction() { $this->setLeftNav('userFeedback'); $req = $this->request; $page = intval($req->getQuery('page', null, 1)); $page = $page > 0 ? $page : 1; $limit = $this->pageNavLimit; $offset = $limit * ($page - 1); $filterCity = $req->getQuery('filterCity', null, -10000); $feedback_content = $req->getQuery('feedback_content'); $where = []; if ($filterCity > -10000) { $where[] = "Apps\\Common\\Models\\UserFeedback.city_id = {$filterCity}"; $this->view->setVar("filterCity", $filterCity); } if ($feedback_content != '') { $where[] = "feedback_content like '%" . $feedback_content . "%'"; $this->view->setVar("feedback_content", $feedback_content); } $whereStr = implode(' AND ', $where); $total = UserFeedback::count($whereStr); $data = UserFeedback::query()->columns(['feedback_id', 'feedback_contact', 'feedback_content', 'feedback_addtime', 'soc.city_name'])->leftJoin('Apps\\Common\\Models\\SysOpenCity', 'soc.city_id=Apps\\Common\\Models\\UserFeedback.city_id', 'soc')->where($whereStr)->limit($limit, $offset)->orderBy('feedback_addtime DESC')->execute(); $this->view->setVar('data', $data); $this->view->setVar('total', $total); $this->view->setVar('page', $page); $this->view->setVar('limit', $limit); $this->view->setVar('openCity', $this->openCityList()); }
/** * 用户反馈 */ public function userFeedbackAction() { $this->setLeftNav('userFeedback'); $req = $this->request; $page = intval($req->getQuery('page', null, 1)); $page = $page > 0 ? $page : 1; $limit = $this->pageNavLimit; $offset = $limit * ($page - 1); $total = UserFeedback::count(); $data = UserFeedback::query()->limit($limit, $offset)->orderBy('feedback_id DESC')->execute(); $this->view->setVar('data', $data); $this->view->setVar('total', $total); $this->view->setVar('page', $page); $this->view->setVar('limit', $limit); }