ASProductBaseModel.m 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // ASProductBaseModel.m
  3. // Asteria
  4. //
  5. // Created by iOS on 2023/6/1.
  6. //
  7. #import "ASProductBaseModel.h"
  8. @implementation ASProductBaseModel
  9. + (ASProductBaseModel*)demoModel {
  10. ASProductBaseModel *m = [[ASProductBaseModel alloc] init];
  11. m.img = @"https://marketplace.canva.cn/O0eQI/MADvnEO0eQI/1/screen_2x/canva-surprised-asian-girl-with-pretty-smile-in-pinup-makeup-style-MADvnEO0eQI.jpg";
  12. m.title = @"Transparent Wigs Brazilian Front Wigs Straight Hair Transparent Wigs Brazilian Front Wigs Straight Hair ";
  13. m.sketchy_app = @"Transparent Wigs Brazilian Front Wigs Straight Hair Body Wave…";
  14. m.discount_app = @"10%";
  15. if (arc4random()%2 == 1) {
  16. m.oldPrice = @"";
  17. } else {
  18. m.oldPrice = @"234.43";
  19. }
  20. if (arc4random()%2 == 1) {
  21. m.sketchy_app = @"";
  22. }
  23. m.Id = @(arc4random()%12130).stringValue;
  24. m.nowPrice = @"223.45";
  25. m.rate_star = [NSString stringWithFormat:@"%u",arc4random()%90 + 2];
  26. m.sale_num = @"324123";
  27. return m;
  28. }
  29. - (NSString *)nowPrice {
  30. NSDecimalNumber *num = [NSDecimalNumber decimalNumberWithString:_nowPrice];
  31. return [NSString stringWithFormat:@"%@%.2f",self.currencySymbol, num.doubleValue];
  32. }
  33. - (NSString *)oldPrice {
  34. NSDecimalNumber *num = [NSDecimalNumber decimalNumberWithString:_oldPrice];
  35. return [NSString stringWithFormat:@"%@%.2f",self.currencySymbol, num.doubleValue];
  36. }
  37. - (NSString *)img {
  38. return [NSString stringWithFormat:@"https://%@%@%@",HostPath, ProductImgPath, _img];
  39. }
  40. - (NSString *)sale_num {
  41. return [NSString stringWithFormat:@"%ldK", _sale_num.integerValue/1000];
  42. }
  43. + (NSDictionary *)mj_replacedKeyFromPropertyName {
  44. return @{
  45. @"Id": @"entity_id",
  46. @"oldPrice": @"price",
  47. @"nowPrice":@"final_price",
  48. @"img":@"image",
  49. @"title":@"name",
  50. @"sketchy_app":@"short_description"
  51. };
  52. }
  53. @end