diff --git a/campus-modular/src/main/java/com/oddfar/campus/business/service/IMTService.java b/campus-modular/src/main/java/com/oddfar/campus/business/service/IMTService.java index 8cd91f8..caa4898 100644 --- a/campus-modular/src/main/java/com/oddfar/campus/business/service/IMTService.java +++ b/campus-modular/src/main/java/com/oddfar/campus/business/service/IMTService.java @@ -65,4 +65,12 @@ public interface IMTService { * 刷新版本号,预约item,门店shop列表, */ void refreshAll(); + + /** + * 每日预约申购结果 + */ + void appointmentResults(); + + + } diff --git a/campus-modular/src/main/java/com/oddfar/campus/business/service/impl/IMTServiceImpl.java b/campus-modular/src/main/java/com/oddfar/campus/business/service/impl/IMTServiceImpl.java index c167081..5e5db73 100644 --- a/campus-modular/src/main/java/com/oddfar/campus/business/service/impl/IMTServiceImpl.java +++ b/campus-modular/src/main/java/com/oddfar/campus/business/service/impl/IMTServiceImpl.java @@ -1,6 +1,7 @@ package com.oddfar.campus.business.service.impl; import cn.hutool.core.convert.Convert; +import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUtil; import cn.hutool.crypto.Mode; import cn.hutool.crypto.Padding; @@ -456,6 +457,40 @@ public void refreshAll() { iShopService.refreshItem(); } + @Override + public void appointmentResults() { + logger.info("申购结果查询开始========================="); + List iUsers = iUserService.selectReservationUser(); + for (IUser iUser : iUsers) { + try { + String url = "https://app.moutai519.com.cn/xhr/front/mall/reservation/list/pageOne/query"; + String body = HttpUtil.createRequest(Method.GET, url) + .header("MT-Device-ID", iUser.getDeviceId()) + .header("MT-APP-Version", getMTVersion()) + .header("MT-Token", iUser.getToken()) + .header("User-Agent", "iOS;16.3;Apple;?unrecognized?").execute().body(); + JSONObject jsonObject = JSONObject.parseObject(body); + if (jsonObject.getInteger("code") != 2000) { + String message = jsonObject.getString("message"); + throw new ServiceException(message); + } + for (Object itemVOs : jsonObject.getJSONObject("data").getJSONArray("reservationItemVOS")) { + JSONObject item = JSON.parseObject(itemVOs.toString()); + // 预约时间在24小时内的 + if (item.getInteger("status") == 2 && DateUtil.between(item.getDate("reservationTime"), new Date(), DateUnit.HOUR) < 24) { + String logContent = DateUtil.formatDate(item.getDate("reservationTime")) + " 申购" + item.getString("itemName") + "成功"; + IMTLogFactory.reservation(iUser, logContent); + } + + } + } catch (Exception e) { + logger.error("查询申购结果失败:失败原因{}", e.getMessage()); + } + + } + logger.info("申购结果查询结束========================="); + } + public JSONObject reservation(IUser iUser, String itemId, String shopId) { Map map = new HashMap<>(); JSONArray itemArray = new JSONArray(); diff --git a/campus-modular/src/main/java/com/oddfar/campus/business/task/CampusIMTTask.java b/campus-modular/src/main/java/com/oddfar/campus/business/task/CampusIMTTask.java index 974d17d..f59eb3f 100644 --- a/campus-modular/src/main/java/com/oddfar/campus/business/task/CampusIMTTask.java +++ b/campus-modular/src/main/java/com/oddfar/campus/business/task/CampusIMTTask.java @@ -68,4 +68,14 @@ public void refresh() { } + /** + * 18.05分获取申购结果 + */ + @Async + @Scheduled(cron = "0 5 18 ? * * ") + public void appointmentResults() { + imtService.appointmentResults(); + } + + } \ No newline at end of file diff --git a/vue_campus_admin/src/views/imt/user/index.vue b/vue_campus_admin/src/views/imt/user/index.vue index 0a6aa41..336ef28 100644 --- a/vue_campus_admin/src/views/imt/user/index.vue +++ b/vue_campus_admin/src/views/imt/user/index.vue @@ -260,6 +260,14 @@ @click="handleUpdate(scope.row)" >修改 + + 刷新token +
- 发送验证码 + 发送验证码({{ stateNum }}) +
@@ -462,6 +473,39 @@ 取 消 + + + + + +
+ 发送验证码({{ stateNum }}) + +
+
+ + + + +
+ +
@@ -506,6 +550,10 @@ export default { // 是否显示弹出层 open: false, openUser: false, + refreshToken: false, + // 发送短信按钮倒计时 + state: false, + stateNum: 60, // 查询参数 queryParams: { pageNum: 1, @@ -590,6 +638,7 @@ export default { cancel() { this.open = false; this.openUser = false; + this.refreshToken = false; this.reset(); }, // 表单重置 @@ -706,20 +755,23 @@ export default { }); }, //发生验证码 - sendCode(mobile) { - this.form.deviceId = this.guid(); + sendCode(mobile, deviceId) { + this.form.deviceId = deviceId == "" ? this.guid() : deviceId; sendCode(mobile, this.form.deviceId).then((response) => { this.$modal.msgSuccess("发送成功"); + this.state = true; + let timer = setInterval(() => { + this.stateNum--; + if (this.stateNum === 0) { + clearInterval(timer); + this.state = false; + } + }, 1000); }); }, //登录 login(mobile, code) { - login(mobile, code, this.form.deviceId).then((response) => { - this.$modal.msgSuccess("登录成功"); - this.open = false; - this.openUser = false; - this.getList(); - }); + this.refresh(mobile, code, this.form.deviceId, 0) }, /** 删除按钮操作 */ handleDelete(row) { @@ -735,6 +787,23 @@ export default { }) .catch(() => {}); }, + refresh(mobile, code, deviceId, status) { + const msg = status ? "刷新成功" : "登录成功"; + login(mobile, code, deviceId).then((response) => { + this.$modal.msgSuccess(msg); + this.open = false; + this.openUser = false; + this.getList(); + }); + }, + handleUpdateToken(row) { + this.refreshToken = true; + this.form = { + mobile: row.mobile, + deviceId: row.deviceId, + }; + this.title = "刷新用户:" + row.remark + "(" + row.mobile + ")登录信息"; + }, }, };