getBeUser(); foreach ($this->fields as $field) { try { switch ($field) { case "sex": $value = 0; if ($be_user->sex == 1) { $value = 2; } elseif ($be_user->sex == 2) { $value = 1; } $userService = new ProfileService(); $userService->updateUser($be_user, [$field => $value]); break; } } catch (\Exception $e) { } } } public function reply() { switch ($this->state) { case "1": return "仅回复"; break; case "2": return "联系客服"; break; } } /** * 拉入黑名单 * @return mixed|void */ public function defriend() { BlackListModel::create([ 'uid' => $this->complaint->be_uid, 'complaint_id' => $this->complaint->id, 'end_at' => $this->defriend_at, 'type' => 'goodnight', 'state' => $this->defriend_state, ]); } }