优化订单查询

master
chenzhi 4 years ago
parent 45d883e89c
commit 4fdb94c617

@ -131,9 +131,11 @@ class SpendController extends ThinkController
// $map1 = $map;
// }
$this->checkListOrCountAuthRestMap($map,["extend", "pay_order_number", "user_account"]);
D("Spend")->addSubsiteWhere($map);
$map1 = $map;
$map1['pay_status'] = 1;
$total = null_to_0(SM(self::model_name)->where($map1)->sum('pay_amount'));
$total = null_to_0(M(self::model_name,"tab_")->where($map1)->sum('pay_amount'));
$this->assign('total', $total);
$this->meta_title = $this->m_title = '游戏充值';
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Spend/lists', 'status' => 1])->find());

@ -51,11 +51,6 @@ class SpendModel extends Model
{
/* 设置默认的表前缀 */
$this->tablePrefix = 'tab_';
if(is_subsiteTable("tab_spend")){
//修改连接
$this->connection = SUBSITE_DB;
$connection = SUBSITE_DB;
}
/* 执行构造方法 */
parent::__construct($name, $tablePrefix, $connection);
}
@ -71,6 +66,20 @@ class SpendModel extends Model
$create_time = I('post.create_time');
return $create_time ? strtotime($create_time) : NOW_TIME;
}
/**
* 添加子站点条件
* @param [arrary] $map
* @param string $alias spend数据库别名
* @return void
*/
public function addSubsiteWhere(&$map,$alias='')
{
$field = "partner_type";
!empty($alias) && $field = $alias.".".$field;
if(IS_SUBSITE){
$map[$field] = PARTNER_TYPE;
}
}
public function amdin_account()
{
@ -895,7 +904,7 @@ class SpendModel extends Model
}else{
$map['s.game_id'] = '-1';
}
$data = SM("Spend","tab_")
$data = M("Spend","tab_")
->alias('s')
->index('game_time')
->where(['s.pay_status' => 1])
@ -937,7 +946,7 @@ class SpendModel extends Model
$map['s.game_id'] = ['in', $gameIds];
}
$data = SM("Spend","tab_")
$data = M("Spend","tab_")
->alias('s')
->index('game_time')
->field("

@ -35,12 +35,12 @@ define ( 'RUNTIME_PATH', './Runtime/' );
* 项目配置
*/
$JBC_DB_CONFIG = include_once APP_PATH."/Common/Conf/env.php";
$JBC_DB_CONFIG = $JBC_DB_CONFIG['SUBSITE_DB_CONFIG']['JBC_DB_CONFIG'];
$JBC_DB_CONFIG = $JBC_DB_CONFIG['SUBSITE_DB_CONFIG']['WM_DB_CONFIG'];
define ( 'IS_SUBSITE', true);
define ( 'PARTNER_TYPE', 2);
define ( 'SUBSITE_NAME', "jbc");
define ( 'SUBSITE_NAME', "wm");
define ( 'SUBSITE_DB', $JBC_DB_CONFIG );
define ( 'SUBSITE_INDEX', "jbc.php" );//子站点路口影响session
define ( 'SUBSITE_INDEX', "wm.php" );//子站点路口影响session
/**
* 引入核心入口
Loading…
Cancel
Save