公会流水清洗更换
This commit is contained in:
@@ -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