You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
804 B

  1. <?php
  2. namespace App\Service\v3\Implementations;
  3. use App\Constants\v3\ErrorCode;
  4. use App\Exception\ErrorCodeException;
  5. use App\Model\v3\User;
  6. use App\Service\v3\Interfaces\UserInfoServiceInterface;
  7. class UserInfoService implements UserInfoServiceInterface
  8. {
  9. /**
  10. * 更新
  11. * @param $userId
  12. * @param $data
  13. * @return int
  14. */
  15. public function do($userId, $data)
  16. {
  17. $user = User::query()->find($userId);
  18. $res = $user->fill($data)->save();
  19. if (!$res) {
  20. throw new ErrorCodeException(ErrorCode::USER_INFO_UPDATE_ERROR);
  21. }
  22. return $res;
  23. }
  24. public function check($userId)
  25. {
  26. // TODO: Implement check() method.
  27. }
  28. public function undo($userId)
  29. {
  30. // TODO: Implement undo() method.
  31. }
  32. }