本文整理匯總了PHP中CommonUtil::getCachedTermStatus方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonUtil::getCachedTermStatus方法的具體用法?PHP CommonUtil::getCachedTermStatus怎麽用?PHP CommonUtil::getCachedTermStatus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CommonUtil
的用法示例。
在下文中一共展示了CommonUtil::getCachedTermStatus方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: actionRefreshJson
public function actionRefreshJson()
{
$this->layout = false;
header('Content-type: application/json');
$refresh = array();
$conn = Yii::app()->db;
$onlineN = $conn->createCommand("select count(*) from tbl_online_user where sessionid='" . session_id() . "'")->queryRow(false);
if ($onlineN[0] == 0) {
echo "this.location.href='/main/login.do'";
Yii::app()->user->logout();
Yii::app()->end();
} else {
$conn->createCommand("update tbl_online_user set lasttime=sysdate() where sessionid='" . session_id() . "'")->execute();
}
if ($_POST['marChangeFlag'] == -1) {
$refresh['marChangeFlag'] = 0;
$refresh['marMsg'] = implode(',', $conn->createCommand("select message from tbl_marquee where showMar=1 order by updatedTime desc")->queryColumn());
}
$ltrRec = $conn->createCommand("select resultDate,notTeAutoCloseTime,teAutoCloseTime from tbl_ltr where term='" . $this->term . "'")->queryRow();
$notTeAutoRemainTime = strtotime($ltrRec['resultDate'] . ' ' . $ltrRec['notTeAutoCloseTime']) - time();
$teAutoRemainTime = strtotime($ltrRec['resultDate'] . ' ' . $ltrRec['teAutoCloseTime']) - time();
if (isset($_POST['btcs'])) {
$btcs = array();
$termStatus = CommonUtil::getCachedTermStatus();
$btcsRec = $conn->createCommand("select t.*,(SELECT IF(r.open=0,0,t.open) FROM tbl_default_rate r WHERE r.id=t.type OR (r.id='txbx' AND t.type='tx' AND t.id='tx_1') OR (r.id='txfbx' AND t.type='tx' AND t.id<>'tx_1') OR (r.id='sxbx' AND t.type='sx' AND t.id='sx_1') OR (r.id='sxfbx' AND t.type='sx' AND t.id<>'sx_1') OR (r.id='ws0' AND t.type='ws' AND t.id='ws_0') OR (r.id='wsf0' AND t.type='ws' AND t.id<>'ws_0')) AS defaultopen from tbl_ltr_type t where t.`btc` in ('" . str_replace(",", "','", $_POST['btcs']) . "') order by btc,REPLACE(RIGHT(id, 2),'_','0')")->queryAll();
foreach ($btcsRec as $btc) {
if ($btc['btc'] == 'tm' || $btc['btc'] == 'zm') {
if ($btc['btc'] . '_' . $_POST['pan'] != $btc['type']) {
continue;
}
}
$rate = floatval($btc['rate0' . Yii::app()->user->lei]);
$rate1 = floatval($btc['rate1' . Yii::app()->user->lei]);
if ($rate1 > 0) {
$rate = array($rate, $rate1);
}
//$openStatus=(strpos($btc['btc'],'tm')===false||strpos($btc['btc'],'tm')>0)?$termStatus['ftmstatus']:$termStatus['tmstatus'];
$openStatus = 0;
if ($termStatus['status'] != 2) {
if (strpos("'tm','tmds','tmdx','tmhsds','tmsb','tmwsdx','tmqs','tx','bbds','bbdx','mx'", "'{$btc['btc']}'") !== false) {
if ($teAutoRemainTime > 0) {
$openStatus = intval($btc['defaultopen']);
}
} else {
if ($notTeAutoRemainTime > 0) {
$openStatus = intval($btc['defaultopen']);
}
}
}
$btcs[$btc['btc']]['open'][] = $openStatus;
//$termStatus['status']==1?($openStatus==0?intval($btc['open']):($openStatus-1)):0;
$btcs[$btc['btc']]['rate'][] = $rate;
$btcs[$btc['btc']]['bet'][] = floatval($btc['bet']);
$btcs[$btc['btc']]['bh'][] = floatval($btc['bh']);
//$btcs[$btc['btc']]['adjRate'][]=$btc['adjRate'];
//$btcs[$btc['btc']]['name'][]=$btc['adjRate'];
//$btcs[$btc['btc']]['items'][]=$btc['adjRate'];
//$btcs[$btc['btc']]['cbIdx']=
}
$adjRateRec = $conn->createCommand("select * from tbl_adjrate where `btc` in ('" . str_replace(",", "','", $_POST['btcs']) . "') order by btId,nameIdx")->queryAll();
foreach ($adjRateRec as $adjRate) {
$rate = floatval($adjRate['rate0' . Yii::app()->user->lei]);
$rate1 = floatval($adjRate['rate1' . Yii::app()->user->lei]);
if (is_array($btcs[$adjRate['btc']]['rate'][$adjRate['idx']])) {
$rate = array($rate, $rate1);
}
$btcs[$adjRate['btc']]['adjRate'][$adjRate['idx']][] = $rate;
}
$refresh['btcs'] = $btcs;
}
$refresh['remainTimes'] = array($notTeAutoRemainTime, $teAutoRemainTime);
$refresh['term'] = $this->term;
$refresh['creditSum'] = Yii::app()->user->creditSum;
if ($this->term != Yii::app()->user->term) {
$refresh['usedSum'] = 0;
Yii::app()->user->setState('usedSum', 0);
Yii::app()->user->setState('term', $this->term);
} else {
$refresh['usedSum'] = Yii::app()->user->usedSum;
}
echo CJSON::encode($refresh);
Yii::app()->end();
}
示例2: actionModifyMaxProrate
public function actionModifyMaxProrate()
{
$this->layout = false;
header('Content-type: application/json');
$status = CommonUtil::getCachedTermStatus();
if ($status['status'] != 2) {
echo '{"success":false,"msg":"還未結賬,不能修改"}';
Yii::app()->end();
}
Yii::app()->db->createCommand("update tbl_user set maxProrate={$_POST['maxProrate']} where id='{$_POST['userId']}'")->execute();
echo '{"success":true}';
Yii::app()->end();
}
示例3: actionRefreshJson
/**
* post:
* btcs:
* tm,tmds,tmdx,tmhsds,tmsb,tmwsdx,tmqs
* | zm,zhds,zhdx
* | lm
* | tx
* |bbds,bbdx
* | mx 六肖
* | sx,ws
* sxl
* wsl
* bz 五不中
* zt_0,zt_0_ds,zt_0_dx,zt_0_hsds,zt_0_sb,zt_0_wsdx,zt_0_qs正特1
* zt_1,zt_1_ds,zt_1_dx,zt_1_hsds,zt_1_sb,zt_1_wsdx,zt_1_qs
lei 0 盤 ,0-A, 1-B
marChangeFlag 0
onliner qq133
pan 2
get:
marChangeFlag 第一次請求或 有改動,則為 -1
oc
btcs:{open, rate, bet }
* @return unknown_type
*/
public function actionRefreshJson()
{
$this->layout = false;
header('Content-type: application/json');
$refresh = array();
//$site=Yii::app()->user->getState('site');
$huo = $_POST['huo'];
$lei = $_POST['lei'];
//盤
$roleid = Yii::app()->user->role;
$userid = Yii::app()->user->id;
$conn = Yii::app()->db;
if ($_POST['marChangeFlag'] == -1) {
$refresh['marChangeFlag'] = 0;
$refresh['marMsg'] = implode(',', $conn->createCommand("select message from tbl_marquee where showMar=1 order by updatedTime desc")->queryColumn());
}
$conn->createCommand("delete from tbl_online_user where lasttime<sysdate()-INTERVAL 10 MINUTE")->execute();
//$conn->createCommand("update tbl_online_user set lasttime=sysdate() where sessionid='".session_id()."'")->execute();
if (Yii::app()->user->level >= 0) {
$onlineN = $conn->createCommand("select count(*) from tbl_online_user where sessionid='" . session_id() . "'")->queryRow(false);
if ($onlineN[0] == 0) {
echo "this.location.href='/main/login.do'";
Yii::app()->end();
} else {
$conn->createCommand("update tbl_online_user set lasttime=sysdate() where sessionid='" . session_id() . "'")->execute();
}
}
$onlinerRec = $conn->createCommand("select count(*) from tbl_online_user o left join tbl_user u on o.userid=u.id where u.parent_{$roleid}='{$userid}' or o.userid='{$userid}'")->queryRow(false);
$refresh['oc'] = $onlinerRec[0];
if ($huo == 2) {
$huo = 0;
$roleid = $roleid - 1;
$userid = Yii::app()->user->parentId;
}
//$refresh['key']=session_id();
$xuHuo = array("1", "1-prorate_4-prorate_3-prorate_2", "1-prorate_4-prorate_3", "1-prorate_4", "1");
$sumHuo = $huo == 1 ? "*({$xuHuo[$roleid]})" : "*prorate_{$roleid}";
$whereStatUser = " and statUser_{$roleid}='" . $userid . "' and betUserId<>'" . $userid . "'";
$ltrRec = $conn->createCommand("select resultDate,notTeAutoCloseTime,teAutoCloseTime from tbl_ltr where term='" . $this->term . "'")->queryRow();
$notTeAutoRemainTime = strtotime($ltrRec['resultDate'] . ' ' . $ltrRec['notTeAutoCloseTime']) - time();
$teAutoRemainTime = strtotime($ltrRec['resultDate'] . ' ' . $ltrRec['teAutoCloseTime']) - time();
if (isset($_POST['btcs'])) {
$pan = $_POST['pan'];
//A 0, B 1,AB 2,AB+ 3 種類
$btcs = array();
$termStatus = CommonUtil::getCachedTermStatus();
$sbs = array(0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2);
$jqs = array(11, 7, 10, 6, 9, 1);
$betCmd = $conn->createCommand("select ltrBtcId,ltrTypeId,sum(betSum" . $sumHuo . ") as bet,sum(-hyResult" . $sumHuo . ") as win,sum(betSum{$sumHuo}*(rate0+rebate/100-1)) as winSum,sum(betSum{$sumHuo}*(1-rebate/100)) as noWinSum,betCode,prorate_{$roleid} as prorate,rate0,rate1,rebate from tbl_bet where termid='" . $this->term . "' and `ltrBtcId` in ('" . str_replace(",", "','", $_POST['btcs']) . "') {$whereStatUser} group by ltrTypeId order by ltrTypeId");
$selfBhCmd = $conn->createCommand("select ltrBtcId,ltrTypeId,sum(betSum) as bet,sum(-hyResult) as win,sum(betSum*(rate0+rebate/100-1)) as winSum,sum(betSum*(1-rebate/100)) as noWinSum,rate0,rate1,rebate from tbl_bet where termid='" . $this->term . "' and `ltrBtcId` in ('" . str_replace(",", "','", $_POST['btcs']) . "') and betUserId='" . $userid . "' group by ltrTypeId order by ltrTypeId");
$btcsRec = $conn->createCommand("select t.*,(SELECT IF(r.open=0,0,t.open) FROM tbl_default_rate r WHERE r.id=t.type OR (r.id='txbx' AND t.type='tx' AND t.id='tx_1') OR (r.id='txfbx' AND t.type='tx' AND t.id<>'tx_1') OR (r.id='sxbx' AND t.type='sx' AND t.id='sx_1') OR (r.id='sxfbx' AND t.type='sx' AND t.id<>'sx_1') OR (r.id='ws0' AND t.type='ws' AND t.id='ws_0') OR (r.id='wsf0' AND t.type='ws' AND t.id<>'ws_0')) AS defaultopen from tbl_ltr_type t where t.`btc` in ('" . str_replace(",", "','", $_POST['btcs']) . "') order by btc,REPLACE(RIGHT(id, 2),'_','0')")->queryAll();
foreach ($btcsRec as $btc) {
if ($btc['btc'] == 'tm' || $btc['btc'] == 'zm') {
//if($pan==2||$pan==3) $pan=0;
// AB AB+ 都顯示特碼A賠率
//避免特碼A B 重合,要麽A賠率,要麽B賠率
if ($btc['btc'] . '_' . ($pan == 1 ? 1 : 0) != substr($btc['id'], 0, strrpos($btc['id'], '_'))) {
continue;
}
}
$rate = floatval($btc['rate0' . $lei]);
$rate1 = floatval($btc['rate1' . $lei]);
if ($rate1 > 0) {
$rate = array($rate, $rate1);
}
//$openStatus=(strpos($btc['btc'],'tm')===false||strpos($btc['btc'],'tm')>0)?$termStatus['ftmstatus']:$termStatus['tmstatus'];('tm','tmds','tmdx','tmhsds','tmsb','tmwsdx','tmqs','tx','bbds','bbdx','mx')
$openStatus = 0;
if ($termStatus['status'] != 2) {
if (strpos("'tm','tmds','tmdx','tmhsds','tmsb','tmwsdx','tmqs','tx','bbds','bbdx','mx'", "'{$btc['btc']}'") !== false) {
if ($teAutoRemainTime > 0) {
$openStatus = intval($btc['defaultopen']);
}
} else {
if ($notTeAutoRemainTime > 0) {
$openStatus = intval($btc['defaultopen']);
//.........這裏部分代碼省略.........
示例4: actionTz
/**
* rate_21,22,33 620
rate_21,22,43 620
rate_21,33,43 620
rate_22,33,43 620
sum_lm_1 6
rate_30,31,32 21,90
sum_lm_0 3
need update tbl_stat,tbl_ltr_type[win,bet] A B C ? 實貨虛貨?
bhuser bx999
* @return unknown_type
*/
public function actionTz()
{
$this->layout = false;
header('Content-type: application/json');
//$posts=CommonUtil::getBetRateSum($_POST);
/*$openStatus=0;
if($termStatus['status']!=2){
if(strpos("'tm','tmds','tmdx','tmhsds','tmsb','tmwsdx','tmqs','tx','bbds','bbdx','mx'","'{$btc['btc']}'")!==false){
if($teAutoRemainTime>0){
$openStatus=intval($btc['defaultopen']);
}
}else{
if($notTeAutoRemainTime>0){
$openStatus=intval($btc['defaultopen']);
}
}
}*/
$msg = '';
$conn = Yii::app()->db;
$userid = Yii::app()->user->id;
$roleid = Yii::app()->user->role;
$lei = isset($_POST['lei']) ? intval($_POST['lei']) : Yii::app()->user->getState('lei');
$vNull = NULL;
$findRateCmd = $conn->createCommand("select t.*,(SELECT IF(r.open=0,0,t.open) FROM tbl_default_rate r WHERE r.id=t.type OR (r.id='txbx' AND t.type='tx' AND t.id='tx_1') OR (r.id='txfbx' AND t.type='tx' AND t.id<>'tx_1') OR (r.id='sxbx' AND t.type='sx' AND t.id='sx_1') OR (r.id='sxfbx' AND t.type='sx' AND t.id<>'sx_1') OR (r.id='ws0' AND t.type='ws' AND t.id='ws_0') OR (r.id='wsf0' AND t.type='ws' AND t.id<>'ws_0')) AS defaultopen from tbl_ltr_type t where t.`id`=:id");
$ltrRec = $conn->createCommand("select resultDate,notTeAutoCloseTime,teAutoCloseTime from tbl_ltr where term='" . $this->term . "'")->queryRow();
$notTeAutoRemainTime = strtotime($ltrRec['resultDate'] . ' ' . $ltrRec['notTeAutoCloseTime']) - time();
$teAutoRemainTime = strtotime($ltrRec['resultDate'] . ' ' . $ltrRec['teAutoCloseTime']) - time();
$openStatus = 0;
$termStatus = CommonUtil::getCachedTermStatus();
$typeRecs = array();
$posts = array();
if ($termStatus['status'] != 2) {
$rates = array();
$sums = array();
$head = '';
$isMulti = false;
$totleSum = 0;
foreach ($_POST as $key => $value) {
$head = substr($key, 0, 4);
if ($head == 'sum_') {
if ($value != '') {
$value = intval($value);
if ($value <= 0) {
continue;
}
$sKey = substr($key, 4);
$totleSum += $value;
$typeRec = $findRateCmd->queryRow(true, array(":id" => $sKey));
if ($typeRec === null || $typeRec === false) {
continue;
}
$typeRecs[$sKey] = $typeRec;
if (strpos("'tm','tmds','tmdx','tmhsds','tmsb','tmwsdx','tmqs','tx','bbds','bbdx','mx'", "'{$typeRec['btc']}'") !== false) {
if ($teAutoRemainTime > 0) {
$openStatus = intval($typeRec['defaultopen']);
}
} else {
if ($notTeAutoRemainTime > 0) {
$openStatus = intval($typeRec['defaultopen']);
}
}
if ($openStatus == 0) {
$msg = "{$typeRec['name']} 已關盤";
break;
} else {
$openStatus = 0;
}
$sums[$sKey] = $value;
}
} elseif ($head == 'rate') {
$rates[substr($key, 5)] = $value;
$isMulti = $isMulti || strpos($key, ',') !== false;
}
}
$isMulti = $isMulti && count($sums) == 1;
$posts = array('rates' => $rates, 'sums' => $sums, 'isMulti' => $isMulti, 'totleSum' => $totleSum);
} else {
echo CJSON::encode(array("msg" => "已結賬,不能下注", "success" => false));
Yii::app()->end();
}
if ($posts['totleSum'] > Yii::app()->user->creditSum - Yii::app()->user->usedSum) {
echo CJSON::encode(array("msg" => "信用額度不夠", "success" => false));
Yii::app()->end();
}
$autoBhMap = array('tm' => 0, 'zm' => 1, 'zhds' => 1, 'zhdx' => 1, 'zt' => 2, 'tmds' => 3, 'tmdx' => 3, 'tmhsds' => 3, 'tmwsdx' => 3, 'tmqs' => 3, 'ztds' => 3, 'ztdx' => 3, 'zthsds' => 3, 'ztwsdx' => 3, 'ztqs' => 3, 'tmsb' => 4, 'ztsb' => 4, 'lm_0' => 5, 'lm_1' => 6, 'lm_2' => 7, 'lm_3' => 8, 'lm_4' => 9, 'tx' => 10, 'sx' => 11, 'ws' => 12, 'bbds' => 13, 'bbdx' => 13, 'mx' => 14, 'sxl' => 15, 'wsl' => 15, 'bz' => 16, 'dzy' => 17, 'qsb' => 18, 'zx_0' => 19, 'zx_1' => 19, 'zx_2' => 19, 'zx_3' => 19, 'zx_4' => 20, 'zx_5' => 20, 'qm_0' => 21, 'qm_1' => 21, 'qm_2' => 21, 'qm_3' => 21, 'qm_4' => 21, 'qm_5' => 21, 'qm_6' => 21, 'qm_7' => 21);
//.........這裏部分代碼省略.........