bug修改
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace app\api\model;
|
||||
|
||||
use app\common\controller\Push;
|
||||
use app\common\library\GiftTableManager;
|
||||
use think\Cache;
|
||||
use think\Db;
|
||||
use think\Log;
|
||||
@@ -432,13 +433,37 @@ class Room extends Model
|
||||
$week = strtotime(date('Y-m-d', strtotime('this week Monday')));
|
||||
//本周的房间流水
|
||||
if($room_type == 6){
|
||||
$total_transaction = db::name('vs_give_gift')
|
||||
->where(['from_id' => $room_id, 'from' =>6, 'createtime' => ['between', [$week, time()]]])
|
||||
->sum('total_price');
|
||||
$tables = GiftTableManager::getTablesByTimeRange(
|
||||
$week,
|
||||
time()
|
||||
);
|
||||
$all_total_price =0;
|
||||
if($tables){
|
||||
foreach ($tables as $table_name){
|
||||
//表前缀
|
||||
$table_prefix = config('database.prefix');
|
||||
$table_name = str_replace($table_prefix, '', $table_name);
|
||||
$total_price = db::name($table_name)->where(['from_id' => $room_id, 'from' =>6, 'createtime' => ['between', [$week, time()]]])->sum('total_price');
|
||||
$all_total_price += $total_price;
|
||||
}
|
||||
}
|
||||
$total_transaction = $all_total_price;
|
||||
}else{
|
||||
$total_transaction = db::name('vs_give_gift')
|
||||
->where(['from_id' => $room_id, 'from' =>2, 'createtime' => ['between', [$week, time()]]])
|
||||
->sum('total_price');
|
||||
$tables = GiftTableManager::getTablesByTimeRange(
|
||||
$week,
|
||||
time()
|
||||
);
|
||||
$all_total_price =0;
|
||||
if($tables){
|
||||
foreach ($tables as $table_name){
|
||||
//表前缀
|
||||
$table_prefix = config('database.prefix');
|
||||
$table_name = str_replace($table_prefix, '', $table_name);
|
||||
$total_price = db::name($table_name)->where(['from_id' => $room_id, 'from' =>2, 'createtime' => ['between', [$week, time()]]])->sum('total_price');
|
||||
$all_total_price += $total_price;
|
||||
}
|
||||
}
|
||||
$total_transaction = $all_total_price;
|
||||
}
|
||||
|
||||
$ss = 0;
|
||||
|
||||
Reference in New Issue
Block a user