Inheritance: extends PL_Config_Db
Example #1
0
 public function upToDate()
 {
     $f3 = \Base::instance();
     if (!$this->tableExists('options')) {
         return false;
     } else {
         $dbConf = new DbConfig();
         $lastDbVersion = $this->lastDatabaseVersion();
         if ($dbConf->isOpt('dbVersion') && $dbConf->getOpt('dbVersion') == $lastDbVersion) {
             return true;
         }
         return false;
     }
 }
Example #2
0
 /**
  * @description connect the database
  * @param null
  * @return an object of the PDO
  */
 public function connect()
 {
     $config = new DbConfig();
     try {
         $pdo = new PDO($config->getDBNameHost(), $config->getDBUsr(), $config->getDBPwd());
         // set attributes of the PDO
         $pdo->setAttribute(PDO::ATTR_AUTOCOMMIT, false);
         $pdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
         $pdo->query("set names utf8");
         echo date("Y-m-d h:i:s") . " :connect to database successfully...<br>";
         return $pdo;
     } catch (PDOException $e) {
         echo date("Y-m-d h:i:s") . " :Could not connect to the database:<br>.{$e}";
     }
 }
Example #3
0
 static function getGupiaoDay($zqdm, $date)
 {
     $id = $zqdm . "_{$date}";
     $mc = DbConfig::getMongodb('dayklineinfo');
     if ($ret = $mc->findOne(array('_id' => $id))) {
         return $ret;
     }
     $pre = App::zqdmPre($zqdm);
     if (!$pre) {
         echo $error = "{$zqdm} no  marcket pre get\n";
         return $ret;
     }
     //
     $todate = date('Ymd');
     $kline = static::getDayK($pre . $zqdm, $date, $todate);
     $ret = array();
     if ($kline) {
         foreach ($kline as $info) {
             $day = date('Ymd', strtotime($info['time']));
             $id = $zqdm . "_{$day}";
             $info['day'] = $day;
             $info['zqdm'] = $zqdm;
             if (!$ret) {
                 $ret = $info;
             }
             $mc->findAndModify(array('_id' => $id), array('$set' => $info), array(), array('upsert' => true));
         }
     }
     return $ret;
 }
Example #4
0
 public function setup()
 {
     $db = DbConfig::get_params();
     $entitiesPaths = [APPPATH . 'classes/model/doctrine'];
     $isDevMode = false;
     $config = Setup::createAnnotationMetadataConfiguration($entitiesPaths, $isDevMode);
     $dbParams = ['driver' => 'pdo_mysql', 'host' => $db['host'], 'dbname' => $db['dbname'], 'user' => $db['username'], 'password' => $db['password'], 'charset' => 'utf8'];
     $this->em = EntityManager::create($dbParams, $config);
 }
Example #5
0
 public function setup()
 {
     $db = DbConfig::get_params();
     $capsule = new Illuminate\Database\Capsule\Manager();
     $capsule->addConnection(['driver' => 'mysql', 'host' => $db['host'], 'database' => $db['dbname'], 'username' => $db['username'], 'password' => $db['password'], 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '']);
     $capsule->setEventDispatcher(new Illuminate\Events\Dispatcher(new Illuminate\Container\Container()));
     $capsule->setAsGlobal();
     $capsule->bootEloquent();
 }
Example #6
0
 protected static function initializeSQLiteDbTables($location)
 {
     $sqlite = new SQLite3($location);
     $tables_setup = DbConfig::getDbTablesSetup();
     foreach ($tables_setup as &$query) {
         $sqlite->exec($query);
     }
     unset($table);
 }
  function ConstantBasedDbConfig($name)
  {
    parent :: DbConfig($name);

    $this->driver = DB_DRIVER;
    $this->host = DB_HOST;
    $this->database = DB_NAME;
    $this->user = DB_USER;
    $this->password = DB_PASSWORD;
  }
