GameComplaintHandle.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace App\Services\Complain;
  3. use App\Models\BlackListModel;
  4. use App\Models\Gteam\UserModel;
  5. use App\Services\User\ProfileService;
  6. class GameComplaintHandle extends ComplaintHandle
  7. {
  8. public function erasing()
  9. {
  10. $be_user = $this->getBeUser();
  11. foreach ($this->fields as $field) {
  12. try {
  13. switch ($field) {
  14. case "cj_wx_rank":
  15. $gteamUser = UserModel::find($be_user->uid);
  16. $gteamUser->cj_wx_rank = 0;
  17. $gteamUser->save();
  18. // no break
  19. case "wz_wx_rank":
  20. $gteamUser = UserModel::find($be_user->uid);
  21. $gteamUser->wz_wx_rank = 0;
  22. $gteamUser->save();
  23. break;
  24. case "sex":
  25. $value = 0;
  26. if ($be_user->sex == 1) {
  27. $value = 2;
  28. } elseif ($be_user->sex == 2) {
  29. $value = 1;
  30. }
  31. $userService = new ProfileService();
  32. $userService->updateUser($be_user, [$field => $value]);
  33. break;
  34. }
  35. } catch (\Exception $e) {
  36. }
  37. }
  38. }
  39. public function reply()
  40. {
  41. switch ($this->state) {
  42. case "1":
  43. return "仅回复";
  44. break;
  45. case "2":
  46. return "联系客服";
  47. break;
  48. }
  49. }
  50. public function defriend()
  51. {
  52. BlackListModel::create([
  53. 'uid' => $this->complaint->be_uid,
  54. 'complaint_id' => $this->complaint->id,
  55. 'end_at' => $this->defriend_at,
  56. 'type' => 'game',
  57. 'state' => $this->defriend_state,
  58. ]);
  59. }
  60. }