ComplaintsController.php 2.13 KB
<?php

class Home_ComplaintsController extends QLib_Controller_Home_Action
{
	public function init()
	{
		$this->QLayoutTitle()->headTitle('我的投诉');
		$this->QLayoutScript()->offsetSetFile(60, $this->_js('jqueryui'))->offsetSetFile(61, $this->_js('global'))->offsetSetFile(62,$this->_js('user_main'))->offsetSetFile(30, $this->_js('formValidator'))->offsetSetFile(31, $this->_js('complaints'));
		$this->QLayoutLink()->offsetSetStylesheet(25, $this->_css('common'))->offsetSetStylesheet(26, $this->_css('myyoho'))->offsetSetStylesheet(27, $this->_css('jqueryuicss'));
	}
	
	public function indexAction()
	{
		$this->view->page = $page = $this->helpPaging('yoho')->setTotal(QModels_Passport_Complaints_My_Client::getMyComlaintsCount($this->uid))->setSize(10);
		$this->view->list = QModels_Passport_Complaints_My_Client::getMyComplaints($this->uid, $page);
	}
	
	public function addmycompAction()
	{
		$caption = QLib_Utils_String::String()->pregReplaceHtml(trim($this->helpGpost('caption')));
		empty($caption) ? $this->helpJsRedirect('请输入投诉标题') : true;
		
		$customer = QLib_Utils_String::String()->pregReplaceHtml(trim($this->helpGpost('customer')));
		empty($customer) ? $this->helpJsRedirect('请输入投诉对象') : true;
		
		$type = intval($this->helpGpost('type'));
		$order = QLib_Utils_String::String()->pregReplaceHtml(trim($this->helpGpost('order')));
		
		$comment = QLib_Utils_String::String()->pregReplaceHtml(trim($this->helpGpost('comment')));
		empty($comment) ? $this->helpJsRedirect('请输入投诉内容') : true;
		$add_complaints_id = QModels_Passport_Complaints_My_Client::setMyComplaints($this->uid, $caption, $customer, $type, $order, $comment);
		$add_complaints_id == true ? $this->helpRefresh('/home/complaints') : $this->helpJsRedirect('添加失败');
	
	}
	public function cancelcompAction()
	{
		$id = intval($this->helpGquery('id'));
		$id < 1 ? $this->helpJsRedirect('参数不正确') : true;
		$update_complaints_id = QModels_Passport_Complaints_My_Client::updateMyComplaintsStatus($this->uid, $id);
		$update_complaints_id ? $this->helpJsonResult(200, '撤销成功') : $this->helpJsonResult(404, '撤销失败');
	}
}
?>