Example #8
0
 public function setup()
 {
     define('YII_DEBUG', false);
     $basePath = dirname(dirname(dirname(dirname(__DIR__))));
     // go 4 up
     require $basePath . '/vendor/yiisoft/yii2/Yii.php';
     Yii::setAlias('@model', "{$basePath}/app/classes/model");
     $dbConfig = DbConfig::get_params();
     $db = new \yii\db\Connection(['dsn' => "mysql:host={$dbConfig['host']};dbname={$dbConfig['dbname']}", 'username' => $dbConfig['username'], 'password' => $dbConfig['password'], 'charset' => 'utf8']);
     Post::$db = $db;
     Comment::$db = $db;
 }
Example #9
0
 public function setup()
 {
     define('YII_DEBUG', false);
     $basePath = dirname(dirname(dirname(dirname(__DIR__))));
     // go 4 up
     require $basePath . '/vendor/yiisoft/yii/framework/yii.php';
     require_once "{$basePath}/app/classes/model/yii1/Comment.php";
     require_once "{$basePath}/app/classes/model/yii1/Post.php";
     $dbConfig = DbConfig::get_params();
     $db = new CDbConnection("mysql:host={$dbConfig['host']};dbname={$dbConfig['dbname']};charset=utf8", $dbConfig['username'], $dbConfig['password']);
     CActiveRecord::$db = $db;
 }
Example #10
0
 /**
  * Zwraca instancję obiektu Singleton
  *
  * @return Singleton
  * @access public
  * @static
  */
 public static function getInstance()
 {
     if (self::$oInstance == false) {
         $mysql_host = 'localhost';
         $port = '3306';
         $username = '******';
         $password = '******';
         $database = 'ii293327';
         self::$oInstance = new PDO('mysql:host=' . $mysql_host . ';dbname=' . $database . ';port=' . $port, $username, $password);
     }
     return self::$oInstance;
 }
  function IniBasedDbConfig($name)
  {
    parent :: DbConfig($name);

    $toolkit =& Limb :: toolkit();
    $ini =& $toolkit->getIni('common.ini');

    $this->driver = $ini->getOption('driver', 'DB');
    $this->host = $ini->getOption('host', 'DB');
    $this->database = $ini->getOption('database', 'DB');
    $this->user = $ini->getOption('user', 'DB');
    $this->password = $ini->getOption('password', 'DB');
  }
Example #12
0
 public function store()
 {
     $request = $this->request;
     $request->fill(Input::all());
     if ($request->save()) {
         Mail::send('emails.get_request', array('name' => $request->name, 'phone' => $request->phone, 'email' => $request->email, 'page' => $request->page, 'departament' => $request->departament, 'question' => $request->question), function ($message) {
             $message->from('*****@*****.**', 'Server Message');
             $message->to(DbConfig::get("app.admin.email_to_send_requests"), "Администратор")->subject('Пришла заявка на сайт АйПи Решения');
         });
         return Redirect::back()->with('success', \Lang::get('request/messages.create.success'));
     } else {
         return Redirect::back()->withInput()->withErrors($request->errors());
     }
 }
Example #13
0
 public function setup()
 {
     $db = DbConfig::get_params();
     $di = new Phalcon\DI();
     $di->set('modelsManager', function () {
         return new Phalcon\Mvc\Model\Manager();
     });
     $di->set('db', function () use($db) {
         return new Phalcon\Db\Adapter\Pdo\Mysql(['host' => $db['host'], 'username' => $db['username'], 'password' => $db['password'], 'dbname' => $db['dbname']]);
     });
     $di->set('modelsMetadata', function () {
         return new Phalcon\Mvc\Model\Metadata\Memory();
     });
 }
Example #14
0
 private static function initDB()
 {
     if (self::$db === NULL) {
         self::$db = new DbUtil(DbConfig::getHost(), DbConfig::getUserName(), DbConfig::getUserPwd(), DbConfig::getDbName());
         self::$login_time = time();
     } else {
         $cur = time();
         if ($cur - self::$login_time > 60) {
             self::$db->close();
             self::$db->init(DbConfig::getHost(), DbConfig::getUserName(), DbConfig::getUserPwd(), DbConfig::getDbName());
             self::$login_time = $cur;
         }
     }
     return TRUE;
 }
