本文整理汇总了PHP中Response::show方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::show方法的具体用法?PHP Response::show怎么用?PHP Response::show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Response
的用法示例。
在下文中一共展示了Response::show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hot
/**
* 获取热门排行
*/
public static function hot()
{
try {
// 根据内容id获取排行语句
$sql = "select * from hit order by count desc limit 6";
$connect = Db::getInstance()->connect();
$hitSelect = mysql_query($sql, $connect);
$hitIds = $newsMap = array();
while ($row = mysql_fetch_assoc($hitSelect)) {
$hitIds[] = $row['news_id'];
}
$newsSql = "select * from news where id in (" . implode(',', $hitIds) . ") and image != ''";
$newsSelect = mysql_query($newsSql, $connect);
$newsList = array();
while ($row = mysql_fetch_assoc($newsSelect)) {
$newsList[$row['id']] = $row;
}
// 组装新数据
foreach ($hitIds as $hitId) {
if (!isset($newsList[$hitId])) {
continue;
}
$newsMap[] = $newsList[$hitId];
}
//var_dump($newsMap);exit;
} catch (Exception $e) {
return Response::show(400, '数据获取有误');
}
if ($newsMap) {
return Response::show(200, '热门排行数据返回成功', $newsMap);
} else {
return Response::show(200, '数据返回成功', $newsMap);
}
}
示例2: index
public function index()
{
$this->check();
$errorLog = isset($_POST['error_log']) ? $_POST['error_log'] : '';
if (!$errorLog) {
return Response::show(401, '日志为空');
}
$sql = "insert into \n\t\t\t\t\terror_log(\n\t\t\t\t\t\t`app_id`,\n\t\t\t\t\t\t`did`,\n\t\t\t\t\t\t`version_id`,\n\t\t\t\t\t\t`version_mini`,\n\t\t\t\t\t\t`error_log`,\n\t\t\t\t\t\t`create_time`)\n\t\t\t\t\tvalues(\n\t\t\t\t\t\t" . $this->params['app_id'] . ",\n\t\t\t\t\t\t'" . $this->params['did'] . "',\n\t\t\t\t\t\t" . $this->params['version_id'] . ",\n\t\t\t\t\t\t" . $this->params['version_mini'] . ",\n\t\t\t\t\t\t'" . $errorLog . "',\n\t\t\t\t\t\t" . time() . "\n\t\t\t\t\t)";
$connect = Db::getInstance()->connect();
if (mysql_query($sql, $connect)) {
return Response::show(200, '错误信息插入成功');
} else {
return Response::show(400, '错误信息插入失败');
}
}
示例3: index
public function index()
{
$this->check();
// 获取版本升级信息
$versionUpgrade = $this->getversionUpgrade($this->app['id']);
if ($versionUpgrade) {
if ($versionUpgrade['type'] && $this->params['version_id'] < $versionUpgrade['version_id']) {
$versionUpgrade['is_upload'] = $versionUpgrade['type'];
} else {
$versionUpgrade['is_upload'] = 0;
}
return Response::show(200, '版本升级信息获取成功', $versionUpgrade);
} else {
return Response::show(400, '版本升级信息获取失败');
}
}
示例4: check
public function check()
{
$this->params['app_id'] = $appId = isset($_POST['app_id']) ? $_POST['app_id'] : '';
$this->params['version_id'] = $versionId = isset($_POST['version_id']) ? $_POST['version_id'] : '';
$this->params['version_mini'] = $versionMini = isset($_POST['version_mini']) ? $_POST['version_mini'] : '';
$this->params['did'] = $did = isset($_POST['did']) ? $_POST['did'] : '';
$this->params['encrypt_did'] = $encryptDid = isset($_POST['encrypt_did']) ? $_POST['encrypt_did'] : '';
if (!is_numeric($appId) || !is_numeric($versionId)) {
return Response::show(401, '参数不合法');
}
// 判断APP是否需要加密
$this->app = $this->getApp($appId);
if (!$this->app) {
return Response::show(402, 'app_id不存在');
}
if ($this->app['is_encryption'] && $encryptDid != md5($did . $this->app['key'])) {
return Response::show(403, '没有该权限');
}
}
示例5: sendSMS
function sendSMS()
{
$token = self::randToken();
$data = array('zh' => $this->id, 'mm' => $this->pwd, 'dxlbid' => $this->product, 'extno' => $this->product, 'hm' => $this->mobile);
$data['nr'] = '暖暖的用户,您的验证码为' . $token . ',如非本人操作,请忽略本短信【暖暖购物】';
//$data['message'] =urlencode('尊敬的用户,您的验证码为'.$token.'【暖暖】') ;
$status = self::postFn($data, $this->url . ':' . $this->port . '/Service.asmx/sendsms');
$status = 0;
//跳过短信环节;
$re = new Token();
$arr = array('tel' => $this->mobile, 'token' => $token, 'timeout' => time() + 300);
//失效时间为5分钟
$arr_search = array('tel' => $this->mobile);
$reponse = new Response();
if (mysql_fetch_assoc($re->token_select($arr_search, 1))) {
$re->token_update($arr, "tel={$this->mobile}");
} else {
$re->token_insert($arr);
}
if (!$status) {
echo $reponse->show(200);
}
//echo $token;
}
示例6: date
$arr['registerDate'] = date("Y/m/d");
$condition = isset($arr['tel']) ? 'tel=\'' . $arr['tel'] . '\'' : 'uid=\'' . $arr['uid'] . '\'';
$setUser = new UserInfo();
$re_select = $setUser->userinfo_select($arr_select, 1);
//uid如果已经存在的用户,更新资料
if (mysql_fetch_row($re_select)) {
$arr['gender'] = isset($arr['gender']) ? $arr['gender'] : 0;
$arr['age'] = isset($arr['age']) ? $arr['age'] : 0;
$arr['idCard'] = isset($arr['idCard']) ? $arr['idCard'] : '';
$arr['realName'] = isset($arr['realName']) ? $arr['realName'] : '';
$arr['birthDate'] = isset($arr['birthDate']) ? $arr['birthDate'] : '';
$checkArr = array('uid' => $arr['uid']);
//更新个人信息
$r = $setUser->userinfo_select($checkArr, 1);
if (!mysql_fetch_assoc($r)) {
echo $res->show(407);
exit;
}
$re = $setUser->userinfo_update($arr, $condition);
if ($re == 1) {
echo $res->show(200, mysql_fetch_assoc($setUser->userinfo_select($arr_select, 1)));
} else {
echo $res->show(407);
}
exit;
}
//不存在的用户,新创建
if (isset($arr['token'])) {
//找回密码,要验证token
if (isset($arr['tel'])) {
$token = $arr['token'];
示例7: File
<?php
// http://www.app.com/list.php?page=1&pagesize=12
require_once '../basic/format.php';
require_once '../core/cache.php';
// 加载缓存文件
$file = new File();
$data = $file->cacheData('index_cache');
if ($data) {
return Response::show(200, '首页数据获取成功', $data);
} else {
return Response::show(400, '首页数据获取失败', $data);
}
exit;
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$pageSize = isset($_GET['pagesize']) ? $_GET['pagesize'] : 1;
if (!is_numeric($page) || !is_numeric($pagesize)) {
return Response::show(401, '数据不合法', '', 'xml');
}
$offset = ($page - 1) * $pagesize;
$sql = "select * from areas";
示例8: header
<?php
header("Content-Type: application/json;charset=utf-8");
header("Access-Control-Allow-Origin:*");
header("Access-Control-Allow-Methods:POST,GET");
require_once "./Db.php";
require_once "./Response.php";
$username = Response::_post('username');
$userpass = Response::_post('userpass');
if (!isset($username) || !isset($userpass)) {
Response::show(400, '输入的数据不正确');
} else {
$connect = Db::getInstance()->connect();
$sql = "select * from users where user_name='" . $username . "'and user_psd='" . $userpass . "'";
$result = mysql_query($sql, $connect);
if (!mysql_num_rows($result)) {
Response::show(400, '输入的用户名或密码不正确');
} else {
$results = mysql_fetch_assoc($result);
Response::show(200, 'success', $results);
}
}
示例9: array
<?php
//父母基本信息接口
require_once '../../models/Response.php';
require_once '../../models/data/ParentInfo.php';
if (isset($_GET['uid'])) {
$uid = $_GET['uid'];
$arr = array('childID' => $uid);
$re = new ParentInfo();
$userinfo = $re->parentinfo_select($arr, 5);
//个人信息
$data = array();
$r = '';
while ($r = mysql_fetch_assoc($userinfo)) {
$data[$r['isMum'] == 1 ? 'mum' : 'dad'] = $r;
}
$msg = new Response();
echo $msg->show('200', $data);
}
示例10: checkToken
require_once '../../models/Token.php';
error_reporting(0);
require_once '../../models/Response.php';
$res = new Response();
if ($_GET['tel'] && $_GET['send'] == 1) {
$obj = new Token_SMS();
$tel = $_GET['tel'];
$uid = '';
$obj->__set($uid, $tel);
$token = $obj->sendSMS();
} elseif ($_GET['tel'] && isset($_GET['token'])) {
$token = $_GET['token'];
$tel = $_GET['tel'];
$status = checkToken($tel, $token);
$res->show($status);
} else {
$res->show(400);
}
//检查验证码与tel对应关系
function checkToken($tel, $token)
{
$obj = new Token_SMS();
$uid = '';
$obj->__set($uid, $tel);
return $obj->getToken($tel, $token);
}
/*
$obj = new Sms();
$tel = '15911122086';
$uid = md5($tel);
示例11: array
<?php
require_once './format.php';
$data = array('id' => 1, 'name' => 'apeng', 'type' => array(1, 2, 3), 'test' => array(1, 2, 3 => array(123, 'type')));
Response::show(200, 'success', $data, 'array');
示例12: Response
//收藏、取消收藏接口
//$islike =1 收藏 $islike=0 取消收藏
$res = new Response();
$ul = new UserLike();
if (isset($_POST['islike']) && isset($_POST['uid']) && isset($_POST['itemID'])) {
$islike = $_POST['islike'];
$uid = $_POST['uid'];
$itemid = $_POST['itemID'];
if (1 == $islike) {
$arr = array('userid' => $uid);
$limit = 1;
$re = mysql_fetch_assoc($ul->userlike_select($arr, $limit));
$like_arr_items = explode(',', $re['items']);
if ($re) {
if (in_array($itemid, $like_arr_items)) {
echo $res->show(200);
exit;
}
$arr = array('items' => $re['items'] . ',' . $itemid);
$condition = '`userid`=' . $uid;
$re = $ul->userlike_update($arr, $condition);
if ($re) {
echo $res->show(200);
} else {
echo $res->show(500);
}
} else {
$arr = array('items' => $itemid, 'userid' => $uid);
$re = $ul->userlike_insert($arr);
if ($re) {
echo $res->show(200);
示例13: Response
//用户基本信息接口
require_once '../../models/Response.php';
require_once '../..//models/UserProfile.php';
require_once '../../models/UserProfile.php';
$msg = new Response();
$page = isset($_GET['page']) ? $_GET['page'] : null;
if (isset($_GET['uid']) || $_GET['tel']) {
$uid = $_GET['uid'];
$re = new UserProfile();
if (isset($_GET['password']) && isset($_GET['tel'])) {
$tel = $_GET['tel'];
$pwd = md5($_GET['password']);
$userinfo = $re->checkAuth($tel, $pwd);
//登录验证密码
if ($userinfo == FALSE) {
echo $msg->show('406');
} else {
$userinfo = $re->userinfo(null, $tel);
if (!isset($userinfo['nickname'])) {
$data = array('nickname' => $tel);
$condition = '`tel`=' . $tel;
$re->updateUserInfo($data, $condition);
}
$parentpercent = $re->parentpercent($uid);
//父母信息完成比例
$likeNum = $re->likeNum($uid);
//收藏个数
$data = array('userinfo' => $userinfo, 'parentpercent' => $parentpercent, 'likeNum' => $likeNum);
echo $msg->show('200', $data);
}
exit;
示例14: Response
<?php
require_once '../../models/data/UserInfo.php';
require_once '../../models/upAddress.php';
require_once '../../models/Response.php';
//增加地址接口
$response = new Response();
$add = new UpAddress();
//更新个人资料
if (isset($_POST['uid']) && $_POST['data'] && $_POST['isParent'] == 0) {
$uid = $_POST['uid'];
$data = $_POST['data'];
$re = $add->upAddress($data, $uid);
echo $response->show(200, $re);
} elseif (isset($_POST['uid']) && $_POST['data'] && $_POST['isParent'] == 1) {
$uid = $_POST['uid'];
$data = $_POST['data'];
$isParent = $_POST['isParent'];
$isMum = $_POST['isMum'];
$re = $add->upAddress($data, $uid, $isParent, $isMum);
echo $response->show(200, $re);
} else {
echo $response->show(400);
}
示例15: Response
<?php
//发现页面数据调用接口
require_once '../../models/Response.php';
require_once '../..//models/Discovery.php';
$style = new Response();
$gender = isset($_GET['gender']) ? $_GET['gender'] : NULL;
$pageId = isset($_GET['page']) ? $_GET['page'] : 1;
$uid = isset($_GET['uid']) ? $_GET['uid'] : 1;
$type = isset($_GET['type']) ? $_GET['type'] : NULL;
$re = new Discovery();
$data = $re->presentForHuman($gender, $type, $pageId, $uid);
echo $style->show('200', $data);