新增多库

master
chenzhi 4 years ago
parent 0612bdd0b0
commit f034698dbc

@ -1057,3 +1057,12 @@ function showNumPercent($num)
} }
} }
//优化子站点实例化方法
function SM($name='', $tablePrefix='tab_')
{
$tableName = strtolower($tablePrefix.$name);
if(in_array($tableName,C('SUBSITE_TABLE')) && IS_SUBSITE){
return M($name, $tablePrefix,SUBSITE_DB);
}
return M($name, $tablePrefix);
}

@ -103,7 +103,7 @@ return array(
/* SESSION 和 COOKIE 配置 */ /* SESSION 和 COOKIE 配置 */
'SESSION_PREFIX' => 'onethink_admin', //session前缀 'SESSION_PREFIX' => 'onethink_admin', //session前缀
'SESSION_COOKIE_PATH' => '/admin.php', 'SESSION_COOKIE_PATH' => '/'.SUBSITE_INDEX,
'COOKIE_PREFIX' => 'onethink_admin_', // Cookie前缀 避免冲突 'COOKIE_PREFIX' => 'onethink_admin_', // Cookie前缀 避免冲突
'VAR_SESSION_ID' => 'session_id', //修复uploadify插件无法传递session_id的bug 'VAR_SESSION_ID' => 'session_id', //修复uploadify插件无法传递session_id的bug
@ -113,5 +113,9 @@ return array(
'TMPL_EXCEPTION_FILE' => MODULE_PATH.'View/Public/exception.html',// 异常页面的模板文件 'TMPL_EXCEPTION_FILE' => MODULE_PATH.'View/Public/exception.html',// 异常页面的模板文件
/*默认公司名称*/ /*默认公司名称*/
'DEFAULT_COMPANY'=>"海南万盟天下科技有限公司", 'DEFAULT_COMPANY'=>"海南万盟天下科技有限公司",
'OFFICIEL_CHANNEL'=>"江息网络" 'OFFICIEL_CHANNEL'=>"江息网络",
/*分库的表格*/
'SUBSITE_TABLE'=>[
"tab_spend"
]
); );

@ -137,23 +137,21 @@ class SpendController extends ThinkController
$this->checkListOrCountAuthRestMap($map,["extend", "pay_order_number", "user_account"]); $this->checkListOrCountAuthRestMap($map,["extend", "pay_order_number", "user_account"]);
$map1 = $map; $map1 = $map;
$map1['pay_status'] = 1; $map1['pay_status'] = 1;
$total = null_to_0(D(self::model_name)->where($map1)->sum('pay_amount')); $total = null_to_0(SM(self::model_name)->where($map1)->sum('pay_amount'));
$ttotal = null_to_0(D(self::model_name)->where('pay_time' . total(1))->where(array('pay_status' => 1))->sum('pay_amount'));
$ytotal = null_to_0(D(self::model_name)->where('pay_time' . total(5))->where(array('pay_status' => 1))->sum('pay_amount'));
$this->assign('total', $total); $this->assign('total', $total);
$this->assign('ttotal', $ttotal);
$this->assign('ytotal', $ytotal);
$this->meta_title = $this->m_title = '游戏充值'; $this->meta_title = $this->m_title = '游戏充值';
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Spend/lists', 'status' => 1])->find()); $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Spend/lists', 'status' => 1])->find());
$data = D(self::model_name)->lists($_GET["p"], $map, $order); $data = D(self::model_name)->lists($_GET["p"], $map, $order);
if(!empty($data['data'])){
$adminUsernameList = getAdminUsernameList(array_column($data['data'], 'market_admin_id')); $adminUsernameList = getAdminUsernameList(array_column($data['data'], 'market_admin_id'));
foreach ($data['data'] as $key=>&$value ) { foreach ($data['data'] as $key=>&$value ) {
($value['promote_account']=='官方渠道')?($value['promote_account']=C('OFFICIEL_CHANNEL')):''; ($value['promote_account']=='官方渠道')?($value['promote_account']=C('OFFICIEL_CHANNEL')):'';
$value['market_admin_username'] = $adminUsernameList[$value['market_admin_id']] ?? '无'; $value['market_admin_username'] = $adminUsernameList[$value['market_admin_id']] ?? '无';
$value['is_check_str'] = D(self::model_name)::IsCheckStr[$value['is_check']]; $value['is_check_str'] = D(self::model_name)::IsCheckStr[$value['is_check']];
} }
}
$this->assign('showMarketAdmin', session('user_auth')['show_market_admin']); $this->assign('showMarketAdmin', session('user_auth')['show_market_admin']);
$this->assign('showPromote', session('user_auth')['show_promote']); $this->assign('showPromote', session('user_auth')['show_promote']);
$this->assign('isMarketAdmin', $isMarketAdmin); $this->assign('isMarketAdmin', $isMarketAdmin);

