公会流水清洗更换
This commit is contained in:
@@ -214,6 +214,7 @@ class Guild extends adminApi
|
||||
$insert_data['room_id'] = $rid;
|
||||
$insert_data['status'] = 1;
|
||||
$insert_data['is_deacon'] = 1;
|
||||
$insert_data['apply_time'] = time();
|
||||
$insert_data['createtime'] = time();
|
||||
$insert_data['is_show_room'] = 1;
|
||||
//结算比例
|
||||
@@ -510,17 +511,15 @@ class Guild extends adminApi
|
||||
foreach ($list as $k=>$v){
|
||||
$search_stime = $search_stime_str;
|
||||
$search_etime = $search_etime_str;
|
||||
// $search_stime = date('Y-m-d H:i:s','1761554521');
|
||||
// $search_etime = date('Y-m-d H:i:s','1766564906');
|
||||
if($search_stime!=""){
|
||||
if($v['apply_time'] && $search_stime < $v['apply_time']) {
|
||||
if($v['apply_time'] && strtotime($search_stime) < $v['apply_time']) {
|
||||
$search_stime = date('Y-m-d H:i:s',$v['apply_time']);
|
||||
}
|
||||
}else{
|
||||
$search_stime = date('Y-m-d H:i:s',$v['apply_time']);
|
||||
}
|
||||
if($search_etime!=""){
|
||||
if($v['quit_time'] && ($search_etime > $v['quit_time'])){
|
||||
if($v['quit_time'] && (strtotime($search_etime) > $v['quit_time'])){
|
||||
$search_etime = date('Y-m-d H:i:s',$v['quit_time']);
|
||||
}
|
||||
}else{
|
||||
|
||||
@@ -19,13 +19,17 @@ class SingerSong extends adminApi
|
||||
$search = input('search', '');
|
||||
$status = input('status', '');
|
||||
$where=[];
|
||||
$wheres = [];
|
||||
//搜索信息有值且是纯数字
|
||||
if(is_numeric($search)){
|
||||
$where['ss.user_id'] = $search;
|
||||
$wheres['user_id'] = $search;
|
||||
$where['u.user_code'] = $search;
|
||||
$user_id = db::name('user')->where('user_code', $search)->value('id');
|
||||
$wheres['user_id'] = $user_id;
|
||||
}
|
||||
if($search && !is_numeric($search)){
|
||||
$where['u.nickname'] = ['like', '%'.$search.'%'];;
|
||||
$where['u.nickname'] = ['like', '%'.$search.'%'];
|
||||
$user_id = db::name('user')->where('nickname', $search)->value('id');
|
||||
$wheres['user_id'] = $user_id;
|
||||
}
|
||||
if($start_time && $end_time){
|
||||
$where['ss.createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
|
||||
@@ -34,9 +38,6 @@ class SingerSong extends adminApi
|
||||
if($status){
|
||||
$where['ss.status'] = $status;
|
||||
$wheres['status'] = $status;
|
||||
}else{
|
||||
$where = [];
|
||||
$wheres = [];
|
||||
}
|
||||
|
||||
$count = db::name('vs_singer')->where($wheres)->count();
|
||||
|
||||
@@ -73,15 +73,17 @@ class Room extends Model
|
||||
public function getRoomFlow($room_id,$stime='',$etime=''){
|
||||
$give_where = [];
|
||||
$give_where['from_id'] = $room_id;
|
||||
$give_where['from'] = ["in",[2,3,6]];
|
||||
// $give_where['from'] = ["in",[2,3,6]];
|
||||
$give_where['from'] = 2;
|
||||
if(!empty($stime)){
|
||||
$give_where['createtime'] = ['>=',strtotime($stime)];
|
||||
}
|
||||
if(!empty($etime)){
|
||||
$give_where['createtime'] = ['<=',strtotime($etime)];
|
||||
$give_where['createtime'] = ['<',strtotime($etime)];
|
||||
}
|
||||
if(!empty($stime) && !empty($etime)){
|
||||
$give_where['createtime'] = ['between',[strtotime($stime),strtotime($etime)]];
|
||||
// $give_where['createtime'] = ['between',[strtotime($stime),strtotime($etime)]];
|
||||
$give_where['createtime'] = [['>=',strtotime($stime)],['<',strtotime($etime)]];
|
||||
}
|
||||
$total_price = db::name('vs_give_gift')->where($give_where)
|
||||
->sum('total_price');
|
||||
|
||||
@@ -1005,7 +1005,7 @@ class GiveGift extends Model
|
||||
return false;
|
||||
}
|
||||
//记录公会流水
|
||||
if($from_type==2){
|
||||
if($from_type==2 && $from_id > 0){
|
||||
model('api/Guild')->guild_flow($from_id,$gift_price,$res);
|
||||
}
|
||||
//查询是否第一次送礼
|
||||
|
||||
@@ -1265,12 +1265,15 @@ class Guild extends Model
|
||||
|
||||
//公会流水记录
|
||||
public function guild_flow($room_id,$flow_price,$give_gift_id=0){
|
||||
if($room_id<=0 || $flow_price<=0){
|
||||
return ['code' => 0, 'msg' => '参数错误', 'data' => null];
|
||||
}
|
||||
$guild_user_info = Db::name('vs_guild_user')->where(['room_id' => $room_id, 'delete_time' => 0, 'status' => 1, 'quit_time' => 0])->find();
|
||||
if ($guild_user_info) {
|
||||
//记录流水
|
||||
$data = [
|
||||
'guild_id' => $guild_user_info['guild_id'],
|
||||
'room_id' => $room_id,
|
||||
'room_id' => $guild_user_info['room_id'],
|
||||
'give_gift_id' => $give_gift_id,
|
||||
'flow_price' => $flow_price,
|
||||
'day' => date('Y-m-d'),
|
||||
|
||||
@@ -25,7 +25,7 @@ class Test
|
||||
// $this->xlh_gift_send();
|
||||
// echo "\n";
|
||||
//
|
||||
// $this->clean_guild_flow();
|
||||
$this->clean_guild_flow();
|
||||
|
||||
}
|
||||
|
||||
@@ -507,15 +507,66 @@ class Test
|
||||
|
||||
//清洗公会流水
|
||||
public function clean_guild_flow()
|
||||
{die;
|
||||
{
|
||||
echo "开始清洗公会流水: \n";
|
||||
$guild = db::name('vs_guild')->where(['status' => 1])->select();
|
||||
$guild = db::name('vs_guild')->select();
|
||||
foreach ($guild as $value) {
|
||||
echo "================================\n";
|
||||
echo "开始清洗公会({$value['id']})流水 \n";
|
||||
$guild_user = db::name('vs_guild_user')->where(['guild_id' => $value['id'],'status' => 1,'apply_time'=>['>',0],'room_id' => ['>',0]])->select();
|
||||
$transaction = 0;
|
||||
foreach ($guild_user as $v) {
|
||||
$week_start_time_seach = "1761554521";
|
||||
$week_end_time_seach = "1766667632";
|
||||
if($v['apply_time'] && $week_start_time_seach < $v['apply_time']){
|
||||
$week_start_time_seach = $v['apply_time'];
|
||||
}
|
||||
if($v['quit_time'] && ($week_end_time_seach > $v['quit_time'])){
|
||||
$week_end_time_seach = $v['quit_time'];
|
||||
}
|
||||
$transaction_one = db::name('vs_give_gift')
|
||||
->where('from_id',$v['room_id'])
|
||||
->where(['createtime'=>['>=',$week_start_time_seach]])
|
||||
->where(['createtime'=>['<',$week_end_time_seach]])
|
||||
->where(['from'=>2])
|
||||
->sum('total_price');
|
||||
|
||||
// Db::name('vs_guild_user')->where(['id' => $v['id']])->setInc('coin', $transaction_one);
|
||||
if($transaction_one>0){
|
||||
$data = [
|
||||
'guild_id' => $value['id'],
|
||||
'room_id' => $v['room_id'],
|
||||
'give_gift_id' => 0,
|
||||
'flow_price' => $transaction_one,
|
||||
'day' => "",
|
||||
'createtime' => time(),
|
||||
];
|
||||
// $res = Db::name('vs_guild_flow')->insert($data);
|
||||
}
|
||||
$transaction += $transaction_one;
|
||||
echo " 公会房间(". $v['room_id'] .")流水:" . $transaction_one . "\n";
|
||||
}
|
||||
// Db::name('vs_guild')->where(['id' => $value['id']])->setInc('income', $transaction);
|
||||
echo "清洗公会房间流水完成:" . count($guild_user) . "\n";
|
||||
}
|
||||
echo "清洗公会流水完成: ".count($guild)."\n";
|
||||
}
|
||||
|
||||
//清洗公会流水
|
||||
public function clean_guild_flow1()
|
||||
{die;
|
||||
echo "开始清洗公会流水: \n";
|
||||
$guild = db::name('vs_guild')->where(['status' => 1])->select();
|
||||
foreach ($guild as $value) {
|
||||
echo "================================\n";
|
||||
//echo "开始清洗公会({$value['id']})流水 \n";
|
||||
$guild_user = db::name('vs_guild_user')->where(['guild_id' => $value['id'],'status' => 1,'apply_time'=>['>',0],'room_id' => ['>',0]])->select();
|
||||
$transaction = 0;
|
||||
$transaction_one_all = 0;
|
||||
foreach ($guild_user as $v) {
|
||||
$guild_flow_price = Db::name('vs_guild_flow')->where(['guild_id' => $value['id'],'room_id' => $v['room_id']])->sum('flow_price');
|
||||
$transaction += $guild_flow_price;
|
||||
|
||||
$week_start_time_seach = "1761554521";
|
||||
$week_end_time_seach = "1766564906";
|
||||
if($v['apply_time'] && $week_start_time_seach < $v['apply_time']){
|
||||
@@ -526,33 +577,26 @@ class Test
|
||||
}
|
||||
$transaction_one = db::name('vs_give_gift')
|
||||
->where('from_id',$v['room_id'])
|
||||
->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$week_start_time_seach, $week_end_time_seach]]])
|
||||
->where(['from'=>2,'createtime' => ['between', [$week_start_time_seach, $week_end_time_seach]]])
|
||||
->sum('total_price');
|
||||
// db::name('vs_guild_user')->where(['id' => $v['id']])->update([
|
||||
// 'coin' => $transaction_one,
|
||||
// ]);
|
||||
// Db::name('vs_guild_user')->where(['id' => $v['id']])->setInc('coin', $transaction_one);
|
||||
|
||||
// $data = [
|
||||
// 'guild_id' => $value['id'],
|
||||
// 'room_id' => $v['room_id'],
|
||||
// 'give_gift_id' => 0,
|
||||
// 'flow_price' => $transaction_one,
|
||||
// 'day' => "",
|
||||
// 'createtime' => time(),
|
||||
// ];
|
||||
// $res = Db::name('vs_guild_flow')->insert($data);
|
||||
|
||||
$transaction += $transaction_one;
|
||||
echo " 公会房间(". $v['room_id'] .")流水:" . $transaction_one . "\n";
|
||||
if($guild_flow_price != $transaction_one){
|
||||
echo "公会房间(". $v['room_id'] .")流水与公会用户流水不一致:" . $guild_flow_price . "--" . $transaction_one . "\n";
|
||||
$flow_price_cha = $v['coin']-$guild_flow_price;
|
||||
echo "差:".($flow_price_cha) . "\n";
|
||||
// Db::name('vs_guild_user')->where(['id' => $v['id']])->setDec('coin', $flow_price_cha);
|
||||
}
|
||||
$transaction_one_all= $transaction_one_all+$transaction_one;
|
||||
}
|
||||
// db::name('vs_guild')->where(['id' => $value['id']])->update([
|
||||
// 'income' => $transaction,
|
||||
// ]);
|
||||
// Db::name('vs_guild')->where(['id' => $value['id']])->setInc('income', $transaction);
|
||||
echo "清洗公会房间流水完成:" . count($guild_user) . "\n";
|
||||
if($transaction != $transaction_one_all){
|
||||
echo "公会流水与公会用户流水不一致:" . $transaction . "--" . $value['income'] . "\n";
|
||||
$transaction_cha = $value['income']-$transaction;
|
||||
echo $value['id']."差:".($transaction_cha) . "\n";
|
||||
// Db::name('vs_guild')->where(['id' => $value['id']])->setDec('income', $transaction_cha);
|
||||
}
|
||||
// echo "清洗公会房间流水完成:" . count($guild_user) . "\n";
|
||||
}
|
||||
echo "清洗公会流水完成: ".count($guild)."\n";
|
||||
// echo "清洗公会流水完成: ".count($guild)."\n";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user