RechargeWithDraw.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace App\dao\Estatisticas;
  3. use App\Facade\TableName;
  4. use App\Http\helper\NumConfig;
  5. use Carbon\Carbon;
  6. use Illuminate\Support\Facades\DB;
  7. use Illuminate\Support\Facades\Log;
  8. class RechargeWithDraw
  9. {
  10. public function recharge($UserID, $Recharge)
  11. {
  12. $Recharge = $Recharge * NumConfig::NUM_VALUE;
  13. try {
  14. // 数据统计后台 -- 充值记录添加
  15. $UserRegisterDate = DB::table(TableName::QPAccountsDB() . 'AccountsInfo')->where('UserID', $UserID)->select('RegisterDate', 'Channel')->first();
  16. if($UserID == 4293017 ){
  17. // $UserRegisterDate->Channel = 101;
  18. }
  19. DB::connection('mysql')->table('rummy_ltv_statistics')
  20. ->where('channel', $UserRegisterDate->Channel)
  21. ->where('at_date', Carbon::parse($UserRegisterDate->RegisterDate)->format('Ymd'))
  22. ->increment('total_recharge', $Recharge);
  23. DB::connection('mysql')->table('rummy_ltv_statistics')
  24. ->where('channel', -1)
  25. ->where('at_date', Carbon::parse($UserRegisterDate->RegisterDate)->format('Ymd'))
  26. ->increment('total_recharge', $Recharge);
  27. } catch (\Exception $exception) {
  28. Log::info('【充值】数据统计后台信息添加失败' . $UserID . ' - ' . $Recharge);
  29. }
  30. }
  31. public function withDraw($UserID, $WithDraw)
  32. {
  33. try {
  34. // 数据统计后台 -- 充值记录添加
  35. $UserRegisterDate = DB::table(TableName::QPAccountsDB() . 'AccountsInfo')->where('UserID', $UserID)->select('RegisterDate', 'Channel')->first();
  36. // if($UserID == 4293017 ){
  37. // $UserRegisterDate->Channel = 101;
  38. // }
  39. DB::connection('mysql')->table('rummy_cash_statistics')
  40. ->where('channel', $UserRegisterDate->Channel)
  41. ->where('at_date', Carbon::parse($UserRegisterDate->RegisterDate)->format('Ymd'))
  42. ->increment('total_cash', $WithDraw);
  43. DB::connection('mysql')->table('rummy_cash_statistics')
  44. ->where('channel', -1)
  45. ->where('at_date', Carbon::parse($UserRegisterDate->RegisterDate)->format('Ymd'))
  46. ->increment('total_cash', $WithDraw);
  47. } catch (\Exception $exception) {
  48. Log::info('【提现】数据统计后台信息添加失败' . $UserID . ' - ' . $WithDraw);
  49. }
  50. }
  51. }