Commit de1f282a by Lazy

建立仓库

parents
<?php
/**
* 模拟登陆只能同时登陆一个会员与后台管理用户
* @param string $configs 要模拟登陆的用户 多个 , 隔开
* @author Lazy 2017-10-26
*/
function faker_login($configs) {
is_array($configs) || $configs = explode(',', $configs);
foreach ($configs as $config) {
$_ = strpos($config, '.');
$fun = $_ ? substr($config, 0, $_) : $config;
$fun = $fun == 'admin' ? 'faker_admin' : 'faker_member';
$config = 'user.'.$config;
call_user_func($fun, $config);
}
}
/**
* 数据库连接配置获取
* @author Lazy 2017-10-26
* @param $config 要获取的配置名称
*/
function require_db_config($config) {
$file = format_common_path('db.'.$config);
file_exists($file) || $file = format_common_path('db.local');
return $file;
}
/**
* 模拟登陆admin后台
*/
function faker_admin($file) {
$cookies = cookie('sys_key');
if (empty($cookies)) {
$config = require format_common_path($file);
setNcCookie('sys_key', $config, 3600, '', null);
}
}
/**
* 模拟登陆会员用户
*/
function faker_member($file) {
$TIMESTAMP = $_SERVER['REQUEST_TIME'];
$_SESSION = require format_common_path($file);
}
/**
* 组装文件所在路径
* @author Lazy 2017-10-26
* @param $file_name 文件名称
*/
function format_common_path($file_name) {
//static $path = '%s%s%s.php';
$file_name = str_replace('.', DIRECTORY_SEPARATOR, $file_name);
return __DIR__ . DIRECTORY_SEPARATOR . $file_name . '.php';
}
\ No newline at end of file
<?php
/**
* 合同测试数据库
* @author Lazy 2017-10-26
*/
return [
'dbhost' => '192.168.1.66',
'dbuser' => 'hjk0820',
'dbpwd' => '123456',
'dbname' => 'contract'
];
\ No newline at end of file
<?php
/**
* 测试服务器数据库
* @author Lazy 2017-10-26
*/
return [
'dbhost' => '114.55.72.135',
'dbuser' => 'ecuser',
'dbpwd' => 'ec08@0user',
'dbname' => 'zhongche_nc'
];
\ No newline at end of file
<?php
/**
* 李锟主测试数据库
* @author Lazy 2017-10-26
*/
return [
'dbhost' => '192.168.1.66',
'dbuser' => 'hjk0820',
'dbpwd' => '123456',
'dbname' => 'zhongche_nc'
];
\ No newline at end of file
<?php
/**
* 李锟test
* @author Lazy 2017-10-26
*/
return [
'dbhost' => '192.168.1.66',
'dbuser' => 'hjk0820',
'dbpwd' => '123456',
'dbname' => 'test'
];
\ No newline at end of file
<?php
/**
* 本地测试数据库
* @author Lazy 2017-10-26
*/
return [
'dbhost' => '127.0.0.1',
'dbuser' => 'root',
'dbpwd' => '',
'dbname' => 'zhongche_nc'
];
\ No newline at end of file
<?php
/**
* 美峰主测试数据库
* @author Lazy 2017-10-26
*/
return [
'dbhost' => '192.168.1.99',
'dbuser' => 'bidding',
'dbpwd' => '123456',
'dbname' => 'zhongche_nc'
];
\ No newline at end of file
<?php
/**
* 肖浪测试主数据库
* @author Lazy 2017-10-26
*/
return [
'dbhost' => '192.168.1.150',
'dbuser' => 'root',
'dbpwd' => 'root',
'dbname' => 'zhongche_nc',
];
\ No newline at end of file
<?php
//在 shopnc.php 头部插入下面两行代码
require sprintf('%s%sconfig%2$scommon.php', dirname(__DIR__), DIRECTORY_SEPARATOR);
$__DB_CONFIG = require_db_config('local'); //选择数据库配置
//在 shopnc.php 尾部插入下面
//载入模拟登陆信息
faker_login('170');
//在 config.ini.php 文件头部写入以下代码
if ( ! function_exists('local')) {
$path = dirname(dirname(dirname(__DIR__)));
require sprintf('%s%sconfig%2$scommon.php', $path, DIRECTORY_SEPARATOR);
$__DB_CONFIG = require_db_config('local');
}
//并修改数据库
$config['db']['master']['dbhost'] = $__DB_CONFIG['dbhost'];
$config['db']['master']['dbport'] = isset($__DB_CONFIG['dbport']) ? $__DB_CONFIG['dbport'] : '3306';
$config['db']['master']['dbuser'] = $__DB_CONFIG['dbuser'];
$config['db']['master']['dbpwd'] = $__DB_CONFIG['dbpwd'];
$config['db']['master']['dbname'] = $__DB_CONFIG['dbname'];
<?php
/**
* 杭州经诺机电有限公司
* @author Lazy 2017-10-26
*/
return [
'is_login' => 1,
'member_id' => '1531',
'company_id' => '1505',
'company_type' => '1',
'role_id' => '0',
'member_name' => 'zc2282',
'member_truename' => '111',
'member_portrait' => 'app/member/1531/05453362820774116.jpg',
'member_sex' => '0',
'member_mobile' => '',
'member_email' => '123@123.com',
'member_nickname' => '111',
'is_blue' => 1,
'is_auth' => 1,
'company_name' => '杭州经诺机电有限公司',
'company_level' => '2',
'company_domain' => '',
'store_id' => '1505',
'store_name' => '杭州三重五金机电设备有限公司',
'portal_id' => '1505',
'portal_name' => '杭州经诺机电有限公司',
'last_access' => $TIMESTAMP,
'_RULE_LIST_1531_1' => [
'sale', 'purchase', 'enterprise', 'message', 'member', 'subaccount', 'sale-goods',
'sale-quote', 'sale-tender', 'sale-order', 'sale-recruit', 'sale-buyer', 'sale-business',
'purchase-management', 'purchase-inquiry', 'purchase-tender', 'purchase-order', 'purchase-recruit',
'purchase-supplier', 'enterprise-management', 'enterprise-auth', 'enterprise-pic', 'enterprise-notice',
'enterprise-performance', 'message-system', 'member-account', 'member-collection', 'subaccount-user',
'sale-store', 'sale-goods-add', 'sale-goods-online', 'sale-goods-offline', 'sale-goods-class',
'sale-goods-fare', 'sale-quote-list', 'sale-tender-list', 'sale-order-list', 'sale-recruit-list',
'sale-buyer-cooperation', 'sale-buyer-invite', 'sale-business-my', 'sale-business-inquiry',
'sale-send-list', 'purchase-management-materiel', 'purchase-materiel-class', 'purchase-management-address',
'purchase-inquiry-add', 'purchase-inquiry-list', 'purchase-tender-add', 'purchase-tender-list',
'purchase-order-list', 'purchase-recruit-add', 'purchase-recruit-list', 'purchase-supplier-cooperation',
'purchase-supplier-potential', 'purchase-recipient-list', 'purchase-invoice', 'purchase-invoice-list',
'enterprise-management-info', 'enterprise-auth-realname', 'enterprise-auth-qualification',
'enterprise-pic-list', 'enterprise-pic-company', 'enterprise-notice-list', 'enterprise-performance-list',
'message-system-list', 'message-trade-list', 'message-letter-list', 'member-account-info',
'member-account-password', 'member-collection-product', 'member-collection-store', 'subaccount-user-list',
'sale-store-theme', 'sale-store-banner', 'enterprise-management-contact', 'member-collection-portal'
]
];
\ No newline at end of file
<?php
/**
* 重庆飞耀不锈钢制造有限公司
* @author Lazy 2017-10-26
*/
return [
'is_login' => 1,
'member_id' => '170',
'company_id' => '154',
'company_type' => '1',
'role_id' => '0',
'member_name' => 'zc3006',
'member_truename' => '',
'member_portrait' => 'app/member/170/05436989290362883.jpg',
'member_sex' => '0',
'member_mobile' => '',
'member_email' => '',
'member_nickname' => '',
'is_blue' => 1,
'is_auth' => 1,
'company_name' => '重庆飞耀',
'company_level' => '2',
'company_domain' => '',
'store_id' => '154',
'store_name' => '重庆飞耀不锈钢制造有限公司',
'portal_id' => '154',
'portal_name' => '重庆飞耀',
'last_access' => $TIMESTAMP,
'_RULE_LIST_170_1' => [
'sale', 'purchase', 'enterprise', 'message', 'member', 'subaccount', 'sale-goods',
'sale-quote', 'sale-tender', 'sale-order', 'sale-recruit', 'sale-buyer', 'sale-business',
'purchase-management', 'purchase-inquiry', 'purchase-tender', 'purchase-order', 'purchase-recruit',
'purchase-supplier', 'enterprise-management', 'enterprise-auth', 'enterprise-pic', 'enterprise-notice',
'enterprise-performance', 'message-system', 'member-account', 'member-collection', 'subaccount-user',
'sale-store', 'sale-goods-add', 'sale-goods-online', 'sale-goods-offline', 'sale-goods-class',
'sale-goods-fare', 'sale-quote-list', 'sale-tender-list', 'sale-order-list', 'sale-recruit-list',
'sale-buyer-cooperation', 'sale-buyer-invite', 'sale-business-my', 'sale-business-inquiry',
'sale-send-list', 'purchase-management-materiel', 'purchase-materiel-class', 'purchase-management-address',
'purchase-inquiry-add', 'purchase-inquiry-list', 'purchase-tender-add', 'purchase-tender-list',
'purchase-order-list', 'purchase-recruit-add', 'purchase-recruit-list', 'purchase-supplier-cooperation',
'purchase-supplier-potential', 'purchase-recipient-list', 'purchase-invoice', 'purchase-invoice-list',
'enterprise-management-info', 'enterprise-auth-realname', 'enterprise-auth-qualification',
'enterprise-pic-list', 'enterprise-pic-company', 'enterprise-notice-list', 'enterprise-performance-list',
'message-system-list', 'message-trade-list', 'message-letter-list', 'member-account-info',
'member-account-password', 'member-collection-product', 'member-collection-store', 'subaccount-user-list',
'sale-store-theme', 'sale-store-banner', 'enterprise-management-contact', 'member-collection-portal'
]
];
\ No newline at end of file
<?php
/**
* admin 后台管理员
* @author Lazy 2017-10-26
*/
return 'NXW09BKy6xS0RU7l_gStR4Q8RP0mgZUDzcVH5ZgklnBVKlbKmnZg25i2rxMm6lmL178g1siMgGfGpw2NhUrFZEccaWm_1K46RG9LiC59AymAEM0QkagMlKAPmngeI9UBqN-OX94Ghy3Sl7wLnRr-GD3PlITM1KoK5rlY0pVFVgmPnG-5h-g81S9QSmmKzrUOXYkSoK4KBSALxh0lPbscxfyqiPOfsEPsFL6a3ZvAV80gEMsaxmfMoL0HhxkLVHtJrHwLU3p2hz2Ri--5f6uSREC';
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment