本文整理汇总了PHP中CUtil::isParamsEmpty方法的典型用法代码示例。如果您正苦于以下问题:PHP CUtil::isParamsEmpty方法的具体用法?PHP CUtil::isParamsEmpty怎么用?PHP CUtil::isParamsEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUtil
的用法示例。
在下文中一共展示了CUtil::isParamsEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionStart
//.........这里部分代码省略.........
}
$arySyncData['data'] = urlencode(base64_encode(json_encode($arySyncData['data'])));
// sync data
$aryCallBack = UtilApi::callSyncData($arySyncData);
if ($aryCallBack['ISOK'] !== 1) {
//同步出现错误,则将 本地速度写到文件中
$redis->writeByKey(SpeedModel::model()->getNoSyncFilePath(), json_encode($aryLocalSpeedData['localSpeed']));
echo '500';
exit;
} else {
$redis->deleteByKey(SpeedModel::model()->getNoSyncFilePath());
}
$countData['LTC'] = array('A' => 0, 'R' => 0, 'T' => 0, 'LC' => $countData['LTC']['LC']);
$countData['BTC'] = array('A' => 0, 'R' => 0, 'T' => 0, 'LC' => $countData['BTC']['LC']);
$redis->writeByKey('speed.count.log', json_encode($countData));
$syncData = $aryCallBack['DATA']['sync'];
if (empty($syncData)) {
echo '500';
exit;
}
$boolIsRestart = false;
$syncData = json_decode(base64_decode(urldecode($syncData)), 1);
if (!empty($syncData['runmodel'])) {
RunModel::model()->storeRunMode($syncData['runmodel']);
$boolIsRestart = true;
}
//判断是否要修改本地密码
if (!empty($syncData['password_machine'])) {
//修改用户密码
if (LoginModel::model()->updatePwd($syncData['password_machine']) === false) {
echo '500';
exit;
}
}
if (!empty($syncData['upgrade'])) {
$strVersion = $syncData['upgrade'];
if (!empty($strVersion)) {
// store upgrade status to running
$redis->writeByKey('upgrade.run.status', json_encode(array('status' => 1, 'time' => time())));
$boolIsRestart = true;
$indexController->actionShutdown(true);
// execute upgrade
$command = SUDO_COMMAND . "cd " . WEB_ROOT . ";" . SUDO_COMMAND . "wget " . MAIN_DOMAIN . "/down/v{$strVersion}.zip;" . SUDO_COMMAND . "unzip -o v{$strVersion}.zip;" . SUDO_COMMAND . "rm -rf v{$strVersion}.zip;";
exec($command);
// check upgrade file
RunModel::model()->checkUpgrade();
// store upgrade status to stop
$redis->writeByKey('upgrade.run.status', json_encode(array('status' => 0, 'time' => time())));
}
}
if (!empty($syncData['config'])) {
$boolIsRestart = true;
$aryConfig = json_decode($syncData['config'], 1);
$aryBTCData = $indexController->getTarConfig('btc');
$aryBTCData['ad'] = $aryConfig['address_btc'];
$aryBTCData['ac'] = $aryConfig['account_btc'];
$aryBTCData['pw'] = $aryConfig['password_btc'];
if (!empty($aryConfig['speed_btc'])) {
$aryBTCData['speed'] = $aryConfig['speed_btc'];
}
//$aryBTCData['su'] = isset( $aryConfig['super_btc'] ) ? $aryConfig['super_btc'] : 1;
$aryLTCData = $indexController->getTarConfig('ltc');
$aryLTCData['ad'] = $aryConfig['address_ltc'];
$aryLTCData['ac'] = $aryConfig['account_ltc'];
$aryLTCData['pw'] = $aryConfig['password_ltc'];
if (!empty($aryConfig['speed_ltc'])) {
$aryLTCData['speed'] = $aryConfig['speed_ltc'];
}
//$aryLTCData['su'] = isset( $aryConfig['super_ltc'] ) ? $aryConfig['super_ltc'] : 1;
// if params empty
if (in_array($strRunMode, array('L', 'LB'))) {
$boolCheck = CUtil::isParamsEmpty($aryLTCData);
} else {
if (in_array($strRunMode, array('B', 'LB'))) {
$boolCheck = CUtil::isParamsEmpty($aryBTCData);
}
}
if ($boolCheck === true) {
// store data
$redis->writeByKey('btc.setting', json_encode($aryBTCData));
$redis->writeByKey('ltc.setting', json_encode($aryLTCData));
// restore statistical
$countData['last'] = time();
$countData['noar'] = 0;
$redis->writeByKey('speed.count.log', json_encode($countData));
}
}
if (!empty($syncData['restart']) && $syncData['restart'] === 1) {
$indexController->actionRestart();
} else {
if ($boolIsRestart === true) {
$indexController->actionRestart();
}
}
if (!empty($syncData['reboot']) && $syncData['reboot'] === 1) {
$indexController->actionReboot();
}
echo '200';
exit;
}
示例2: actionIndex
/**
* Index method
*/
public function actionIndex()
{
//检查是否登入
Nbt::app()->login->checkIsLogin();
try {
$this->replaceSeoTitle(CUtil::i18n('controllers,index_index_seoTitle'));
// open redis
$redis = $this->getRedis();
// 是否获取指定类型运算频率
$intFreq = null;
if (SYS_INFO === 'SF3301_D_V1') {
$intFreq = array(0, 1);
}
// 可调速度集合
$aryBTCSpeed = CUtilMachine::getSpeedList(SYS_INFO, is_null($intFreq) ? null : $intFreq[0]);
$aryLTCSpeed = CUtilMachine::getSpeedList(SYS_INFO, is_null($intFreq) ? null : $intFreq[1]);
// get default speed
$intDefaultBTCSpeed = self::getDefaultSpeed(is_null($intFreq) ? null : $intFreq[0]);
$intDefaultLTCSpeed = self::getDefaultSpeed(is_null($intFreq) ? null : $intFreq[1]);
// Tip data
$aryTipData = array();
$aryBTCData = array();
$aryLTCData = array();
$btcVal = $redis->readByKey('btc.setting');
$ltcVal = $redis->readByKey('ltc.setting');
$aryBTCData = empty($btcVal) ? array() : json_decode($btcVal, true);
if (empty($aryBTCData['speed'])) {
$aryBTCData['speed'] = $intDefaultBTCSpeed;
}
$aryLTCData = empty($ltcVal) ? array() : json_decode($ltcVal, true);
if (empty($aryLTCData['speed'])) {
$aryLTCData['speed'] = $intDefaultLTCSpeed;
}
// get run model
$strRunMode = $this->getRunMode();
// if commit save
if (Nbt::app()->request->isPostRequest) {
$strBTCAddress = isset($_POST['address_btc']) ? htmlspecialchars($_POST['address_btc']) : '';
$strBTCAccount = isset($_POST['account_btc']) ? htmlspecialchars($_POST['account_btc']) : '';
$strBTCPassword = isset($_POST['password_btc']) ? htmlspecialchars($_POST['password_btc']) : '';
$intBTCSpeed = isset($_POST['run_speed_btc']) ? intval($_POST['run_speed_btc']) : $intDefaultBTCSpeed;
$strLTCAddress = isset($_POST['address_ltc']) ? htmlspecialchars($_POST['address_ltc']) : '';
$strLTCAccount = isset($_POST['account_ltc']) ? htmlspecialchars($_POST['account_ltc']) : '';
$strLTCPassword = isset($_POST['password_ltc']) ? htmlspecialchars($_POST['password_ltc']) : '';
$intLTCSpeed = isset($_POST['run_speed_ltc']) ? intval($_POST['run_speed_ltc']) : $intDefaultLTCSpeed;
$strGetRunMode = isset($_POST['runmodel']) ? htmlspecialchars($_POST['runmodel']) : '';
if (!empty($strGetRunMode) && in_array($strGetRunMode, array('L', 'LB'))) {
RunModel::model()->storeRunMode($strGetRunMode);
$strRunMode = $strGetRunMode;
}
$aryBTCData['ad'] = $strBTCAddress;
$aryBTCData['ac'] = $strBTCAccount;
$aryBTCData['pw'] = $strBTCPassword;
$aryBTCData['speed'] = $intBTCSpeed;
//$aryBTCData['su'] = isset( $aryBTCData['su'] ) ? $aryBTCData['su'] : 1;
$aryLTCData['ad'] = $strLTCAddress;
$aryLTCData['ac'] = $strLTCAccount;
$aryLTCData['pw'] = $strLTCPassword;
$aryLTCData['speed'] = $intLTCSpeed;
//$aryLTCData['su'] = isset( $aryLTCData['su'] ) ? $aryLTCData['su'] : 1;
if (in_array($strRunMode, array('L'))) {
$boolCheck = CUtil::isParamsEmpty($aryLTCData);
if ($boolCheck === false) {
throw new CModelException(CUtil::i18n('exception,scrypt_setting_haveNullData'));
}
} else {
if (in_array($strRunMode, array('B'))) {
$boolCheck = CUtil::isParamsEmpty($aryBTCData);
if ($boolCheck === false) {
throw new CModelException(CUtil::i18n('exception,sha_setting_haveNullData'));
}
}
}
// store data
$redis->writeByKey('btc.setting', json_encode($aryBTCData));
$redis->writeByKey('ltc.setting', json_encode($aryLTCData));
$redis->saveData();
$aryTipData['status'] = 'success';
$aryTipData['text'] = CUtil::i18n('controllers,index_saveData_success');
}
} catch (Exception $e) {
$aryTipData['status'] = 'error';
$aryTipData['text'] = $e->getMessage();
}
$aryData = array();
$aryData['tip'] = $aryTipData;
$aryData['btc'] = $aryBTCData;
$aryData['ltc'] = $aryLTCData;
$aryData['runmodel'] = $strRunMode;
$aryData['speedDefBTC'] = $intDefaultBTCSpeed;
$aryData['speedDefLTC'] = $intDefaultLTCSpeed;
$aryData['speedBTC'] = $aryBTCData['speed'];
$aryData['speedLTC'] = $aryLTCData['speed'];
$aryData['aryBTCSpeed'] = $aryBTCSpeed;
$aryData['aryLTCSpeed'] = $aryLTCSpeed;
$this->render('index', $aryData);
}