public function searchWidget($vercode = 0) { if (!$this->_widgetFac) { Log::write("WidgetSearch::searchWidget():_widgetFac is null", "log"); return false; } $sql = $this->_widgetFac->getWidgeMemSql($vercode); if (!$sql || empty($sql)) { Log::write('WidgetSearch::searchWidget():getWidgeMemSql() sql is empty', 'log'); $result = get_rsp_result(false, 'get widget mem sql failed'); return $result; } $result = $this->_memcached->getSearchResult($sql); if ($result) { return $result; } $result = $this->_widgetFac->getWidgetProtocol(); if (!$result) { Log::write('WidgetSearch::searchWidget():getWidgetProtocol() failed', 'log'); $result = get_rsp_result(false, 'get widget protocol failed'); return $result; } $result = json_encode($result); $bResult = $this->_memcached->setSearchResult($sql, $result); if (!$bResult) { Log::write('WidgetSearch::setSearchResult() failed', 'log'); } return $result; }
public function searchLabel($start, $limit) { try { $sql = $this->_label->getSelectLabelSql($start, $limit); $protocol = (int) (isset($_GET['protocolCode']) ? $_GET['protocolCode'] : 0); $result = $this->_memcached->getSearchResult($sql . $protocol); if ($result) { return json_encode($result); } // Log::write('LabelDb::searchLabel() SQL:'.$sql, 'debug'); $rows = $this->executeQuery($sql); if ($rows === false) { Log::write('LabelDb::searchLabel() SQL:' . $sql . ' failed', 'log'); $result = get_rsp_result(false, 'get label sql failed'); return $result; } $arrLabel = $this->_getLabelList($rows); $nCount = $this->getQueryCount(); $result = array('result' => true, 'count' => $nCount, 'label' => $arrLabel); $bResult = $this->_memcached->setSearchResult($sql . $protocol, $result, 3600); if (!$bResult) { Log::write("LabelDb::searchLabel failed", "log"); } } catch (Exception $e) { Log::write("LabelDb::searchLabel()exception error:" . $e->getMessage(), "log"); return false; } return json_encode($result); }
* “main_prev_url”: “http://www.coolshow.com/1.jpg“, * “prev_img_num”:3, * “prev_imgs”: * [ * {“img_url”: “http://www.coolshow.com/1.jpg”}, * {“img_url”:” http://www.coolshow.com/2.jpg”}, * {“img_url”:” http://www.coolshow.com/3.jpg”} * ] * }, * ... *], *} */ //以下部分测试通过 require_once 'public/public.php'; $nPage = isset($_GET['page']) ? $_GET['page'] : 0; $nNum = isset($_GET['reqnum']) ? $_GET['reqnum'] : 10; $nStart = $nNum * $nPage; if (!is_numeric($req_num) || !is_numeric($req_page)) { echo get_rsp_result(false, 'get param is not num'); exit; //错误请求 } require_once "tasks/CoolShow/CoolShowSearch.class.php"; $nCoolType = (int) (isset($_GET['mtype']) ? $_GET['mtype'] : COOLXIU_TYPE_THEMES); $coolshow = new CoolShowSearch(); $json_result = $coolshow->getCoolShow($nCoolType, $nStart, $nNum); echo $json_result; require_once 'tasks/Records/RecordTask.class.php'; $rt = new RecordTask(); $rt->saveRequest($type);
<?php require_once 'public/public.php'; $nCoolType = isset($_GET['type']) ? $_GET['type'] : -1; $keyWord = isset($_GET['keyword']) ? $_GET['keyword'] : ''; $bColor = isset($_GET['iscolor']) ? $_GET['iscolor'] : 0; $nPage = isset($_GET['page']) ? $_GET['page'] : 0; $nLimit = isset($_GET['reqNum']) ? $_GET['reqNum'] : 1000; if (empty($keyWord)) { echo get_rsp_result(false, 'keyword is null'); exit; } require_once 'configs/config.php'; require_once "tasks/CoolShow/CoolShowSearch.class.php"; $coolshow = new CoolShowSearch(); $result = $json_result = $coolshow->searchLucene($nCoolType, $keyWord, $bColor, $nPage, $nLimit); echo $result; require_once 'tasks/Records/RecordTask.class.php'; $rt = new RecordTask(); $rt->saveLucene($nCoolType);
$json_param = isset($_POST['statis']) ? $_POST['statis'] : ''; $json_param = stripslashes($json_param); $arr_param = json_decode($json_param, true); $strProduct = isset($arr_param['product']) ? $arr_param['product'] : ''; $strMeid = isset($arr_param['meid']) ? $arr_param['meid'] : ''; $strUid = isset($arr_param['uid']) ? $arr_param['uid'] : ''; $procode = (int) (isset($arr_param['procode']) ? $arr_param['procode'] : 0); } require_once "tasks/CoolShow/CoolShowSearch.class.php"; //下面两个数据库操作可以合并优化 $coolshow = new CoolShowSearch(); $bIsCharge = $coolshow->checkIscharge(COOLXIU_TYPE_THEMES, $id); if ($bIsCharge) { require_once 'tasks/Exorder/ExorderRecordDb.class.php'; $erDb = new ExorderRecordDb(); $bResult = $erDb->checkMobileCharged($strProduct, $nCoolType, $id, $cpid, $strMeid, $strImsi, $strUid); if (!$bResult) { $result = get_rsp_result(false, 'the resource is not paid'); exit($result); } } $url = $coolshow->getUrl($nCoolType, $id); if ($url === false) { Log::write('CoolShowSearch::getUrl(COOLXIU_TYPE_THEMES) id:' . $id, 'log'); exit; } url_skip_download($url); } catch (Exception $e) { Log::write('thdownload:: exception error:' . $e->getMessage(), 'log'); exit; }
* 2:下载 * 3:应用 * * applytype:操作子类型,当操作类型为应用(3)时作为应用的类型 * 1: 壁纸->待机 * 2: 壁纸->桌面 * 3: 壁纸->主菜单 * * POST字段 :为手机基本信息 * product:产品名称 * cyid: 酷云账号(暂无) * imsi: 终端串号 * meid 终端串号 * versionCode:应用版本 * width: 分辨率宽 * height: 分辨率高 * network: 网络模式2g/3g/wifi */ require_once 'lib/WriteLog.lib.php'; require_once 'public/public.php'; require_once 'tasks/Records/RecordTask.class.php'; require_once 'tasks/statis/StatisInterface.class.php'; if (!isset($_GET['id'])) { Log::write('statis:: id is not set', 'log'); exit(get_rsp_result(false, 'id is empty')); } //mongodb记录 $rt = new RecordTask(); $result = $rt->saveStaticRecord(); echo get_rsp_result(true);
$strImei = isset($arr_param['imei']) ? $arr_param['imei'] : ''; $strImsi = isset($arr_param['imsi']) ? $arr_param['imsi'] : ''; $strUid = isset($arr_param['uid']) ? $arr_param['uid'] : ''; $strNet = isset($arr_param['net']) ? $arr_param['net'] : ''; } $erDb = new ExorderRecordDb(); $bResult = $erDb->checkMobileCharged($strProduct, $nCoolType, $strId, $strCpid, $strMeid, $strImsi, $strUid); if ($bResult) { $reuslt = array('result' => true, 'exorder' => '', 'charged' => true); echo json_encode($reuslt); exit; } $exorderDb = new ExorderDb(); $strExorder = $exorderDb->createExorder($nCoolType); if (!$strExorder) { echo get_rsp_result(false, 'create exorder failed'); exit; } $reuslt = array('result' => true, 'exorder' => $strExorder, 'charged' => false); echo json_encode($reuslt); $bQuery = isset($_GET['query']) ? $_GET['query'] : 0; #0表示拉取订单号和收费信息,1表示查询收费信息 if ($bQuery) { exit; } require_once 'tasks/CoolShow/CoolShowSearch.class.php'; require_once 'tasks/Records/RecordTask.class.php'; $coolshow = new CoolShowSearch(); $arrRsc = $coolshow->getRsc($nCoolType, $strId); $arrRsc = $arrRsc['result']; $cpid = '';
try { $strExorder = isset($_GET['exorder']) ? $_GET['exorder'] : ''; //订单号 if (empty($strExorder)) { echo get_rsp_result(false, 'exorder is empty'); exit; } $isScore = (int) (isset($_GET['isscore']) ? $_GET['isscore'] : 0); require_once 'tasks/Exorder/ExorderRecordDb.class.php'; $erDb = new ExorderRecordDb(); $bResult = $erDb->updateMobileExorder($strExorder, $isScore); if (!$bResult) { Log::write('mcharge updateMobileExorder() failed', 'log'); echo get_rsp_result(false, 'save mobile charge failed'); exit; } echo get_rsp_result(true); require_once 'tasks/Records/RecordTask.class.php'; $rt = new RecordTask(); $nCoolType = isset($_GET['mtype']) ? $_GET['mtype'] : 0; $strCyid = isset($_GET['uid']) ? $_GET['uid'] : ''; if (!empty($strUid)) { $strId = isset($_GET['id']) ? $_GET['id'] : ''; $strCpid = isset($_GET['cpid']) ? $_GET['cpid'] : ''; $erDb->saveChargeRecord($strExorder, $strCyid, $nCoolType, $strId, $strCpid); } $rt->updateOrder($nCoolType, $strExorder, $isScore); } catch (Exception $e) { Log::write('mcharge exception', 'log'); echo get_rsp_result(false, 'mcharge exception'); }
<?php /** *评论评分的接口 * $type : 资源类型 * $id : 资源ID */ require_once 'public/public.php'; require_once 'tasks/Records/ScoreRecord.class.php'; $scoreRecord = new ScoreRecord(); $bResult = $scoreRecord->saveScore(); echo get_rsp_result($bResult);
public function getDesignerCoolShow($nCoolType = 0, $strCyid, $nStart, $nLimit) { try { if (empty($strCyid)) { Log::write('CoolShowSearch::getDesignerCoolShow() cyid is empy', 'log'); $result = get_rsp_result(false, 'cyid is empy'); return $result; } $coolshow = CoolShowFactory::getCoolShow($nCoolType); if (!$coolshow) { Log::write('CoolShowSearch::getDesignerCoolShow() coolshow is null', 'log'); $result = get_rsp_result(false, 'get coolshow is null'); return $result; } $this->_setCoolShowParam($coolshow); $strSql = $coolshow->getDesignerCoolShowSql($strCyid, $nStart, $nLimit); if (!$strSql) { Log::write('CoolShowSearch::getDesignerCoolShow():getDesignerCoolShowSql() failed, Sql is empty', 'log'); $result = get_rsp_result(false, 'get protocol sql empty'); return $result; } $result = $this->_getMem()->getSearchResult($strSql); if ($result) { // Log::write('CoolXiuDb::getDesignerCoolShow():getSearchResult()'.$strSql, 'log'); return json_encode($result); } $arrProtocol = $this->_getProtocol($coolshow, $strSql); $sql = $coolshow->getCountDesignerCoolShowSql($strCyid); $count = $this->_getDb()->getCoolShowCount($sql); if ($count === false) { Log::write('CoolShowSearch::getDesignerCoolShow():getCoolShowCount() failed, SQL:' . $strSql, 'log'); return false; } $result = array('result' => true, 'total_number' => $count, 'ret_number' => count($arrProtocol), $coolshow->strType => $arrProtocol); $this->_getMem()->setSearchResult($strSql, $result, 60 * 60); return json_encode($result); } catch (Exception $e) { Log::write('CoolShowSearch::getDesignerCoolShow() excepton error:' . $e->getMessage(), 'log'); $result = get_rsp_result(false, 'get designer res exception'); return $result; } }
<?php /** * 关注/取消关注 */ require_once 'lib/WriteLog.lib.php'; try { require_once 'tasks/Collect/CollectTask.class.php'; $nType = isset($_GET['type']) ? $_GET['type'] : 0; $collect = new CollectTask(); if ($nType == 0) { $result = $collect->getMyDesigner(); } if ($nType == 1) { $result = $collect->getDesigner(); } echo $result; } catch (Exception $e) { Log::write('designer exception:' . $e->getMessage(), 'log'); echo get_rsp_result(false, 'designer exception'); }
<?php if (isset($_GET['page']) && isset($_GET['reqNum'])) { $req_page = isset($_GET['page']) ? $_GET['page'] : 0; $req_num = isset($_GET['reqNum']) ? $_GET['reqNum'] : 10; $start = $req_num * $req_page; } else { $req_page = isset($_POST['start']) ? $_POST['start'] : 0; $req_num = isset($_POST['limit']) ? $_POST['limit'] : 10; $start = $req_page; } if ($req_num === null || $req_page === null || !is_numeric($req_num) || !is_numeric($req_page)) { $result = get_rsp_result(false, 'request skip or limit failed'); exit; } require_once "tasks/CoolShow/CoolShowSearch.class.php"; $coolshow = new CoolShowSearch(); $json_result = $coolshow->getCoolShow(COOLXIU_TYPE_THEMES, $req_page, $req_num); echo $json_result;
* POST字段 :statis * POST值:product:产品名称 * imsi: 终端串号 * imei 终端串号 * meid 终端串号 * version:应用版本 * width: 分辨率宽 * height: 分辨率高 */ session_start(); require_once 'lib/WriteLog.lib.php'; require_once 'public/public.php'; require_once 'configs/config.php'; require_once 'tasks/label/LabelDb.class.php'; try { $moduletype = (int) (isset($_GET['moduletype']) ? $_GET['moduletype'] : 3); $msubtype = (int) (isset($_GET['msubtype']) ? $_GET['msubtype'] : 0); $width = (int) (isset($_GET['width']) ? $_GET['width'] : 0); $height = (int) (isset($_GET['height']) ? $_GET['height'] : 0); $req_page = (int) (isset($_GET['page']) ? $_GET['page'] : 0); $req_num = (int) (isset($_GET['reqNum']) ? $_GET['reqNum'] : 50); $start = $req_num * $req_page; $limit = $req_num; $labelDb = new LabelDb(); $labelDb->setLabelParam($moduletype, $msubtype, $width, $height); $json_ret = $labelDb->searchLabel($start, $limit); echo $json_ret; } catch (Exception $e) { Log::write('labellist::exception error:' . $e->getMessage(), 'log'); echo get_rsp_result(false); }
function getAlbums($adid, $channel = 0) { try { $arr_size_tag = $this->_getAndroidWpSizeTag(); if ($arr_size_tag === false) { Log::write("AndroidWallpaperDb::getAlbums():_getAndroidWpSizeTag() failed", "log"); $result = get_rsp_result(false, 'get android wallpaper size tag failed'); return $result; } $sql = $this->_adWp->getSelectAdListByTypeSql($arr_size_tag[0], $adid); $result = $this->_memcached->getSearchResult($sql . 'album'); if ($result) { // Log::write('AndroidWallpaperDb::getAlbums(): SQL'.$sql.' \n result'.json_encode($result), 'error'); return $result; } $this->_explodeRatio($arr_size_tag); $arr_android_wp = $this->_getAdverList($sql, $channel, $adid); if ($arr_android_wp === false) { Log::write("AndroidWallpaperDb::getAlbums():_getAdverList() failed", "log"); $result = get_rsp_result(false, 'get android wallpaper failed'); return $result; } $json_rsp = array('result' => true, 'albums' => $arr_android_wp); $json_result = json_encode($json_rsp); $this->_memcached->setSearchResult($sql . 'album', $json_result, 3600); return $json_result; } catch (Exception $e) { Log::write("AndroidWallpaperDb::getAlbums()exception error:" . $e->getMessage(), "log"); $result = get_rsp_result(false, 'get android wallpaper exception'); return $result; } }
<?php /** * 设计师资源 */ require_once 'lib/WriteLog.lib.php'; try { require_once 'configs/config.php'; require_once "tasks/CoolShow/CoolShowSearch.class.php"; $nCoolType = isset($_GET['type']) ? $_GET['type'] : 0; $strCyid = isset($_GET['cyid']) ? $_GET['cyid'] : 10; $nPage = isset($_GET['page']) ? $_GET['page'] : 0; $nNum = isset($_GET['num']) ? $_GET['num'] : 10; $nStart = $nPage * $nNum; $coolshow = new CoolShowSearch(); $json_result = $coolshow->getDesignerCoolShow($nCoolType, $strCyid, $nStart, $nNum); echo $json_result; } catch (Exception $e) { Log::write('collect exception:' . $e->getMessage(), 'log'); echo get_rsp_result(false, 'collect exception'); }
public function getDesigner() { try { $strCyid = isset($_GET['cyid']) ? $_GET['cyid'] : ''; if (empty($strCyid)) { return get_rsp_result(false, 'cyid is empty'); } $sql = Collect::getSelectDesignerSql($strCyid); global $g_arr_db_config; $dbConfig = $g_arr_db_config['designer']; $rows = $this->_getDb($dbConfig)->getRecords($sql); if ($rows === false) { Log::write('CollectTask::getDesigner():getRecords() failed, SQL:' . $sql, 'log'); return get_rsp_result(false, 'get designer error'); } $arrDesigner = array(); foreach ($rows as $row) { $designer = new DesignerProtocol(); $designer->setProtocol($row); $arrDesigner[] = $designer; } return json_encode(array('result' => true, 'designer' => $arrDesigner)); } catch (Exception $e) { Log::write('CollectTask::getDesigner() excepton error:' . $e->getMessage(), 'log'); $result = get_rsp_result(false, 'get designer exception'); return $result; } }
<?php /** *查询资源评论评分的接口 * $type : 资源类型 * $id : 资源ID */ $nCoolType = isset($_GET['type']) ? $_GET['type'] : 0; //cooltype:主题、壁纸、铃声、字体等分类 //$nCommType= isset($_GET['commType'])?$_GET['commType']:0; //评论类型:0:全部评论 1:系统bug $strId = isset($_GET['id']) ? $_GET['id'] : ''; $strCpid = isset($_GET['cpid']) ? $_GET['cpid'] : ''; $skip = isset($_GET['page']) ? $_GET['page'] : 0; $limit = isset($_GET['reqNum']) ? $_GET['reqNum'] : 10; require_once 'public/public.php'; require_once 'tasks/Records/ScoreRecord.class.php'; $scoreRecord = new ScoreRecord(); $result = $scoreRecord->searchCpidRecord($nCoolType, $strCpid, $limit, $skip); if (!$result) { exit(get_rsp_result(false, 'search record failed')); } echo $result;
* $id : 资源ID */ require_once 'lib/WriteLog.lib.php'; try { $nCoolType = isset($_GET['type']) ? $_GET['type'] : 0; //cooltype:主题、壁纸、铃声、字体等分类 $strUid = isset($_GET['uid']) ? $_GET['uid'] : ''; $nPage = isset($_GET['page']) ? $_GET['page'] : 0; $nNum = isset($_GET['num']) ? $_GET['num'] : 0; $nStart = $nPage * $nNum; require_once 'tasks/Exorder/ExorderRecordDb.class.php'; $erDb = new ExorderRecordDb(); $rows = $erDb->getChargeRecord($strUid, $nCoolType, $nStart, $nNum); if ($rows === false) { Log::write('myrsc getChargeRecord() failed', 'log'); echo get_rsp_result(false, 'get charge record failed'); exit; } require_once 'tasks/protocol/MyResProtocol.php'; $arrProtocol = array(); foreach ($rows as $row) { $myRes = new MyResProtocol(); $myRes->setProtocol($row); array_push($arrProtocol, $myRes); } $arrResult = array('result' => true, 'list' => $arrProtocol); echo json_encode($arrResult); } catch (Exception $e) { Log::write('myrsc exception', 'log'); echo get_rsp_result(false, 'myrsc exception'); }
<?php $req_page = isset($_GET['page']) ? $_GET['page'] : 0; $req_num = isset($_GET['reqNum']) ? $_GET['reqNum'] : 10; $start = $req_num * $req_page; $nCoolType = (int) isset($_GET['type']) ? $_GET['type'] : 0; require_once 'configs/config.php'; require_once "tasks/CoolShow/CoolShowSearch.class.php"; $coolshow = new CoolShowSearch(); $protocol = $coolshow->getBanner($nCoolType); if (!$protocol || count($protocol) <= 0) { return get_rsp_result(false, 'get banner error'); } $result = array('result' => true, 'banners' => $protocol); echo $json_result;
} if (!empty($strGet)) { $bResult = $memcached->getSearchResult($strGet); if (!$bResult) { echo "getSearchResult() failed"; exit; } echo get_rsp_result(1) . 'get mem:' . $bResult; } if ($bGetIp) { $arr_memcache1['memcache'] = array(array('host' => '127.0.0.1', 'port' => '11211', 'persistent' => true, 'weight' => 2)); $arr_memcache2['memcache'] = array(array('host' => '127.0.0.1', 'port' => '11211', 'persistent' => true, 'weight' => 2)); if ($bGetIp == 1) { $arr_memcache = $arr_memcache1; } if ($bGetIp == 2) { $arr_memcache = $arr_memcache2; } $memcached = new MemDb(); $memcached->setConnect($arr_memcache); $bResult = $memcached->getSearchResult($strGetIp); if (!$bResult) { echo "getSearchResult() failed"; exit; } echo get_rsp_result(1) . 'get mem:' . $bResult; } ?>