Example #15
0
 public function mysql()
 {
     $db = \DbConfig::get_params();
     $dbname = $db['dbname'];
     $scheme_sql = 'CREATE DATABASE IF NOT EXISTS `' . $dbname . '`;';
     $scheme_sql .= 'DROP TABLE IF EXISTS `comment`;';
     $scheme_sql .= 'DROP TABLE IF EXISTS `post`;';
     $scheme_sql .= file_get_contents(APPPATH . '../../schema/php_dev.sql');
     foreach (explode(';', $scheme_sql) as $sql) {
         if (preg_match('/^\\n$/u', $sql)) {
             continue;
         }
         $result = \DB::query($sql)->execute();
         if ($result) {
             \Cli::write(\Cli::color($sql, 'green'));
         } else {
             \Cli::error(\Cli::color($sql, 'red'));
         }
     }
 }
Example #16
0
 private function setAddressBookModel($recordId = null)
 {
     $db = DbConfig::getInstance();
     if ($recordId == null) {
         $query = $db->prepare("SELECT * FROM address_book ORDER BY name DESC");
         $query->execute();
         if ($results = $query->fetchAll()) {
             self::$data['contacts'] = $results;
         }
     } else {
         $query = $db->prepare("SELECT * FROM address_book WHERE id = ? LIMIT 1");
         $query->execute([$recordId]);
         $result = $query->fetch();
         self::$data['data']['name'] = $result['name'];
         self::$data['data']['id'] = $result['id'];
         self::$data['data']['surname'] = $result['surname'];
         self::$data['data']['phone'] = $result['phone'];
         self::$data['data']['address'] = $result['address'];
     }
 }
Example #17
0
 private function setHomeModel($page, $category)
 {
     $db = DbConfig::getInstance();
     if (!$page) {
         if (!$category) {
             $query = $db->prepare("SELECT * FROM posts ORDER BY date DESC LIMIT 10");
         } else {
             $query = $db->prepare("SELECT * FROM posts where categories_id = ? ORDER BY date DESC LIMIT 10");
         }
     } else {
         $start = ($page - 1) * 10;
         self::$data['activePage'] = $page;
         if (!$category) {
             $query = $db->prepare("SELECT * FROM posts ORDER BY date DESC  LIMIT {$start},10");
         } else {
             $query = $db->prepare("SELECT * FROM posts WHERE  categories_id = ? ORDER BY date DESC  LIMIT {$start},10");
         }
     }
     if ($category) {
         $query->execute([$category]);
     } else {
         $query->execute();
     }
     self::$data['articles'] = $query->fetchAll();
     foreach (self::$data['articles'] as &$article) {
         $article['text'] = $this->toBB($article['text']);
     }
     if (!$category) {
         $query = $db->prepare("SELECT COUNT(*) FROM posts");
         $query->execute();
     } else {
         $query = $db->prepare("SELECT COUNT(*) FROM posts where categories_id = ?");
         $query->execute([$category]);
     }
     $result = $query->fetch();
     self::$data['articlesCount'] = $result[0];
     self::$data['pages'] = ceil((int) $result[0] / 10);
 }
 /**
  * Init DB
  */
 public function __construct()
 {
     parent::__construct();
 }
<?php

