JXGoldMangVc.m 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. //
  2. // JXGoldMangVc.m
  3. // shiku_im
  4. //
  5. // Created by 123 on 2020/6/14.
  6. // Copyright © 2020 Reese. All rights reserved.
  7. //
  8. #import "JXGoldMangVc.h"
  9. #import "JXGoldShareView.h"
  10. #import "JXRelayVC.h"
  11. #import "JXALLShowView.h"
  12. @interface JXGoldMangVc ()
  13. @property (weak, nonatomic) IBOutlet UIImageView *headIMG;
  14. @property (weak, nonatomic) IBOutlet UILabel *userName;
  15. @property (weak, nonatomic) IBOutlet UILabel *levelL;
  16. @property (weak, nonatomic) IBOutlet UILabel *keLinL;
  17. @property (weak, nonatomic) IBOutlet UILabel *lijL;
  18. @property (weak, nonatomic) IBOutlet UILabel *weekFL;
  19. @property (weak, nonatomic) IBOutlet UILabel *monthFL;
  20. //下一级
  21. @property (weak, nonatomic) IBOutlet UILabel *moneyL;
  22. @property (weak, nonatomic) IBOutlet UILabel *nextJijiL;
  23. @property (weak, nonatomic) IBOutlet UILabel *weekFL2;
  24. @property (weak, nonatomic) IBOutlet UILabel *monthFL2;
  25. @property (weak, nonatomic) IBOutlet UIButton *nowLIngBtn;
  26. @property (strong, nonatomic) IBOutlet UIView *whiteBackView;
  27. @end
  28. @implementation JXGoldMangVc
  29. - (IBAction)gback:(id)sender {
  30. [g_navigation dismissViewController:self animated:self];
  31. }
  32. - (void)createUI{
  33. UIScrollView *scrollView=[[UIScrollView alloc]init];
  34. scrollView.backgroundColor=[UIColor greenColor];
  35. [_whiteBackView addSubview:scrollView];
  36. [scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.left.right.mas_equalTo(0);
  38. make.top.mas_equalTo(0);
  39. make.bottom.mas_equalTo(0);
  40. }];
  41. UIImageView * banner1 = [[UIImageView alloc]init];
  42. banner1.image = [UIImage imageNamed:@"title-bg"];
  43. [scrollView addSubview:banner1];
  44. [banner1 mas_makeConstraints:^(MASConstraintMaker *make) {
  45. make.left.right.mas_equalTo(0);
  46. make.top.mas_equalTo(0);
  47. }];
  48. UILabel * userName = [[UILabel alloc]init];
  49. userName.text = @"小飞飞";
  50. [banner1 addSubview:userName];
  51. [userName mas_makeConstraints:^(MASConstraintMaker *make) {
  52. make.left.mas_equalTo(20); ;
  53. make.bottom.mas_equalTo(-20);
  54. }];
  55. UIImageView * headIMG = [[UIImageView alloc]init];
  56. headIMG.image = [UIImage imageNamed:@"组11"];
  57. [banner1 addSubview:headIMG];
  58. [headIMG mas_makeConstraints:^(MASConstraintMaker *make) {
  59. make.centerX.mas_equalTo(userName.mas_centerX);
  60. make.bottom.mas_equalTo(userName.mas_top).mas_offset(-20);
  61. }];
  62. UIImageView * topIMGLine = [[UIImageView alloc]init];
  63. topIMGLine.image = [UIImage imageNamed:@"jgjHui"];
  64. [scrollView addSubview:topIMGLine];
  65. [topIMGLine mas_makeConstraints:^(MASConstraintMaker *make) {
  66. make.centerX.mas_equalTo(userName.mas_centerX);
  67. make.bottom.mas_equalTo(userName.mas_top).mas_offset(-20);
  68. }];
  69. }
  70. - (void)viewDidLoad {
  71. [super viewDidLoad];
  72. _headIMG.layer.cornerRadius=30;
  73. _headIMG.layer.masksToBounds=YES;
  74. [g_server getHeadImageSmall:g_server.myself.userId userName:g_server.myself.userNickname imageView:self.headIMG];
  75. self.userName.text=g_myself.userNickname;
  76. if (JX_SCREEN_WIDTH>=414){
  77. return;
  78. }
  79. UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc]
  80. initWithTarget:self
  81. action:@selector(foundSwipe:)];
  82. //设置识别滑动方向
  83. recognizer.direction =UISwipeGestureRecognizerDirectionUp;
  84. //Swipe手势识别器关联到View
  85. [_whiteBackView addGestureRecognizer:recognizer];
  86. UISwipeGestureRecognizer *recognizer2 = [[UISwipeGestureRecognizer alloc]
  87. initWithTarget:self
  88. action:@selector(foundSwipe2:)];
  89. recognizer2.direction =UISwipeGestureRecognizerDirectionDown;
  90. [_whiteBackView addGestureRecognizer:recognizer2];
  91. }
  92. - (void)foundSwipe2:(UISwipeGestureRecognizer *)sender {
  93. //设置识别滑动方向
  94. sender.direction =UISwipeGestureRecognizerDirectionDown;
  95. //Swipe手势识别器关联到View
  96. [self.view addGestureRecognizer:sender];
  97. CGRect bounds=self.view.bounds;
  98. bounds.origin.y=0;
  99. _whiteBackView.bounds=bounds;
  100. }
  101. - (void)foundSwipe:(UISwipeGestureRecognizer *)sender {
  102. CGRect bounds=_whiteBackView.bounds;
  103. bounds.origin.y=110;
  104. _whiteBackView.bounds=bounds;
  105. }
  106. - (void)viewWillAppear:(BOOL)animated{
  107. [super viewWillAppear:animated];
  108. long time = (long)[[NSDate date] timeIntervalSince1970];
  109. time = (time *1000 + g_server.timeDifference);
  110. NSString *salt = [NSString stringWithFormat:@"%ld", time];
  111. [g_server Useract_act_VipConfigGoldMag:salt andToView:self];
  112. //[g_server getUserVipact_GainUserGoldMang:salt andToView:self];
  113. [g_server getUserVipInformation:salt andToView:self];
  114. [g_notify addObserver:self selector:@selector(goldNoti) name:@"goldShare" object:nil];
  115. [g_notify addObserver:self selector:@selector(tongyong) name:@"tongyong" object:nil];
  116. }
  117. //通用弹框
  118. - (void)tongyong{
  119. _nameStr=@"ssss";
  120. long time = (long)[[NSDate date] timeIntervalSince1970];
  121. time = (time *1000 + g_server.timeDifference);
  122. NSString *salt = [NSString stringWithFormat:@"%ld", time];
  123. [g_server Useract_act_VipConfigGoldMag:salt andToView:self];
  124. // [g_server act_UsergoldMangerHistory:salt andToView:self];
  125. }
  126. -(void)goldNoti{
  127. JXMessageObject *msg=[[JXMessageObject alloc] init];
  128. msg.type = [NSNumber numberWithInt:kWCMessageTypeText];
  129. // msg.toUserId = _user.userId;
  130. msg.fromUserId = MY_USER_ID;
  131. msg.fromUserName = g_server.myself.userNickname;
  132. msg.content = [NSString stringWithFormat:@"我刚刚在金管家领取%d元 周礼金,点击查看我的礼金",1];
  133. msg.timeSend = [NSDate date];
  134. JXRelayVC * relay = [[JXRelayVC alloc] init];
  135. NSMutableArray *array = [NSMutableArray arrayWithObject:msg];
  136. relay.relayMsgArray = array;
  137. relay.isUrl = NO;
  138. relay.yunMoney=@"20";
  139. relay.yunGetMoney=self.weekFL.text;
  140. relay.pushType = @"messageContent";
  141. [g_navigation pushViewController:relay animated:YES];
  142. }
  143. /**立即领取*/
  144. - (IBAction)nowLinQBtn:(id)sender {
  145. [JXGoldShareView showView];
  146. }
  147. -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
  148. [SVProgressHUD dismiss];
  149. NSLog(@"金管家 :  %@",dict);
  150. if([aDownload.action isEqualToString:act_GetUserVipInformation])
  151. {
  152. NSDictionary * currentDictionary = [dict objectForKey:@"current"];
  153. self.levelL.text=[NSString stringWithFormat:@"%@",currentDictionary[@"level"]];
  154. self.keLinL.text=[NSString stringWithFormat:@"%@",currentDictionary[@"money"]];
  155. self.lijL.text=[NSString stringWithFormat:@"%@",currentDictionary[@"upgradeCoin"]];
  156. NSString *weeekStr= [NSString stringWithFormat:@"%@",currentDictionary[@"weekRedPackageCoin"]];
  157. self.weekFL.text=weeekStr;
  158. self.monthFL.text=[NSString stringWithFormat:@"%@",currentDictionary[@"monthRedPackageCoin"]];
  159. NSDictionary * nextDictionary = [dict objectForKey:@"next"];
  160. int nexMoney=[nextDictionary[@"money"] intValue];
  161. int totalRecharge= [dict[@"totalRecharge"] intValue];
  162. self.moneyL.text=[NSString stringWithFormat:@"%d",totalRecharge-nexMoney];
  163. self.nextJijiL.text=[NSString stringWithFormat:@"%@",nextDictionary[@"upgradeCoin"]];
  164. self.weekFL2.text=[NSString stringWithFormat:@"%@",nextDictionary[@"weekRedPackageCoin"]];
  165. self.monthFL2.text=[NSString stringWithFormat:@"%@",nextDictionary[@"monthRedPackageCoin"]];
  166. if ([weeekStr floatValue]<=0) {
  167. self.nowLIngBtn.alpha=0.5;
  168. self.nowLIngBtn.userInteractionEnabled=NO;
  169. }
  170. if (_nameStr.length>0) {
  171. NSArray *statustr=currentDictionary[@"upgradeAward"];
  172. NSString *statusValue=@"";
  173. if ([[statustr lastObject] intValue]==-1) {
  174. statusValue=@" 很遗憾,您本周奖励领取失败,请联系在线客服咨询!";
  175. }
  176. if ([[statustr lastObject] intValue]==0) {
  177. statusValue=@" 本活动奖励仅限每周三中午12点开放领取!";
  178. }
  179. if ([[statustr lastObject] intValue]==1) {//审核中
  180. statusValue=@" 您已经成功提交奖励申请,请耐心等待。如有疑问请咨询在线客服!";
  181. } if ([[statustr lastObject] intValue]==2) {//已完成
  182. statusValue=@"恭喜您已经成功领取,请前往账户中心查看余额。如果长时间未到账,请联系在线客服!";
  183. }
  184. JXALLShowView *show=[[JXALLShowView alloc]init];
  185. show.backgroundColor=[UIColor colorWithWhite:0.0 alpha:0.2];
  186. show.frame=[UIScreen mainScreen].bounds;
  187. show.nameStr=statusValue;
  188. [[UIApplication sharedApplication].keyWindow addSubview:show];
  189. }
  190. }
  191. else if([aDownload.action isEqualToString:act_GainUserCoin])
  192. {
  193. }
  194. }
  195. -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{
  196. [SVProgressHUD dismiss];
  197. NSString * errorCode = [NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]];
  198. if([errorCode isEqualToString:@"权限验证失败"])
  199. {
  200. }
  201. else
  202. {
  203. [SVProgressHUD showErrorWithStatus:[NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]]];
  204. }
  205. return hide_error;
  206. }
  207. @end