PairComplaintHandle.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace App\Services\Complain;
  3. use App\Models\BlackListModel;
  4. use App\Models\Deed\DeedModel;
  5. use App\Models\Fpdx\PairModel;
  6. use App\Services\User\ProfileService;
  7. class PairComplaintHandle extends ComplaintHandle
  8. {
  9. public function erasing()
  10. {
  11. $be_user = $this->getBeUser();
  12. foreach ($this->fields as $field) {
  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. $be_user = $this->getBeUser();
  34. if ($be_user->sex == 1) {
  35. $value = 2;
  36. } elseif ($be_user->sex = 2) {
  37. $value = 1;
  38. }
  39. $userService = new ProfileService();
  40. $userService->updateUser($be_user, [$field => $value]);
  41. break;
  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. case "4":
  55. $deed = DeedModel::find($this->complaint->value);
  56. $pair = PairModel::where('assoc_id', $deed->ack)->first();
  57. if (800 <= $pair->state && $pair->state < 900) {
  58. $pair->state -= 300;
  59. $pair->save();
  60. }
  61. return "修改不满意";
  62. }
  63. }
  64. public function defriend()
  65. {
  66. BlackListModel::create([
  67. 'uid' => $this->complaint->be_uid,
  68. 'complaint_id' => $this->complaint->id,
  69. 'end_at' => $this->defriend_at,
  70. 'type' => 'fpdx',
  71. 'state' => $this->defriend_state,
  72. ]);
  73. }
  74. }