require_once '../../_config/DbConfig.php';
$dbconfig = new DbConfig();
$financeConn = $dbconfig->ConnFinance();
session_start();
$username = $_POST['username'];
$password = $_POST['password'];
$sql = "SELECT * FROM FINANCE_USER WHERE FINANCE_USER_NAME = '{$username}' AND FINANCE_USER_PASS = '******'";
$s = oci_parse($financeConn, $sql);
oci_execute($s);
$r = oci_fetch_array($s, OCI_ASSOC);
if ($r) {
    echo "SUKSES";
    $_SESSION['user_finance'] = $username;
    $_SESSION['user_finance_role'] = $r['FINANCE_USER_ROLE'];
    $_SESSION['user_finance_id'] = $r['FINANCE_USER_ID'];
} else {
    echo "GAGAL";
}
Example #20
0
 public static function testConf($host, $port, $database, $user, $pass)
 {
     self::$_username = $user;
     self::$_password = $pass;
     self::$_database = $database;
     self::$_hostname = $host;
     self::$_port = $port;
     self::$_loadConfig = false;
     // prevent config from being loaded, used for testing database connection
     try {
         $db = new DbConfig();
     } catch (Exception $ex) {
         self::$_loadConfig = true;
         return $ex->getMessage();
     }
     self::$_loadConfig = true;
     return true;
 }
Example #21
0
 /**
  * Returns the appropriate database configuration
  * @return array
  */
 static function getConf()
 {
     if (($url = getenv("DATABASE_URL")) !== false) {
         // dokku / heroku
         $url = parse_url($url);
         self::$_username = $url['user'];
         self::$_password = $url['pass'];
         self::$_database = substr($url["path"], 1);
         self::$_hostname = $url['host'];
         self::$_port = $url["port"];
     } else {
         if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_SERVER['APP_ROOT'] . 'library/wpos/dbconfig.php')) {
             // config set
             require $_SERVER['DOCUMENT_ROOT'] . $_SERVER['APP_ROOT'] . 'library/wpos/dbconfig.php';
             self::$_username = $dbConfig['user'];
             self::$_password = $dbConfig['pass'];
             self::$_database = $dbConfig["database"];
             self::$_hostname = $dbConfig['host'];
             self::$_port = $dbConfig["port"];
         }
     }
     $conf = ["host" => self::$_hostname, "port" => self::$_port, "user" => self::$_username, "pass" => self::$_password, "db" => self::$_database];
     return $conf;
 }
Example #22
0
<?php

