口袋版本的一折买

AccountModel.m 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // AccountModel.m
  3. // CommerceManage
  4. //
  5. // Created by 小花 on 2016/12/27.
  6. // Copyright © 2016年 vaic. All rights reserved.
  7. //
  8. #import "AccountModel.h"
  9. @implementation AccountModel
  10. //+ (instancetype)AccountStatusWithDict:(NSDictionary *)dict {
  11. // AccountModel *account = [[self alloc] init];
  12. // account.token = dict[@"token"];
  13. //
  14. // return account;
  15. //}
  16. /**
  17. * 当一个对象要归档进沙盒的时候就会调用 归档
  18. * 目的,在这个方法中说明这个对象的哪些属性写进沙盒
  19. * @param encoder <#encoder description#>
  20. */
  21. - (void)encodeWithCoder:(NSCoder *)encoder
  22. {
  23. [encoder encodeObject:self.token forKey:@"token"];
  24. [encoder encodeObject:self.unionid forKey:@"unionid"];
  25. [encoder encodeObject:self.openId forKey:@"openId"];
  26. //
  27. }
  28. /**
  29. * 反归档 的时候会调用这个方法 解档
  30. * 目的:在这个方法中说明这个对象的哪些属性从沙河中解析出来
  31. 从沙河中解析对象 反归档会调用这个方法 需要解析哪些属性
  32. * @param decoder <#decoder description#>
  33. *
  34. * @return <#return value description#>
  35. */
  36. -(instancetype)initWithCoder:(NSCoder *)decoder
  37. {
  38. if (self = [super init]) {
  39. self.token = [decoder decodeObjectForKey:@"token"];
  40. self.unionid = [decoder decodeObjectForKey:@"unionid"];
  41. self.openId = [decoder decodeObjectForKey:@"openId"];
  42. }
  43. return self;
  44. }
  45. @end