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


PHP Tools::coerceInt方法代碼示例

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


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

示例1: ratioEdit

 /**
  * 更新faq點擊率
  * @param array $postArr
  */
 public function ratioEdit($postArr)
 {
     if (!Tools::coerceInt($postArr['Id'])) {
         return array('msg' => '請選擇正確的FAQ', 'status' => -1, 'href' => 1);
     }
     $ratio = Tools::coerceInt($postArr['ratio']);
     if ($this->update(array('ratio' => $ratio), "Id={$postArr['Id']}")) {
         return array('msg' => false, 'status' => 1, 'href' => 1);
     } else {
         return array('msg' => '更改失敗', 'status' => -2, 'href' => 1);
     }
 }
開發者ID:huangwei2wei,項目名稱:kfxt,代碼行數:16,代碼來源:PlayerFaq.class.php

示例2: edit

 public function edit($postArr)
 {
     if (empty($postArr['Id'])) {
         return array('msg' => '參數錯誤', 'status' => -1, 'href' => 1);
     }
     $monthScorce = Tools::coerceInt($postArr['month_scorce']);
     $codeScorce = Tools::coerceInt($postArr['code_scorce']);
     $totalScorce = round($monthScorce * 0.8 + $codeScorce * 0.2);
     $updateArr = array('month_scorce' => $monthScorce, 'code_scorce' => $codeScorce, 'total_scorce' => $totalScorce);
     $this->update($updateArr, "Id={$postArr['Id']}");
     return array('msg' => '修改評分成功', 'status' => 1, 'href' => 2);
 }
開發者ID:huangwei2wei,項目名稱:kfxt,代碼行數:12,代碼來源:ProgramStatsQuarter.class.php

示例3: edit

 public function edit($postArr)
 {
     if (empty($postArr['Id'])) {
         return array('msg' => '參數錯誤', 'status' => -1, 'href' => 1);
     }
     $dataList = $this->findById($postArr['Id']);
     $qualityScorce = Tools::coerceInt($postArr['qulaity_scorce']);
     $efficiencyScorce = Tools::coerceInt($postArr['efficiency_scorce']);
     $activeScorce = Tools::coerceInt($postArr['active_scorce']);
     $innovationScorce = Tools::coerceInt($postArr['innovation_scorce']);
     $totalScorce = round($qualityScorce * 0.4 + $efficiencyScorce * 0.4 + $activeScorce * 0.1 + $innovationScorce * 0.1);
     $updateArr = array('qulaity_scorce' => $qualityScorce, 'efficiency_scorce' => $efficiencyScorce, 'active_scorce' => $activeScorce, 'innovation_scorce' => $innovationScorce, 'total_scorce' => $totalScorce);
     $this->update($updateArr, "Id={$postArr['Id']}");
     return array('msg' => '修改成功', 'status' => 1, 'href' => 2);
 }
開發者ID:huangwei2wei,項目名稱:kfxt,代碼行數:15,代碼來源:ProgramStatsMonth.class.php

示例4: getLibaoCard_2

 /**
  * 富人國獲取禮包卡號動作 
  * @todo 未完成...
  */
 public function getLibaoCard_2()
 {
     exit;
     if (!$_REQUEST['marking']) {
         return array('status' => 0, 'info' => null, 'data' => 'not params marking');
     }
     if (!$_REQUEST['card_id']) {
         return array('status' => 0, 'info' => null, 'data' => 'not params card_id');
     }
     $cardId = Tools::coerceInt($_REQUEST['card_id']);
     $serverMarking = strtoupper($_REQUEST['marking']);
     $this->_modelGameSerList = $this->_getGlobalData('Model_GameSerList', 'object');
     $serverDetail = $this->_modelGameSerList->findByMarking(2, self::MARKING . $serverMarking);
     $serverId = $serverDetail['Id'];
     $this->_utilApiFrg = $this->_getGlobalData('Util_ApiFrg', 'object');
     $get = array('c' => 'Card', 'a' => 'Create', 'doaction' => 'save');
     $post = array('TypeId' => $cardId, 'cardbyte' => 32, 'Number' => 1, 'TimeLimit' => 0);
     $this->_utilApiFrg->addHttp($serverId, $get, $post);
     $this->_utilApiFrg->send();
     $data = $this->_utilApiFrg->getResult();
 }
開發者ID:huangwei2wei,項目名稱:kfxt,代碼行數:25,代碼來源:Safe360.class.php

