public function getList() { $typeList = array(); $typeList['catering'] = "餐饮"; $typeList['variety'] = "便利店"; $type = tool::getParams('type', ''); $name = $typeList[$type]; $searchType = "3"; $key = isset($_GET['key']) ? trim($_GET['key']) : null; //这里是一个坐标值 $pageNum = isset($_GET['page']) ? trim($_GET['page']) - 1 : 0; // $name = "便利店"; // $key = "24.459657,118.087648"; //老虎城 $response = $this->poi->getList($name, $searchType, $key, $pageNum); $response = json_decode($response, true); if ($response['status'] != 0) { $this->send(array('result' => 'fail', 'message' => $response['message'])); } // 返回错误信息.同时记录日志 message $list = array(); $data = $response['results']; foreach ($data as $key => $val) { $location = $val['location']; $item = $value; unset($item['location']); $item['location'] = $location['lat'] . ',' . $location['lng']; $list[$key] = $item; } $this->send(array('result' => 'success', 'message' => '成功', 'data' => $list)); }
/** * 发起团 * http://localhost/beauty/index.php?m=ruan&c=index&a=create */ public function create() { $data = tool::getParams("data", ''); $data['created'] = strtotime(date('Y-m-d H:i:s')); $data['orderNum'] = 0; $result = parent::save($data); echo json_encode(array('code' => '0', 'message' => '成功', 'data' => $result)); }
/** * 用户昵称是否存在 * http://local.meizai.com/api.php?m=user&a=checknickname&nickname=aaa */ public function checkNickname() { $nickname = tool::getParams('nickname', ''); $data = $this->dao->select("*")->from(TABLE_USER)->where('nickname')->eq($nickname)->fetch(); if ($data) { $this->send(array('result' => 'fail', 'message' => '昵称已经存在')); } $this->send(array('result' => 'success', 'message' => '昵称不存在')); }
function login($account = "", $password = "") { if (!$account) { $account = tool::getParams('phone', ''); } $password = tool::getParams('password', ''); if (!$account || !$password) { $this->send(array('result' => 'fail', 'message' => '手机号或密码不能为空')); } $user = $this->identify($account, $password); a($user); exit; if (!$user) { $this->send(array('result' => 'fail', 'message' => '手机号或密码错误')); } $this->send(array('result' => 'success', 'message' => $this->lang->getSuccess, 'data' => $user)); }
/** * 查询团详情 * http://local.meizai.com/api.php?m=user&a=apilogin&account=18250813004&password=123456 */ public function apiLogin($account = '', $password = '') { /* If the user logon already, goto the pre page. */ if ($this->user->isLogon()) { $this->send(array('result' => 'fail', 'message' => '您已经登陆')); } /* If the user sumbit post, check the user and then authorize him. */ if (!empty($_POST) || !empty($_GET)) { if (!$account) { $account = tool::getParams('phone', ''); } $password = tool::getParams('password', ''); if (!$this->user->login($account, $password)) { $this->send(array('result' => 'fail', 'message' => '手机号或密码错误')); } $this->send(array('result' => 'success', 'message' => '登陆成功', 'data' => $this->app->user)); } $this->send(array('result' => 'fail', 'message' => '获取不到用户名和密码')); }