$cond = array();
$mon = new PL_Db_Mongo(DbConfig::getMongodb($coll));
$limit = $this->getParam('rows', 20);
$page = $this->getParam('page', 0);
//prcoess sort as string "0 dec,1"
$sort = array();
$sidx = $this->getParam('sidx');
$sord = $this->getParam('sord');
if ($sidx) {
    $sidx .= $sord;
    preg_match_all('/[\\s]*([\\w]+)[\\s]+([\\w]+)[\\s]*/', $sidx, $mout);
    foreach ((array) $mout[1] as $k => $v) {
        if ($mout[2][$k] == 'asc') {
            $sort[$v] = 1;
        } else {
            $sort[$v] = -1;
        }
    }
} else {
    if ($sord == 'desc') {
        $sort[0] = -1;
    } else {
        if ($sord == 'asc') {
            $sort[0] = 1;
        }
    }
}
//process query
//todo procecess all ops
Example #23
0
 /**
  * 检查参数签名
  */
 function authSig($request)
 {
     $method = $request['m'];
     $param = $request['p'];
     if ($param['signature']) {
         $signature = $param['signature'];
         unset($param['signature']);
         $keys = array_keys($param);
         sort($keys);
         $s = '';
         foreach ($keys as $key) {
             $value = $param[$key];
             if (is_string($value) || is_numeric($value) || is_bool($value)) {
                 $s .= '&' . $key . '=' . $value;
             }
         }
         $s = substr($s, 1) . $method . P_VERSION . '~@#1xdaf,dmuopamie%%123.';
         $mysig = md5($s);
         if ($mysig != $signature) {
             glog::info("签名不对[{$mysig}]!=[{$signature}], " . json_encode($request), 'sign');
             return array('s' => StatusCode::invalid_siginature, 'msg' => 'invalid signature');
         }
         $timestamp = $param['timestamp'];
         if ($method == 'System.login') {
             // 手机设备时间和服务器时间可能有差异,所以第一次请求 System.login 时不验证时间。
             return false;
         }
         // 1. 对 timestamp 做验证 与 服务器当前时间相差太多的 认为是不合法的请求
         $now = getApp()->now;
         if (abs($now - $timestamp) > 300) {
             $ts1 = date('Y-m-d H:i:s', $now);
             $ts2 = date('Y-m-d H:i:s', $timestamp);
             glog::info("请求时间异常 server[{$ts1}], client[{$ts2}], " . json_encode($request), 'sign');
             return false;
             return array('s' => StatusCode::invalid_request_time, 'msg' => 'invalid timestamp');
         }
         // 2. 记录用户上次调用这个接口的时间戳,如果新的 timestamp <= old_timestamp 则认为是不合法的请求
         $uid = getApp()->getuid();
         $section_id = getApp()->getsec();
         if ($uid && $section_id) {
             if (model_Util::inBlacklist($uid)) {
                 //黑名单访问,禁止
                 glog::info("黑名单中玩家[{$uid}]访问分区[{$section_id}] " . json_encode($request), 'blacklist');
                 return array('s' => StatusCode::invalid_request_time, 'msg' => "uid[{$uid}] is in blacklist");
             }
             try {
                 $redis = DbConfig::getRedis('cache');
                 $timestamp_key = "sig_{$section_id}_{$uid}_{$method}";
                 $old_timestamp = $redis->get($timestamp_key);
                 if (is_numeric($old_timestamp)) {
                     // 手机端网络超时后重试,后台可能会收到两次同样时间戳的请求 所以 $timestamp == $old_timestamp 还是很有可能的
                     if ($timestamp < $old_timestamp) {
                         $ts1 = date('Y-m-d H:i:s', $old_timestamp);
                         $ts2 = date('Y-m-d H:i:s', $timestamp);
                         glog::info("请求时间异常, 上次请求[{$ts1}], 本次请求[{$ts2}], " . json_encode($request), 'sign');
                         return false;
                         return array('s' => StatusCode::outdated_siginature, 'msg' => 'outdated signature', 'debug' => "old_timestamp: {$old_timestamp}");
                     } else {
                         $redis->multi();
                         $redis->set($timestamp_key, $timestamp);
                         $redis->expire($timestamp_key, 360);
                         $redis->exec();
                         return false;
                     }
                 } else {
                     $redis->multi();
                     $redis->set($timestamp_key, $timestamp);
                     $redis->expire($timestamp_key, 360);
                     $redis->exec();
                     return false;
                 }
             } catch (Exception $ex) {
                 error_log("无法连接 cache redis ");
                 return false;
             }
         }
         return false;
     }
     glog::info("没有签名," . json_encode($request), 'sign');
     return array('s' => StatusCode::invalid_siginature, 'msg' => 'no signature');
 }
Example #24
0
 function actionSendSystemMsg()
 {
     //$uid = (int)self::getParam('uid');
     $userstr = self::getParam('uid');
     $sec = self::getParam('sec');
     $content = self::getParam('content');
     $desc = self::getParam('desc');
     $items = self::getParam('items');
     $ready_id = self::getParam('ready_id');
     foreach ((array) $items as $value) {
         $tag = $value['tag'];
         $num = intval($value['num']);
         if ($tag == 'gem' && $num > 100000) {
             echo "error, 元宝不能大于100000";
             exit;
         }
     }
     $key = uniqid();
     $msg = array('key' => $key, 'time' => app()->now, 'content' => $content, 'type' => 'system');
     if ($userstr != "all") {
         $uids = explode(',', $userstr);
         $itemmsg = "";
         foreach ($uids as $uid) {
             $uid = getApp()->getRealUid($uid, $sec);
             $sec = getApp()->getRealSec($sec);
             $player = new model_Player($uid, $sec);
             $level = $player->objectGet("base", "level");
             foreach ((array) $items as $key => $value) {
                 $tag = $value['tag'];
                 $num = intval($value['num']);
                 if ($tag == 'qiyu_zhidian') {
                     $zhidian_lvl = max(1, $level * 3 - 34);
                     for ($i = 0; $i < $num; $i++) {
                         $items[] = array('tag' => 'qiyu_zhidian', 'level' => $zhidian_lvl, 'num' => 1);
                     }
                     unset($items[$key]);
                 }
             }
             if (is_array($items) && count($items) > 0) {
                 $msg['status'] = 'award';
                 #$msg['content'].="\n$desc";
                 $cdkey = model_Cdkey::gen($items, $desc, 1, 'def');
                 $msg['cdkey'] = $cdkey;
             }
             $r = model_Chat::sendMsg($msg, $uid, 'origin', $sec);
         }
     } else {
         $r = model_Chat::send($msg, 2, "", "toall", $sec);
     }
     if ($r) {
         $mon = new PL_Db_Mongo(DbConfig::getMongodb('userlogin'));
         $mon->switchColl('msgready');
         $mon = $mon->getmc();
         $id = $mon->update(array('ready_id' => (int) $ready_id), array('$set' => array('applicant_status' => 0, 'check_man' => $_SERVER['PHP_AUTH_USER'])));
         echo json_encode(array('s' => 'OK'));
     }
 }