示例5: actionEv

 /**
  * 評價統計
  */
 public function actionEv()
 {
     $gameTypes = $this->_getGlobalData('game_type');
     $gameTypes = Model::getTtwoArrConvertOneArr($gameTypes, 'Id', 'name');
     $sources = array('1' => '官網', '2' => '遊戲');
     $selected = array();
     //選中數組
     $selected['lang'] = $_POST['lang'];
     $selected['source'] = Tools::coerceInt($_POST['source']);
     $selected['start_time'] = $_POST['start_time'];
     $selected['end_time'] = $_POST['end_time'];
     $selected['game_type_id'] = Tools::coerceInt($_POST['game_type_id']);
     if ($this->_isPost()) {
         $this->_modelPlayerFaqLog = $this->_getGlobalData('Model_PlayerFaqLog', 'object');
         if (empty($_POST['start_time']) || empty($_POST['end_time'])) {
             $this->_utilMsg->showMsg('請選擇開始時間與結束時間', -1, 2);
         }
         $stats = $this->_modelPlayerFaqLog->stats($_POST['source'], $_POST['game_type_id'], array('start' => $_POST['start_time'], 'end' => $_POST['end_time']), $_POST['lang']);
     }
     $this->_view->assign('dataList', $stats);
     $sources[''] = '所有';
     $gameTypes[''] = '所有';
     $lang = $this->_getGlobalData('lang');
     //語言
     $this->_view->assign('land', $lang);
     $this->_view->assign('sources', $sources);
     $this->_view->assign('gameTypes', $gameTypes);
     $this->_view->assign('selected', $selected);
     $this->_utilMsg->createPackageNavBar();
     if ($_POST['xls']) {
         //導出excel
         Tools::import('Util_ExportExcel');
         $this->_utilExportExcel = new Util_ExportExcel('faq統計', 'Excel/StatsFaq', $stats);
         $this->_utilExportExcel->outPutExcel();
     } else {
         $this->_view->display();
     }
 }
開發者ID:huangwei2wei,項目名稱:kfxt,代碼行數:41,代碼來源:StatsFaq.class.php

示例6: actionSphinxStatus

 /**
  * sphinx工作狀態
  * @return boolean
  */
 public function actionSphinxStatus()
 {
     $this->_utilFaqSearch = $this->_getGlobalData('Util_FaqSearch', 'object');
     $keyWords = $_REQUEST['keywords'];
     $gameTypeId = Tools::coerceInt(1);
     $page = Tools::coerceInt(1);
     if (!$page) {
         $page = 1;
     }
     $pageSize = Tools::coerceInt(8);
     if (!$pageSize) {
         $pageSize = 8;
     }
     $this->_utilFaqSearch->setFaqStatus(1);
     //設置不需要官網的
     $this->_utilFaqSearch->setLimit($page, $pageSize);
     $data = $this->_utilFaqSearch->search('贏在大亨', $gameTypeId, $this->_curLang);
     if (count($data['data'])) {
         echo 1;
     } else {
         echo 0;
     }
 }
開發者ID:huangwei2wei,項目名稱:kfxt,代碼行數:27,代碼來源:InterfaceData.class.php

示例7: actionIndex

 public function actionIndex()
 {
     $users = $this->_getGlobalData('user_index_id');
     if ($this->_isPost()) {
         $auditType = $this->_getGlobalData('frg_audit_type');
         array_unshift($auditType, '匯總');
         if (empty($_POST['start_date']) || empty($_POST['end_date'])) {
             $this->_utilMsg->showMsg('請設置開始時間與結束時間', -1, 2);
         }
         if ($_POST['audit_user_id']) {
             $auditUserId = Tools::coerceInt($_POST['audit_user_id']);
         }
         $this->_modelApplyDataFrg = $this->_getGlobalData('Model_ApplyDataFrg', 'object');
         $time = array('start' => strtotime($_POST['start_date']), 'end' => strtotime($_POST['end_date']));
         $dataList = $this->_modelApplyDataFrg->stats($time, $auditUserId);
         $this->_view->assign('dataList', $dataList);
         $this->_view->assign('displayTrue', true);
         $this->_view->assign('auditType', $auditType);
     }
     $this->_view->assign('users', $users);
     $this->_utilMsg->createPackageNavBar();
     $this->_view->display();
 }
開發者ID:huangwei2wei,項目名稱:kfxt,代碼行數:23,代碼來源:StatsGmAudit.class.php

