()
| 35 | private int reasonId = 1; |
| 36 | |
| 37 | @Override |
| 38 | public void run() { |
| 39 | Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+8")); |
| 40 | int day = cal.get(Calendar.DATE); |
| 41 | |
| 42 | /* |
| 43 | 根据userInfo.getVipStatus() ,如果是1 ,会员有效,0会员失效。 |
| 44 | @JunzhouLiu: fixed query_vipStatusType()现在可以查询会员状态,以及会员类型了 2020-10-15 |
| 45 | */ |
| 46 | int vipType = queryVipStatusType(); |
| 47 | |
| 48 | if (vipType == 0) { |
| 49 | log.info("非大会员,跳过领取大会员权益"); |
| 50 | return; |
| 51 | } |
| 52 | |
| 53 | if (vipType == 1 && day == 1) { |
| 54 | log.info("开始领取大会员漫画权益"); |
| 55 | Map<String, Object> map = new HashMap<>(1); |
| 56 | map.put("reason_id", reasonId); |
| 57 | JsonObject jsonObject = HttpUtils.doPost(ApiList.MANGA_GET_VIP_REWARD, GsonUtils.toJson(map)); |
| 58 | if (jsonObject.get(STATUS_CODE_STR).getAsInt() == 0) { |
| 59 | /* |
| 60 | @happy888888:好像也可以getAsString或,getAsShort |
| 61 | @JunzhouLiu:Int比较好判断 |
| 62 | */ |
| 63 | int num = jsonObject.get("data").getAsJsonObject().get("amount").getAsInt(); |
| 64 | log.info("大会员成功领取{}张漫读劵", num); |
| 65 | } else { |
| 66 | log.info("大会员领取漫读劵失败,原因为:{}", jsonObject.get("msg").getAsString()); |
| 67 | } |
| 68 | } else { |
| 69 | log.info("本日非领取大会员漫画执行日期"); |
| 70 | } |
| 71 | |
| 72 | if (day == 1 || day % 3 == 0) { |
| 73 | if (vipType == 2) { |
| 74 | log.info("开始领取年度大会员权益"); |
| 75 | OftenApi.getVipPrivilege(1); |
| 76 | OftenApi.getVipPrivilege(2); |
| 77 | } |
| 78 | } else { |
| 79 | log.info("本日非领取年度大会员权益执行日期"); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | @Override |
| 84 | public String getName() { |
nothing calls this directly
no test coverage detected