JXGoldMangerVc.m 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  1. //
  2. // JXGoldMangerVc.m
  3. // shiku_im
  4. //
  5. // Created by os on 2020/6/26.
  6. // Copyright © 2020 Reese. All rights reserved.
  7. //
  8. #import "JXGoldMangerVc.h"
  9. #import "JXRelayVC.h"
  10. #import "JXGoldShareView.h"
  11. #import "JXALLShowView.h"
  12. @interface JXGoldMangerVc ()
  13. @property (nonatomic,copy) NSString *nameStr;
  14. @property (weak, nonatomic) UILabel *levelL;
  15. @property (weak, nonatomic) UILabel *keLinL;
  16. @property (weak, nonatomic) UILabel *lijL;
  17. @property (weak, nonatomic) UILabel *weekFL;
  18. @property (weak, nonatomic) UILabel *monthFL;
  19. //下一级
  20. @property (weak, nonatomic) UILabel *moneyL;
  21. @property (weak, nonatomic) UILabel *nextJijiL;
  22. @property (weak, nonatomic) UILabel *weekFL2;
  23. @property (weak, nonatomic) UILabel *monthFL2;
  24. @property (weak, nonatomic) UIButton *nowLIngBtn;
  25. @property (strong, nonatomic) UIView *whiteBackView;
  26. @property (strong, nonatomic) UIView *scrollView;
  27. @property (strong, nonatomic) UIImageView * topIMGLine;
  28. @end
  29. @implementation JXGoldMangerVc
  30. - (void)viewDidLoad {
  31. [super viewDidLoad];
  32. _vipDict=[NSDictionary dictionary];
  33. _scrollView=[[UIView alloc]init];
  34. _scrollView.backgroundColor=[UIColor whiteColor];
  35. [self.view addSubview:_scrollView];
  36. [_scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.left.right.mas_equalTo(0);
  38. make.top.mas_equalTo(JX_SCREEN_TOP);
  39. make.bottom.mas_equalTo(0);
  40. }];
  41. [self createHeadUI];
  42. [self createUI];
  43. [self prepareFor];
  44. UIButton * nowLIngBtn = [[UIButton alloc]init];
  45. [nowLIngBtn setBackgroundImage:[UIImage imageNamed:@"jgj立即领取"] forState:UIControlStateNormal];
  46. [self.view addSubview:nowLIngBtn];
  47. [nowLIngBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  48. make.left.right.mas_equalTo(0);
  49. make.bottom.mas_equalTo(0);
  50. }];
  51. [nowLIngBtn addTarget:self action:@selector(nowLIngBtnclick) forControlEvents:UIControlEventTouchUpInside];
  52. if (JX_SCREEN_WIDTH>=414){
  53. return;
  54. }
  55. UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc]
  56. initWithTarget:self
  57. action:@selector(foundSwipe:)];
  58. //设置识别滑动方向
  59. recognizer.direction =UISwipeGestureRecognizerDirectionUp;
  60. //Swipe手势识别器关联到View
  61. [_scrollView addGestureRecognizer:recognizer];
  62. UISwipeGestureRecognizer *recognizer2 = [[UISwipeGestureRecognizer alloc]
  63. initWithTarget:self
  64. action:@selector(foundSwipe2:)];
  65. recognizer2.direction =UISwipeGestureRecognizerDirectionDown;
  66. [_scrollView addGestureRecognizer:recognizer2];
  67. }
  68. - (void)foundSwipe2:(UISwipeGestureRecognizer *)sender {
  69. //设置识别滑动方向
  70. sender.direction =UISwipeGestureRecognizerDirectionDown;
  71. //Swipe手势识别器关联到View
  72. [self.view addGestureRecognizer:sender];
  73. CGRect bounds=self.view.bounds;
  74. bounds.origin.y=0;
  75. _scrollView.bounds=bounds;
  76. }
  77. - (void)foundSwipe:(UISwipeGestureRecognizer *)sender {
  78. CGRect bounds=_scrollView.bounds;
  79. bounds.origin.y=110;
  80. _scrollView.bounds=bounds;
  81. }
  82. - (void)createHeadUI{
  83. UIImageView * banner1 = [[UIImageView alloc]init];
  84. banner1.image = [UIImage imageNamed:@"title-bg"];
  85. [_scrollView addSubview:banner1];
  86. [banner1 mas_makeConstraints:^(MASConstraintMaker *make) {
  87. make.left.right.mas_equalTo(0);
  88. make.top.mas_equalTo(0);
  89. }];
  90. UILabel * userName = [[UILabel alloc]init];
  91. userName.text = @"小飞飞";
  92. [banner1 addSubview:userName];
  93. userName.text=g_server.myself.userNickname;
  94. [userName mas_makeConstraints:^(MASConstraintMaker *make) {
  95. make.left.mas_equalTo(20); ;
  96. make.bottom.mas_equalTo(-20);
  97. }];
  98. UIImageView * headIMG = [[UIImageView alloc]init];
  99. headIMG.image = [UIImage imageNamed:@"组11"];
  100. [banner1 addSubview:headIMG];
  101. [headIMG mas_makeConstraints:^(MASConstraintMaker *make) {
  102. make.centerX.mas_equalTo(userName.mas_centerX);
  103. make.bottom.mas_equalTo(userName.mas_top).mas_offset(-11);
  104. make.width.mas_equalTo(50);
  105. make.height.mas_equalTo(50);
  106. }];
  107. headIMG.layer.cornerRadius=25;
  108. headIMG.layer.masksToBounds=YES;
  109. [g_server getHeadImageSmall:g_server.myself.userId userName:g_server.myself.userNickname imageView:headIMG];
  110. userName.text=g_myself.userNickname;
  111. UIImageView * topIMGLine = [[UIImageView alloc]init];
  112. topIMGLine.image = [UIImage imageNamed:@"jgjHui"];
  113. [_scrollView addSubview:topIMGLine];
  114. self.topIMGLine=topIMGLine;
  115. [topIMGLine mas_makeConstraints:^(MASConstraintMaker *make) {
  116. make.top.mas_equalTo(banner1.mas_bottom);
  117. make.right.left.mas_equalTo(0);
  118. }];
  119. UILabel * leftLevelTitle = [[UILabel alloc]init];
  120. leftLevelTitle.text = @"目前等级";
  121. leftLevelTitle.font=[UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  122. leftLevelTitle.textColor=kRGBColor(36, 36, 36);
  123. leftLevelTitle.font=[UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  124. [topIMGLine addSubview:leftLevelTitle];
  125. [leftLevelTitle mas_makeConstraints:^(MASConstraintMaker *make) {
  126. make.left.mas_equalTo(20); ;
  127. make.top.mas_equalTo(15);
  128. }];
  129. UILabel * rightLevelTitle = [[UILabel alloc]init];
  130. rightLevelTitle.text = @"0级";
  131. rightLevelTitle.textColor=kRGBColor(36, 36, 36);
  132. rightLevelTitle.font=[UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
  133. [topIMGLine addSubview:rightLevelTitle];
  134. self.levelL=rightLevelTitle;
  135. [rightLevelTitle mas_makeConstraints:^(MASConstraintMaker *make) {
  136. make.right.mas_equalTo(-20); ;
  137. make.top.mas_equalTo(15);
  138. }];
  139. UIView * line_View = [[UILabel alloc]init];
  140. line_View.backgroundColor = [UIColor redColor];
  141. [topIMGLine addSubview:line_View];
  142. [line_View mas_makeConstraints:^(MASConstraintMaker *make) {
  143. make.left.mas_equalTo(20); ;
  144. make.right.mas_equalTo(-20);
  145. make.height.mas_equalTo(0.5);
  146. make.top.mas_equalTo(leftLevelTitle.mas_bottom).mas_offset(15);
  147. }];
  148. UILabel * rightLevelVaue = [[UILabel alloc]init];
  149. rightLevelVaue.text = @"本次领取";
  150. rightLevelVaue.textColor=kRGBColor(36, 36, 36);
  151. rightLevelVaue.font=[UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  152. [topIMGLine addSubview:rightLevelVaue];
  153. [rightLevelVaue mas_makeConstraints:^(MASConstraintMaker *make) {
  154. make.centerY.mas_equalTo(topIMGLine.mas_centerY).mas_offset(20);
  155. make.left.mas_equalTo(20);
  156. }];
  157. UILabel * keLinL = [[UILabel alloc]init];
  158. keLinL.text = @"0";
  159. keLinL.textColor=kRGBColor(36, 36, 36);
  160. keLinL.font=[UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
  161. [topIMGLine addSubview:keLinL];
  162. self.keLinL=keLinL;
  163. [keLinL mas_makeConstraints:^(MASConstraintMaker *make) {
  164. make.centerY.mas_equalTo(rightLevelVaue.mas_centerY).mas_offset(0);
  165. make.left.mas_equalTo(rightLevelVaue.mas_right).mas_offset(15);
  166. }];
  167. //晋级礼金
  168. UILabel * jinjiMoney = [[UILabel alloc]init];
  169. jinjiMoney.text = @"晋级礼金";
  170. jinjiMoney.textColor=kRGBColor(77, 77, 77);
  171. jinjiMoney.font=[UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  172. [topIMGLine addSubview:jinjiMoney];
  173. [jinjiMoney mas_makeConstraints:^(MASConstraintMaker *make) {
  174. make.centerX.mas_equalTo(topIMGLine.mas_centerX).mas_offset(20);
  175. make.top.mas_equalTo(line_View.mas_bottom).mas_offset(12);
  176. }];
  177. UILabel * weekMoney = [[UILabel alloc]init];
  178. weekMoney.text = @"周俸禄";
  179. weekMoney.textColor=kRGBColor(77, 77, 77);
  180. weekMoney.font=[UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  181. [topIMGLine addSubview:weekMoney];
  182. [weekMoney mas_makeConstraints:^(MASConstraintMaker *make) {
  183. make.centerX.mas_equalTo(topIMGLine.mas_centerX).mas_offset(20);
  184. make.top.mas_equalTo(jinjiMoney.mas_bottom).mas_offset(12);
  185. }];
  186. UILabel * monthMoney = [[UILabel alloc]init];
  187. monthMoney.text = @"月俸禄";
  188. monthMoney.textColor=kRGBColor(77, 77, 77);
  189. monthMoney.font=[UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  190. [topIMGLine addSubview:monthMoney];
  191. [monthMoney mas_makeConstraints:^(MASConstraintMaker *make) {
  192. make.centerX.mas_equalTo(topIMGLine.mas_centerX).mas_offset(20);
  193. make.top.mas_equalTo(weekMoney.mas_bottom).mas_offset(12);
  194. }];
  195. //值
  196. UILabel * jinjiMoneyValue = [[UILabel alloc]init];
  197. jinjiMoneyValue.text = @"0";
  198. jinjiMoneyValue.textColor=kRGBColor(77, 77, 77);
  199. jinjiMoneyValue.font=[UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  200. [topIMGLine addSubview:jinjiMoneyValue];
  201. self.lijL=jinjiMoneyValue;
  202. [jinjiMoneyValue mas_makeConstraints:^(MASConstraintMaker *make) {
  203. make.right.mas_equalTo(-20);
  204. make.top.mas_equalTo(line_View.mas_bottom).mas_offset(12);
  205. }];
  206. UILabel * weekMoneyValue = [[UILabel alloc]init];
  207. weekMoneyValue.text = @"0";
  208. weekMoneyValue.textColor=kRGBColor(77, 77, 77);
  209. weekMoneyValue.font=[UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  210. [topIMGLine addSubview:weekMoneyValue];
  211. self.weekFL=weekMoneyValue;
  212. [weekMoneyValue mas_makeConstraints:^(MASConstraintMaker *make) {
  213. make.right.mas_equalTo(-20);
  214. make.top.mas_equalTo(jinjiMoneyValue.mas_bottom).mas_offset(12);
  215. }];
  216. UILabel * monthFL = [[UILabel alloc]init];
  217. monthFL.text = @"0";
  218. monthFL.textColor=kRGBColor(77, 77, 77);
  219. monthFL.font=[UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  220. [topIMGLine addSubview:monthFL];
  221. self.monthFL=monthFL;
  222. [monthFL mas_makeConstraints:^(MASConstraintMaker *make) {
  223. make.right.mas_equalTo(-20);
  224. make.top.mas_equalTo(weekMoneyValue.mas_bottom).mas_offset(12);
  225. }];
  226. }
  227. - (void)createUI{
  228. UIImageView * topIMGLine2 = [[UIImageView alloc]init];
  229. topIMGLine2.image = [UIImage imageNamed:@"矩形27拷贝"];
  230. [_scrollView addSubview:topIMGLine2];
  231. [topIMGLine2 mas_makeConstraints:^(MASConstraintMaker *make) {
  232. make.top.mas_equalTo(_topIMGLine.mas_bottom).mas_offset(15);
  233. make.right.left.mas_equalTo(0);
  234. }];
  235. UILabel * leftLevelTitle2 = [[UILabel alloc]init];
  236. leftLevelTitle2.text = @"升级至下一级所需大码量";
  237. leftLevelTitle2.textColor=kRGBColor(36, 36, 36);
  238. //leftLevelTitle2.textColor=kRGBColor(222, 29, 19);
  239. leftLevelTitle2.font=[UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  240. [topIMGLine2 addSubview:leftLevelTitle2];
  241. [leftLevelTitle2 mas_makeConstraints:^(MASConstraintMaker *make) {
  242. make.left.mas_equalTo(20); ;
  243. make.top.mas_equalTo(20);
  244. }];
  245. UILabel * rightLevelTitle2 = [[UILabel alloc]init];
  246. rightLevelTitle2.text = @"0";
  247. [topIMGLine2 addSubview:rightLevelTitle2];
  248. self.moneyL=rightLevelTitle2;
  249. [rightLevelTitle2 mas_makeConstraints:^(MASConstraintMaker *make) {
  250. make.right.mas_equalTo(-20); ;
  251. make.top.mas_equalTo(20);
  252. }];
  253. UIView * line_View2 = [[UILabel alloc]init];
  254. line_View2.backgroundColor = [UIColor redColor];
  255. [topIMGLine2 addSubview:line_View2];
  256. [line_View2 mas_makeConstraints:^(MASConstraintMaker *make) {
  257. make.left.mas_equalTo(20); ;
  258. make.right.mas_equalTo(-20);
  259. make.height.mas_equalTo(0.5);
  260. make.top.mas_equalTo(leftLevelTitle2.mas_bottom).mas_offset(15);
  261. }];
  262. UILabel * rightLevelVaue2 = [[UILabel alloc]init];
  263. rightLevelVaue2.text = @"晋级礼金";
  264. rightLevelVaue2.textColor=kRGBColor(77, 77, 77);
  265. rightLevelVaue2.font=[UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  266. [topIMGLine2 addSubview:rightLevelVaue2];
  267. [rightLevelVaue2 mas_makeConstraints:^(MASConstraintMaker *make) {
  268. make.centerY.mas_equalTo(topIMGLine2.mas_centerY).mas_offset(20);
  269. make.left.mas_equalTo(20);
  270. }];
  271. UILabel * nextJijiL = [[UILabel alloc]init];
  272. nextJijiL.text = @"0";
  273. nextJijiL.textColor=kRGBColor(36, 36, 36);
  274. //nextJijiL.textColor=kRGBColor(222, 29, 19);
  275. nextJijiL.font=[UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
  276. [topIMGLine2 addSubview:nextJijiL];
  277. self.nextJijiL=nextJijiL;
  278. [nextJijiL mas_makeConstraints:^(MASConstraintMaker *make) {
  279. make.centerY.mas_equalTo(rightLevelVaue2.mas_centerY).mas_offset(0);
  280. make.left.mas_equalTo(rightLevelVaue2.mas_right).mas_offset(15);
  281. }];
  282. UILabel * weekFL2 = [[UILabel alloc]init];
  283. weekFL2.text = @"周俸禄";
  284. weekFL2.textColor=kRGBColor(77, 77, 77);
  285. weekFL2.font=[UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  286. [topIMGLine2 addSubview:weekFL2];
  287. [weekFL2 mas_makeConstraints:^(MASConstraintMaker *make) {
  288. make.centerX.mas_equalTo(topIMGLine2.mas_centerX).mas_offset(20);
  289. make.top.mas_equalTo(line_View2.mas_bottom).mas_offset(12);
  290. }];
  291. UILabel * monthFL2 = [[UILabel alloc]init];
  292. monthFL2.text = @"月俸禄";
  293. monthFL2.textColor=kRGBColor(77, 77, 77);
  294. monthFL2.font=[UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  295. [topIMGLine2 addSubview:monthFL2];
  296. [monthFL2 mas_makeConstraints:^(MASConstraintMaker *make) {
  297. make.centerX.mas_equalTo(topIMGLine2.mas_centerX).mas_offset(20);
  298. make.top.mas_equalTo(weekFL2.mas_bottom).mas_offset(12);
  299. }];
  300. //zhi
  301. UILabel * weekFL2Value = [[UILabel alloc]init];
  302. weekFL2Value.text = @"0";
  303. weekFL2Value.textColor=kRGBColor(77, 77, 77);
  304. weekFL2Value.font=[UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  305. [topIMGLine2 addSubview:weekFL2Value];
  306. self.weekFL2=weekFL2Value;
  307. [weekFL2Value mas_makeConstraints:^(MASConstraintMaker *make) {
  308. make.right.mas_equalTo(-20);
  309. make.top.mas_equalTo(line_View2.mas_bottom).mas_offset(12);
  310. }];
  311. UILabel * monthMoneyValue = [[UILabel alloc]init];
  312. monthMoneyValue.text = @"0";
  313. monthMoneyValue.textColor=kRGBColor(77, 77, 77);
  314. monthMoneyValue.font=[UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  315. [topIMGLine2 addSubview:monthMoneyValue];
  316. self.monthFL2=monthMoneyValue;
  317. [monthMoneyValue mas_makeConstraints:^(MASConstraintMaker *make) {
  318. make.right.mas_equalTo(-20);
  319. make.top.mas_equalTo(weekFL2Value.mas_bottom).mas_offset(12);
  320. }];
  321. }
  322. - (void)prepareFor{
  323. [self defineNavBar:@"吉利金管家" andRinghtBtnImg:@""];
  324. }
  325. - (void)viewWillAppear:(BOOL)animated{
  326. [super viewWillAppear:animated];
  327. long time = (long)[[NSDate date] timeIntervalSince1970];
  328. time = (time *1000 + g_server.timeDifference);
  329. // NSString *salt = [NSString stringWithFormat:@"%ld", time];
  330. // [SVProgressHUD show];
  331. [g_server getUserVipInformation:@"" andToView:self];
  332. // [g_server Useract_act_VipConfigGoldMag:salt andToView:self];
  333. [g_notify addObserver:self selector:@selector(goldNoti) name:@"goldShare" object:nil];
  334. [g_notify addObserver:self selector:@selector(tongyong) name:@"tongyong" object:nil];
  335. }
  336. //通用弹框 [g_server getUserVipact_GainUserGoldMang:salt andToView:self];
  337. - (void)tongyong{
  338. _nameStr=@"ssss";
  339. long time = (long)[[NSDate date] timeIntervalSince1970];
  340. time = (time *1000 + g_server.timeDifference);
  341. NSString *salt = [NSString stringWithFormat:@"%ld", time];
  342. [g_server Useract_act_VipConfigGoldMag:salt andToView:self];
  343. // [g_server act_UsergoldMangerHistory:salt andToView:self];
  344. }
  345. -(void)goldNoti{
  346. JXMessageObject *msg=[[JXMessageObject alloc] init];
  347. msg.type = [NSNumber numberWithInt:kWCMessageTypeText];
  348. // msg.toUserId = _user.userId;
  349. msg.fromUserId = MY_USER_ID;
  350. msg.fromUserName = g_server.myself.userNickname;
  351. msg.content = [NSString stringWithFormat:@"我刚刚在金管家领取%d元 周礼金,点击查看我的礼金",[_vipDict[@"totalMoney"] intValue]];
  352. msg.timeSend = [NSDate date];
  353. JXRelayVC * relay = [[JXRelayVC alloc] init];
  354. NSMutableArray *array = [NSMutableArray arrayWithObject:msg];
  355. relay.relayMsgArray = array;
  356. relay.isUrl = NO;
  357. relay.yunMoney=@"20";
  358. relay.yunGetMoney=self.weekFL.text;
  359. relay.pushType = @"messageContent";
  360. [g_navigation pushViewController:relay animated:YES];
  361. }
  362. /**立即领取*/
  363. - (void)nowLIngBtnclick {
  364. if ([_vipDict[@"state"] intValue]==2) {
  365. [JXGoldShareView showView];
  366. return;
  367. }else{
  368. JXALLShowView *show=[[JXALLShowView alloc]init];
  369. show.backgroundColor=[UIColor colorWithWhite:0.0 alpha:0.2];
  370. show.frame=[UIScreen mainScreen].bounds;
  371. int currentState = [_vipDict[@"state"] intValue];
  372. if (currentState>=0) {
  373. //有一个流程正在进行
  374. if (currentState == 0) {
  375. //审核中
  376. show.nameStr=@"您已经成功提交奖励申请,请耐心等待。\n如有疑问请咨询在线客服!";//_vipDict[@"notice"];
  377. } else if (currentState == 1) {
  378. //审核驳回提示
  379. show.nameStr=@"很遗憾,您本周奖励领取失败,请联系在线客服咨询!!";
  380. } else if (currentState == 2) {
  381. show.nameStr=[NSString stringWithFormat:@"我刚刚在金管家领取 %d 元 周礼金,点击查看我的礼金",[_vipDict[@"totalMoney"] intValue]];
  382. } else if (currentState == 5) {
  383. show.nameStr=[NSString stringWithFormat:@"您已经成功领取,请登录您的账户查看余额,如果长时间未到账,请联系在线客服!"];
  384. }else {
  385. //领取成功
  386. show.nameStr= @"恭喜您已经成功领取,请前往账户中心查看余额。\n如果长时间未到账,请联系在线客服!";
  387. }
  388. } else {
  389. if (currentState == -1) {
  390. //新的流程开始
  391. NSString *mydate=[self getCurrentTimeAndWeekDay];
  392. if ([mydate intValue]==[_vipDict[@"configWeek"] intValue]) {
  393. //可领取
  394. // [g_server getUserVipact_GainUserGoldMang:salt andToView:self]
  395. [JXGoldShareView showView];
  396. return;
  397. } else {
  398. int dataValue=[mydate intValue];
  399. NSString *week=@"";
  400. switch (dataValue) {
  401. case 1:
  402. {
  403. week = @"周日";
  404. break;
  405. } case 2:
  406. {
  407. week = @"周一";
  408. break;
  409. } case 3:
  410. {
  411. week = @"周二";
  412. break;
  413. } case 4:
  414. {
  415. week = @"周三";
  416. break;
  417. } case 5:
  418. {
  419. week = @"周四";
  420. break;
  421. } case 6:
  422. {
  423. week = @"周五";
  424. break;
  425. }case 7:
  426. {
  427. week = @"周六";
  428. break;
  429. }
  430. default:
  431. break;
  432. }
  433. show.nameStr= [NSString stringWithFormat:@"很抱歉,本活动仅限每周%d 中午12:00数据更新后开放领取",[_vipDict[@"configWeek"] intValue]-1];
  434. //不可领取
  435. }
  436. } else if (currentState == -2) {
  437. //金额为0,不可领取
  438. show.nameStr=@"可领金额为0,暂不支持领取!";
  439. }
  440. }
  441. [[UIApplication sharedApplication].keyWindow addSubview:show];
  442. }
  443. }
  444. //获取当前时间日期星期
  445. - (NSString *)getCurrentTimeAndWeekDay {
  446. NSArray * arrWeek=[NSArray arrayWithObjects:@"星期日",@"星期一",@"星期二",@"星期三",@"星期四",@"星期五",@"星期六", nil];
  447. NSDate *date = [NSDate date];
  448. /*
  449. NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
  450. */
  451. //ios 8.0 之后 不想看见警告用下面这个
  452. NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
  453. NSDateComponents *comps = [[NSDateComponents alloc] init];
  454. /*
  455. NSInteger unitFlags = NSYearCalendarUnit |
  456. NSMonthCalendarUnit |
  457. NSDayCalendarUnit |
  458. NSWeekdayCalendarUnit |
  459. NSHourCalendarUnit |
  460. NSMinuteCalendarUnit |
  461. NSSecondCalendarUnit;
  462. */
  463. //ios 8.0 之后 不想看见警告用下面这个
  464. NSInteger unitFlags = NSCalendarUnitYear |NSCalendarUnitMonth | NSCalendarUnitDay |NSCalendarUnitWeekday | NSCalendarUnitHour |NSCalendarUnitMinute |NSCalendarUnitSecond;
  465. comps = [calendar components:unitFlags fromDate:date];
  466. NSInteger week = [comps weekday];
  467. NSInteger year=[comps year];
  468. NSInteger month = [comps month];
  469. NSInteger day = [comps day];
  470. return [NSString stringWithFormat:@"%ld",(long)week];
  471. }
  472. -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
  473. [SVProgressHUD dismiss];
  474. NSLog(@"金管家 :  %@",dict);
  475. if([aDownload.action isEqualToString:act_GetUserVipInformation])
  476. {
  477. _vipDict=dict;
  478. NSDictionary * currentDictionary = [dict objectForKey:@"current"];
  479. self.levelL.text=[NSString stringWithFormat:@"%@级",currentDictionary[@"level"]];
  480. self.keLinL.text=[NSString stringWithFormat:@"%@",dict[@"totalMoney"]];
  481. self.lijL.text=[NSString stringWithFormat:@"%@",dict[@"upgradeCoinSum"]];
  482. NSString *weeekStr= [NSString stringWithFormat:@"%@",dict[@"weekMoney"]];
  483. self.weekFL.text=weeekStr;
  484. self.monthFL.text=[NSString stringWithFormat:@"%@",dict[@"monthMoney"]];
  485. NSDictionary * nextDictionary = [dict objectForKey:@"next"];
  486. int nexMoney=[nextDictionary[@"money"] intValue];
  487. int totalRecharge= [dict[@"totalRecharge"] intValue];
  488. self.moneyL.text=[NSString stringWithFormat:@"%d",nexMoney-totalRecharge];
  489. self.nextJijiL.text=[NSString stringWithFormat:@"%@",nextDictionary[@"upgradeCoin"]];
  490. self.weekFL2.text=[NSString stringWithFormat:@"%@",nextDictionary[@"weekRedPackageCoin"]];
  491. self.monthFL2.text=[NSString stringWithFormat:@"%@",nextDictionary[@"monthRedPackageCoin"]];
  492. int currentState = [_vipDict[@"state"] intValue];
  493. return;
  494. if (currentState >= 0) {
  495. JXALLShowView *show=[[JXALLShowView alloc]init];
  496. show.backgroundColor=[UIColor colorWithWhite:0.0 alpha:0.2];
  497. show.frame=[UIScreen mainScreen].bounds;
  498. //有一个流程正在进行
  499. if (currentState == 0) {
  500. //审核中
  501. show.nameStr=@"您已经成功提交奖励申请,请耐心等待。\n如有疑问请咨询在线客服!";//_vipDict[@"notice"];
  502. } else if (currentState == 1) {
  503. //审核驳回提示
  504. show.nameStr=@"很遗憾,您本周奖励领取失败,请联系在线客服咨询!!";
  505. } else if (currentState == 2) {
  506. //待分享
  507. [JXGoldShareView showView];
  508. // String content = "我刚刚在金管家领取" + vipInfoBean.getData().getTotalMoney() + "元 周礼金,点击查看我的礼金" + AppConstant.JINGUANJIA_TAG;
  509. } else if (currentState == 5) {
  510. //待派送
  511. show.nameStr=@"您已经成功提交奖励申请,请耐心等待。\n如有疑问请咨询在线客服!";
  512. } else {
  513. //领取成功
  514. show.nameStr=@"恭喜您已经成功领取,请前往账户中心查看余额。\n如果长时间未到账,请联系在线客服!";
  515. }
  516. [[UIApplication sharedApplication].keyWindow addSubview:show];
  517. }
  518. return;
  519. // if (_nameStr.length>0) {
  520. NSArray *statustr=currentDictionary[@"upgradeAward"];
  521. NSString *statusValue=@"";
  522. if ([[statustr lastObject] intValue]==-1) {// 未申请
  523. statusValue=@" 很遗憾,您本周奖励领取失败,请联系在线客服咨询!";
  524. }
  525. if ([[statustr lastObject] intValue]==0) { //审核中
  526. statusValue=@" 本活动奖励仅限每周三中午12点开放领取!";
  527. }
  528. if ([[statustr lastObject] intValue]==1) {//审核驳回
  529. statusValue=@" 您已经成功提交奖励申请,请耐心等待。如有疑问请咨询在线客服!";
  530. } if ([[statustr lastObject] intValue]==2) {//待分享
  531. statusValue=@"您已经成功领取,请登录您的账户查看余额,如果长时间未到账,请联系在线客服!";
  532. }if ([[statustr lastObject] intValue]==3) {//派送成功
  533. statusValue=@" 恭喜您审核通过了,请点击下方按钮“分享”,即可成功领取";
  534. }if ([[statustr lastObject] intValue]==4) {//派送驳回
  535. statusValue=@" 恭喜您审核通过了,请点击下方按钮“分享”,即可成功领取";
  536. }if ([[statustr lastObject] intValue]==5) {//待派送
  537. statusValue=@" 恭喜您审核通过了,请点击下方按钮“分享”,即可成功领取";
  538. }
  539. // }
  540. }
  541. else if([aDownload.action isEqualToString:act_GainUserCoin])
  542. {
  543. long time = (long)[[NSDate date] timeIntervalSince1970];
  544. time = (time *1000 + g_server.timeDifference);
  545. NSString *salt = [NSString stringWithFormat:@"%ld", time];
  546. [g_server getUserVipInformation:salt andToView:self];
  547. }
  548. }
  549. -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{
  550. [SVProgressHUD dismiss];
  551. NSString * errorCode = [NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]];
  552. if([errorCode isEqualToString:@"权限验证失败"])
  553. {
  554. [g_server getUserVipInformation:@"" andToView:self];
  555. }
  556. else
  557. {
  558. }
  559. // [SVProgressHUD showErrorWithStatus:[NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]]];
  560. return hide_error;
  561. }
  562. @end