本文整理匯總了PHP中core\Config::item方法的典型用法代碼示例。如果您正苦於以下問題:PHP Config::item方法的具體用法?PHP Config::item怎麽用?PHP Config::item使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類core\Config
的用法示例。
在下文中一共展示了Config::item方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: checkFromTld
/**
* 從tld判斷域名
*/
public function checkFromTld($domain)
{
$tld = (array) \Core\Config::item('tld');
$provinceTld = (array) \Core\Config::item('provinceTld');
$suffix = \common\Common::getDomainAllTld($domain);
return in_array($suffix, $tld) || in_array($suffix, $provinceTld) ? array('flag' => 1) : array('flag' => 0);
}
示例2: downAction
/**
* 從new_tao表中找出狀態為15的交易,請求dc接口解鎖域名,解鎖成功後,將該記錄複製到new_trans_history表,同時從new_tao表刪除該記錄
*
*
*
*/
public function downAction()
{
$taoModel = new NewTaoModel();
$taoData = $taoModel->getDataByStatus(15);
if (!empty($taoData)) {
$dLogic = new DomainLogic();
foreach ($taoData as $v) {
$data[$v->t_id] = (array) $v;
$res = $dLogic->setDomainStatus(\core\Config::item('doPubSta')->toArray()['down'], 1);
if ($res !== true) {
unset($data[$v->t_id]);
echo "解鎖new_tao狀態為15的域名id{$v->t_id}失敗,解鎖時間:" . date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . "\n";
}
}
if (!empty($data)) {
$data = array_values($data);
$TransLogic = new TransLogic();
//將信息更新到曆史表中,並在new_tao中刪除
foreach ($data as $v) {
$copyRes = $TransLogic->copyToHistory($v, $v['t_status']);
$delRes = $TransLogic->delByTid($v['t_id']);
if (!$copyRes) {
echo "域名id{$v['t_id']}解鎖成功,但在插入new_trans_history時發生錯誤.時間:" . date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . "\n";
}
if (!$delRes) {
echo "域名id{$v['t_id']}解鎖成功,但在從new_tao刪除該條記錄時發生錯誤.時間:" . date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . "\n";
}
}
}
}
}
示例3: checkAcuctionStatusAction
/**
* 定時處理競價結束的數據處理
*
*
*/
public function checkAcuctionStatusAction()
{
// step1 取出已過交易結束時間,類型為競價的並且有買家id的交易記錄
$taoModel = new NewTaoModel();
$taoData = $taoModel->getExpiredByType(\core\Config::item('isInquiry')->toArray()[1], time());
// step2 將step1的記錄修改狀態為等待買賣雙方確認的狀態,存到new_trans_result表,並更新用戶關注表
$historyModel = new NewTransHistoryModel();
$transLogic = new TransLogic();
if (!empty($taoData)) {
foreach ($taoData as $data) {
$data = get_object_vars($data);
$data['t_status'] = 2;
//存表
if ($historyModel->setTransHistory($data)) {
//更新用戶關注表
if ($transLogic->updateWatchInfo($data['t_id'], $data['t_now_price'], $data['t_nickname'], $endTime = $data['t_end_time'])) {
// step3 刪除new_tao裏麵該條交易記錄
if ($taoModel->delByTid($data['t_id'])) {
echo 'tid 為' . $data['t_id'] . '操作成功';
} else {
echo 'tid 為' . $data['t_id'] . '刪除net_tao原表數據失敗';
}
} else {
echo 'tid 為' . $data['t_id'] . '更新用戶關注表失敗';
}
} else {
echo 'tid 為' . $data['t_id'] . '複製到history 失敗';
}
}
}
}
示例4: delFromTaoAction
/**
* 定時從new_tao表刪除指定狀態的數據
* 指定狀態為:交易成功,等待賣家確認,管理員取消交易
*
*
*
*/
public function delFromTaoAction()
{
$status = \core\Config::item('transStaCode');
$status = array($status->tranSuc, $status->buyHasCon, $status->adminCanceled);
$newTaoModel = new NewTaoModel();
$res = $newTaoModel->delDataByStatus($status);
echo "刪除{$res}條記錄" . PHP_EOL;
}
示例5: getInstance
/**
* 創建數據庫實例
*
* @return object 當前對象
*/
public static function getInstance($dbName = 'ename_trans')
{
if (isset(self::$instance[$dbName]) && self::$instance[$dbName] !== null) {
return self::$instance[$dbName];
}
$config = \core\Config::item($dbName);
new PdoMysql($config, $dbName);
return self::$instance[$dbName];
}
示例6: __construct
private function __construct($config, $configName = 'default')
{
$redis = new \Redis();
$redisConfig = \core\Config::item('redis');
$timeOut = isset($redisConfig->timeout) ? intval($redisConfig->timeout) : 3;
if ($redis->connect($redisConfig->server, $redisConfig->port, $timeOut)) {
$redis->setOption(\Redis::OPT_SERIALIZER, \Redis::SERIALIZER_PHP);
self::$conn[$configName] = $redis;
} else {
throw new \Exception("redis is down");
}
}
示例7: __construct
/**
* 構造函數創建SCOKET連接
*/
public function __construct()
{
$this->config = \core\Config::item('goServer');
$this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (!is_resource($this->socket)) {
throw new \Exception('Unable to create socket: ' . socket_strerror(socket_last_error()) . PHP_EOL);
return;
}
if (!socket_set_option($this->socket, SOL_SOCKET, SO_REUSEADDR, 1) || !socket_set_option($this->socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => $this->config->timeout, 'usec' => 0)) || !socket_set_option($this->socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => $this->config->timeout, 'usec' => 0))) {
throw new \Exception('Unable to set socket option: ' . socket_strerror(socket_last_error()) . PHP_EOL);
return;
}
if (!socket_connect($this->socket, $this->config->server, $this->config->port)) {
throw new \Exception('Unable to connect go server: ' . socket_strerror(socket_last_error()) . PHP_EOL);
return;
}
}
示例8: deleteDataAction
public function deleteDataAction()
{
$esFile = ROOT_PATH . './app/tasks/es.id';
$startId = @file_get_contents($esFile);
$limit = 200;
$newTaoModel = new \NewTaoModel();
$list = $newTaoModel->getListForDeleteEs($startId, $limit);
$es = \core\Config::item('elasticSearch');
$client = \Elasticsearch\ClientBuilder::create()->setHosts(array($es['server']))->build();
echo 'start:' . time() . "\n";
foreach ($list as $v) {
$params = ['index' => $es['index'], 'type' => $es['type'], 'id' => $v->t_id];
$response = $client->delete($params);
$startId = $v->t_last_time;
}
file_put_contents($esFile, $startId);
echo 'end:' . time() . "\n";
}
示例9: fixedBuy
/**
* [fixedBuy description]
* @param int $uId 買家id
* @param bool $isUseNickName 買家是否選擇使用昵稱
* @param array $transIds 交易id
* @param string $buyerIp 買家ip
* @return array('accessTrans' => $accessTrans, 'denyTrans' => $denyTrans);
*/
public function fixedBuy($uId, $transIds, $isUseNickName = false, $buyerIp = '')
{
try {
$goServ = new \core\driver\GoServer();
$config = \core\Config::item('fixedBuy');
// 以下步驟使用goServer並行處理
//
// step 調用logic方法,一次判斷下麵step1,step2,step3返回結果
// step1 獲取該交易id的信息,不存在則該交易結束
// step2 判斷交易裏買家和賣家是否同一個
// step3 判斷交易裏的當前價格和提交上來的價格是否一致
$accessTrans = $denyTrans = array();
foreach ($transIds as $transId => $curId) {
$goServ->call($transId, 'TransLogic::checkTransInfo', array($transId, $uId, $curId));
}
$res = $goServ->send();
foreach ($res as $transId => $value) {
$rs = $value['TransLogic::checkTransInfo'];
if (isset($rs['goError']) || !$rs['flag']) {
$denyTrans[$transId] = isset($rs['goError']) ? $config->systemError : $rs['msg'];
} else {
$accessTrans[$transId] = $rs['msg'];
}
}
if (empty($accessTrans)) {
return array('accessTrans' => $accessTrans, 'denyTrans' => $denyTrans);
}
// step4 創建凍結訂單
foreach ($accessTrans as $transId => $info) {
$goServ->call($transId, 'TransLogic::freezeMoney', array($info['t_dn'], $uId, $info['t_now_price']));
}
$res = $goServ->send();
foreach ($res as $transId => $value) {
$rs = $value['TransLogic::freezeMoney'];
if (isset($rs['goError']) || !$rs) {
$denyTrans[$transId] = isset($rs['goError']) ? $config->systemError : $config->invalidBalance;
unset($accessTrans[$transId]);
} else {
// 凍結成功,記錄財務訂單id
$info['financeId'] = $rs;
$accessTrans[$transId] = $info;
}
}
if (empty($accessTrans)) {
return array('accessTrans' => $accessTrans, 'denyTrans' => $denyTrans);
}
// step5 根據交易裏的我司和非我司標誌更新交易記錄狀態,我司域名狀態直接更新為14,非我司更新為等待賣家確認
// 同時非我司的交易記錄要更新買家違約時間和賣家違約時間
// 若step5失敗,則發起解凍step4裏麵的凍結訂單
$buyerIp = $buyerIp ?: \common\Client::getIp();
foreach ($accessTrans as $transId => $info) {
$buyerNick = $isUseNickName ? \common\common::getNickname($uId, $transId) : false;
$goServ->call($transId, 'TransLogic::updateTransInfo', array($transId, $info['t_type'], $info['t_is_our'], $uId, $buyerNick, $buyerIp, $info['financeId']));
$accessTrans[$transId]['buyerNick'] = $buyerNick;
}
$res = $goServ->send();
foreach ($res as $transId => $value) {
$rs = $value['TransLogic::updateTransInfo'];
$info = $accessTrans[$transId];
if (isset($rs['goError']) || !$rs) {
// 更新信息失敗,解凍訂單
$goServ->call($transId, 'TransLogic::unfreezeMoney', array($info['t_enameId'], $info['financeId']));
$denyTrans[$transId] = isset($rs['goError']) ? $config->systemError : $config->updateFailed;
unset($accessTrans[$transId]);
} else {
// step6 我司域名 使用go 異步並行處理下麵多個流程
// 調用logic裏麵的asyncDeal處理下麵步驟
// 1、調用接口解鎖和Push域名
// 2、調用接口確認凍結財務訂單
// 3、將該交易記錄插入到new_trans_history表
// 4、寫入待評價表
// 5、更新其他用戶關注表的交易結束時間,買家信息
// 6、發送通知買家郵件和站內信
// 7、根據賣家設置,通知賣家
//
// step6: 非我司域名 使用go異步並行處理下麵多個流程
// 調用logic裏麵的asyncDeal處理下麵步驟
// 1、發送通知郵件、發送站內信、短信通知賣家
// 4、複製該交易id的記錄到new_trans_result表
$goServ->call($transId, 'TransLogic::asyncDeal', array($info));
}
}
$goServ->asyncSend();
return array('accessTrans' => array_keys($accessTrans), 'denyTrans' => $denyTrans);
} catch (\Exception $e) {
\core\Logger::write('FixedbuyController.log', array('出現異常', $e->getMessage(), $e->getFile(), $e->getLine()));
return false;
}
}
示例10: noticeSellerIsOk
/**
* 根據賣家設置通知賣家,首先要調用dc接口獲取賣家設置然後調用通知接口
*
*@param $enameid 賣家id
*/
public function noticeSellerIsOk($enameid, $domain, $price, $transId)
{
$sms = (new \common\Users())->noticeSellerIsOk($enameid, \core\Config::item('noticeCode')->toArray()[0]);
//通知是否有拋異常
return (new \common\Message())->sendBuyNowSeller($enameId, $domain, $price, $transId, $sms);
/*
* 是否需要記錄日誌
*if($rs['msg']['result'] !== true)
*{
* \core\Logger::write("DOMAIN_LOG",
* array(__METHOD__,'域名 ' . $domain . ' 設置狀態為 ' . $status . ' 失敗,msg信息為:' . $rs['msg']['msg']));
*}
*/
}
示例11: fixedPrice
/**
* 交易發布
*
* @param s $uId
* int
* @param s $domains
* array 包含我司和非我司域名的二維數組,一個域名包含價格和簡介以及出售周期
* @param s $cashType
* int 提現類型,在控製器檢查,2 不可提現 3 可體現
* @param s $type
* 發布類型
* @param s $ip
* 用戶ip
*/
public function fixedPrice($uId, $domains, $cashType, $type, $ip)
{
try {
$redis = core\driver\Redis::getInstance('default');
$domains = array_merge($domains['domainEname'], $domains['domainNoEname']);
$succDomains = $failDomains = $verifyDomains = array();
// step1:檢測域名後綴
$res = $this->checkDomainTld(array_keys($domains));
$succDomains = $res[0];
$failDomains = array_merge($failDomains, $res[1], $res[2]);
if (empty($succDomains)) {
return array('flag' => TRUE, 'msg' => array('succ' => array(), 'fail' => $failDomains));
}
if (in_array($type, array(\core\Config::item('transType')->zhuantipaimai, \core\Config::item('transType')->yipaiyimai))) {
//專題拍賣和易賣易賣是否需要審核
foreach ($succDomains as $v) {
$this->goSer->call($v, 'DomainLogic::checkOtherTrans', array($v, $type));
}
$res = $this->goSer->send();
$succDomains = array();
foreach ($res as $k => $v) {
$v = $v['DomainLogic::checkOtherTrans'];
if (isset($v['goError'])) {
$failDomains[$k] = '係統繁忙,請重試';
} else {
if ($v === 1) {
$succDomains[] = $k;
} elseif ($v === 3) {
$verifyDomains[$k] = 1;
} else {
$failDomains[$k] = '不符合專題拍賣條件';
}
}
}
if (empty($succDomains)) {
return array('flag' => TRUE, 'msg' => array('succ' => array(), 'fail' => $failDomains));
}
if (in_array($type, array(4, 5))) {
//專題拍賣和易賣易賣是否需要審核
foreach ($succDomains as $v) {
$this->goSer->call($v, 'DomainLogic::checkOtherTrans', array($v, $type));
}
$res = $this->goSer->send();
$succDomains = array();
foreach ($res as $k => $v) {
$v = $v['DomainLogic::checkOtherTrans'];
if (isset($v['goError'])) {
$failDomains[$k] = '係統繁忙,請重試';
} else {
if ($v === 1) {
$succDomains[] = $k;
} elseif ($v === 3) {
$verifyDomains[$k] = 1;
} else {
$failDomains[$k] = '不符合專題拍賣條件';
}
}
}
if (empty($succDomains)) {
return array('flag' => TRUE, 'msg' => array('succ' => array(), 'fail' => $failDomains));
}
//專題是否存在
foreach ($succDomains as $v) {
$this->goSer->call($v, 'DomainLogic::checkTopId', array($domains[$v]['topic']));
}
$res = $this->goSer->send();
$succDomains = array();
foreach ($res as $k => $v) {
$v = $v['DomainLogic::checkTopId'];
if (isset($v['goError'])) {
$failDomains[$k] = '係統繁忙,請重試';
} else {
if ($v === true) {
$succDomains[] = $k;
} else {
$failDomains[$k] = '專題不存在';
}
}
}
if (empty($succDomains)) {
return array('flag' => TRUE, 'msg' => array('succ' => array(), 'fail' => $failDomains));
}
}
}
// step2:檢測域名簡介是否包含關鍵詞
// 檢測出售天數,價格
//.........這裏部分代碼省略.........
示例12: index
/**
* 淘域名查詢數據 如果前台用戶沒有提交這個參數,全部傳0 或者 false
*
* @param array $dn array(1域名|2簡介OR域名,搜索的內容,開頭,結尾)
* @param int $type 交易類型 1:一口價 2:競價 3:競價(預訂競價) 4:競價(專題拍賣) 5:競價(易拍易賣)
* 6:一口價(sedo) 8:拍賣會
* @param array $page array(開始頁,每頁多少條)
* @param int $sort 排序參數 1:剩餘時間 2:當前價格 3:出價次數
* @param int $registrar 注冊商 1:我司 2:非我司
* @param array $price array(開始價格,結束價格)
* @param array $bidding array(競價是否有人出價,競價1元起拍)
* @param array $exclude 必須是2維數組 array(array(內容,開頭,結尾),array(內容,開頭,結尾))
* @param array $class 分類 array(二級分類,三級分類)
* @param array $tld array(後綴1,後綴2)
* @param array $endTime array(起始時間,結束時間) 起始時間可以是0 直接傳結束時間的unix_time
* @param array $len array(開始長度,結束長度)
* @return false:查詢失敗 || array('total','data') total:文檔數量,data:二維數組
*/
public function index($data)
{
$dn = $type = $page = $sort = $registrar = $price = $bidding = $exclude = $class = $tld = $endTime = $len = null;
extract($data);
$es = \core\Config::item('elasticSearch');
$client = \Elasticsearch\ClientBuilder::create()->setHosts(array($es['server']))->build();
$must = $notMust = $should = array();
$from = 0;
$size = 10;
$dn1 = isset($dn[1]) ? $dn[1] : false;
if (is_array($dn) && $dn1) {
$dn2 = isset($dn[2]) ? $dn[2] : false;
$dn3 = isset($dn[3]) ? $dn[3] : false;
if ($dn[1] && $dn[2]) {
// 隻搜索域名
$should[] = array("query_string" => array("query" => "t_body:{$dn[1]}*{$dn[1]}"));
} elseif ($dn[1]) {
$should[] = array("query_string" => array("query" => "t_body:{$dn[1]}*"));
} elseif ($dn[2]) {
$should[] = array("query_string" => array("query" => "t_body:*{$dn[1]}"));
} else {
$should[] = array("query_string" => array("query" => "t_body:*{$dn[1]}*"));
}
if (1 == $dn[0]) {
if ($dn[2] && $dn[3]) {
// 搜索域名OR簡介
$should[] = array("query_string" => array("query" => "t_desc:{$dn[1]}*{$dn[1]}"));
} elseif ($dn[2]) {
$should[] = array("query_string" => array("query" => "t_desc:{$dn[1]}*"));
} elseif ($dn[3]) {
$should[] = array("query_string" => array("query" => "t_desc:*{$dn[1]}"));
} else {
$should[] = array("query_string" => array("query" => "t_desc:*{$dn[1]}*"));
}
}
}
if ($type) {
if (2 == $type) {
$must[] = array("terms" => array("t_type" => array(2, 3, 4, 5, 8)));
//競價
} else {
$must[] = array("term" => array("t_type" => $type));
}
}
if ($registrar) {
$must[] = array("term" => array("t_is_our" => $registrar));
}
if (is_array($price) && ($price[0] || $price[1])) {
$range = array();
intval($price[0]) > 0 ? $range['gte'] = intval($price[0]) : '';
intval($price[1]) > 0 ? $range['lte'] = intval($price[1]) : '';
$must[] = array("range" => array("t_now_price" => $range));
}
if (is_array($bidding) && 2 == $type && ($bidding[0] || $bidding[1])) {
if ($bidding[0]) {
$must[] = array("range" => array("t_buyer" => array("gt" => 0)));
}
if ($bidding[1]) {
$must[] = array("term" => array("t_start_price" => 1));
}
}
if (is_array($exclude)) {
foreach ($exclude as $v) {
list($c, $s, $e) = $v;
if ($c) {
if ($s) {
$notMust[] = array('query_string' => array("query" => "t_body:{$c}*"));
}
if ($e) {
$notMust[] = array('query_string' => array("query" => "t_body:*{$c}"));
}
if (!$s && !$e) {
$notMust[] = array('query_string' => array("query" => "t_body:*{$c}*"));
}
}
}
}
if (is_array($class) && (isset($class[0]) || isset($class[1]))) {
if (isset($class[0]) && $class[0]) {
if (10 == $class[0]) {
$must[] = array("terms" => array("t_two_class" => array(10, 12)));
} elseif (2 == $class[0]) {
//.........這裏部分代碼省略.........
示例13: getTldType
/**
* 獲取域名後綴類型
* @param string $domain
*/
public static function getTldType($domain)
{
$tld = self::getDomainAllTld($domain);
return in_array($tld, (array) \Core\Config::item('provinceTld')) ? 6 : array_search($tld, (array) \Core\Config::item('tld'));
}
示例14: getDomainLowestPrice
public function getDomainLowestPrice($domain, $price)
{
//(class,two,three,長度,域名主體)
list($class, $two, $three, $domainLen, $domainMain) = \common\domain\Domain::getDomainClass($domain);
// 獲取一口價最低價提示配置
$buynowLowest = \core\Config::item('buynow_lowest')->toArray();
// 獲取域名主體$domainMain 以及 域名後綴 $domainTld
$domainTld = \common\Common::getDomainAllTld($domain);
// 獲取域名所屬類型
$domainType = $this->getDomainType($class, $domainMain, $domainTld, $domainLen);
if (!$domainType) {
return false;
}
// 獲取返回該域名最低價。未匹配到返回false
if (isset($buynowLowest[$domainTld][$domainLen][$domainType])) {
$price = $buynowLowest[$domainTld][$domainLen][$domainType];
return $price * 10000;
}
return false;
}
示例15: ini_set
<?php
use Phalcon\DI, Phalcon\DI\FactoryDefault;
ini_set('display_errors', 1);
error_reporting(E_ALL);
define('TEST_ROOT_PATH', __DIR__);
define('ROOT_PATH', dirname(__DIR__));
define('LIBRARY_PATH', ROOT_PATH . '/app/library/');
define('MODELS_PATH', ROOT_PATH . '/app/models/');
define('LOGIC_PATH', ROOT_PATH . '/app/logic/');
define('DEBUG', TRUE);
set_include_path(TEST_ROOT_PATH . PATH_SEPARATOR . get_include_path());
// required for phalcon/incubator
// include __DIR__ . "/vendor/autoload.php";
// use the application autoloader to autoload the classes
// autoload the dependencies found in composer
$loader = new \Phalcon\Loader();
$loader->registerDirs(array(TEST_ROOT_PATH, MODELS_PATH, LIBRARY_PATH, LOGIC_PATH));
$loader->registerNamespaces(array('Phalcon' => TEST_ROOT_PATH . '/incubator-1.2.4/Library/Phalcon'));
$loader->register();
$di = new FactoryDefault();
DI::reset();
// 配置初始化
\core\Config::init(DEBUG);
//\core\Config::setConfig(TEST_ROOT_PATH.'/debug.ini');
// add any needed services to the DI here
DI::setDefault($di);
$db = \core\Config::item('master_trans');