diff --git a/src/main/java/com/yutou/qqbot/bilibili/BiliBiliManga.java b/src/main/java/com/yutou/qqbot/bilibili/BiliBiliManga.java index 918c755..fea9677 100644 --- a/src/main/java/com/yutou/qqbot/bilibili/BiliBiliManga.java +++ b/src/main/java/com/yutou/qqbot/bilibili/BiliBiliManga.java @@ -23,7 +23,7 @@ public class BiliBiliManga { } private static boolean isPayMission = false; - private static final Product missionProduct = new Product(); + private static Product missionProduct = new Product(); private static Timer mission = null; private final List anInterface = new ArrayList<>(); @@ -58,7 +58,7 @@ public class BiliBiliManga { return list; } - private int getMyPoint() { + public static int getMyPoint() { JSONObject user = BiliBiliUtils.http_post("https://manga.bilibili.com/twirp/pointshop.v1.Pointshop/GetUserPoint", ""); if (user != null && user.getInteger("code") == 0) { return user.getJSONObject("data").getInteger("point"); @@ -75,14 +75,14 @@ public class BiliBiliManga { } int userPoint = getMyPoint(); List list = getListProduct(); - Product item = null; + missionProduct = null; for (Product product : list) { if (product.getId() == id) { - item = product; + missionProduct = product; break; } } - if (item == null) { + if (missionProduct == null) { json.put("code", -1); json.put("msg", "未找到商品,可能id有误 id:" + id); return json; @@ -90,17 +90,17 @@ public class BiliBiliManga { if (num == -1) { num = 99999; } - int userPointNum = userPoint / item.getReal_cost(); + int userPointNum = userPoint / missionProduct.getReal_cost(); num = Math.min(num, userPointNum); - if (num < item.getRemain_amount()) { - num = item.getRemain_amount(); + if (num < missionProduct.getRemain_amount()) { + num = missionProduct.getRemain_amount(); } JSONObject data = new JSONObject(); data.put("product_id", id); data.put("product_num", num); - data.put("point", num * item.getReal_cost()); + data.put("point", num * missionProduct.getReal_cost()); startPayMission(data); isPayMission = true; @@ -109,7 +109,7 @@ public class BiliBiliManga { json.put("msg", "商品无货,正在抢购"); }else { json.put("code", 0); - json.put("msg", "任务创建成功:"+item+" 购买数量:"+num); + json.put("msg", "任务创建成功:"+missionProduct+" 购买数量:"+num); } return json; } diff --git a/src/main/java/com/yutou/qqbot/models/WebSign/BiliBiliMangeSign.java b/src/main/java/com/yutou/qqbot/models/WebSign/BiliBiliMangeSign.java index 0b26c71..5ef403e 100644 --- a/src/main/java/com/yutou/qqbot/models/WebSign/BiliBiliMangeSign.java +++ b/src/main/java/com/yutou/qqbot/models/WebSign/BiliBiliMangeSign.java @@ -49,6 +49,7 @@ public class BiliBiliMangeSign extends Model { QQBotManager.getInstance().sendMessage(qq, builder.toString()); return; } + builder.append("可用积分:").append(BiliBiliManga.getMyPoint()).append("\n"); builder.append("-------商城列表-------").append("\n"); for (BiliBiliManga.Product product : BiliBiliManga.getListProduct()) { builder.append(product).append("\n");