PartnerComplaintHandle.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace App\Services\Complain;
  3. use App\Models\BlackListModel;
  4. use App\Services\User\ProfileService;
  5. class PartnerComplaintHandle extends ComplaintHandle
  6. {
  7. public function erasing()
  8. {
  9. $be_user = $this->getBeUser();
  10. foreach ($this->fields as $field) {
  11. try {
  12. switch ($field) {
  13. case "photo_src":
  14. case "photo_1":
  15. case "photo_2":
  16. case "photo_3":
  17. case "photo_4":
  18. $pfs = new ProfileService();
  19. $pfs->deletePhoto($be_user->uid, $field);
  20. break;
  21. case "voice":
  22. case "weixin":
  23. case "qq":
  24. case "school":
  25. case "home":
  26. case "address":
  27. $userService = new ProfileService();
  28. $userService->updateUser($be_user, [$field => '']);
  29. break;
  30. case "sex":
  31. $value = 0;
  32. if ($be_user->sex == 1) {
  33. $value = 2;
  34. } elseif ($be_user->sex = 2) {
  35. $value = 1;
  36. }
  37. $userService = new ProfileService();
  38. $userService->updateUser($be_user, [$field => $value]);
  39. break;
  40. }
  41. } catch (\Exception $e) {
  42. }
  43. }
  44. }
  45. public function reply()
  46. {
  47. switch ($this->state) {
  48. case "1":
  49. return "仅回复";
  50. break;
  51. case "2":
  52. return "联系客服";
  53. break;
  54. }
  55. }
  56. /**
  57. * 拉黑
  58. * @return mixed
  59. */
  60. public function defriend()
  61. {
  62. BlackListModel::create([
  63. 'uid' => $this->complaint->be_uid,
  64. 'complaint_id' => $this->complaint->id,
  65. 'end_at' => $this->defriend_at,
  66. 'type' => 'msy',
  67. 'state' => $this->defriend_state,
  68. ]);
  69. }
  70. }