Example #25
0
<?php

header("Content-Type: application/json", true);
require 'DbConfig.php';
$error = null;
$success = false;
$data = [];
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $db = DbConfig::getInstance();
    if ($_POST['action'] === 'search') {
        if (isset($_POST['text']) && strlen($_POST['text']) > 2) {
            $query = $db->prepare('SELECT * FROM address_book WHERE
                    name LIKE :keyword OR
                    surname LIKE :keyword OR
                    phone LIKE  :keyword OR
                    address LIKE :keyword');
            $query->bindValue(':keyword', '%' . $_POST['text'] . '%');
            $query->execute();
            $results = $query->fetchAll();
            if (!empty($results)) {
                $data = $results;
                $success = true;
            }
        }
    } else {
        if (isset($_POST['data'])) {
            $_data = $_POST['data'];
            $qMarks = str_repeat('?,', count($_data) - 1) . '?';
            array_walk($_data, function (&$value) {
                $value = (int) $value;
            });
Example #26
0
 }
 static function useDynamicMinify()
 {
     //return true;
     return DbConfig::getProperty(CONFIGURATION_PERFORMANCE, CONFIGURATION_PERFORMANCE_USE_DYNAMIC_MINIFY) == 1;
     // 1=YES
Example #27
0
<?php

include_once __DIR__ . '/../db/dbconfig.php';
$filter = isset($_POST['level_fail']);
if (!$filter) {
    exit("{status: 'fail'}");
}
$fails = split(",", $_POST['level_fail']);
if (count($fails) != 20) {
    exit("{status: 'fail'}");
}
foreach ($fails as $fail) {
    if (!is_numeric($fail)) {
        exit("{status: 'fail'}");
    }
}
session_start();
$db = DbConfig::getConnection();
$fails = $_POST['level_fail'];
$user = $_SESSION['user_id'];
$sql = "UPDATE hoc_user SET fail_count='{$fails}' WHERE id={$user} LIMIT 1;";
$db->query($sql);
$db->close();
echo "{status: 'ok'}";
session_write_close();
Example #28
0
 public function testGetData()
 {
     $object = new DbConfig($this->data);
     $this->assertSame($this->data, $object->getData());
 }
Example #29
0
 /**
  * actionCashierGetInfo
  * @author cq
  * @date 2014/07/01
  * @param
  *      id:uid或者pid
  * @return
  *      s
  *      info
  *          uid
  *          create_t
  *          pid
  *          istest
  *          sections
  *              s1
  *                  name
  *                  level
  *                  vip
  *                  gem
  *                  defaul
  *              s2
  *                  ...
  *      payment_config
  *          系统的payment_config
  */
 public function actionCashierGetInfo()
 {
     $now = getApp()->now;
     //$ip = getApp()->getClientIP();
     //验证消息来源是否合法
     $valid_ip_list = array('115.29.193.89', '115.29.225.243', '115.29.229.132', '115.29.229.113', '117.121.10.35');
     /*
     		if(!in_array($ip, $valid_ip_list)){
     		return array('s'=>StatusCode::invalid_ip);
     		}*/
     $id = $_POST['id'];
     if (empty($id)) {
         echo json_encode(array('s' => StatusCode::invalid_param));
         return;
     }
     $mon = new PL_Db_Mongo(DbConfig::getMongodb('userlogin'));
     $um = $mon->findOne(array('email' => $id));
     if (!$um) {
         $um = $mon->findOne(array('pid' => $id));
     }
     if (!$um) {
         echo json_encode(array('s' => StatusCode::invalid_param));
         return;
     }
     $ret = array();
     $ret['s'] = StatusCode::ok;
     //获取用户登录信息
     $ret['info'] = array();
     $ret['info']['uid'] = $um['_id'];
     //接口中需要添加pid by zhangjun
     $ret['info']['pid'] = $um['pid'];
     $ret['info']['create_t'] = $um['_ct'];
     $ret['info']['istest'] = 0;
     $ret['info']['istest'] = $um['istest'] ? 'istest' : 0;
     $ret['info']['istest'] = $um['isdev'] ? 'isdev' : $ret['info']['istest'];
     //获取用户各个分区信息
     $section_config = getApp()->getSectionConfig();
     $ret['info']['sections'] = array();
     if (isset($um['secs'])) {
         foreach ($um['secs'] as $sec => $last_t) {
             $um_mc = new model_Player($um['_id'], $sec);
             $um_data = $um_mc->getFields(array('name', 'level', 'vip', 'gem', '_it'));
             $um_data['vip'] = $um_data['vip']['lvl'];
             $um_data['default'] = $sec == $um['_ld']['sec'] ? 1 : 0;
             $um_data['section_name'] = $section_config[$sec]['name'];
             $ret['info']['sections'][$sec] = $um_data;
         }
     }
     //获取支付信息
     $ret['payment_config'] = getApp()->getPaymentConifg();
     //NULL, $um['source']);
     $ret['payment_unit'] = '元宝';
     $list = $ret['payment_config'];
     //添加自定义支付项
     $max_product_config = array('cash' => -1);
     foreach ($ret['payment_config'] as $index => $p_config) {
         //修改一下提示信息
         $trans_config = PL_Config_Numeric::get('translate', $p_config['desc']);
         $ret['payment_config'][$index]['desc'] = $trans_config['zh_CN'];
         if ($p_config['cash'] > $max_product_config['cash']) {
             $max_product_config = $p_config;
             $product_config_list[] = $p_config;
         }
     }
     $ret['payment_config'] = array();
     $max_product = 1000;
     if ($max_product_config['cash'] > 0) {
         $custom_config = array('type' => 'define', 'gt' => $max_product, 'inputdesc' => '首次充值翻倍额度以游戏内最高可充值额度为准', 'gemcalc' => "Math.ceil(cash*10 + cash*1300/998)", 'product_id' => 'custom');
         $ret['payment_config'][] = $custom_config;
     }
     foreach ($list as $k => $v) {
         //if($v['gemaward'] > 0 && !isset($v['hide'])){
         if (isset($v['forweb'])) {
             $ret['payment_config'][] = $v;
         }
     }
     echo json_encode($ret);
 }
Example #30
0
<?php

require_once __DIR__ . '/../../base.php';
$zqrs = DbConfig::getParam('zqrs', PSPACE);
$jgrq = DbConfig::getParam('prejgrq', PSPACE);
$sshq = DbConfig::getParam('sshq', PSPACE);
$i = 0;
$list = '';
echo "<pre>\n";
//*
foreach ($zqrs as $k => $row) {
    $info = Crawler_Xueqiu::getGupiaoDay($k, $prejgrq);
    if ($info) {
        $sshq[$k] = $info['close'];
    }
}
DbConfig::saveParam('sshq', $sshq, PSPACE);
// */