示例8: _documentDel

 private function _documentDel()
 {
     $this->_modelQualityDocument = $this->_getGlobalData('Model_QualityDocument', 'object');
     $id = Tools::coerceInt($_GET['Id']);
     if ($this->_modelQualityDocument->delById($id)) {
         $this->_utilMsg->showMsg('刪除成功');
     } else {
         $this->_utilMsg->showMsg('刪除失敗', -2);
     }
 }
開發者ID:huangwei2wei,項目名稱:kfxt,代碼行數:10,代碼來源:QualityCheck.class.php

示例9: actionChangeStatus

 /**
  * 更改狀態
  */
 public function actionChangeStatus()
 {
     if ($this->_isAjax()) {
         $id = Tools::coerceInt($_GET['Id']);
         $status = Tools::coerceInt($_GET['status']);
         if ($this->_modelWorkOrder->update(array('status' => $status), "Id={$id}")) {
             $this->_returnAjaxJson(array('status' => 1, 'msg' => '更改狀態成功'));
         } else {
             $this->_returnAjaxJson(array('status' => 0, 'msg' => '更改狀態失敗'));
         }
     }
 }
開發者ID:huangwei2wei,項目名稱:kfxt,代碼行數:15,代碼來源:WorkOrder.class.php

示例10: actionChangeStatus

 /**
  * 更改狀態
  */
 public function actionChangeStatus()
 {
     if ($this->_isAjax()) {
         $id = Tools::coerceInt($_GET['Id']);
         $status = Tools::coerceInt($_GET['status']);
         if ($this->_modelWorkOrder->update(array('status' => $status), "Id={$id}")) {
             #------添加日誌------#
             $this->_modelOrderLog = $this->_getGlobalData('Model_OrderLog', 'object');
             $this->_modelOrderLog->addLog(array('Id' => $id), Model_OrderLog::CHANGE_STATUS);
             #------添加日誌------#
             $this->_returnAjaxJson(array('status' => 1, 'msg' => Tools::getLang('CHANGESTATUS_SUCCESS', __CLASS__)));
         } else {
             $this->_returnAjaxJson(array('status' => 0, 'msg' => Tools::getLang('CHANGESTATUS_ERROR', __CLASS__)));
         }
     }
 }
開發者ID:huangwei2wei,項目名稱:kfxt,代碼行數:19,代碼來源:WorkOrder.class.php

示例11: actionChanageScores

 /**
  * 更改分數ajax
  */
 public function actionChanageScores()
 {
     if ($this->_isAjax()) {
         $scores = $_GET['scores'];
         $qaId = Tools::coerceInt($_GET['qa_id']);
         $this->_modelQuality = $this->_getGlobalData('Model_Quality', 'object');
         if ($this->_modelQuality->update(array('scores' => $scores), "qa_id={$qaId}")) {
             $this->_returnAjaxJson(array('status' => 1, 'msg' => '更改分數成功'));
         } else {
             $this->_returnAjaxJson(array('status' => 0, 'msg' => '更改分數失敗'));
         }
     }
 }
開發者ID:huangwei2wei,項目名稱:kfxt,代碼行數:16,代碼來源:QualityCheck.class.php

