本文整理汇总了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);
}
}
示例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);
}
示例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);
}
示例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();
}
示例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();
}
}
示例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;
}
}
示例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();
}
示例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);
}
}
示例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' => '更改状态失败'));
}
}
}
示例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__)));
}
}
}
示例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' => '更改分数失败'));
}
}
}
示例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 .= " →<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();
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}