1234567891011121314151617181920212223242526272829303132333435 |
- //
- // WeatherModel.m
- // Temperature
- //
- // Created by RD on 2023/4/26.
- //
- #import "WeatherModel.h"
- @implementation WeatherModel
- + (void)rds_getWeatherFinished:(void (^)(WeatherModel * _Nonnull, NSError * _Nonnull))finished{
-
- [RDSDemoApiHelper rds_getWeatherSuccess:^(id responseObject) {
-
- if ([responseObject[@"code"] intValue] == 0) {
-
- NSDictionary *data = responseObject[@"data"];
- WeatherModel *weather = [WeatherModel mj_objectWithKeyValues:data];
-
-
- BLOCK_SAFE_RUN(finished,weather, nil)
- } else{
- NSError *error = [NSError errorWithDomain:responseObject[@"message"] code:[responseObject[@"code"] intValue] userInfo:nil];
- BLOCK_SAFE_RUN(finished,nil, error)
- }
- } failure:^(NSError *error) {
-
- }];
- }
- @end
|