JXGoldMangVc.m 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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. _vipDict=[NSDictionary dictionary];
  77. if (JX_SCREEN_WIDTH>=414){
  78. return;
  79. }
  80. UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc]
  81. initWithTarget:self
  82. action:@selector(foundSwipe:)];
  83. //设置识别滑动方向
  84. recognizer.direction =UISwipeGestureRecognizerDirectionUp;
  85. //Swipe手势识别器关联到View
  86. [_whiteBackView addGestureRecognizer:recognizer];
  87. UISwipeGestureRecognizer *recognizer2 = [[UISwipeGestureRecognizer alloc]
  88. initWithTarget:self
  89. action:@selector(foundSwipe2:)];
  90. recognizer2.direction =UISwipeGestureRecognizerDirectionDown;
  91. [_whiteBackView addGestureRecognizer:recognizer2];
  92. }
  93. - (void)foundSwipe2:(UISwipeGestureRecognizer *)sender {
  94. //设置识别滑动方向
  95. sender.direction =UISwipeGestureRecognizerDirectionDown;
  96. //Swipe手势识别器关联到View
  97. [self.view addGestureRecognizer:sender];
  98. CGRect bounds=self.view.bounds;
  99. bounds.origin.y=0;
  100. _whiteBackView.bounds=bounds;
  101. }
  102. - (void)foundSwipe:(UISwipeGestureRecognizer *)sender {
  103. CGRect bounds=_whiteBackView.bounds;
  104. bounds.origin.y=110;
  105. _whiteBackView.bounds=bounds;
  106. }
  107. - (void)viewWillAppear:(BOOL)animated{
  108. [super viewWillAppear:animated];
  109. long time = (long)[[NSDate date] timeIntervalSince1970];
  110. time = (time *1000 + g_server.timeDifference);
  111. NSString *salt = [NSString stringWithFormat:@"%ld", time];
  112. [g_server Useract_act_VipConfigGoldMag:salt andToView:self];
  113. //[g_server getUserVipact_GainUserGoldMang:salt andToView:self];
  114. [g_server getUserVipInformation:salt andToView:self];
  115. [g_notify addObserver:self selector:@selector(goldNoti) name:@"goldShare" object:nil];
  116. [g_notify addObserver:self selector:@selector(tongyong) name:@"tongyong" object:nil];
  117. }
  118. //通用弹框
  119. - (void)tongyong{
  120. _nameStr=@"ssss";
  121. long time = (long)[[NSDate date] timeIntervalSince1970];
  122. time = (time *1000 + g_server.timeDifference);
  123. NSString *salt = [NSString stringWithFormat:@"%ld", time];
  124. [g_server Useract_act_VipConfigGoldMag:salt andToView:self];
  125. // [g_server act_UsergoldMangerHistory:salt andToView:self];
  126. }
  127. -(void)goldNoti{
  128. JXMessageObject *msg=[[JXMessageObject alloc] init];
  129. msg.type = [NSNumber numberWithInt:kWCMessageTypeText];
  130. // msg.toUserId = _user.userId;
  131. msg.fromUserId = MY_USER_ID;
  132. msg.fromUserName = g_server.myself.userNickname;
  133. msg.content = [NSString stringWithFormat:@"我刚刚在金管家领取%d元 周礼金,点击查看我的礼金",1];
  134. msg.timeSend = [NSDate date];
  135. JXRelayVC * relay = [[JXRelayVC alloc] init];
  136. NSMutableArray *array = [NSMutableArray arrayWithObject:msg];
  137. relay.relayMsgArray = array;
  138. relay.isUrl = NO;
  139. relay.yunMoney=@"20";
  140. relay.yunGetMoney=self.weekFL.text;
  141. relay.pushType = @"messageContent";
  142. [g_navigation pushViewController:relay animated:YES];
  143. }
  144. /**立即领取*/
  145. - (IBAction)nowLinQBtn:(id)sender {
  146. [JXGoldShareView showView];
  147. }
  148. -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
  149. [SVProgressHUD dismiss];
  150. NSLog(@"金管家 :  %@",dict);
  151. if([aDownload.action isEqualToString:act_GetUserVipInformation])
  152. {
  153. _vipDict=dict;
  154. NSDictionary * currentDictionary = [dict objectForKey:@"current"];
  155. self.levelL.text=[NSString stringWithFormat:@"%@",currentDictionary[@"level"]];
  156. self.keLinL.text=[NSString stringWithFormat:@"%@",currentDictionary[@"money"]];
  157. self.lijL.text=[NSString stringWithFormat:@"%@",currentDictionary[@"upgradeCoin"]];
  158. NSString *weeekStr= [NSString stringWithFormat:@"%@",currentDictionary[@"weekRedPackageCoin"]];
  159. self.weekFL.text=weeekStr;
  160. self.monthFL.text=[NSString stringWithFormat:@"%@",currentDictionary[@"monthRedPackageCoin"]];
  161. NSDictionary * nextDictionary = [dict objectForKey:@"next"];
  162. int nexMoney=[nextDictionary[@"money"] intValue];
  163. int totalRecharge= [dict[@"totalRecharge"] intValue];
  164. self.moneyL.text=[NSString stringWithFormat:@"%d",totalRecharge-nexMoney];
  165. self.nextJijiL.text=[NSString stringWithFormat:@"%@",nextDictionary[@"upgradeCoin"]];
  166. self.weekFL2.text=[NSString stringWithFormat:@"%@",nextDictionary[@"weekRedPackageCoin"]];
  167. self.monthFL2.text=[NSString stringWithFormat:@"%@",nextDictionary[@"monthRedPackageCoin"]];
  168. return;
  169. if ([weeekStr floatValue]<=0) {
  170. self.nowLIngBtn.alpha=0.5;
  171. self.nowLIngBtn.userInteractionEnabled=NO;
  172. }
  173. if (_nameStr.length>0) {
  174. NSArray *statustr=currentDictionary[@"upgradeAward"];
  175. NSString *statusValue=@"";
  176. if ([[statustr lastObject] intValue]==-1) {
  177. statusValue=@" 很遗憾,您本周奖励领取失败,请联系在线客服咨询!";
  178. }
  179. if ([[statustr lastObject] intValue]==0) {
  180. statusValue=@" 本活动奖励仅限每周三中午12点开放领取!";
  181. }
  182. if ([[statustr lastObject] intValue]==1) {//审核中
  183. statusValue=@" 您已经成功提交奖励申请,请耐心等待。如有疑问请咨询在线客服!";
  184. } if ([[statustr lastObject] intValue]==2) {//已完成
  185. statusValue=@"恭喜您已经成功领取,请前往账户中心查看余额。如果长时间未到账,请联系在线客服!";
  186. }
  187. JXALLShowView *show=[[JXALLShowView alloc]init];
  188. show.backgroundColor=[UIColor colorWithWhite:0.0 alpha:0.2];
  189. show.frame=[UIScreen mainScreen].bounds;
  190. show.nameStr=statusValue;
  191. [[UIApplication sharedApplication].keyWindow addSubview:show];
  192. }
  193. }
  194. else if([aDownload.action isEqualToString:act_GainUserCoin])
  195. {
  196. }
  197. }
  198. -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{
  199. [SVProgressHUD dismiss];
  200. NSString * errorCode = [NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]];
  201. if([errorCode isEqualToString:@"权限验证失败"])
  202. {
  203. }
  204. else
  205. {
  206. [SVProgressHUD showErrorWithStatus:[NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]]];
  207. }
  208. return hide_error;
  209. }
  210. @end