WeatherModel.m 921 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //
  2. // WeatherModel.m
  3. // Temperature
  4. //
  5. // Created by RD on 2023/4/26.
  6. //
  7. #import "WeatherModel.h"
  8. @implementation WeatherModel
  9. + (void)rds_getWeatherFinished:(void (^)(WeatherModel * _Nonnull, NSError * _Nonnull))finished{
  10. [RDSDemoApiHelper rds_getWeatherSuccess:^(id responseObject) {
  11. if ([responseObject[@"code"] intValue] == 0) {
  12. NSDictionary *data = responseObject[@"data"];
  13. WeatherModel *weather = [WeatherModel mj_objectWithKeyValues:data];
  14. BLOCK_SAFE_RUN(finished,weather, nil)
  15. } else{
  16. NSError *error = [NSError errorWithDomain:responseObject[@"message"] code:[responseObject[@"code"] intValue] userInfo:nil];
  17. BLOCK_SAFE_RUN(finished,nil, error)
  18. }
  19. } failure:^(NSError *error) {
  20. }];
  21. }
  22. @end
  23. @implementation Location
  24. @end
  25. @implementation Now
  26. @end