當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CommonUtil::getSxCode方法代碼示例

本文整理匯總了PHP中CommonUtil::getSxCode方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonUtil::getSxCode方法的具體用法?PHP CommonUtil::getSxCode怎麽用?PHP CommonUtil::getSxCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CommonUtil的用法示例。


在下文中一共展示了CommonUtil::getSxCode方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionRefreshJson


//.........這裏部分代碼省略.........
                 if ($bet['ltrBtcId'] == 'tmds' || substr($bet['ltrBtcId'], -3) == '_ds') {
                     //$betCbIdx=0 單
                     for ($i = 0; $i < 24; $i++) {
                         $btcs[$abBtc]['win'][2 * $i + $betCbIdx] -= $winSum;
                         $btcs[$abBtc]['win'][2 * $i + 1 - $betCbIdx] += $noWinSum;
                         $btcs[$abBtc]['bet'][2 * $i + $betCbIdx] += $betResult / 24;
                     }
                 } elseif ($bet['ltrBtcId'] == 'tmdx' || substr($bet['ltrBtcId'], -3) == '_dx') {
                     for ($i = 0; $i < 24; $i++) {
                         $btcs[$abBtc]['win'][$i + (1 - $betCbIdx) * 24] -= $winSum;
                         $btcs[$abBtc]['win'][$i + $betCbIdx * 24] += $noWinSum;
                         $btcs[$abBtc]['bet'][$i + (1 - $betCbIdx) * 24] += $betResult / 24;
                     }
                 } elseif ($bet['ltrBtcId'] == 'tmhsds' || substr($bet['ltrBtcId'], -3) == 'sds') {
                     for ($i = 0; $i < 48; $i++) {
                         $r = $i % 10 + floor($i / 10);
                         $btcs[$abBtc]['win'][$i] -= $r % 2 == $betCbIdx ? $winSum : -$noWinSum;
                         $btcs[$abBtc]['bet'][$i] += $r % 2 == $betCbIdx ? $betResult / 24 : 0;
                     }
                 } elseif ($bet['ltrBtcId'] == 'tmwsdx' || substr($bet['ltrBtcId'], -3) == 'sdx') {
                     for ($i = 0; $i < 48; $i++) {
                         $r = $i % 10;
                         $btcs[$abBtc]['win'][$i] -= ($r > 3 ? 0 : 1) == $betCbIdx ? $winSum : -$noWinSum;
                         $btcs[$abBtc]['bet'][$i] += ($r > 3 ? 0 : 1) == $betCbIdx ? $betResult / 24 : 0;
                     }
                 } elseif ($bet['ltrBtcId'] == 'tmsb' || substr($bet['ltrBtcId'], -3) == '_sb') {
                     for ($i = 0; $i < 49; $i++) {
                         $r = $sbs[$i];
                         $btcs[$abBtc]['win'][$i] -= $r == $betCbIdx ? $winSum : -$noWinSum;
                         $btcs[$abBtc]['bet'][$i] += $r == $betCbIdx ? $betResult / 12 : 0;
                     }
                 } elseif ($bet['ltrBtcId'] == 'tmqs' || substr($bet['ltrBtcId'], -3) == '_qs') {
                     for ($i = 0; $i < 48; $i++) {
                         $r = CommonUtil::getSxCode($i + 1);
                         $r = in_array($i, $jqs) ? 0 : 1;
                         $btcs[$abBtc]['win'][$i] -= $r == $betCbIdx ? $winSum : -$noWinSum;
                         $btcs[$abBtc]['bet'][$i] += $r == $betCbIdx ? $betResult / 24 : 0;
                     }
                 }
                 $btcs[$bet['ltrBtcId']]['bet'][$betCbIdx] += floatval($bet['bet']);
                 $btcs[$bet['ltrBtcId']]['win'][$betCbIdx] += floatval($bet['win']);
             } else {
                 $btcs[$bet['ltrBtcId']]['bet'][$betCbIdx] += floatval($bet['bet']);
                 $btcs[$bet['ltrBtcId']]['win'][$betCbIdx] += floatval($bet['win']);
             }
         }
         //[ "id","cbType","names", "sum","flag" ]  "items":[[],[],[[48,0,"牛,虎,蛇,馬,羊,狗",9.0,48]]]
         if ($_POST['btcs'] == 'lm' || $_POST['btcs'] == 'dzy' || $_POST['btcs'] == 'mx' || $_POST['btcs'] == 'wsl' || $_POST['btcs'] == 'sxl' || $_POST['btcs'] == 'bz') {
             $items = array();
             $cbIdx = intval($_POST['cbIdx']);
             $items[] = array();
             $items[] = array();
             //$items[]=$conn->createCommand("select id,SUBSTRING(ltrTypeId,instr(ltrTypeId,'_')+1),betType,betSum,SUBSTRING(ltrTypeId,instr(ltrTypeId,'_')+1) from tbl_bet where `ltrBtcId` ='{$_POST['btcs']}' order by ltrTypeId")->queryAll(false);
             $itemWhere = "";
             if ($cbIdx != -1) {
                 $itemWhere = "and `ltrTypeId` ='" . $_POST['btcs'] . "_" . $cbIdx . "'";
                 /*}else{
                 			$itemWhere="and `ltrBtcId` ='".$_POST['btcs']."'";
                 		}*/
                 $btcLen = strlen($_POST['btcs']) + 1 + 1;
                 $itemRec = $conn->createCommand("select id,substring(ltrTypeId,{$btcLen}),betCode,sum(betSum{$sumHuo}) as betSum,id from tbl_bet where termid='{$this->term}' {$itemWhere} {$whereStatUser} group by ltrTypeId,betCode order by betSum desc,REPLACE(REPLACE(REPLACE(REPLACE(CONCAT(',',betCode,','),',1,',',01,'),',2,',',02,'),',3,',',03,'),',4,',',04,') asc")->queryAll(false);
                 /*for($itemI=0;$itemI<count($itemRec);$itemI++){
                 			$itemCodes=split(',',$itemRec[$itemI][2]);
                 			for($itemJ=0;$itemJ<count($itemCodes);$itemJ++){
                 				$itemCodes[$itemJ]=str_pad($itemCodes[$itemJ]+1, 2, "0", STR_PAD_LEFT);
                 			}
開發者ID:haokuweb,項目名稱:myDemo,代碼行數:67,代碼來源:CtrController.php

示例2: settleType

 public function settleType($term)
 {
     $conn = Yii::app()->db;
     $codes = $conn->createCommand("select zm1,zm2,zm3,zm4,zm5,zm6,tm from tbl_ltr_codes where term=:term")->queryRow(true, array(":term" => $term));
     $sql = "update tbl_ltr_type set bet=:bet,win=:win where btc=:btc";
     //$typeCmd=$conn->createCommand("update tbl_ltr_type set bet=:bet,win=:win where btc=:btc");
     $intCode = array();
     $sxCode = array();
     foreach ($codes as $k => $v) {
         $intCode[$k] = intval($v);
         $sxCode[$k] = CommonUtil::getSxCode(intval($v));
     }
     $btcArrs = array();
     //tm
     $r = $intCode['tm'] - 1;
     $conn->createCommand($sql . " and (id='tm_0_{$r}' or id='tm_1_{$r}')")->execute(array(":bet" => 0, ":win" => 1, "btc" => "tm"));
     $conn->createCommand($sql . " and (id<>'tm_0_{$r}' and id<>'tm_1_{$r}')")->execute(array(":bet" => 0, ":win" => 0, "btc" => "tm"));
     $btcArrs[] = "'tm'";
     //tmds
     if ($codes['tm'] == '49') {
         $conn->createCommand($sql)->execute(array(":bet" => 0, ":win" => 2, "btc" => "tmds"));
     } else {
         $r = $intCode['tm'] % 2;
         //48: 0  雙: _1
         $conn->createCommand($sql . " and id='tmds_0'")->execute(array(":bet" => 0, ":win" => $r, "btc" => "tmds"));
         $conn->createCommand($sql . " and id='tmds_1'")->execute(array(":bet" => 0, ":win" => 1 - $r, "btc" => "tmds"));
     }
     $btcArrs[] = "'tmds'";
     //tmdx
     if ($codes['tm'] == '49') {
         $conn->createCommand($sql)->execute(array(":bet" => 0, ":win" => 2, "btc" => "tmdx"));
     } else {
         $r = $intCode['tm'] > 24 ? 1 : 0;
         //24
         $conn->createCommand($sql . " and id='tmdx_0'")->execute(array(":bet" => 0, ":win" => $r, "btc" => "tmdx"));
         $conn->createCommand($sql . " and id='tmdx_1'")->execute(array(":bet" => 0, ":win" => 1 - $r, "btc" => "tmdx"));
     }
     $btcArrs[] = "'tmdx'";
     //tmhsds
     if ($codes['tm'] == '49') {
         $conn->createCommand($sql)->execute(array(":bet" => 0, ":win" => 2, "btc" => "tmhsds"));
     } else {
         $r = substr($codes['tm'], 0, 1) + substr($codes['tm'], 1, 1);
         $r = $r % 2;
         //24
         $conn->createCommand($sql . " and id='tmhsds_0'")->execute(array(":bet" => 0, ":win" => $r, "btc" => "tmhsds"));
         $conn->createCommand($sql . " and id='tmhsds_1'")->execute(array(":bet" => 0, ":win" => 1 - $r, "btc" => "tmhsds"));
     }
     $btcArrs[] = "'tmhsds'";
     //tmwsdx
     if ($codes['tm'] == '49') {
         $conn->createCommand($sql)->execute(array(":bet" => 0, ":win" => 2, "btc" => "tmwsdx"));
     } else {
         $r = $intCode['tm'] % 10 > 4 ? 1 : 0;
         $conn->createCommand($sql . " and id='tmwsdx_0'")->execute(array(":bet" => 0, ":win" => $r, "btc" => "tmwsdx"));
         $conn->createCommand($sql . " and id='tmwsdx_1'")->execute(array(":bet" => 0, ":win" => 1 - $r, "btc" => "tmwsdx"));
     }
     $btcArrs[] = "'tmwsdx'";
     //tmqs
     //	  DECLARE t_sx_jq varchar(15) default '11,7,10,6,9,1';
     //DECLARE t_sx_ys varchar(15) default '0,8,4,3,2,5';
     $jqCodes = array(11, 7, 10, 6, 9, 1);
     if ($codes['tm'] == '49') {
         $conn->createCommand($sql)->execute(array(":bet" => 0, ":win" => 2, "btc" => "tmqs"));
     } else {
         $r = in_array($sxCode['tm'], $jqCodes) ? 1 : 0;
         $conn->createCommand($sql . " and id='tmqs_0'")->execute(array(":bet" => 0, ":win" => $r, "btc" => "tmqs"));
         $conn->createCommand($sql . " and id='tmqs_1'")->execute(array(":bet" => 0, ":win" => 1 - $r, "btc" => "tmqs"));
     }
     $btcArrs[] = "'tmqs'";
     //tmsb
     $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);
     $r = $sbs[$intCode['tm'] - 1];
     $conn->createCommand($sql . " and id='tmsb_{$r}'")->execute(array(":bet" => 0, ":win" => 1, "btc" => "tmsb"));
     $conn->createCommand($sql . " and id<>'tmsb_{$r}'")->execute(array(":bet" => 0, ":win" => 0, "btc" => "tmsb"));
     $btcArrs[] = "'tmsb'";
     //zm
     $r = array();
     for ($i = 1; $i <= 6; $i++) {
         $r[] = "'zm_0_" . ($intCode["zm{$i}"] - 1) . "'";
         $r[] = "'zm_1_" . ($intCode["zm{$i}"] - 1) . "'";
     }
     $r = join(',', $r);
     $conn->createCommand($sql . " and id in ( {$r} )")->execute(array(":bet" => 0, ":win" => 1, "btc" => "zm"));
     $conn->createCommand($sql . " and id not in ( {$r} )")->execute(array(":bet" => 0, ":win" => 0, "btc" => "zm"));
     $btcArrs[] = "'zm'";
     $zhsum = 0;
     for ($i = 1; $i <= 6; $i++) {
         $zhsum += intval($intCode["zm{$i}"]);
     }
     $zhsum += intval($intCode["tm"]);
     //zhds
     $r = $zhsum % 2;
     //48: 0  雙: _1
     $conn->createCommand($sql . " and id='zhds_0'")->execute(array(":bet" => 0, ":win" => $r, "btc" => "zhds"));
     $conn->createCommand($sql . " and id='zhds_1'")->execute(array(":bet" => 0, ":win" => 1 - $r, "btc" => "zhds"));
     $btcArrs[] = "'zhds'";
     //zhdx
     $r = $zhsum > 174 ? 1 : 0;
     $conn->createCommand($sql . " and id='zhdx_0'")->execute(array(":bet" => 0, ":win" => $r, "btc" => "zhdx"));
//.........這裏部分代碼省略.........
開發者ID:haokuweb,項目名稱:myDemo,代碼行數:101,代碼來源:BetService.php


注:本文中的CommonUtil::getSxCode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。