JXLuckRescueFundVc.m 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. //
  2. // JXLuckRescueFundVc.m
  3. // shiku_im
  4. //
  5. // Created by 123 on 2020/6/15.
  6. // Copyright © 2020 Reese. All rights reserved.
  7. //
  8. #import "JXLuckRescueFundVc.h"
  9. #import "JXMoneyShareView.h"
  10. #import "JXRelayVC.h"
  11. #import "JXhelpMoneyView.h"
  12. @interface JXLuckRescueFundVc ()
  13. @property (nonatomic,weak) UILabel *moneyLL2;
  14. @property (nonatomic,weak) UIButton *rightImg;
  15. @property (nonatomic,weak) UIImageView *titleIMG22;
  16. @end
  17. @implementation JXLuckRescueFundVc
  18. - (void)viewDidLoad {
  19. [super viewDidLoad];
  20. [self defineNavBar:@"转运金" andRinghtBtnImg:@""];
  21. [self createUI];
  22. }
  23. - (void)createUI{
  24. UIImageView *backIMG=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"jyjbeijing"]];
  25. backIMG.userInteractionEnabled=YES;
  26. [self.view addSubview:backIMG];
  27. [backIMG mas_makeConstraints:^(MASConstraintMaker *make) {
  28. make.top.mas_equalTo(JX_SCREEN_TOP);
  29. make.left.mas_equalTo(0);
  30. make.right.mas_equalTo(0);
  31. make.bottom.mas_equalTo(0);
  32. }];
  33. UIImageView *titleIMG =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"jyj标题"]];
  34. titleIMG.userInteractionEnabled=YES;
  35. [backIMG addSubview:titleIMG];
  36. [titleIMG mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.top.mas_equalTo(0);
  38. make.centerX.mas_equalTo(backIMG.mas_centerX);
  39. }];
  40. UIImageView *titleIMG22 =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"尊敬的会员"]];
  41. [backIMG addSubview:titleIMG22];
  42. [titleIMG22 mas_makeConstraints:^(MASConstraintMaker *make) {
  43. make.top.mas_equalTo(titleIMG.mas_bottom).mas_offset(1);
  44. make.centerX.mas_equalTo(backIMG.mas_centerX);
  45. }];
  46. // _titleIMG22 = titleIMG22;
  47. // _titleIMG22.hidden = YES;
  48. UIImageView *moneyIMG =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"jyj救援金"]];
  49. [backIMG addSubview:moneyIMG];
  50. [moneyIMG mas_makeConstraints:^(MASConstraintMaker *make) {
  51. make.top.mas_equalTo(titleIMG22.mas_bottom).mas_offset(30);
  52. make.centerX.mas_equalTo(backIMG.mas_centerX);
  53. }];
  54. UILabel *titleJJJ= [[UILabel alloc]init];
  55. titleJJJ.text=@"转运金";
  56. titleJJJ.font=[UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
  57. titleJJJ.textColor=kRGBColor(233, 207, 130);
  58. [moneyIMG addSubview:titleJJJ];
  59. [titleJJJ mas_makeConstraints:^(MASConstraintMaker *make) {
  60. make.top.mas_equalTo(22);
  61. make.centerX.mas_equalTo(moneyIMG.mas_centerX);
  62. }];
  63. UILabel *moneyLL2= [[UILabel alloc]init];
  64. moneyLL2.text=@"0";
  65. moneyLL2.font=[UIFont systemFontOfSize:64 weight:UIFontWeightMedium];
  66. moneyLL2.textColor=kRGBColor(233, 207, 130);
  67. [moneyIMG addSubview:moneyLL2];
  68. self.moneyLL2=moneyLL2;
  69. [moneyLL2 mas_makeConstraints:^(MASConstraintMaker *make) {
  70. make.top.mas_equalTo(42);
  71. make.centerX.mas_equalTo(moneyIMG.mas_centerX);
  72. }];
  73. UIButton *rightImg= [[UIButton alloc]init];
  74. [rightImg setBackgroundImage:[UIImage imageNamed:@"jyj点击领取按钮"] forState:UIControlStateNormal];
  75. rightImg.showsTouchWhenHighlighted=YES;
  76. [rightImg addTarget:self action:@selector(lefIMGClick) forControlEvents:UIControlEventTouchUpInside];
  77. [backIMG addSubview:rightImg];
  78. self.rightImg=rightImg;
  79. [rightImg mas_makeConstraints:^(MASConstraintMaker *make) {
  80. make.bottom.mas_equalTo(-JX_SCREEN_TOP);
  81. make.centerX.mas_equalTo(backIMG.mas_centerX);
  82. }];
  83. [g_notify addObserver:self selector:@selector(backMoney) name:@"comeBack" object:nil];
  84. }
  85. - (void)viewWillAppear:(BOOL)animated{
  86. [super viewWillAppear:animated];
  87. long time = (long)[[NSDate date] timeIntervalSince1970];
  88. time = (time *1000 + g_server.timeDifference);
  89. NSString *salt = [NSString stringWithFormat:@"%ld", time];
  90. NSString *membership=[[NSUserDefaults standardUserDefaults] objectForKey:@"membershipAccount_ID"];
  91. [g_server getact_reliefgetMyRelief:salt membershipAccount:membership toView:self];
  92. [g_notify addObserver:self selector:@selector(tongyong) name:@"tongyong" object:nil];
  93. }
  94. //通用弹框
  95. - (void)tongyong{
  96. JXhelpMoneyView *show=[[JXhelpMoneyView alloc]init];
  97. show.backgroundColor=[UIColor colorWithWhite:0.0 alpha:0.7];
  98. show.frame=[UIScreen mainScreen].bounds;
  99. //show.subtitle.text = self.moneyLL2.text;
  100. show.strURL=self.moneyLL2.text;
  101. [[UIApplication sharedApplication].keyWindow addSubview:show];
  102. }
  103. //立即领取
  104. - (void)lefIMGClick{
  105. [JXMoneyShareView showView];
  106. }
  107. -(void)backMoney{
  108. // long time = (long)[[NSDate date] timeIntervalSince1970];
  109. // time = (time *1000 + g_server.timeDifference);
  110. // NSString *salt = [NSString stringWithFormat:@"%ld", time];
  111. //
  112. // NSString *membership=[[NSUserDefaults standardUserDefaults] objectForKey:@"membershipAccount_ID"];
  113. //
  114. // [g_server getUser:salt membershipAccount:membership toView:self];
  115. //
  116. //}
  117. //
  118. //- (void)shareMoney:(NSString *)strMoney{
  119. JXMessageObject *msg=[[JXMessageObject alloc] init];
  120. msg.type = [NSNumber numberWithInt:kWCMessageTypeText];
  121. // msg.toUserId = _user.userId;
  122. msg.fromUserId = MY_USER_ID;
  123. msg.fromUserName = g_server.myself.userNickname;
  124. msg.content = [NSString stringWithFormat:@"我刚刚领取了%@元转运金,赶紧去领取!===jixin%@",self.moneyLL2.text,@"JXLuckRescueFundVc"];
  125. msg.timeSend = [NSDate date];
  126. JXRelayVC * relay = [[JXRelayVC alloc] init];
  127. NSMutableArray *array = [NSMutableArray arrayWithObject:msg];
  128. relay.relayMsgArray = array;
  129. relay.yunGetMoney=self.moneyLL2.text;
  130. relay.isUrl = NO;
  131. relay.yunMoney=@"10";
  132. relay.pushType = @"messageContent";
  133. [g_navigation pushViewController:relay animated:YES];
  134. }
  135. -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
  136. //更新本地好友
  137. if ([aDownload.action isEqualToString:act_reliefgetMyRelief]) {
  138. self.moneyLL2.text=[NSString stringWithFormat:@"%@",dict[@"amount"]];
  139. if ([dict[@"amount"] intValue]<=0) {
  140. self.rightImg.userInteractionEnabled=NO;
  141. [self.rightImg setImage:[UIImage imageNamed:@"灰色按钮"] forState:UIControlStateNormal];
  142. self.rightImg.alpha=0.5;
  143. _titleIMG22.hidden = YES;
  144. // [SVProgressHUD showWithStatus:@"暂无可领取的转运金,如有疑问,及时联系在线客服进行处理"];
  145. // [SVProgressHUD dismissWithDelay:2.0];
  146. }else {
  147. _titleIMG22.hidden = NO;
  148. }
  149. }
  150. if ([aDownload.action isEqualToString:act_reliefReceiveRelief]) {
  151. // [self shareMoney:self.moneyLL2.text];
  152. // [SVProgressHUD showWithStatus:@"领取成功"];
  153. // [SVProgressHUD dismissWithDelay:1.0];
  154. // [JXMoneyShareView showView];
  155. // [g_navigation dismissViewController:self animated:NO];
  156. }
  157. }
  158. -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{
  159. NSString * errorCode = [NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]];
  160. if ([aDownload.action isEqualToString:act_reliefReceiveRelief]) {
  161. //[SVProgressHUD showWithStatus:errorCode];
  162. //[SVProgressHUD dismissWithDelay:1.0];
  163. }
  164. self.moneyLL2.text=[NSString stringWithFormat:@"%@",@"0"];
  165. return 1;
  166. }
  167. @end