@ -796,12 +796,12 @@ class SpendModel extends Model
} else { } else {
$row = 10; $row = 10;
} }
$list = $this $list = $this->db(1)
->where($map) ->where($map)
->page($page, $row) ->page($page, $row)
->order($order ? $order : 'pay_time desc') ->order($order ? $order : 'pay_time desc')
->select(); ->select();
$count = $this->where($map)->count(); $count = $this->db(1)->where($map)->count();
$data['data'] = $list; $data['data'] = $list;
$page = set_pagination($count, $row); $page = set_pagination($count, $row);
if ($page) { if ($page) {

@ -377,14 +377,10 @@
<td colspan="2">汇总</td> <td colspan="2">汇总</td>
<td colspan="20"> <td colspan="20">
当页充值:{:null_to_0(array_sum(array_column(array_status2value('pay_status','',$list_data),'pay_amount')))} 当页充值:{:null_to_0(array_sum(array_column(array_status2value('pay_status','',$list_data),'pay_amount')))}
<!-- 今日充值:{$ttotal}-->
<!-- 昨日充值:{$ytotal}-->
累计充值:{$total}(此处只汇总充值成功的订单) 累计充值:{$total}(此处只汇总充值成功的订单)
</td> </td>
<!--<td colspan="99" style="color: #a9a9a9;">
今日充值:今日平台所有推广员的累计充值(包括官方渠道)/
昨日充值:昨日平台所有推广员的累计充值(包括官方渠道)
</td>-->
</tr> </tr>
</if> </if>

@ -0,0 +1,48 @@
<?php
/**
* 金菠菜子站点入口
*/
if(version_compare(PHP_VERSION,'5.3.0','<')) die('require PHP > 5.3.0 !');
/**
* 系统调试设置
* 项目正式部署后请设置为false
*/
define('APP_DEBUG', true );
define('BIND_MODULE','Admin');
define('ROOTTT',dirname(__FILE__).'/');
define('ROOTTTTT',dirname(__FILE__));
define('FONTS',dirname(__FILE__).'/Public/Admin/fonts/');
/**
* 应用目录设置
* 安全期间建议安装调试完成后移动到非WEB目录
*/
define ( 'APP_PATH', './Application/' );
if(!is_file(APP_PATH . 'User/Conf/config.php')){
header('Location: ./install.php');
exit;
}
/**
* 缓存目录设置
* 此目录必须可写建议移动到非WEB目录
*/
define ( 'RUNTIME_PATH', './Runtime/' );
/**
* 项目配置
*/
$JBC_DB_CONFIG = include_once APP_PATH."/Common/Conf/env.php";
$JBC_DB_CONFIG = $JBC_DB_CONFIG['JBC_DB_CONFIG'];
define ( 'IS_SUBSITE', TRUE);
define ( 'SUBSITE_NAME', "jbc");
define ( 'SUBSITE_DB', $JBC_DB_CONFIG );
define ( 'SUBSITE_INDEX', "jbc.php" );//子站点路口影响session
/**
* 引入核心入口
* ThinkPHP亦可移动到WEB以外的目录
*/
require './ThinkPHP/ThinkPHP.php';
Loading…
Cancel
Save