/** * 注册手机 */ protected function regMobile() { if (REQUEST_METHOD == 'POST') { $mobile = (int) $this->input->post('mobile'); $this->setSession('mobile', $mobile); CAjax::show(0, 'successful'); } else { CView::show('register/reg_mobile'); } }
/** * 删除用户 */ public function drop() { $id = $this->input->post('id'); $return = $this->_modelPay->deletepay($id); $repArr = array('0', 'successful'); if ($return !== true) { $repArr = array('1001', 'fail'); } CAjax::show($repArr[0], $repArr[1]); }
/** * 编辑密码 */ public function password() { $id = $this->input->get('id'); $password = $this->input->post('password'); $return = $this->_modelOrder->setPassword($id, $password); $repArr = array('0', 'successful'); if ($return !== true) { $repArr = array('1001', 'fail'); } CAjax::show($repArr[0], $repArr[1]); }
/** *故事列表 */ public function index() { $offset = 10; if (REQUEST_METHOD == 'GET') { $data['rows'] = $this->_modelStory->getRows(0, $offset); CView::show('story/index', $data); } else { $total = (int) $this->input->post('total'); $rows = $this->_modelStory->getRows($total, $offset); CAjax::show(0, 'successful', $rows); } }
/** * ajax获取项目列表 */ public function getList() { $page = $this->input->get('page', true); $data = $this->_modelItem->getList($page); //格式化为json输出 $list = array(); if ($data) { foreach ($data as $itemId => $planItem) { $list[$itemId] = array('item' => $planItem->row, 'goods' => $planItem->goods->rows); } } CAjax::show(0, 'successful', $list); }
/** * 用户登出 */ public function logout() { $this->_user->logout(); CAjax::show(0, 'successful'); }