示例12: _userAct

 /**
  * 用戶權限分配 
  */
 private function _userAct()
 {
     if ($this->_isPost()) {
         $userId = $_POST['user_id'];
         $idArr = $_POST['Id'];
         if ($idArr) {
             $idArr = implode(',', $idArr);
         } else {
             $idArr = null;
         }
         $this->_modelUser->update(array('act' => $idArr), "Id={$userId}");
         $this->_utilMsg->showMsg('增加權限成功', 1, Tools::url(CONTROL, ACTION));
     } else {
         $moudlesUrl = $this->_getMoudlesUrl();
         $this->_view->assign('moudlesUrl', $moudlesUrl);
         #------獲得菜單項一維數組------#
         $this->_modelMenu = $this->_getGlobalData('Model_Menu', 'object');
         $menuList = $this->_modelMenu->findAll();
         $menuArr = array();
         foreach ($menuList as $value) {
             $menuArr[$value['value']] = $value['name'];
         }
         #------獲得菜單項一維數組------#
         $userId = Tools::coerceInt($_GET['user_id']);
         $this->_modelAct = $this->_getGlobalData('Model_Act', 'object');
         $dataList = $this->_modelAct->getUseRoleAct($userId);
         $controlList = array();
         $actionList = array();
         $selectedList = array();
         foreach ($dataList as &$value) {
             if ($value['selected']) {
                 $selectedList[$value['Id']] = $value['selected'];
             }
             if ($value['parent_id'] == 0) {
                 array_push($controlList, $value);
             } else {
                 array_push($actionList, $value);
             }
         }
         $checkBox = '';
         foreach ($controlList as $key => $value) {
             $checkBox .= '<tr><td align="left">';
             $checked = array_key_exists($value['Id'], $selectedList) ? 'checked="checked"' : '';
             if ($checked != '') {
                 if ($selectedList[$value['Id']] == 1) {
                     $checked .= " disabled='disabled'' ";
                 }
                 //如果等於1就表示這個選中的按鈕是通過角色選中的
             }
             $checkBox .= "<input type='checkbox' value='{$value['value']}' name='Id[]' {$checked} /><b>{$menuArr[$value['value']]}.{$value['value']}</b><hr />";
             foreach ($actionList as $childValue) {
                 if ($childValue['parent_id'] == $value['Id']) {
                     $checked = array_key_exists($childValue['Id'], $selectedList) ? 'checked="checked"' : '';
                     if ($checked != '') {
                         if ($selectedList[$childValue['Id']] == 1) {
                             $checked .= " disabled='disabled'' ";
                         }
                         //如果等於1就表示這個選中的按鈕是通過角色選中的
                     }
                     $checkBox .= "&nbsp;&nbsp;&nbsp;→<input type='checkbox' value='{$childValue['value']}' name='Id[]' {$checked} />{$menuArr[$childValue['value']]}.<a href='javascript:;' val_data='{$childValue['value']}' name='user_act'>{$childValue['value']}</a><br/>";
                 }
             }
             $checkBox .= '</td></tr>';
         }
         $this->_view->assign('checkBox', $checkBox);
         $this->_utilMsg->createNavBar();
         $this->_view->set_tpl(array('body' => 'User/UserAct.html'));
         $this->_view->display();
     }
 }
開發者ID:huangwei2wei,項目名稱:kfxt,代碼行數:73,代碼來源:User.class.php

示例13: _update

 /**
  * 更新菜單子項
  */
 private function _update()
 {
     if ($this->_isAjax()) {
         if ($_POST['Id']) {
             $updateArr = array('sort' => Tools::coerceInt($_POST['sort']), 'super_action' => trim($_POST['super_action']), 'status' => Tools::coerceInt($_POST['status']), 'name' => $_POST['name'], 'name_2' => $_POST['name_2']);
             $id = Tools::coerceInt($_POST['Id']);
             if ($this->_modelMenu->update($updateArr, "Id={$id}")) {
                 $this->_returnAjaxJson(array('status' => 1, 'msg' => '更新成功'));
             } else {
                 $this->_returnAjaxJson(array('status' => -2, 'msg' => '更新失敗'));
             }
         } else {
             $this->_utilMsg->showMsg(Tools::getLang('SELECT_ERROR', __CLASS__), -1);
         }
     }
 }
開發者ID:huangwei2wei,項目名稱:kfxt,代碼行數:19,代碼來源:Menu.class.php

示例14: _update

 /**
  * 更新菜單子項
  */
 private function _update()
 {
     if ($this->_isPost()) {
         if ($_POST['Id']) {
             $updateArr = array('sort' => Tools::coerceInt($_POST['sort']), 'super_action' => trim($_POST['super_action']));
             $id = Tools::coerceInt($_POST['Id']);
             if ($this->_modelMenu->update($updateArr, "Id={$id}")) {
                 $this->_utilMsg->showMsg(false);
             } else {
                 $this->_utilMsg->showMsg('更新失敗,請聯係管理員', -2);
             }
         } else {
             $this->_utilMsg->showMsg('請選擇您要更新的菜單', -1);
         }
     }
 }
開發者ID:huangwei2wei,項目名稱:kfxt,代碼行數:19,代碼來源:Menu.class.php

示例15: actionChangeLang

 /**
  * 更改語言
  */
 public function actionChangeLang()
 {
     $langId = Tools::coerceInt($_GET['lang']);
     if (!in_array($langId, array(1, 2))) {
         $langId = 1;
     }
     setcookie('kefu_lang', $langId, CURRENT_TIME + 60 * 60 * 6);
     $this->_utilMsg->showMsg(false);
 }
開發者ID:huangwei2wei,項目名稱:kfxt,代碼行數:12,代碼來源:Index.class.php


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