MailLogic.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace App\Http\logic\admin;
  3. use Illuminate\Support\Facades\DB;
  4. class MailLogic
  5. {
  6. public function mailRecord($type,$GameID,$amount,$amount_search)
  7. {
  8. !empty($GameID) && $where[] = ['ai.GameID', 'like', $GameID . '%'];
  9. if (!empty($amount)) {
  10. $where[] = ['pm.amount', '=', $amount * 100];
  11. }
  12. $where[] = ['pm.type', '=', $type];
  13. $build_sql = DB::table('QPAccountsDB.dbo.PrivateMail as pm')->join('QPAccountsDB.dbo.AccountsInfo as ai', 'pm.UserID', 'ai.UserID');
  14. switch ($amount_search) {
  15. case 100:
  16. $where[] = ['pm.amount', '<', 10000];
  17. break;
  18. case 500:
  19. $where[] = ['pm.amount', '>=', 10000];
  20. $where[] = ['pm.amount', '<=', 50000];
  21. break;
  22. case 1000:
  23. $where[] = ['pm.amount', '>=', 50000];
  24. $where[] = ['pm.amount', '<=', 100000];
  25. break;
  26. case 1001:
  27. $where[] = ['pm.amount', '>', 100000];
  28. break;
  29. }
  30. $field = ['pm.*', 'ai.GameID'];
  31. $list = $build_sql
  32. ->where($where)
  33. ->select($field)
  34. ->orderByDesc('CreateTime')
  35. ->paginate(10);
  36. $prize = DB::connection('write')->table('QPTreasureDB.dbo.PropCfg')->select('PropID', 'PropName')->get()->toArray();
  37. //$prop = DB::connection('write')->table('QPAccountsDB.dbo.YN_MatchProp')->select('PropID', 'PropName')->get()->toArray();
  38. // $data = array_merge($prize, $prop);
  39. // foreach ($data as $key => $value) {
  40. // $prop_arr[$value->PropID] = $value->PropName;
  41. // }
  42. foreach ($list as $key => &$value) {
  43. if (!empty($value->BonusString)) {
  44. $bonus = $value->BonusString;
  45. $bonus = explode(';', $bonus);
  46. $value->BonusString = '';
  47. foreach ($bonus as $k => &$v) {
  48. $v = explode(',', $v);
  49. if (count($v) >1) {
  50. $value->BonusString .= '金币x' . ($v[1] / 100) . ',';
  51. }
  52. }
  53. }
  54. }
  55. return $list;
  56. }
  57. }