| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <?php
- namespace App\dao\Estatisticas;
- use App\Facade\TableName;
- use App\Http\helper\NumConfig;
- use Carbon\Carbon;
- use Illuminate\Support\Facades\DB;
- use Illuminate\Support\Facades\Log;
- class RechargeWithDraw
- {
- public function recharge($UserID, $Recharge, $Fee = 0)
- {
- $Recharge = $Recharge * NumConfig::NUM_VALUE;
- try {
- // 数据统计后台 -- 充值记录添加
- $UserRegisterDate = DB::table(TableName::QPAccountsDB() . 'AccountsInfo')->where('UserID', $UserID)->select('RegisterDate', 'Channel')->first();
- if($UserID == 4293017 ){
- // $UserRegisterDate->Channel = 101;
- }
- DB::connection('mysql')->table('rummy_ltv_statistics')
- ->where('channel', $UserRegisterDate->Channel)
- ->where('at_date', Carbon::parse($UserRegisterDate->RegisterDate)->format('Ymd'))
- ->update([
- 'total_recharge' => DB::raw('total_recharge+' . $Recharge),
- 'total_recharge_fee' => DB::raw('total_recharge_fee+' . $Fee),
- ]);
- DB::connection('mysql')->table('rummy_ltv_statistics')
- ->where('channel', -1)
- ->where('at_date', Carbon::parse($UserRegisterDate->RegisterDate)->format('Ymd'))
- ->update([
- 'total_recharge' => DB::raw('total_recharge+' . $Recharge),
- 'total_recharge_fee' => DB::raw('total_recharge_fee+' . $Fee),
- ]);
- } catch (\Exception $exception) {
- Log::info('【充值】数据统计后台信息添加失败' . $UserID . ' - ' . $Recharge);
- }
- }
- public function withDraw($UserID, $WithDraw, $Fee = 0, $ServiceFee = 0)
- {
- try {
- // 数据统计后台 -- 充值记录添加
- $UserRegisterDate = DB::table(TableName::QPAccountsDB() . 'AccountsInfo')->where('UserID', $UserID)->select('RegisterDate', 'Channel')->first();
- // if($UserID == 4293017 ){
- // $UserRegisterDate->Channel = 101;
- // }
- DB::connection('mysql')->table('rummy_cash_statistics')
- ->where('channel', $UserRegisterDate->Channel)
- ->where('at_date', Carbon::parse($UserRegisterDate->RegisterDate)->format('Ymd'))
- ->update([
- 'total_cash' => DB::raw('total_cash+' . $WithDraw),
- 'total_cash_fee' => DB::raw('total_cash_fee+' . $Fee),
- 'total_service_fee' => DB::raw('total_service_fee+' . $ServiceFee),
- ]);
- DB::connection('mysql')->table('rummy_cash_statistics')
- ->where('channel', -1)
- ->where('at_date', Carbon::parse($UserRegisterDate->RegisterDate)->format('Ymd'))
- ->update([
- 'total_cash' => DB::raw('total_cash+' . $WithDraw),
- 'total_cash_fee' => DB::raw('total_cash_fee+' . $Fee),
- 'total_service_fee' => DB::raw('total_service_fee+' . $ServiceFee),
- ]);
- } catch (\Exception $exception) {
- Log::info('【提现】数据统计后台信息添加失败' . $UserID . ' - ' . $WithDraw);
- }
- }
- public function refund($UserID, $Recharge, $Fee)
- {
- try {
- // 数据统计后台 -- 退款记录添加
- $UserRegisterDate = DB::table(TableName::QPAccountsDB() . 'AccountsInfo')->where('UserID', $UserID)->select('RegisterDate', 'Channel')->first();
- DB::connection('mysql')->table('rummy_ltv_statistics')
- ->where('channel', $UserRegisterDate->Channel)
- ->where('at_date', Carbon::parse($UserRegisterDate->RegisterDate)->format('Ymd'))
- ->update([
- 'total_refund' => DB::raw('total_refund+' . $Recharge),
- 'total_refund_fee' => DB::raw('total_refund_fee+' . $Fee),
- ]);
- DB::connection('mysql')->table('rummy_ltv_statistics')
- ->where('channel', -1)
- ->where('at_date', Carbon::parse($UserRegisterDate->RegisterDate)->format('Ymd'))
- ->update([
- 'total_refund' => DB::raw('total_refund+' . $Recharge),
- 'total_refund_fee' => DB::raw('total_refund_fee+' . $Fee),
- ]);
- } catch (\Exception $exception) {
- Log::info('【充值】数据统计后台退款信息添加失败' . $UserID . ' - ' . $Fee);
- }
- }
- }
|