144 文件已重命名
36个文件已修改
4个文件已添加
| | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | @Table("lucky_activity_awards") |
| | |
| | | |
| | | private Date updateTime; |
| | | |
| | | //真实用户中奖所占百分比 |
| | | private BigDecimal realDrawnPercent; |
| | | |
| | | |
| | | @Transient |
| | | private LuckyActivityAwardMaterial material; |
| | | |
| | |
| | | private ActivityAwardParams activityAwardParams; |
| | | |
| | | |
| | | public BigDecimal getRealDrawnPercent() { |
| | | return realDrawnPercent; |
| | | } |
| | | |
| | | public void setRealDrawnPercent(BigDecimal realDrawnPercent) { |
| | | this.realDrawnPercent = realDrawnPercent; |
| | | } |
| | | |
| | | public ActivityAwardParams getActivityAwardParams() { |
| | | return activityAwardParams; |
| | | } |
| | |
| | | //我的中奖概率 |
| | | private BigDecimal myDrawnProbability; |
| | | |
| | | //超过的人数百分比 |
| | | private BigDecimal exceedPersonPercent; |
| | | |
| | | public Long getActivityId() { |
| | | return activityId; |
| | | } |
| | |
| | | public void setMyDrawnProbability(BigDecimal myDrawnProbability) { |
| | | this.myDrawnProbability = myDrawnProbability; |
| | | } |
| | | |
| | | public BigDecimal getExceedPersonPercent() { |
| | | return exceedPersonPercent; |
| | | } |
| | | |
| | | public void setExceedPersonPercent(BigDecimal exceedPersonPercent) { |
| | | this.exceedPersonPercent = exceedPersonPercent; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.daylucky.aspect; |
| | | |
| | | import com.ks.app.entity.AppInfo; |
| | | import com.ks.daylucky.pojo.DTO.TokenParseResultDTO; |
| | | import com.ks.daylucky.pojo.VO.AcceptData; |
| | | import com.ks.daylucky.pojo.VO.admin.AdminAcceptData; |
| | | import com.ks.daylucky.service.impl.AppManager; |
| | | import com.ks.daylucky.util.ApiCodeConstant; |
| | | import com.ks.daylucky.util.Constant; |
| | | import com.ks.daylucky.util.UserInfoUtil; |
| | | import com.ks.lucky.pojo.DO.LuckySponsors; |
| | | import org.aspectj.lang.ProceedingJoinPoint; |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.PrintWriter; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 参数检查AOP |
| | | */ |
| | | @Aspect |
| | | @Order(3) |
| | | @Component |
| | | public class AdminAspect { |
| | | |
| | | public static final String EDP = "execution(* com.ks.daylucky.controller.admin.**.*(..))"; |
| | | |
| | | @Around(EDP) |
| | | public Object verifySponsor(ProceedingJoinPoint joinPoint) throws Throwable { |
| | | ServletRequestAttributes servletContainer = (ServletRequestAttributes) RequestContextHolder |
| | | .getRequestAttributes(); |
| | | |
| | | HttpServletRequest request = servletContainer.getRequest(); |
| | | LuckySponsors sponsors = (LuckySponsors) request.getSession().getAttribute(Constant.SESSION_ADMIN_SPONSOR_KEY); |
| | | |
| | | for (Object obj : joinPoint.getArgs()) { |
| | | if (obj instanceof AdminAcceptData) { |
| | | //注入赞助商 |
| | | ((AdminAcceptData) obj).setSponsors(sponsors); |
| | | ((AdminAcceptData) obj).setAppId(5L); |
| | | break; |
| | | } |
| | | } |
| | | return joinPoint.proceed(joinPoint.getArgs()); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.google.code.kaptcha.Producer; |
| | | import com.google.code.kaptcha.impl.DefaultKaptcha; |
| | | import com.google.code.kaptcha.util.Config; |
| | | import com.ks.daylucky.util.Constant; |
| | | import com.ks.lucky.pojo.DO.LuckySponsors; |
| | | import com.ks.lucky.remote.service.LuckySponsorService; |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.context.annotation.Bean; |
| | |
| | | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.AuthenticationException; |
| | | import org.springframework.security.core.GrantedAuthority; |
| | | import org.springframework.security.core.authority.SimpleGrantedAuthority; |
| | | import org.springframework.security.core.userdetails.UserDetails; |
| | | import org.springframework.security.core.userdetails.UserDetailsService; |
| | | import org.springframework.security.core.userdetails.UsernameNotFoundException; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Properties; |
| | | |
| | | @EnableWebSecurity |
| | | public class WebSecurityConfig extends WebSecurityConfigurerAdapter { |
| | | |
| | | @Reference(version = "1.0.0") |
| | | private LuckySponsorService luckySponsorService; |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class); |
| | | |
| | | |
| | | private final String LOGIN_PROCESSING_URL="/admin/api/user/login"; |
| | | private final String LOGIN_PROCESSING_URL = "/admin/api/user/login"; |
| | | |
| | | //图形验证码配置 |
| | | @Bean |
| | |
| | | http.headers().frameOptions().disable(); |
| | | http.authorizeRequests() |
| | | .antMatchers("/admin/api/captcha.jpg*").permitAll() |
| | | .antMatchers("/admin/api/**","/index.html").authenticated() |
| | | .antMatchers("/admin/api/**", "/index.html").authenticated() |
| | | .and() |
| | | .formLogin() |
| | | //自定义登录界面 |
| | | .loginPage("/login.html") |
| | | .loginPage("/admin/login.html") |
| | | //设置接收的属性字段 |
| | | .usernameParameter("account") |
| | | .passwordParameter("pwd") |
| | | //处理登录逻辑的url |
| | | .loginProcessingUrl(LOGIN_PROCESSING_URL) |
| | | //登录成功后的跳转 |
| | | .successHandler(new AuthenticationSuccessHandler() { |
| | | @Override |
| | | public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException { |
| | | SecurityUser user = (SecurityUser) authentication.getPrincipal(); |
| | | LuckySponsors sponsors =user.getSponsors(); |
| | | httpServletRequest.getSession().setAttribute(Constant.SESSION_ADMIN_SPONSOR_KEY, sponsors); |
| | | logger.info("successHandler"); |
| | | httpServletResponse.setContentType("application/json;charset=UTF-8"); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("code", 200); |
| | | jsonObject.put("code", 0); |
| | | jsonObject.put("msg", "登录成功"); |
| | | httpServletResponse.getWriter().print(jsonObject); |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | class SecurityUser implements UserDetails { |
| | | |
| | | private LuckySponsors sponsors; |
| | | |
| | | public SecurityUser() { |
| | | |
| | | } |
| | | |
| | | public SecurityUser(LuckySponsors sponsors) { |
| | | this.sponsors = sponsors; |
| | | } |
| | | |
| | | public LuckySponsors getSponsors() { |
| | | return sponsors; |
| | | } |
| | | |
| | | @Override |
| | | public Collection<? extends GrantedAuthority> getAuthorities() { |
| | | Collection<GrantedAuthority> authorities = new ArrayList<>(); |
| | | SimpleGrantedAuthority authority = new SimpleGrantedAuthority("admin"); |
| | | authorities.add(authority); |
| | | return authorities; |
| | | } |
| | | |
| | | @Override |
| | | public String getPassword() { |
| | | return sponsors.getPwd(); |
| | | } |
| | | |
| | | @Override |
| | | public String getUsername() { |
| | | return sponsors.getName(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isAccountNonExpired() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isAccountNonLocked() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isCredentialsNonExpired() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isEnabled() { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | class MyUserDetailsService implements UserDetailsService { |
| | | |
| | | @Override |
| | | public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException { |
| | | |
| | | LuckySponsors sponsors = luckySponsorService.getSponsorByAccount(s); |
| | | if (sponsors == null) { |
| | | throw new UsernameNotFoundException("账户不存在"); |
| | | } |
| | | //TODO 用户权限赋予 |
| | | return null; |
| | | return new SecurityUser(sponsors); |
| | | } |
| | | } |
| | | |
| | |
| | | throw new BadCredentialsException("密码错误"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Authentication authenticate(Authentication authentication) throws AuthenticationException { |
| | | // 获取前端表单中输入后返回的用户名、密码 |
| | | String userName = (String) authentication.getPrincipal(); |
| | | String password = StringUtil.Md5((String) authentication.getCredentials()); |
| | | |
| | | SecurityUser userInfo = (SecurityUser) this.getUserDetailsService().loadUserByUsername(userName); |
| | | |
| | | boolean isValid = password.equalsIgnoreCase(userInfo.getPassword()); |
| | | // 验证密码 |
| | | if (!isValid) { |
| | | throw new BadCredentialsException("密码错误!"); |
| | | } |
| | | return new UsernamePasswordAuthenticationToken(userInfo, password, userInfo.getAuthorities()); |
| | | } |
| | | } |
| | | } |
| | |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | //@Configuration |
| | | @Configuration |
| | | public class XXLJobConfig { |
| | | |
| | | Logger log = LoggerFactory.getLogger(XXLJobConfig.class); |
| | |
| | | package com.ks.daylucky.controller.admin; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.ks.daylucky.pojo.DO.ActivityExtraInfo; |
| | | import com.ks.daylucky.pojo.DO.ActivityTag; |
| | | import com.ks.daylucky.pojo.VO.admin.ActivityAdminVo; |
| | | import com.ks.daylucky.pojo.VO.admin.AdminAcceptData; |
| | | import com.ks.daylucky.service.ActivityExtraInfoService; |
| | | import com.ks.daylucky.service.ActivityTagService; |
| | | import com.ks.daylucky.util.factory.vo.ActivityAdminVoFactory; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.lang.reflect.Type; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | /** |
| | | * 添加活动 |
| | | * |
| | | * @param request |
| | | * @param data |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("addActivity") |
| | | public String addActivity(HttpServletRequest request, String data, String type) { |
| | | public String addActivity(AdminAcceptData acceptData, String data, String type) { |
| | | ActivityAdminVo vo = new Gson().fromJson(data, ActivityAdminVo.class); |
| | | Long sponsorId = 1L; |
| | | Long sponsorId = acceptData.getSponsors().getId(); |
| | | Long appId = 5L; |
| | | LuckyActivity activity = LuckyActivityFactory.create(sponsorId, vo); |
| | | activity.setAppId(appId); |
| | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("getActivityDetail") |
| | | public String getActivityDetail(HttpServletRequest request, Long id) { |
| | | public String getActivityDetail(AdminAcceptData acceptData, Long id) { |
| | | LuckyActivity activity = luckyActivityService.getActivityDetail(id); |
| | | List<ActivityTag> tagList = activityTagService.getTagList(id); |
| | | ActivityExtraInfo info = activityExtraInfoService.getDetail(activity.getId()); |
| | |
| | | return JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(bean)); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("listActivity") |
| | | public String listActivity(AdminAcceptData acceptData, String states, int page, int limit) { |
| | | List<Integer> stateList = null; |
| | | if (!StringUtil.isNullOrEmpty(states)) { |
| | | Type type = new TypeToken<List<Integer>>() { |
| | | }.getType(); |
| | | stateList = new Gson().fromJson(states, type); |
| | | } |
| | | List<LuckyActivity> activityList = luckyActivityService.getActivityList(acceptData.getAppId(), acceptData.getSponsors().getId(), stateList, null, page, limit); |
| | | //获取详情 |
| | | List<ActivityAdminVo.ActivityBean> voList = new ArrayList<>(); |
| | | for (LuckyActivity activity : activityList) { |
| | | activity = luckyActivityService.getActivityDetail(activity.getId()); |
| | | ActivityExtraInfo info = activityExtraInfoService.getDetail(activity.getId()); |
| | | List<ActivityTag> tagList = activityTagService.getTagList(activity.getId()); |
| | | voList.add(ActivityAdminVoFactory.createActivityBean(activity, tagList)); |
| | | } |
| | | |
| | | |
| | | long count = luckyActivityService.countActivity(acceptData.getAppId(), acceptData.getSponsors().getId(), stateList, null); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("list", voList); |
| | | data.put("count", count); |
| | | return JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(data)); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | public String getRankList(AcceptData acceptData, Long activityId, int page) { |
| | | List<ActivityJoinerRankInfoVO> voList = new ArrayList<>(); |
| | | |
| | | List<ActivityJoinerRankInfo> list = luckyActivityJoinService.getWeightRankList(activityId, page,10); |
| | | List<ActivityJoinerRankInfo> list = luckyActivityJoinService.getWeightRankList(activityId, page, 10); |
| | | if (list != null && list.size() > 0) { |
| | | Map<Long, UserInfo> userInfoMap = userInfoService.listUserInfoAsMap(UserInfoUtil.getBaseUserList(list)); |
| | | for (ActivityJoinerRankInfo info : list) { |
| | |
| | | //获取我的排行 |
| | | ActivityJoinerRankInfo rank = luckyActivityJoinService.getMyWeightRank(activityId, acceptData.getApp().getId(), targetUid + ""); |
| | | //获取总人数 |
| | | long count = luckyActivityJoinService.countWeightRank(activityId); |
| | | BigDecimal percent = new BigDecimal(rank.getRank()).divide(new BigDecimal(count), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)); |
| | | vo.setPercent(percent.intValue()); |
| | | vo.setPercent(probability.getExceedPersonPercent()); |
| | | |
| | | BigDecimal offset = null; |
| | | if (average.compareTo(my) > 0) { |
| | | offset = new BigDecimal(0).subtract(average.divide(my, 2, BigDecimal.ROUND_HALF_UP)); |
| | | } else { |
| | | offset = my.divide(average, 2, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | BigDecimal offset = my.divide(average, 2, BigDecimal.ROUND_HALF_UP); |
| | | |
| | | |
| | | vo.setOffset(offset); |
| | | |
New file |
| | |
| | | package com.ks.daylucky.job; |
| | | |
| | | import com.ks.daylucky.pojo.DO.UserInfo; |
| | | import com.ks.daylucky.query.UserInfoQuery; |
| | | import com.ks.daylucky.service.UserInfoService; |
| | | import com.ks.lucky.exception.LuckyActivityException; |
| | | import com.ks.lucky.exception.LuckyActivityJoinException; |
| | | import com.ks.lucky.pojo.DO.LuckyActivity; |
| | | import com.ks.lucky.pojo.DO.LuckyActivityJoinRecord; |
| | | import com.ks.lucky.pojo.DO.LuckyActivityOpenInfo; |
| | | import com.ks.lucky.pojo.DTO.JoinInfo; |
| | | import com.ks.lucky.remote.service.LuckyActivityJoinService; |
| | | import com.ks.lucky.remote.service.LuckyActivityOpenInfoService; |
| | | import com.ks.lucky.remote.service.LuckyActivityService; |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | |
| | | @Component |
| | | public class VirtualJoinJob { |
| | | |
| | | |
| | | @Reference(version = "1.0.0") |
| | | private LuckyActivityJoinService luckyActivityJoinService; |
| | | |
| | | @Reference(version = "1.0.0") |
| | | private LuckyActivityOpenInfoService luckyActivityOpenInfoService; |
| | | |
| | | @Reference(version = "1.0.0") |
| | | private LuckyActivityService luckyActivityService; |
| | | |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | |
| | | |
| | | @XxlJob("join-virtual") |
| | | public ReturnT<String> join(String param) throws Exception { |
| | | Long appId = Long.parseLong(param); |
| | | //获取正在进行中的活动 |
| | | List<LuckyActivity> activityList = luckyActivityService.getActivityList(appId, null, Arrays.asList(new Integer[]{LuckyActivity.STATE_STARTED}), null, 1, 10); |
| | | for (LuckyActivity activity : activityList) { |
| | | join(activity); |
| | | } |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | |
| | | public void join(LuckyActivity activity) { |
| | | //查询最小开奖人数 |
| | | LuckyActivityOpenInfo opneInfo = luckyActivityOpenInfoService.getOpenInfo(activity.getId()); |
| | | int minPersonCount = opneInfo.getMinPersonCount(); |
| | | int nowCount = (int) luckyActivityJoinService.countJoiner(activity.getId(), null); |
| | | //已经达到开奖条件 |
| | | if (nowCount >= minPersonCount) { |
| | | return; |
| | | } |
| | | Date preOpenTime = opneInfo.getPreOpenTime(); |
| | | long diff = preOpenTime.getTime() - System.currentTimeMillis(); |
| | | //距离开奖剩余的分钟数 |
| | | int diffMinute = (int) (diff / (1000 * 60)); |
| | | |
| | | //平均每分钟需要加入的用户 |
| | | int percentMinutePerson = (minPersonCount - nowCount) / diffMinute + 1; |
| | | |
| | | if (percentMinutePerson > 0) { |
| | | UserInfoQuery query = new UserInfoQuery(); |
| | | query.appId = activity.getAppId(); |
| | | query.type = UserInfo.TYPE_VIRTUAL; |
| | | long count = userInfoService.countUser(query); |
| | | |
| | | List<UserInfo> userList = getRandomPerson(activity.getAppId(), (int) count, percentMinutePerson); |
| | | for (UserInfo userInfo : userList) { |
| | | JoinInfo joinInfo = JoinInfo.JoinInfoFactory.createAlipay(UUID.randomUUID().toString()); |
| | | try { |
| | | luckyActivityJoinService.join(activity.getId(), activity.getAppId(), userInfo.getId() + "", 1, joinInfo, LuckyActivityJoinRecord.USER_TYPE_VIRTUAL); |
| | | } catch (LuckyActivityException e) { |
| | | e.printStackTrace(); |
| | | } catch (LuckyActivityJoinException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | private List<UserInfo> getRandomPerson(Long appId, int totalCount, int count) { |
| | | List<UserInfo> userInfoList = new ArrayList<>(); |
| | | Set<Integer> pset = new HashSet<>(); |
| | | while (pset.size() < count) { |
| | | pset.add((int) (totalCount * Math.random())); |
| | | } |
| | | |
| | | for (Integer p : pset) { |
| | | UserInfoQuery query = new UserInfoQuery(); |
| | | query.appId = appId; |
| | | query.type = UserInfo.TYPE_VIRTUAL; |
| | | query.count = 1; |
| | | query.start = p; |
| | | List<UserInfo> userList = userInfoService.getUserList(query, null, null); |
| | | if (userList.size() > 0) { |
| | | userInfoList.add(userList.get(0)); |
| | | } |
| | | } |
| | | return userInfoList; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | @Document(collection = "activityExtraInfo") |
| | |
| | | private String shareImageLink; |
| | | //活动有效天数 |
| | | private Integer validDay; |
| | | |
| | | //真用户中奖的比例 |
| | | private BigDecimal realDrawnPercent; |
| | | |
| | | private Date createTime; |
| | | private Date updateTime; |
| | | |
| | | |
| | | public BigDecimal getRealDrawnPercent() { |
| | | return realDrawnPercent; |
| | | } |
| | | |
| | | public void setRealDrawnPercent(BigDecimal realDrawnPercent) { |
| | | this.realDrawnPercent = realDrawnPercent; |
| | | } |
| | | |
| | | public Integer getValidDay() { |
| | | return validDay; |
| | | } |
| | |
| | | public class UserMsg { |
| | | |
| | | public enum UserMsgType { |
| | | lucky("抽奖消息", "https://daylucky-1255749512.cos.ap-nanjing.myqcloud.com/image/icon/icon_msg_lucky.png"); |
| | | lucky("抽奖消息", "http://img.j.banliapp.com/image/icon/icon_msg_lucky.png"); |
| | | |
| | | private String name; |
| | | private String icon; |
| | |
| | | public class DrawnProbabilityVO { |
| | | private String average;//平均中奖概率 |
| | | private String my;//我的中奖概率 |
| | | private int percent;//百分比 |
| | | private BigDecimal percent;//百分比 |
| | | private BigDecimal offset;//与平均值相差倍数 |
| | | |
| | | |
| | |
| | | this.my = my; |
| | | } |
| | | |
| | | public int getPercent() { |
| | | public BigDecimal getPercent() { |
| | | return percent; |
| | | } |
| | | |
| | | public void setPercent(int percent) { |
| | | public void setPercent(BigDecimal percent) { |
| | | this.percent = percent; |
| | | } |
| | | |
| | |
| | | |
| | | private String bgColor; |
| | | |
| | | private String fontColr; |
| | | private String fontColor; |
| | | |
| | | |
| | | public LabelVO(String name, String bgColor, String fontColr) { |
| | | public LabelVO(String name, String bgColor, String fontColor) { |
| | | this.name = name; |
| | | this.bgColor = bgColor; |
| | | this.fontColr = fontColr; |
| | | this.fontColor = fontColor; |
| | | } |
| | | |
| | | public String getName() { |
| | |
| | | this.bgColor = bgColor; |
| | | } |
| | | |
| | | public String getFontColr() { |
| | | return fontColr; |
| | | |
| | | public String getFontColor() { |
| | | return fontColor; |
| | | } |
| | | |
| | | public void setFontColr(String fontColr) { |
| | | this.fontColr = fontColr; |
| | | public void setFontColor(String fontColor) { |
| | | this.fontColor = fontColor; |
| | | } |
| | | } |
| | |
| | | private List<BannerBean> bannerList; |
| | | private List<ActivityTag> tags; |
| | | |
| | | //列表中使用 |
| | | private String serialNo; |
| | | private Integer maxPersonCount; |
| | | private Integer currentPersonCount; |
| | | private String state; |
| | | private String stateDesc; |
| | | private String createTime; |
| | | private String preStartTime; |
| | | private String actualStartTime; |
| | | private String preFinishTime; |
| | | private String actualFinishTime; |
| | | |
| | | |
| | | public String getStateDesc() { |
| | | return stateDesc; |
| | | } |
| | | |
| | | public void setStateDesc(String stateDesc) { |
| | | this.stateDesc = stateDesc; |
| | | } |
| | | |
| | | public String getSerialNo() { |
| | | return serialNo; |
| | | } |
| | | |
| | | public void setSerialNo(String serialNo) { |
| | | this.serialNo = serialNo; |
| | | } |
| | | |
| | | public Integer getMaxPersonCount() { |
| | | return maxPersonCount; |
| | | } |
| | | |
| | | public void setMaxPersonCount(Integer maxPersonCount) { |
| | | this.maxPersonCount = maxPersonCount; |
| | | } |
| | | |
| | | public Integer getCurrentPersonCount() { |
| | | return currentPersonCount; |
| | | } |
| | | |
| | | public void setCurrentPersonCount(Integer currentPersonCount) { |
| | | this.currentPersonCount = currentPersonCount; |
| | | } |
| | | |
| | | public String getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(String state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public String getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(String createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public String getPreStartTime() { |
| | | return preStartTime; |
| | | } |
| | | |
| | | public void setPreStartTime(String preStartTime) { |
| | | this.preStartTime = preStartTime; |
| | | } |
| | | |
| | | public String getActualStartTime() { |
| | | return actualStartTime; |
| | | } |
| | | |
| | | public void setActualStartTime(String actualStartTime) { |
| | | this.actualStartTime = actualStartTime; |
| | | } |
| | | |
| | | public String getPreFinishTime() { |
| | | return preFinishTime; |
| | | } |
| | | |
| | | public void setPreFinishTime(String preFinishTime) { |
| | | this.preFinishTime = preFinishTime; |
| | | } |
| | | |
| | | public String getActualFinishTime() { |
| | | return actualFinishTime; |
| | | } |
| | | |
| | | public void setActualFinishTime(String actualFinishTime) { |
| | | this.actualFinishTime = actualFinishTime; |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | |
| | | this.tags = tags; |
| | | } |
| | | |
| | | |
| | | |
| | | public static class BannerBean { |
| | | private String id; |
| | | private String url; |
New file |
| | |
| | | package com.ks.daylucky.pojo.VO.admin; |
| | | |
| | | import com.ks.lucky.pojo.DO.LuckySponsors; |
| | | |
| | | public class AdminAcceptData { |
| | | private LuckySponsors sponsors; |
| | | private Long appId; |
| | | |
| | | public LuckySponsors getSponsors() { |
| | | return sponsors; |
| | | } |
| | | |
| | | public void setSponsors(LuckySponsors sponsors) { |
| | | this.sponsors = sponsors; |
| | | } |
| | | |
| | | public Long getAppId() { |
| | | return appId; |
| | | } |
| | | |
| | | public void setAppId(Long appId) { |
| | | this.appId = appId; |
| | | } |
| | | } |
| | |
| | | public String alipayUid; |
| | | public String wxOpenId; |
| | | public String wxUnionId; |
| | | public Integer type; |
| | | |
| | | } |
| | |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | public List<UserInfo> getUserList(UserInfoQuery query, int page, int pageSize); |
| | | public List<UserInfo> getUserList(UserInfoQuery query, Integer page, Integer pageSize); |
| | | |
| | | /** |
| | | * 获取用户的数量 |
| | |
| | | //如果是中奖消息要发送模板消息 |
| | | UserInfo userInfo = userInfoService.getUserDetail(uid); |
| | | AppInfo appInfo = appManager.getAppDetail(userInfo.getAppId()); |
| | | String templateId = appConfigService.getConfigCache(userInfo.getAppId(), ConfigKeyEnum.luckyResultMsgTemplateId, null).getValue(); |
| | | try { |
| | | String templateId = appConfigService.getConfigCache(userInfo.getAppId(), ConfigKeyEnum.luckyResultMsgTemplateId, null).getValue(); |
| | | AlipayXcxUtil.sendTemplateMsg(AlipayAppUtil.getAlipayAppInfo(appInfo.getAlipayInfo()), templateId, "pages/activity-detail/activity-detail?id=" + activity.getId(), userInfo.getAlipayUid(), null, "恭喜您,中奖了!", ActivityUtil.getActivityDateNumber(activity.getId(), activity.getCreateTime())); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } catch (AlipayXcxException e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<UserInfo> getUserList(UserInfoQuery query, int page, int pageSize) { |
| | | query.start = (page - 1) * pageSize; |
| | | query.count = pageSize; |
| | | public List<UserInfo> getUserList(UserInfoQuery query, Integer page, Integer pageSize) { |
| | | if (page != null && pageSize != null) { |
| | | query.start = (page - 1) * pageSize; |
| | | query.count = pageSize; |
| | | } |
| | | return userInfoMapper.list(query); |
| | | } |
| | | |
| | |
| | | package com.ks.daylucky.util; |
| | | |
| | | public class Constant { |
| | | public final static String SESSION_ADMIN_SPONSOR_KEY="SESSION_ADMIN_SPONSOR_KEY"; |
| | | |
| | | public final static int PAGE_SIZE = 20; |
| | | |
| | | //活动列表的数量 |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 获取活动状态简介 |
| | | * |
| | | * @param state |
| | | * @return |
| | | */ |
| | | public static String getStateDesc(int state) { |
| | | switch (state) { |
| | | case LuckyActivity.STATE_OPENED: |
| | | return "已开奖"; |
| | | case LuckyActivity.STATE_STARTED: |
| | | return "已开始"; |
| | | case LuckyActivity.STATE_FINISH: |
| | | return "已结束"; |
| | | case LuckyActivity.STATE_NOT_STARTED: |
| | | return "已发布"; |
| | | case LuckyActivity.STATE_PRE_OPENED: |
| | | return "已预开奖"; |
| | | case LuckyActivity.STATE_NOT_PUBLISH: |
| | | return "未发布"; |
| | | case LuckyActivity.STATE_NOT_SUBMIT_VERIFY: |
| | | return "未提交审核"; |
| | | case LuckyActivity.STATE_VERIFY_REJECT: |
| | | return "审核拒绝"; |
| | | case LuckyActivity.STATE_WAITING_VERIFY: |
| | | return "等待审核"; |
| | | case LuckyActivity.STATE_OPEN_FAIL: |
| | | return "开奖失败"; |
| | | case LuckyActivity.STATE_FOUCE_FINISH: |
| | | return "已结束"; |
| | | |
| | | |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | public static LuckyMsgContent createDrawn(Long activityId,Date activityCreateTime, String awardName) { |
| | | LuckyMsgContent msgContent = new LuckyMsgContent(); |
| | | msgContent.setLuckyMsgType(LuckyMsgContent.LuckyMsgType.joinSuccess); |
| | | msgContent.setLuckyMsgType(LuckyMsgContent.LuckyMsgType.drawn); |
| | | msgContent.setActivityId(activityId); |
| | | msgContent.setDateNumber(ActivityUtil.getActivityDateNumber(activityId,activityCreateTime)); |
| | | msgContent.setRemarks("无"); |
| | |
| | | |
| | | import com.ks.daylucky.pojo.DO.ActivityTag; |
| | | import com.ks.daylucky.pojo.VO.admin.ActivityAdminVo; |
| | | import com.ks.daylucky.util.activity.ActivityUtil; |
| | | import com.ks.lucky.pojo.DO.*; |
| | | import com.ks.lucky.pojo.DTO.ActivityAwardParams; |
| | | import com.ks.lucky.pojo.DTO.sponsorad.AlipayLifeAdInfo; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | public class ActivityAdminVoFactory { |
| | | |
| | | |
| | | public static ActivityAdminVo create(LuckyActivity activity, List<ActivityTag> tagList,int validDay) { |
| | | public static ActivityAdminVo create(LuckyActivity activity, List<ActivityTag> tagList, int validDay) { |
| | | ActivityAdminVo vo = new ActivityAdminVo(); |
| | | vo.setActivity(createActivityBean(activity, tagList)); |
| | | vo.setAwardInfo(createAwardList(activity)); |
| | |
| | | bean.setBannerList(createBannerList(activity.getBannerList())); |
| | | bean.setPoster(activity.getMaterialPoster()); |
| | | bean.setTags(tagList); |
| | | |
| | | bean.setCreateTime(TimeUtil.getGernalTime(activity.getCreateTime().getTime(), "yyyy-MM-dd HH:mm")); |
| | | if (activity.getActualFinishTime() != null) { |
| | | bean.setActualFinishTime(TimeUtil.getGernalTime(activity.getActualFinishTime().getTime(), "yyyy-MM-dd HH:mm")); |
| | | } |
| | | if (activity.getActualStartTime() != null) { |
| | | bean.setActualStartTime(TimeUtil.getGernalTime(activity.getActualStartTime().getTime(), "yyyy-MM-dd HH:mm")); |
| | | } |
| | | bean.setCurrentPersonCount(activity.getCurrentPersonCount()); |
| | | if (activity.getPreFinishTime() != null) { |
| | | bean.setPreFinishTime(TimeUtil.getGernalTime(activity.getPreFinishTime().getTime(), "yyyy-MM-dd HH:mm")); |
| | | } |
| | | bean.setMaxPersonCount(activity.getMaxPersonCount()); |
| | | if (activity.getPreStartTime() != null) { |
| | | bean.setPreStartTime(TimeUtil.getGernalTime(activity.getPreStartTime().getTime(), "yyyy-MM-dd HH:mm")); |
| | | } |
| | | bean.setState(ActivityUtil.getStateDesc(activity.getState())); |
| | | bean.setStateDesc(activity.getStateRemarks()); |
| | | |
| | | bean.setSerialNo(ActivityUtil.getActivityDateNumber(activity.getId(), activity.getCreateTime())); |
| | | |
| | | |
| | | return bean; |
| | | } |
| | | |
| | | private static List<ActivityAdminVo.ActivityBean.BannerBean> createBannerList(List<LuckyActivityImage> imageList) { |
| | | List<ActivityAdminVo.ActivityBean.BannerBean> beanList = new ArrayList<>(); |
| | | for (LuckyActivityImage image : imageList) { |
| | | ActivityAdminVo.ActivityBean.BannerBean bean = new ActivityAdminVo.ActivityBean.BannerBean(); |
| | | bean.setId(image.getId()); |
| | | bean.setUrl(image.getUrl()); |
| | | beanList.add(bean); |
| | | } |
| | | if (imageList != null) |
| | | for (LuckyActivityImage image : imageList) { |
| | | ActivityAdminVo.ActivityBean.BannerBean bean = new ActivityAdminVo.ActivityBean.BannerBean(); |
| | | bean.setId(image.getId()); |
| | | bean.setUrl(image.getUrl()); |
| | | beanList.add(bean); |
| | | } |
| | | return beanList; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | List<String> descList = new ArrayList<>(); |
| | | descList.add("关注赞助商生活号。"); |
| | | descList.add("点赞赞助商生活号最新发布消息。"); |
| | | |
| | | descList.add("免费参与抽奖活动"); |
| | | if (sponsorInfo.getAd().getAlipayLifeAdInfo().getMustAttention() == null || !sponsorInfo.getAd().getAlipayLifeAdInfo().getMustAttention()) { |
| | | descList.add("无需关注生活号。"); |
| | | } else { |
| | | descList.add("关注赞助商生活号。"); |
| | | } |
| | | bean.setConditions(conditions); |
| | | bean.setConditionsDesc(descList); |
| | | bean.setMarks(sponsorInfo.getAd().getDesc()); |
| | |
| | | if (awards.getMaterial().getType() == LuckyActivityAwardMaterial.ActivityAwardMaterialType.alipayRedPackage) { |
| | | switch (awards.getAwardWay()) { |
| | | case LuckyActivityAwards.AWARD_WAY_DIVIDE: |
| | | bean.setTypeIcon("https://daylucky-1255749512.cos.ap-nanjing.myqcloud.com/image/icon/icon_award_way_divide.png"); |
| | | bean.setTypeIcon("http://img.j.banliapp.com/image/icon/icon_award_way_divide.png"); |
| | | if(awards.getCount()==1){ |
| | | bean.setTypeIcon("http://img.j.banliapp.com/image/icon/icon_award_way_jing.png"); |
| | | } |
| | | |
| | | break; |
| | | case LuckyActivityAwards.AWARD_WAY_RANDOM: |
| | | bean.setTypeIcon("https://daylucky-1255749512.cos.ap-nanjing.myqcloud.com/image/icon/icon_award_way_random.png"); |
| | | bean.setTypeIcon("http://img.j.banliapp.com/image/icon/icon_award_way_random.png"); |
| | | break; |
| | | } |
| | | } else { |
| | |
| | | package com.ks.daylucky.util.mq.consumer; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.ks.daylucky.exception.ActivityDrawnRecieveNotifyInfoException; |
| | | import com.ks.daylucky.pojo.DO.ActivityDrawnRecieveNotifyInfo; |
| | | import com.ks.daylucky.service.ActivityDrawnRecieveNotifyInfoService; |
| | |
| | | try { |
| | | //活动状态改变 |
| | | ActivityDrawnMsgDTO dto = JsonUtil.getSimpleGson().fromJson(message.msgBody, ActivityDrawnMsgDTO.class); |
| | | LoggerUtil.mqLogger.info("中奖通知:{}",new Gson().toJson(dto)); |
| | | //获取详情 |
| | | |
| | | LuckyActivityAwardResult result = luckyActivityAwardResultService.getDetail(dto.getAwardResultId()); |
| | |
| | | package com.ks.daylucky.util.mq.consumer; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.ks.daylucky.exception.UserMsgException; |
| | | import com.ks.daylucky.pojo.DTO.UserMsgSettings; |
| | | import com.ks.daylucky.pojo.VO.SimpleUser; |
| | |
| | | for (Message message : messageList) { |
| | | BaseMQMsg baseMQMsg = JsonUtil.getSimpleGson().fromJson(message.msgBody, BaseMQMsg.class); |
| | | String tag = baseMQMsg.getCmqMsgTag(); |
| | | LoggerUtil.mqLogger.info("消息消费:{}",new Gson().toJson(baseMQMsg)); |
| | | |
| | | if (tag.equalsIgnoreCase(LuckyCMQConstant.TAG_ACTIVITY_STATE_CHANGE)) { |
| | | |
| | | //活动状态改变 |
| | | ActivityStateChangeMsgDTO dto = JsonUtil.getSimpleGson().fromJson(message.msgBody, ActivityStateChangeMsgDTO.class); |
| | | LoggerUtil.mqLogger.info("活动状态改变:{}",new Gson().toJson(dto)); |
| | | |
| | | List<ActivitySimpleUser> userList; |
| | | switch (dto.getState()) { |
| | | //开奖 |
| | |
| | | ip: |
| | | logpath: /data/applogs/xxl-job/jobhandler |
| | | logretentiondays: 30 |
| | | port: 9991 |
| | | port: 9999 |
| | | admin: |
| | | addresses: http://localhost:8081/xxl-job-admin |
| | | addresses: http://111.231.250.166:9000/xxl-job-admin |
| | | |
| | | cos: |
| | | appId: 1255749512 |
| | |
| | | <if test="query.wxUnionId!=null">and wx_union_id=#{query.wxUnionId}</if> |
| | | <if test="query.minCreateTime!=null">and create_time>=#{query.minCreateTime}</if> |
| | | <if test="query.maxCreateTime!=null">and #{query.maxCreateTime}>create_time</if> |
| | | <if test="query.type!=null">and #{query.type}=`type`</if> |
| | | |
| | | |
| | | </sql> |
| | | <select id="list" resultMap="BaseResultMap">select |
| | | <include refid="Base_Column_List"/> |
File was renamed from service-daylucky/src/main/resources/static/activity-list.html |
| | |
| | | |
| | | var table = layui.table; |
| | | |
| | | var url = "/admin/api/app/list?key=" + encodeURIComponent(app.key) + "&startDate=" + app.start + "&endDate=" + app.end; |
| | | var url = "/admin/activity/listActivity"; |
| | | |
| | | |
| | | table.render({ |
| | |
| | | cols: [ |
| | | [{type: 'checkbox', title: "ID"}, |
| | | {field: 'id', width: 80, sort: true, title: "ID"}, |
| | | {field: 'appCode', width: 120, sort: true, title: "应用唯一标识"}, |
| | | {field: 'appName', edit: 'text', width: 150, title: "应用名称"}, |
| | | {field: 'appDesc', edit: 'text', width: 200, title: "应用简介"}, |
| | | {field: 'remarks', edit: 'text', width: 200, title: "备注"}, |
| | | {field: 'serialNo', width: 120, sort: true, title: "活动期号"}, |
| | | {type: 'image', field: 'poster', edit: 'text', width: 150, title: "封面"}, |
| | | {field: 'state', width: 200, title: "状态"}, |
| | | {field: 'stateDesc', width: 200, title: "状态简介"}, |
| | | {field: 'createTime', sort: true, width: 150, title: "创建时间"}, |
| | | {field: 'updateTime', sort: true, width: 150, title: "修改时间"}, |
| | | // {field: 'status', width: 80, title: "状态", templet: "#statusContainer"}, |
| | |
| | | "code": res.code, //解析接口状态 |
| | | "msg": res.msg, //解析提示文本 |
| | | "count": res.data.count, //解析数据长度 |
| | | "data": res.data.data //解析数据列表 |
| | | "data": res.data.list //解析数据列表 |
| | | }; |
| | | } |
| | | //,…… //其他参数 |
File was renamed from service-daylucky/src/main/resources/static/index.html |
| | |
| | | <html class="x-admin-sm"> |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>金币管理系统</title> |
| | | <title>天天抽奖管理系统</title> |
| | | <meta name="renderer" content="webkit|ie-comp|ie-stand"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" |
| | |
| | | <link rel="stylesheet" href="./css/font.css"> |
| | | <link rel="stylesheet" href="./css/xadmin.css"> |
| | | <link rel="stylesheet" href="./css/theme3049.min.css"> |
| | | <script src="./lib/layui/layui.js" charset="utf-8"></script> |
| | | <script src="lib/layui/layui.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="./js/xadmin.js"></script> |
| | | <script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script> |
| | | <script src="js/http.js" type="text/javascript" charset="utf-8"></script> |
| | |
| | | <!-- 顶部开始 --> |
| | | <div class="container"> |
| | | <div class="logo"> |
| | | <a href="./index.html">天天抽奖管理系统</a></div> |
| | | <a href="index.html">天天抽奖管理系统</a></div> |
| | | <div class="left_open"> |
| | | <a><i title="展开左侧栏" class="iconfont"></i></a> |
| | | </div> |
| | |
| | | </div> |
| | | <div class="layui-tab-content"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <iframe src='./welcome.html' frameborder="0" scrolling="yes" class="x-iframe"></iframe> |
| | | <iframe src='welcome.html' frameborder="0" scrolling="yes" class="x-iframe"></iframe> |
| | | </div> |
| | | </div> |
| | | <div id="tab_show"></div> |
File was renamed from service-daylucky/src/main/resources/static/lib/layui/lay/modules/layer.js |
| | |
| | | /** layui-v2.5.5 MIT License By https://www.layui.com */ |
| | | ;!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var e=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,i=t.length-1,n=i;n>0;n--)if("interactive"===t[n].readyState){e=t[n].src;break}return e||t[i].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,i){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](i)},link:function(t,i,n){if(r.path){var a=document.getElementsByTagName("head")[0],s=document.createElement("link");"string"==typeof i&&(n=i);var l=(n||t).replace(/\.|\//g,""),f="layuicss-"+l,c=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function u(){return++c>80?e.console&&console.error("layer.css: Invalid"):void(1989===parseInt(o.getStyle(document.getElementById(f),"width"))?i():setTimeout(u,100))}()}}},r={v:"3.1.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},(n.icon===-1||n.icon===t&&!o.config.skin)&&(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:210},n))}},s=function(e){var t=this;t.index=++r.index,t.config=i.extend({},t.config,o.config,e),document.body?t.creat():setTimeout(function(){t.creat()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'<div class="layui-layer-title" style="'+(f?r.title[1]:"")+'">'+(f?r.title[0]:r.title)+"</div>":"";return r.zIndex=s,t([r.shade?'<div class="layui-layer-shade" id="layui-layer-shade'+a+'" times="'+a+'" style="'+("z-index:"+(s-1)+"; ")+'"></div>':"",'<div class="'+l[0]+(" layui-layer-"+o.type[r.type])+(0!=r.type&&2!=r.type||r.shade?"":" layui-layer-border")+" "+(r.skin||"")+'" id="'+l[0]+a+'" type="'+o.type[r.type]+'" times="'+a+'" showtime="'+r.time+'" conType="'+(e?"object":"string")+'" style="z-index: '+s+"; width:"+r.area[0]+";height:"+r.area[1]+(r.fixed?"":";position:absolute;")+'">'+(e&&2!=r.type?"":u)+'<div id="'+(r.id||"")+'" class="layui-layer-content'+(0==r.type&&r.icon!==-1?" layui-layer-padding":"")+(3==r.type?" layui-layer-loading"+r.icon:"")+'">'+(0==r.type&&r.icon!==-1?'<i class="layui-layer-ico layui-layer-ico'+r.icon+'"></i>':"")+(1==r.type&&e?"":r.content||"")+'</div><span class="layui-layer-setwin">'+function(){var e=c?'<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>':"";return r.closeBtn&&(e+='<a class="layui-layer-ico '+l[7]+" "+l[7]+(r.title?r.closeBtn:4==r.type?"1":"2")+'" href="javascript:;"></a>'),e}()+"</span>"+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t<i;t++)e+='<a class="'+l[6]+t+'">'+r.btn[t]+"</a>";return'<div class="'+l[6]+" layui-layer-btn-"+(r.btnAlign||"")+'">'+e+"</div>"}():"")+(r.resize?'<span class="layui-layer-resize"></span>':"")+"</div>"],u,i('<div class="layui-layer-move"></div>')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"","auto"];t.content='<iframe scrolling="'+(t.content[1]||"auto")+'" allowtransparency="true" id="'+l[4]+a+'" name="'+l[4]+a+'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="'+t.content[0]+'"></iframe>';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'<i class="layui-layer-TipsG"></i>',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i(".layui-layer-move")[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),i("#layui-layer-shade"+e.index).css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():e.offset(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;a<c.stX&&(a=c.stX),a>f&&(a=f),o<c.stY&&(o=c.stY),o>u&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&i("#layui-layer-shade"+t.index).on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){var a=i("#"+l[0]+e),s=a.find(l[1]).outerHeight()||0,f=a.attr("minLeft")||181*o.minIndex+"px",c=a.css("position");o.record(a),o.minLeft[0]&&(f=o.minLeft[0],o.minLeft.shift()),a.attr("position",c),r.style(e,{width:180,height:s,left:f,top:n.height()-s,position:"fixed",overflow:"hidden"},!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),a.attr("minLeft")||o.minIndex++,a.attr("minLeft",f)},r.restore=function(e){var t=i("#"+l[0]+e),n=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(n[0]),height:parseFloat(n[1]),top:parseFloat(n[2]),left:parseFloat(n[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e)},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e){var t=i("#"+l[0]+e),n=t.attr("type"),a="layer-anim-close";if(t[0]){var s="layui-layer-wrap",f=function(){if(n===o.type[1]&&"object"===t.attr("conType")){t.children(":not(."+l[5]+")").remove();for(var a=t.find("."+s),r=0;r<2;r++)a.unwrap();a.css("display",a.data("display")).removeClass(s)}else{if(n===o.type[2])try{var f=i("#"+l[4]+e)[0];f.contentWindow.document.write(""),f.contentWindow.close(),t.find("."+l[5])[0].removeChild(f)}catch(c){}t[0].innerHTML="",t.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e]};t.data("isOutAnim")&&t.addClass("layer-anim "+a),i("#layui-layer-moves, #layui-layer-shade"+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),t.attr("minLeft")&&(o.minIndex--,o.minLeft.push(t.attr("minLeft"))),r.ie&&r.ie<10||!t.data("isOutAnim")?f():setTimeout(function(){f()},200)}},r.closeAll=function(e){i.each(i("."+l[0]),function(){var t=i(this),n=e?t.attr("type")===e:1;n&&r.close(t.attr("times")),n=null})};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'<textarea class="layui-layer-input"'+a+"></textarea>":function(){return'<input type="'+(1==e.formType?"password":"text")+'" class="layui-layer-input">'}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["确定","取消"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(t){s=t.find(".layui-layer-input"),s.val(e.value||"").focus(),"function"==typeof f&&f(t)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a='<span class="'+n+'">'+t[0].title+"</span>";i<e;i++)a+="<span>"+t[i].title+"</span>";return a}(),content:'<ul class="layui-layer-tabmain">'+function(){var e=t.length,i=1,a="";if(e>0)for(a='<li class="layui-layer-tabli '+n+'">'+(t[0].content||"no content")+"</li>";i<e;i++)a+='<li class="layui-layer-tabli">'+(t[i].content||"no content")+"</li>";return a}()+"</ul>",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=t.photos.constructor===Object,f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("没有图片")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0),h()}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.hover(function(){s.imgsee.show()},function(){s.imgsee.hide()}),s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev()}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext()}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]<r[1]&&(a[0]=a[0]/r[1],a[1]=a[1]/r[1])}return[a[0]+"px",a[1]+"px"]}(),title:!1,shade:.9,shadeClose:!0,closeBtn:!1,move:".layui-layer-phimg img",moveType:1,scrollbar:!1,moveOut:!0,isOutAnim:!1,skin:"layui-layer-photos"+c("photos"),content:'<div class="layui-layer-phimg"><img src="'+u[d].src+'" alt="'+(u[d].alt||"")+'" layer-pid="'+u[d].pid+'"><div class="layui-layer-imgsee">'+(u.length>1?'<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>':"")+'<div class="layui-layer-imgbar" style="display:'+(a?"block":"")+'"><span class="layui-layer-imgtit"><a href="javascript:;">'+(u[d].alt||"")+"</a><em>"+s.imgIndex+"/"+u.length+"</em></span></div></div></div>",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imguide,.layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常<br>是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["static/admin/layui/lay/modules/jquery"],function(){return o.run(e.jQuery),r}):function(){o.run(e.jQuery),r.ready()}()}(window); |
| | | ;!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var e=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,i=t.length-1,n=i;n>0;n--)if("interactive"===t[n].readyState){e=t[n].src;break}return e||t[i].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,i){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](i)},link:function(t,i,n){if(r.path){var a=document.getElementsByTagName("head")[0],s=document.createElement("link");"string"==typeof i&&(n=i);var l=(n||t).replace(/\.|\//g,""),f="layuicss-"+l,c=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function u(){return++c>80?e.console&&console.error("layer.css: Invalid"):void(1989===parseInt(o.getStyle(document.getElementById(f),"width"))?i():setTimeout(u,100))}()}}},r={v:"3.1.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},(n.icon===-1||n.icon===t&&!o.config.skin)&&(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:210},n))}},s=function(e){var t=this;t.index=++r.index,t.config=i.extend({},t.config,o.config,e),document.body?t.creat():setTimeout(function(){t.creat()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'<div class="layui-layer-title" style="'+(f?r.title[1]:"")+'">'+(f?r.title[0]:r.title)+"</div>":"";return r.zIndex=s,t([r.shade?'<div class="layui-layer-shade" id="layui-layer-shade'+a+'" times="'+a+'" style="'+("z-index:"+(s-1)+"; ")+'"></div>':"",'<div class="'+l[0]+(" layui-layer-"+o.type[r.type])+(0!=r.type&&2!=r.type||r.shade?"":" layui-layer-border")+" "+(r.skin||"")+'" id="'+l[0]+a+'" type="'+o.type[r.type]+'" times="'+a+'" showtime="'+r.time+'" conType="'+(e?"object":"string")+'" style="z-index: '+s+"; width:"+r.area[0]+";height:"+r.area[1]+(r.fixed?"":";position:absolute;")+'">'+(e&&2!=r.type?"":u)+'<div id="'+(r.id||"")+'" class="layui-layer-content'+(0==r.type&&r.icon!==-1?" layui-layer-padding":"")+(3==r.type?" layui-layer-loading"+r.icon:"")+'">'+(0==r.type&&r.icon!==-1?'<i class="layui-layer-ico layui-layer-ico'+r.icon+'"></i>':"")+(1==r.type&&e?"":r.content||"")+'</div><span class="layui-layer-setwin">'+function(){var e=c?'<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>':"";return r.closeBtn&&(e+='<a class="layui-layer-ico '+l[7]+" "+l[7]+(r.title?r.closeBtn:4==r.type?"1":"2")+'" href="javascript:;"></a>'),e}()+"</span>"+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t<i;t++)e+='<a class="'+l[6]+t+'">'+r.btn[t]+"</a>";return'<div class="'+l[6]+" layui-layer-btn-"+(r.btnAlign||"")+'">'+e+"</div>"}():"")+(r.resize?'<span class="layui-layer-resize"></span>':"")+"</div>"],u,i('<div class="layui-layer-move"></div>')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"","auto"];t.content='<iframe scrolling="'+(t.content[1]||"auto")+'" allowtransparency="true" id="'+l[4]+a+'" name="'+l[4]+a+'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="'+t.content[0]+'"></iframe>';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'<i class="layui-layer-TipsG"></i>',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i(".layui-layer-move")[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),i("#layui-layer-shade"+e.index).css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():e.offset(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;a<c.stX&&(a=c.stX),a>f&&(a=f),o<c.stY&&(o=c.stY),o>u&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&i("#layui-layer-shade"+t.index).on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){var a=i("#"+l[0]+e),s=a.find(l[1]).outerHeight()||0,f=a.attr("minLeft")||181*o.minIndex+"px",c=a.css("position");o.record(a),o.minLeft[0]&&(f=o.minLeft[0],o.minLeft.shift()),a.attr("position",c),r.style(e,{width:180,height:s,left:f,top:n.height()-s,position:"fixed",overflow:"hidden"},!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),a.attr("minLeft")||o.minIndex++,a.attr("minLeft",f)},r.restore=function(e){var t=i("#"+l[0]+e),n=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(n[0]),height:parseFloat(n[1]),top:parseFloat(n[2]),left:parseFloat(n[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e)},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e){var t=i("#"+l[0]+e),n=t.attr("type"),a="layer-anim-close";if(t[0]){var s="layui-layer-wrap",f=function(){if(n===o.type[1]&&"object"===t.attr("conType")){t.children(":not(."+l[5]+")").remove();for(var a=t.find("."+s),r=0;r<2;r++)a.unwrap();a.css("display",a.data("display")).removeClass(s)}else{if(n===o.type[2])try{var f=i("#"+l[4]+e)[0];f.contentWindow.document.write(""),f.contentWindow.close(),t.find("."+l[5])[0].removeChild(f)}catch(c){}t[0].innerHTML="",t.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e]};t.data("isOutAnim")&&t.addClass("layer-anim "+a),i("#layui-layer-moves, #layui-layer-shade"+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),t.attr("minLeft")&&(o.minIndex--,o.minLeft.push(t.attr("minLeft"))),r.ie&&r.ie<10||!t.data("isOutAnim")?f():setTimeout(function(){f()},200)}},r.closeAll=function(e){i.each(i("."+l[0]),function(){var t=i(this),n=e?t.attr("type")===e:1;n&&r.close(t.attr("times")),n=null})};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'<textarea class="layui-layer-input"'+a+"></textarea>":function(){return'<input type="'+(1==e.formType?"password":"text")+'" class="layui-layer-input">'}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["确定","取消"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(t){s=t.find(".layui-layer-input"),s.val(e.value||"").focus(),"function"==typeof f&&f(t)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a='<span class="'+n+'">'+t[0].title+"</span>";i<e;i++)a+="<span>"+t[i].title+"</span>";return a}(),content:'<ul class="layui-layer-tabmain">'+function(){var e=t.length,i=1,a="";if(e>0)for(a='<li class="layui-layer-tabli '+n+'">'+(t[0].content||"no content")+"</li>";i<e;i++)a+='<li class="layui-layer-tabli">'+(t[i].content||"no content")+"</li>";return a}()+"</ul>",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=t.photos.constructor===Object,f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("没有图片")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0),h()}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.hover(function(){s.imgsee.show()},function(){s.imgsee.hide()}),s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev()}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext()}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]<r[1]&&(a[0]=a[0]/r[1],a[1]=a[1]/r[1])}return[a[0]+"px",a[1]+"px"]}(),title:!1,shade:.9,shadeClose:!0,closeBtn:!1,move:".layui-layer-phimg img",moveType:1,scrollbar:!1,moveOut:!0,isOutAnim:!1,skin:"layui-layer-photos"+c("photos"),content:'<div class="layui-layer-phimg"><img src="'+u[d].src+'" alt="'+(u[d].alt||"")+'" layer-pid="'+u[d].pid+'"><div class="layui-layer-imgsee">'+(u.length>1?'<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>':"")+'<div class="layui-layer-imgbar" style="display:'+(a?"block":"")+'"><span class="layui-layer-imgtit"><a href="javascript:;">'+(u[d].alt||"")+"</a><em>"+s.imgIndex+"/"+u.length+"</em></span></div></div></div>",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imguide,.layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常<br>是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["static/admin/lib/layui/lay/modules/jquery"],function(){return o.run(e.jQuery),r}):function(){o.run(e.jQuery),r.ready()}()}(window); |
File was renamed from service-daylucky/src/main/resources/static/login.html |
| | |
| | | </form> |
| | | </div> |
| | | |
| | | <script src="js/common.js"></script> |
| | | |
| | | <script> |
| | | var form = null; |
| | | $(function () { |
| | |
| | | captcha: vm.inputThis.yzm |
| | | }, function (data) { |
| | | layer.close(index); |
| | | if (data.code == 200) { |
| | | if (data.code == 0) { |
| | | window.location.replace("index.html"); |
| | | } else { |
| | | common.notify.error(data.msg); |
| | | } |
| | | |
| | | }, function (e) { |
New file |
| | |
| | | package com.ks.daylucky; |
| | | |
| | | import com.ks.daylucky.job.VirtualJoinJob; |
| | | import com.ks.lucky.exception.LuckyActivityException; |
| | | import com.ks.lucky.exception.LuckyActivityJoinException; |
| | | import com.ks.lucky.pojo.DO.LuckyActivityJoinRecord; |
| | | import com.ks.lucky.pojo.DTO.JoinInfo; |
| | | import com.ks.lucky.remote.service.LuckyActivityJoinService; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.UUID; |
| | | |
| | | //@SpringBootTest |
| | | public class JoinTest { |
| | | @Reference(version = "1.0.0") |
| | | private LuckyActivityJoinService luckyActivityJoinService; |
| | | |
| | | @Resource |
| | | private VirtualJoinJob virtualJoinJob; |
| | | |
| | | @Test |
| | | public void join() { |
| | | Long activityId = 10055L; |
| | | Long appId = 5L; |
| | | Long uid = 1024L; |
| | | for (int i = 13; i < 23; i++) { |
| | | JoinInfo joinInfo = JoinInfo.JoinInfoFactory.createAlipay(UUID.randomUUID().toString()); |
| | | try { |
| | | luckyActivityJoinService.join(activityId, appId, (uid + i) + "", null, joinInfo, LuckyActivityJoinRecord.USER_TYPE_VIRTUAL); |
| | | } catch (LuckyActivityException e) { |
| | | e.printStackTrace(); |
| | | } catch (LuckyActivityJoinException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | @Test |
| | | public void virtualJoin() { |
| | | try { |
| | | virtualJoinJob.join("5"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ks.app.util.AlipayAppUtil; |
| | | import com.ks.daylucky.exception.UserMsgException; |
| | | import com.ks.daylucky.pojo.DO.UserInfo; |
| | | import com.ks.daylucky.pojo.DTO.UserMsgSettings; |
| | | import com.ks.daylucky.service.UserInfoExtraService; |
| | | import com.ks.daylucky.service.UserInfoService; |
| | | import com.ks.daylucky.service.UserMsgService; |
| | | import com.ks.daylucky.service.impl.AlipayTemplateMsgManager; |
| | | import com.ks.daylucky.service.impl.AppManager; |
| | | import com.ks.daylucky.util.activity.ActivityUtil; |
| | | import com.ks.daylucky.util.factory.LuckyMsgContentFactory; |
| | | import com.ks.daylucky.util.factory.UserMsgFactory; |
| | | import com.ks.lucky.pojo.DO.LuckyActivity; |
| | | import com.ks.lucky.pojo.DO.LuckyActivityAwardResult; |
| | | import com.ks.lucky.pojo.DO.LuckyActivityAwards; |
| | | import com.ks.lucky.pojo.DO.LuckyActivityJoinRecord; |
| | | import com.ks.lucky.pojo.DTO.ActivitySimpleUser; |
| | | import com.ks.lucky.remote.service.LuckyActivityAwardResultService; |
| | | import com.ks.lucky.remote.service.LuckyActivityAwardService; |
| | | import com.ks.lucky.remote.service.LuckyActivityJoinService; |
| | | import com.ks.lucky.remote.service.LuckyActivityService; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.yeshi.utils.alipay.AlipayXcxUtil; |
| | | import org.yeshi.utils.exception.AlipayXcxException; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @SpringBootTest |
| | | public class MsgTest { |
| | |
| | | |
| | | @Reference(version = "1.0.0") |
| | | private LuckyActivityService luckyActivityService; |
| | | @Reference(version = "1.0.0") |
| | | private LuckyActivityJoinService luckyActivityJoinService; |
| | | @Resource |
| | | private UserInfoExtraService userInfoExtraService; |
| | | @Reference(version = "1.0.0") |
| | | private LuckyActivityAwardResultService luckyActivityAwardResultService; |
| | | @Reference(version = "1.0.0") |
| | | private LuckyActivityAwardService luckyActivityAwardService; |
| | | |
| | | @Resource |
| | | private AlipayTemplateMsgManager alipayTemplateMsgManager; |
| | | |
| | | |
| | | Logger logger = LoggerFactory.getLogger(MsgTest.class); |
| | | |
| | | @Test |
| | | public void addMsg() { |
| | |
| | | } |
| | | } |
| | | |
| | | private List<ActivitySimpleUser> getValidJoinerList(Long activityId) { |
| | | List<ActivitySimpleUser> list = new ArrayList<>(); |
| | | //查询所有参与者 |
| | | long count = luckyActivityJoinService.countJoiner(activityId, LuckyActivityJoinRecord.USER_TYPE_REAL); |
| | | int pageSize = 500; |
| | | int page = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); |
| | | for (int i = 0; i < page; i++) { |
| | | List<ActivitySimpleUser> userList = luckyActivityJoinService.getJoinerList(activityId, LuckyActivityJoinRecord.USER_TYPE_REAL, i + 1, pageSize); |
| | | list.addAll(userList); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | private UserMsgSettings getUserMsgSetting(Long uid) { |
| | | return userInfoExtraService.getUserMsgSettings(uid); |
| | | } |
| | | |
| | | @Test |
| | | public void consumeMsg() { |
| | | |
| | | Long activityId = 10052L; |
| | | List<ActivitySimpleUser> userList = getValidJoinerList(activityId); |
| | | for (ActivitySimpleUser user : userList) { |
| | | //判断是否中奖 |
| | | UserMsgSettings settings = getUserMsgSetting(Long.parseLong(user.getUid())); |
| | | LuckyActivity activity = luckyActivityService.getActivity(activityId); |
| | | |
| | | LuckyActivityAwardResult result = luckyActivityAwardResultService.getResult(user.getAppId(), user.getUid(), activityId); |
| | | if (result != null) { |
| | | if (settings.getDrawnMsg() != null && settings.getDrawnMsg()) { |
| | | LuckyActivityAwards awards = luckyActivityAwardService.getAwardDetail(result.getAwardId()); |
| | | |
| | | try { |
| | | userMsgService.addMsg(UserMsgFactory.createLuckyMsg(Long.parseLong(result.getUid()), LuckyMsgContentFactory.createDrawn(activityId, activity.getCreateTime(), awards.getAwardName()))); |
| | | } catch (UserMsgException e) { |
| | | logger.error("添加中奖消息出错 awardResultId-{}", result.getId(), e); |
| | | } |
| | | |
| | | //发送中奖模板消息 |
| | | alipayTemplateMsgManager.sendDrawnMsg(activity, Long.parseLong(result.getUid())); |
| | | } |
| | | } else { |
| | | if (settings.getNotDrawnMsg() != null && settings.getNotDrawnMsg()) { |
| | | try { |
| | | userMsgService.addMsg(UserMsgFactory.createLuckyMsg(Long.parseLong(user.getUid()), LuckyMsgContentFactory.createNotDrawn(activityId, activity.getCreateTime()))); |
| | | } catch (UserMsgException e) { |
| | | logger.error("添加未中奖消息出错 activityId-{} uid-{} ",activityId, user.getUid(), e); |
| | | } |
| | | //发送未中奖模板消息 |
| | | alipayTemplateMsgManager.sendUnDrawnMsg(activity, Long.parseLong(result.getUid())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | //中奖状态 |
| | | public List<Integer> drawStateList; |
| | | public Integer userType; |
| | | public Integer maxWeight; |
| | | } |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void addRecord(Set<String> uids, Long activityId, long awardId) { |
| | | if (uids == null || uids.size() == 0) { |
| | | return; |
| | | } |
| | | LuckyActivityAwards award = luckyActivityAwardManager.getAwardDetail(awardId); |
| | | Map<String, BigDecimal> moneyMap = new HashMap<>(); |
| | | //计算每个人的支付宝红包金额 |
| | |
| | | if (result.getState() != LuckyActivityAwardResult.STATE_NOT_RECIEVE) { |
| | | return; |
| | | } |
| | | LoggerUtil.activityJoinLogger.info("设置中奖过期未领开始:awardResultId-{}",id); |
| | | LoggerUtil.activityJoinLogger.info("设置中奖过期未领开始:awardResultId-{}", id); |
| | | |
| | | LuckyActivityAwardResult update = new LuckyActivityAwardResult(); |
| | | update.setId(id); |
| | |
| | | result.setState(update.getState()); |
| | | //发布消息 |
| | | CMQManager.getInstance().publishActivityDrawnMsg(ActivityDrawnMsgDTO.create(result)); |
| | | LoggerUtil.activityJoinLogger.info("设置中奖过期未领成功:awardResultId-{}",id); |
| | | LoggerUtil.activityJoinLogger.info("设置中奖过期未领成功:awardResultId-{}", id); |
| | | } |
| | | |
| | | /** |
| | |
| | | * 获取参与数据 |
| | | * |
| | | * @param activityId |
| | | * @param userType 用户类型 |
| | | * @return |
| | | */ |
| | | public Map<String, Integer> getJoinData(Long activityId) { |
| | | public Map<String, Integer> getJoinData(Long activityId, Integer userType) { |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | ActivityJoinRecordQuery query = new ActivityJoinRecordQuery(); |
| | | if (userType != null) { |
| | | query.userType = userType; |
| | | } |
| | | query.activityId = activityId; |
| | | long count = luckyActivityJoinRecordMapper.count(query); |
| | | int pageSize = 200; |
| | |
| | | int difJoinnerCount = openInfo.getMinPersonCount() - (int) joinerCount; |
| | | difJoinnerCount = difJoinnerCount > 0 ? difJoinnerCount : 0; |
| | | |
| | | joinerCount = joinerCount < openInfo.getMinPersonCount() ? (openInfo.getMinPersonCount()) : joinerCount; |
| | | long joinerCountCompute = joinerCount < openInfo.getMinPersonCount() ? (openInfo.getMinPersonCount()) : joinerCount; |
| | | |
| | | //平均中奖概率 |
| | | BigDecimal averageProbability = new BigDecimal(awardCount).divide(new BigDecimal(joinerCount), 8, BigDecimal.ROUND_DOWN); |
| | | BigDecimal averageProbability = new BigDecimal(awardCount).divide(new BigDecimal(joinerCountCompute), 8, BigDecimal.ROUND_DOWN); |
| | | statistic.setAverageDrawnProbability(averageProbability); |
| | | LuckyActivityJoinRecord record=null; |
| | | if (!StringUtil.isNullOrEmpty(uid)) { |
| | | query.appId = appId; |
| | | query.uid = uid; |
| | | LuckyActivityJoinRecord record = luckyActivityJoinManager.getRecord(activityId, appId, uid); |
| | | record = luckyActivityJoinManager.getRecord(activityId, appId, uid); |
| | | if (record != null) { |
| | | //我的中奖概率 |
| | | BigDecimal myProbability = new BigDecimal(awardCount * record.getWeight()).divide(new BigDecimal(weight).add(new BigDecimal(difJoinnerCount)), 8, BigDecimal.ROUND_DOWN); |
| | | statistic.setMyDrawnProbability(myProbability); |
| | | } |
| | | } |
| | | //超过了多少人 |
| | | query = new ActivityJoinRecordQuery(); |
| | | query.activityId = activityId; |
| | | query.maxWeight=record.getWeight(); |
| | | long lessCount = luckyActivityJoinRecordMapper.count(query); |
| | | statistic.setExceedPersonPercent(new BigDecimal(lessCount).multiply(new BigDecimal(100).divide(new BigDecimal(joinerCount), 2, BigDecimal.ROUND_DOWN))); |
| | | |
| | | statistic.setActivityId(activityId); |
| | | return statistic; |
| | | } |
| | |
| | | import com.ks.lucky.mapper.LuckyActivityMapper; |
| | | import com.ks.lucky.pojo.DO.LuckyActivity; |
| | | import com.ks.lucky.pojo.DO.LuckyActivityAwards; |
| | | import com.ks.lucky.pojo.DO.LuckyActivityJoinRecord; |
| | | import com.ks.lucky.pojo.DO.LuckyActivityOpenInfo; |
| | | import com.ks.lucky.pojo.DTO.ActivityMQMsg; |
| | | import com.ks.lucky.remote.service.LuckyActivityOpenService; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | |
| | | @Service(version = "1.0.0") |
| | | public class LuckyActivityOpenServiceImpl implements LuckyActivityOpenService { |
| | |
| | | throw new LuckyActivityAwardException(LuckyActivityAwardException.CODE_NOT_EXIST, "无奖项信息"); |
| | | } |
| | | |
| | | //获取用户数据 |
| | | Map<String, Integer> data = luckyActivityJoinManager.getJoinData(activityId); |
| | | |
| | | Set<String> drawnUserSet = new HashSet<>(); |
| | | |
| | | //虚拟用户先中奖 |
| | | Map<String, Integer> data = luckyActivityJoinManager.getJoinData(activityId, LuckyActivityJoinRecord.USER_TYPE_VIRTUAL); |
| | | for (LuckyActivityAwards awards : awardsList) { |
| | | if (awards.getRealDrawnPercent().compareTo(new BigDecimal(1)) >= 0) { |
| | | //完全真实情况 |
| | | continue; |
| | | } |
| | | BigDecimal virtualRate = new BigDecimal(1).subtract(awards.getRealDrawnPercent()); |
| | | int count = virtualRate.multiply(new BigDecimal(awards.getCount())).setScale(0, RoundingMode.UP).intValue(); |
| | | Set<String> uids = LuckyRunUtil.compute(data, count); |
| | | for (String uid : uids) { |
| | | data.remove(uid); |
| | | } |
| | | drawnUserSet.addAll(uids); |
| | | //保存开奖结果 |
| | | luckyActivityAwardResultManager.addRecord(uids, awards.getActivityId(), awards.getId()); |
| | | //剩余奖品数量 |
| | | awards.setCount(awards.getCount() - count); |
| | | } |
| | | |
| | | //除去已经中奖的用户再次中奖 |
| | | data = luckyActivityJoinManager.getJoinData(activityId, null); |
| | | for (String uid : drawnUserSet) { |
| | | data.remove(uid); |
| | | } |
| | | |
| | | for (LuckyActivityAwards awards : awardsList) { |
| | | //获取中奖用户ID |
| | | Set<String> uids = LuckyRunUtil.compute(data, awards.getCount()); |
| | | //移除已经中奖了的用户 |
| | | for (String uid : uids) { |
| | | data.remove(uid); |
| | | } |
| | | //保存开奖结果 |
| | | luckyActivityAwardResultManager.addRecord(uids, awards.getActivityId(), awards.getId()); |
| | | } |
| | | |
| | | |
| | | //更新状态 |
| | | luckyActivityManager.setState(activityId,LuckyActivity.STATE_PRE_OPENED,"预开奖成功"); |
| | | luckyActivityManager.setState(activityId, LuckyActivity.STATE_PRE_OPENED, "预开奖成功"); |
| | | |
| | | //添加消息 |
| | | CMQManager.getInstance().addActivityMsg(new ActivityMQMsg(activityId, ActivityMQMsg.TYPE_OPEN_SHOW, new Date())); |
| | |
| | | throw new LuckyActivityException(1, "尚未开奖"); |
| | | } |
| | | |
| | | LuckyActivity update = new LuckyActivity(); |
| | | update.setId(activityId); |
| | | update.setUpdateTime(new Date()); |
| | | update.setState(LuckyActivity.STATE_OPENED); |
| | | update.setStateRemarks("已开奖"); |
| | | luckyActivityManager.updateSelectiveByPrimaryKey(update); |
| | | luckyActivityManager.setState(activityId, LuckyActivity.STATE_OPENED, "已开奖"); |
| | | |
| | | //设置实际开奖时间 |
| | | LuckyActivityOpenInfo openInfo = luckyActivityOpenInfoManager.getOpenInfo(activityId); |
| | |
| | | * @return |
| | | */ |
| | | public static Set<String> compute(Map<String, Integer> map, int number) { |
| | | if (number < 1) { |
| | | return new HashSet<>(); |
| | | } |
| | | |
| | | List<String> mList = new ArrayList<>(); |
| | | for (Iterator<String> its = map.keySet().iterator(); its.hasNext(); ) { |
| | |
| | | <result column="remarks" jdbcType="VARCHAR" property="remarks"/> |
| | | <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> |
| | | <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> |
| | | |
| | | <result column="real_drawn_percent" property="realDrawnPercent" jdbcType="DECIMAL"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">id, activity_id, level, count, award_way, award_params, material_id, remarks, create_time, update_time,award_name,award_poster</sql> |
| | | <sql id="Base_Column_List">id, activity_id, level, count, award_way, award_params, material_id, remarks, create_time, update_time,award_name,award_poster,real_drawn_percent</sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">select |
| | | <include refid="Base_Column_List"/> |
| | | from lucky_activity_awards where id = #{id,jdbcType=BIGINT} |
| | |
| | | from lucky_activity_awards where 1=1 |
| | | <include refid="listWhere"/> |
| | | <if test="query.sortList!=null"> |
| | | <foreach collection="query.sortList" item="item" separator="," open=" order by "> ${item}</foreach> |
| | | <foreach collection="query.sortList" item="item" separator="," open=" order by ">${item}</foreach> |
| | | </if> |
| | | limit #{query.start},#{query.count} |
| | | </select> |
| | |
| | | <delete id="deleteByPrimaryKey" |
| | | parameterType="java.lang.Long">delete from lucky_activity_awards where id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" useGeneratedKeys="true" keyProperty="id" |
| | | parameterType="com.ks.lucky.pojo.DO.LuckyActivityAwards">insert into lucky_activity_awards (id, activity_id, level, count, award_way, award_params, material_id, remarks, create_time, update_time,id,award_name,award_poster) values (#{id,jdbcType=BIGINT}, #{activityId,jdbcType=BIGINT}, #{level,jdbcType=INTEGER}, #{count,jdbcType=INTEGER}, #{awardWay,jdbcType=INTEGER}, #{awardParams,jdbcType=VARCHAR}, #{materialId,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},#{id,jdbcType=BIGINT},#{awardName,jdbcType=VARCHAR},#{awardPoster,jdbcType=VARCHAR})</insert> |
| | | parameterType="com.ks.lucky.pojo.DO.LuckyActivityAwards">insert into lucky_activity_awards (id, activity_id, level, count, award_way, award_params, material_id, remarks, create_time, update_time,id,award_name,award_poster,real_drawn_percent) values (#{id,jdbcType=BIGINT}, #{activityId,jdbcType=BIGINT}, #{level,jdbcType=INTEGER}, #{count,jdbcType=INTEGER}, #{awardWay,jdbcType=INTEGER}, #{awardParams,jdbcType=VARCHAR}, #{materialId,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},#{id,jdbcType=BIGINT},#{awardName,jdbcType=VARCHAR},#{awardPoster,jdbcType=VARCHAR},#{realDrawnPercent,jdbcType=DECIMAL})</insert> |
| | | <insert id="insertSelective" useGeneratedKeys="true" keyProperty="id" |
| | | parameterType="com.ks.lucky.pojo.DO.LuckyActivityAwards">insert into lucky_activity_awards |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="awardName != null">award_name,</if> |
| | | <if test="awardPoster != null">award_poster,</if> |
| | | <if test="realDrawnPercent != null">real_drawn_percent,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="awardName != null">#{awardName,jdbcType=VARCHAR},</if> |
| | | <if test="awardPoster != null">#{awardPoster,jdbcType=VARCHAR},</if> |
| | | <if test="realDrawnPercent != null">#{realDrawnPercent,jdbcType=DECIMAL}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.lucky.pojo.DO.LuckyActivityAwards">update |
| | |
| | | <if test="updateTime != null">update_time = #{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="awardName !=null">award_name =#{awardName,jdbcType=VARCHAR},</if> |
| | | <if test="awardPoster !=null">award_poster =#{awardPoster,jdbcType=VARCHAR},</if> |
| | | <if test="realDrawnPercent !=null">real_drawn_percent =#{realDrawnPercent,jdbcType=DECIMAL},</if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" |
| | | parameterType="com.ks.lucky.pojo.DO.LuckyActivityAwards">update lucky_activity_awards set activity_id = #{activityId,jdbcType=BIGINT}, level = #{level,jdbcType=INTEGER}, count = #{count,jdbcType=INTEGER}, award_way = #{awardWay,jdbcType=INTEGER}, award_params = #{awardParams,jdbcType=VARCHAR}, material_id = #{materialId,jdbcType=VARCHAR}, remarks = #{remarks,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP} ,award_name =#{awardName,jdbcType=VARCHAR} ,award_poster =#{awardPoster,jdbcType=VARCHAR} where id = #{id,jdbcType=BIGINT}</update> |
| | | parameterType="com.ks.lucky.pojo.DO.LuckyActivityAwards">update lucky_activity_awards set activity_id = #{activityId,jdbcType=BIGINT}, level = #{level,jdbcType=INTEGER}, count = #{count,jdbcType=INTEGER}, award_way = #{awardWay,jdbcType=INTEGER}, award_params = #{awardParams,jdbcType=VARCHAR}, material_id = #{materialId,jdbcType=VARCHAR}, remarks = #{remarks,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP} ,award_name =#{awardName,jdbcType=VARCHAR} ,award_poster =#{awardPoster,jdbcType=VARCHAR} ,real_drawn_percent =#{realDrawnPercent,jdbcType=DECIMAL} where id = #{id,jdbcType=BIGINT}</update> |
| | | </mapper> |
| | |
| | | </if> |
| | | <if test="query.minCreateTime!=null">and create_time>=#{query.minCreateTime}</if> |
| | | <if test="query.maxCreateTime!=null">and #{query.maxCreateTime}>create_time</if> |
| | | <if test="query.maxWeight!=null">and #{query.maxWeight}>weight </if> |
| | | |
| | | |
| | | </sql> |
| | | |
| | | |
| | |
| | | |
| | | @Test |
| | | public void test(){ |
| | | ColumnParseUtil.parseColumn(LuckyActivityOpenInfo.class,"D:\\workspace\\DayLucky\\service-lucky\\src\\main\\resources\\mapper\\LuckyActivityOpenInfoMapper.xml"); |
| | | ColumnParseUtil.parseColumn(LuckyActivityAwards.class,"D:\\workspace\\DayLucky\\service-lucky\\src\\main\\resources\\mapper\\LuckyActivityAwardsMapper.xml"); |
| | | } |
| | | } |
| | |
| | | |
| | | @Test |
| | | public void join() { |
| | | Long activityId = 10037L; |
| | | Long activityId = 10052L; |
| | | Long appId = 4L; |
| | | String uid = 8L + ""; |
| | | for (int i = 0; i < 1000; i++) { |
| | | Long uid = 1024L; |
| | | for (int i = 0; i < 7; i++) { |
| | | JoinInfo joinInfo = JoinInfo.JoinInfoFactory.createAlipay(UUID.randomUUID().toString()); |
| | | try { |
| | | luckyActivityJoinService.join(activityId, appId, (i + 8) + "", null, joinInfo, LuckyActivityJoinRecord.USER_TYPE_VIRTUAL); |
| | | luckyActivityJoinService.join(activityId, appId, (uid + i) + "", null, joinInfo, LuckyActivityJoinRecord.USER_TYPE_VIRTUAL); |
| | | } catch (LuckyActivityException e) { |
| | | e.printStackTrace(); |
| | | } catch (LuckyActivityJoinException e) { |