From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 25 二月 2025 16:41:22 +0800 Subject: [PATCH] 淘宝转链接口更新 --- fanli/src/main/java/com/yeshi/fanli/job/ShameUserInviteCodePublishJOB.java | 164 +++++++++++++++++++++++++++--------------------------- 1 files changed, 82 insertions(+), 82 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/job/ShameUserInviteCodePublishJOB.java b/fanli/src/main/java/com/yeshi/fanli/job/ShameUserInviteCodePublishJOB.java index f6d08f1..a2672ac 100644 --- a/fanli/src/main/java/com/yeshi/fanli/job/ShameUserInviteCodePublishJOB.java +++ b/fanli/src/main/java/com/yeshi/fanli/job/ShameUserInviteCodePublishJOB.java @@ -1,82 +1,82 @@ -package com.yeshi.fanli.job; - -import java.util.Date; -import java.util.List; - -import javax.annotation.Resource; - -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import com.yeshi.fanli.entity.bus.user.UserInfo; -import com.yeshi.fanli.entity.integral.CodePublishRecord; -import com.yeshi.fanli.service.inter.user.UserInfoService; -import com.yeshi.fanli.service.inter.user.integral.CodePublishRecordService; -import com.yeshi.fanli.util.Constant; -import com.yeshi.fanli.util.TimeUtil; - -/** - * 閭�璇风爜鍙戝竷 - * - * @author Administrator - * - */ -@Component -public class ShameUserInviteCodePublishJOB { - - @Resource - private UserInfoService userInfoService; - - @Resource - private CodePublishRecordService codePublishRecordService; - - // 7鐐瑰埌23鐐规瘡10鍒嗛挓鎵ц涓�娆� - @Scheduled(cron = "0 0/10 7-23 * * ? ") - public void publish() { - if (!Constant.IS_TASK) - return; - long time = System.currentTimeMillis(); - int day = TimeUtil.getDayDifferenceCount(new Date(TimeUtil.convertToTimeTemp("2019-11-28", "yyyy-MM-dd")), - new Date()); - int count = (day + 1) * 3; - if (count > 33) - count = 33; - List<CodePublishRecord> list = codePublishRecordService.listByMinTime(0, 200, - new Date(TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(time, "yyyyMMdd"), "yyyyMMddd"))); - int shameCount = 0; - for (CodePublishRecord record : list) { - UserInfo user = userInfoService.selectByPKey(record.getUid()); - if (user != null && user.getType() == 1) - shameCount++; - } - - if (shameCount > 33) {// 涓嶅啀娣诲姞 - return; - } - int leftCount = count - shameCount; - if (leftCount <= 0) - return; - - long publishLeftCount = (TimeUtil - .convertToTimeTemp(TimeUtil.getGernalTime(time + 1000 * 60 * 60 * 24L, "yyyyMMdd"), "yyyyMMddd") - time) - / (1000 * 60 * 10L); - // 浠婂ぉ杩樺墿涓嬬殑鍒嗛挓鏁� - if (leftCount > count * publishLeftCount / 102) { - // 璁$畻鏈鏄惁鍙戝竷 - int start = (int) (Math.random() * 1000); - List<UserInfo> userList = userInfoService.listByType(1, start, 1); - try { - Thread.sleep((int) (Math.random() * 1000 * 60 * 3L)); - } catch (InterruptedException e) { - e.printStackTrace(); - } - // 鏌ヨ鐢ㄦ埛鏄惁杩�3澶╁唴鍙戝竷杩� - if (codePublishRecordService.listValid(userList.get(0).getId(), 0, 1).size() > 0) - return; - if (userList != null && userList.size() > 0) { - codePublishRecordService.publishInviteCode(userList.get(0).getId()); - } - } - } - -} +package com.yeshi.fanli.job; + +import java.util.Date; +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import com.yeshi.fanli.entity.bus.user.UserInfo; +import com.yeshi.fanli.entity.integral.CodePublishRecord; +import com.yeshi.fanli.service.inter.user.UserInfoService; +import com.yeshi.fanli.service.inter.user.integral.CodePublishRecordService; +import com.yeshi.fanli.util.Constant; +import org.yeshi.utils.TimeUtil; + +/** + * 閭�璇风爜鍙戝竷 + * + * @author Administrator + * + */ +@Component +public class ShameUserInviteCodePublishJOB { + + @Resource + private UserInfoService userInfoService; + + @Resource + private CodePublishRecordService codePublishRecordService; + + // 7鐐瑰埌23鐐规瘡10鍒嗛挓鎵ц涓�娆� + @Scheduled(cron = "0 0/10 7-23 * * ? ") + public void publish() { + if (!Constant.IS_TASK) + return; + long time = System.currentTimeMillis(); + int day = TimeUtil.getDayDifferenceCount(new Date(TimeUtil.convertToTimeTemp("2019-11-28", "yyyy-MM-dd")), + new Date()); + int count = (day + 1) * 3; + if (count > 33) + count = 33; + List<CodePublishRecord> list = codePublishRecordService.listByMinTime(0, 200, + new Date(TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(time, "yyyyMMdd"), "yyyyMMddd"))); + int shameCount = 0; + for (CodePublishRecord record : list) { + UserInfo user = userInfoService.selectByPKey(record.getUid()); + if (user != null && user.getType() == 1) + shameCount++; + } + + if (shameCount > 33) {// 涓嶅啀娣诲姞 + return; + } + int leftCount = count - shameCount; + if (leftCount <= 0) + return; + + long publishLeftCount = (TimeUtil + .convertToTimeTemp(TimeUtil.getGernalTime(time + 1000 * 60 * 60 * 24L, "yyyyMMdd"), "yyyyMMddd") - time) + / (1000 * 60 * 10L); + // 浠婂ぉ杩樺墿涓嬬殑鍒嗛挓鏁� + if (leftCount > count * publishLeftCount / 102) { + // 璁$畻鏈鏄惁鍙戝竷 + int start = (int) (Math.random() * 1000); + List<UserInfo> userList = userInfoService.listByType(1, start, 1); + try { + Thread.sleep((int) (Math.random() * 1000 * 60 * 3L)); + } catch (InterruptedException e) { + e.printStackTrace(); + } + // 鏌ヨ鐢ㄦ埛鏄惁杩�3澶╁唴鍙戝竷杩� + if (codePublishRecordService.listValid(userList.get(0).getId(), 0, 1).size() > 0) + return; + if (userList != null && userList.size() > 0) { + codePublishRecordService.publishInviteCode(userList.get(0).getId()); + } + } + } + +} -- Gitblit v1.8.0