private function getFeedback($id) { // 用 phalcon 的方式查找该用户 $conditions = " id = :id: AND msg_flag != :msg_flag:"; $parameters = array("id" => "{$id}", "msg_flag" => '2'); $feedback = MeiuiFeedback::findFirst(array($conditions, "bind" => $parameters)); return $feedback; }
public function add_feedback() { $data = $this->main; $data['status'] = '400200'; if (addslashes($_GET['msg']) and intval($_GET['user_id'])) { $feedback = new MeiuiFeedback(); $feedback->msg = addslashes($_GET['msg']); $feedback->username = intval($_GET['user_id']); $feedback->phone = '15068159661'; $feedback->created_at = time(); if ($feedback->save() == false) { $data['alert']['msg'] = $this->lang['feedback_fail']; } else { $data['alert']['msg'] = $this->lang['request_success']; } } else { $data['alert']['msg'] = $this->lang['feedback_fail']; } die(json_encode($data)); }