ContactComplaintHandle.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. namespace App\Services\Complain;
  3. use App\Models\BlackListModel;
  4. use App\Models\FlowerLogModel;
  5. use App\Services\User\ProfileService;
  6. class ContactComplaintHandle 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 "photo_src":
  15. case "photo_1":
  16. case "photo_2":
  17. case "photo_3":
  18. case "photo_4":
  19. $pfs = new ProfileService();
  20. $pfs->deletePhoto($be_user->uid, $field);
  21. break;
  22. case "voice":
  23. case "weixin":
  24. case "qq":
  25. case "school":
  26. case "home":
  27. case "address":
  28. $userService = new ProfileService();
  29. $userService->updateUser($be_user, [$field => '']);
  30. break;
  31. case "sex":
  32. $value = 0;
  33. if ($be_user->sex == 1) {
  34. $value = 2;
  35. } elseif ($be_user->sex = 2) {
  36. $value = 1;
  37. }
  38. $userService = new ProfileService();
  39. $userService->updateUser($be_user, [$field => $value]);
  40. break;
  41. }
  42. } catch (\Exception $e) {
  43. }
  44. }
  45. }
  46. public function reply()
  47. {
  48. switch ($this->state) {
  49. case "1":
  50. return "仅回复";
  51. break;
  52. case "2":
  53. return "联系客服";
  54. break;
  55. case "3":
  56. $user = $this->getUser();
  57. $user->increment('red_flower', 1.5);
  58. FlowerLogModel::create([
  59. 'uid' => $user->uid,
  60. 'red_flower' => 1.5,
  61. 'type' => 5,
  62. 'remark' => '你的举报已通过,退回1.5倍消费小fa!',
  63. ]);
  64. return "退还小花";
  65. break;
  66. }
  67. }
  68. public function defriend()
  69. {
  70. BlackListModel::create([
  71. 'uid' => $this->complaint->be_uid,
  72. 'complaint_id' => $this->complaint->id,
  73. 'end_at' => $this->defriend_at,
  74. 'type' => 'chat',
  75. 'state' => $this->defriend_state,
  76. ]);
  77. }
  78. }