private function validate() { if ($_GET['v'] == 'test') { return TRUE; } if (IS_POST) { $params = $_POST; $sign = $params['sign']; if (empty($sign)) { sleep(1); $this->ajaxReturn(return_data_format('获取信息失败', '4002', 0), 'JSON'); } unset($params['sign']); $t = sign($params); if (strcasecmp($sign, $t) != 0) { sleep(1); $this->ajaxReturn(return_data_format('获取信息失败', '4002', 0), 'JSON'); } } else { sleep(1); $this->ajaxReturn(return_data_format('获取信息失败', '4002', 0), 'JSON'); } }
/** * 获取token值 * * @author frenlee <*****@*****.**> * @since 2015年5月11日 下午7:47:26 */ public function getToken() { //echo C('TOKEN'); $this->ajaxReturn(return_data_format(C('TOKEN'))); }
/** * 获取读书笔记 * * @author frenlee <*****@*****.**> * @since 2015年5月11日 下午5:54:29 */ public function annotations() { $id = isset($_POST['id']) ? I('post.id') : ''; $p = isset($_POST['p']) ? I('post.p') : 0; if (empty($id)) { $this->ajaxReturn(return_error_data_format()); } $j = D('Json'); $data = $j->getAnnotations($id, $p); $data['data'] = json_decode($data['data'], true); $this->ajaxReturn(return_data_format($data)); }