| | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.PrintWriter; |
| | |
| | | } |
| | | |
| | | |
| | | @RequestMapping("getTime") |
| | | public void getTime(PrintWriter out) { |
| | | |
| | | long time = System.currentTimeMillis(); |
| | | |
| | | String str = TimeUtil.getGernalTime(time, "yyyyMMdd HH:mm:ss"); |
| | | |
| | | out.print(String.format("time: %s format:%s", time + "", str)); |
| | | } |
| | | |
| | | |
| | | @RequestMapping("searchAlbum") |
| | | public void searchAlbum(String key, PrintWriter out) { |
| | | SearchService.SearchResult result = searchService.searchAlbum(0, key, null, 1, 20, false); |
| | |
| | | private EHCacheManager ehCacheManager; |
| | | |
| | | @RequestMapping("configList") |
| | | public void configList(Long detailSystemId, String key, PrintWriter out) { |
| | | public void configList(Long detailSystemId, String key, String type, PrintWriter out) { |
| | | key = StringUtil.isNullOrEmpty(key) ? "" : key.trim(); |
| | | List<DetailSystemConfig> list = configService.listConfig(detailSystemId, key); |
| | | List<DetailSystemConfig> list = null; |
| | | if ("value".equalsIgnoreCase(type)) { |
| | | list = configService.listConfigByValue(detailSystemId, key); |
| | | } else { |
| | | list = configService.listConfig(detailSystemId, key); |
| | | } |
| | | JSONObject json = new JSONObject(); |
| | | json.put("code", "0"); |
| | | JSONArray listJson = new JSONArray(list); |
| | |
| | | userParser.sendVerifyCode(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("register")) { |
| | | userParser.register(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("phoneLogin")) { |
| | | userParser.phoneLogin(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("login")) { |
| | | userParser.login(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("updateLoginUserInfo")) { |
| | |
| | | commentParser.bindWX(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("allowOneKeyLogin")) { |
| | | commentParser.allowOneKeyLogin(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("sendSMSCode")) { |
| | | //短信发送 |
| | | userParser.sendSMSCode(acceptData, request, out); |
| | | } |
| | | out.close(); |
| | | } |
| | |
| | | userParser.register(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("login")) { |
| | | userParser.login(acceptData, request, out); |
| | | }else if (method.equalsIgnoreCase("phoneLogin")) { |
| | | userParser.phoneLogin(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("updateLoginUserInfo")) { |
| | | userParser.updateLoginUserInfo(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getLoginUserInfo")) { |
New file |
| | |
| | | package com.yeshi.buwan.controller.api; |
| | | |
| | | import com.yeshi.buwan.service.inter.user.UserDPContentWatchStatisticService; |
| | | import com.yeshi.buwan.util.JsonUtilV2; |
| | | import com.yeshi.buwan.util.RedisManager; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import org.apache.zookeeper.Login; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.annotation.RequestSerializableByKey; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 客户端事件收集 |
| | | * @date 15:36 2021/12/28 |
| | | * @return |
| | | **/ |
| | | @Controller |
| | | @RequestMapping("api/v2/event") |
| | | public class ClientEventController { |
| | | |
| | | Logger logger = LoggerFactory.getLogger(ClientEventController.class); |
| | | |
| | | @Resource |
| | | private UserDPContentWatchStatisticService userDPContentWatchStatisticService; |
| | | |
| | | |
| | | ///阅读新闻 |
| | | @RequestMapping("readNews") |
| | | @ResponseBody |
| | | public String readNews(AcceptData acceptData, String LoginUid) { |
| | | logger.info("readNews:{},{},{}", acceptData.getDetailSystem().getId(), userDPContentWatchStatisticService.getIdentityId(acceptData), LoginUid); |
| | | userDPContentWatchStatisticService.readNews(acceptData, LoginUid); |
| | | return JsonUtilV2.loadTrueJson(""); |
| | | } |
| | | |
| | | ///沉浸式视频播放 |
| | | @RequestSerializableByKey(key = "#acceptData.Package+'-'+#acceptData.device+'-'+#acceptData.utdId") |
| | | @RequestMapping("playDrawVideo") |
| | | @ResponseBody |
| | | public String playDrawVideo(AcceptData acceptData, String Source, String From, boolean Finish, String LoginUid) { |
| | | logger.info("playDrawVideo:{},{},{},{},{},{}", acceptData.getDetailSystem().getId(), userDPContentWatchStatisticService.getIdentityId(acceptData), Source, From, Finish, LoginUid); |
| | | userDPContentWatchStatisticService.playDrawVideo(acceptData, LoginUid); |
| | | return JsonUtilV2.loadTrueJson(""); |
| | | } |
| | | |
| | | ///小说阅读 |
| | | @RequestMapping("readNovel") |
| | | @ResponseBody |
| | | public String readNovel(AcceptData acceptData, long Duration, String LoginUid) { |
| | | logger.info("readNovel:{},{},{},{}", acceptData.getDetailSystem().getId(), userDPContentWatchStatisticService.getIdentityId(acceptData), Duration, LoginUid); |
| | | userDPContentWatchStatisticService.readNovel(acceptData, Duration, LoginUid); |
| | | return JsonUtilV2.loadTrueJson(""); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | } catch (SMSException e) { |
| | | e.printStackTrace(); |
| | | out.print(JsonUtil.loadFalseJson(e.getMessage())); |
| | | logger.error("发送验证码出错:phone-{} msg-{}",phone,e.getMessage(),e); |
| | | return; |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadFalseJson("短信发送出错,请稍后再试")); |
| | | logger.error("发送验证码出错:phone-{} msg-{}",phone,e.getMessage(),e); |
| | | return; |
| | | } |
| | | out.print(JsonUtil.loadTrueJson("")); |
| | | } |
| | | |
| | | |
| | | |
| | | public void getVideoCommentList(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | |
| | | String videoId = request.getParameter("VideoId"); |
| | |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.recommend.FloatAD; |
| | | import com.yeshi.buwan.domain.user.UserDPContentWatchStatistic; |
| | | import com.yeshi.buwan.dto.config.ADShieldIPConfig; |
| | | import com.yeshi.buwan.dto.log.BaseLog; |
| | | import com.yeshi.buwan.log.LogHelper; |
| | | import com.yeshi.buwan.service.imp.SystemService; |
| | | import com.yeshi.buwan.service.inter.ad.FloatADService; |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import com.yeshi.buwan.service.inter.user.UserDPContentWatchStatisticService; |
| | | import com.yeshi.buwan.service.manager.APPManager; |
| | | import com.yeshi.buwan.service.manager.IPManager; |
| | | import com.yeshi.buwan.util.IPUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | |
| | | |
| | | @Resource |
| | | private SystemConfigService systemConfigService; |
| | | |
| | | @Resource |
| | | private UserDPContentWatchStatisticService userDPContentWatchStatisticService; |
| | | |
| | | @Resource |
| | | private APPManager appManager; |
| | | |
| | | |
| | | public ADConfig getAdShowType(String key, String channel, int version, Map<String, String> map) { |
| | |
| | | } |
| | | } |
| | | } |
| | | //是否为内容阅读用户 |
| | | boolean isDPUser = false; |
| | | try { |
| | | isDPUser = userDPContentWatchStatisticService.isDPUser(acceptData); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | |
| | | //广告全部屏蔽区域 |
| | | String shieldAdLocationInfo = map.get("shield_ad_ip_location"); |
| | | boolean hiddenAll = shieldAllAd(acceptData.getChannel(), acceptData.getVersion(), shieldAdLocationInfo, ip); |
| | |
| | | splashConfig = null; |
| | | //开屏 |
| | | ad.put("splash", splash); |
| | | if (!isDPUser) |
| | | adNew.put("splash", gson.toJson(splashConfig)); |
| | | |
| | | |
| | |
| | | if (hiddenAll) |
| | | adConfig = null; |
| | | ad.put("exitApp", adConfig == null ? "" : adConfig.getType()); |
| | | if (!isDPUser) |
| | | adNew.put("exitApp", gson.toJson(adConfig)); |
| | | //全屏广告控制 |
| | | adConfig = getAdShowType("ad_video_detail_full_video", acceptData.getChannel(), acceptData.getVersion(), map); |
| | | if (hiddenAll) |
| | | adConfig = null; |
| | | ad.put("videoDetailFullVideo", adConfig == null ? "" : adConfig.getType()); |
| | | if (!isDPUser) |
| | | adNew.put("videoDetailFullVideo", gson.toJson(adConfig)); |
| | | //搜索页广告控制 |
| | | adConfig = getAdShowType("ad_video_search", acceptData.getChannel(), acceptData.getVersion(), map); |
| | |
| | | adConfig = getAdShowType("home_ad_interstitial", acceptData.getChannel(), acceptData.getVersion(), map); |
| | | if (hiddenAll) |
| | | adConfig = null; |
| | | if (!isDPUser) |
| | | adNew.put("homeInterstitial", gson.toJson(adConfig)); |
| | | |
| | | //应用退出全屏 |
| | | adConfig = getAdShowType("ad_exit_app_fullvideo", acceptData.getChannel(), acceptData.getVersion(), map); |
| | | if (hiddenAll) |
| | | adConfig = null; |
| | | if (!isDPUser) |
| | | adNew.put("exitAppFullvideo", gson.toJson(adConfig)); |
| | | |
| | | |
| | | |
| | | //其他广告 |
| | |
| | | //注销 |
| | | data.put("unRegisterLink", map.get("unregister_link")); |
| | | |
| | | data.put("aboutUsLink", map.get("about_us_link")); |
| | | data.put("feedBackLink", map.get("feed_back_link")); |
| | | data.put("helpLink", map.get("help_link")); |
| | | |
| | | //是否正在上线 |
| | | |
| | | boolean onLine = false; |
| | | try { |
| | | onLine = appManager.isOnline(acceptData.getDetailSystem().getId(), acceptData.getVersion(), acceptData.getChannel()); |
| | | } catch (Exception e) { |
| | | } |
| | | data.put("onLining", onLine); |
| | | |
| | | |
| | | out.print(JsonUtil.loadTrueJson(data.toString())); |
| | | } |
| | |
| | | import com.yeshi.buwan.dto.search.SolrShortVideoSearchFilter; |
| | | import com.yeshi.buwan.dto.search.SolrVideoSearchFilter; |
| | | import com.yeshi.buwan.dto.user.LoginInfoDto; |
| | | import com.yeshi.buwan.exception.SMSException; |
| | | import com.yeshi.buwan.exception.user.LoginUserException; |
| | | import com.yeshi.buwan.exception.user.RegisterUserException; |
| | | import com.yeshi.buwan.service.inter.SMSService; |
| | | import com.yeshi.buwan.videos.pptv.PPTVUtil; |
| | | import com.yeshi.buwan.service.imp.*; |
| | | import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService; |
| | |
| | | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | |
| | | @Resource |
| | | private SMSService smsService; |
| | | |
| | | public void getUid(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); |
| | |
| | | content = title; |
| | | } |
| | | |
| | | boolean isS = MailSenderUtil.sendEmail(account, "ysyz17784739772@126.com", "weikou2014", title, |
| | | boolean isS = MailSenderUtil.sendEmail(account, "app_yzm_zc@163.com", "KZKSRTEMDWEQRAQR", title, |
| | | content); |
| | | // } |
| | | |
| | | // }).start(); |
| | | out.print(JsonUtil.loadTrueJson("验证码发送成功")); |
| | | } |
| | | |
| | | |
| | | public void sendSMSCode(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | String phone = request.getParameter("phone"); |
| | | |
| | | if (StringUtil.isNullOrEmpty(phone)) { |
| | | out.print(JsonUtil.loadFalseJson("电话号码不能为空")); |
| | | return; |
| | | } |
| | | |
| | | if (!StringUtil.isMobile(phone)) { |
| | | out.print(JsonUtil.loadFalseJson("电话号码格式不正确")); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | smsService.sendLoginVCode(phone, 6,acceptData.getDetailSystem().getId(),acceptData.getVersion()); |
| | | } catch (SMSException e) { |
| | | e.printStackTrace(); |
| | | out.print(JsonUtil.loadFalseJson(e.getMessage())); |
| | | return; |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadFalseJson("短信发送出错,请稍后再试")); |
| | | return; |
| | | } |
| | | out.print(JsonUtil.loadTrueJson("")); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 登录 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 登录 |
| | | * |
| | | * @param request |
| | | * @param out |
| | | */ |
| | | public void phoneLogin(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | String account = request.getParameter("phone");// 邮箱 |
| | | String vcode = request.getParameter("code");// 密码 |
| | | if (StringUtil.isNullOrEmpty(account)) { |
| | | out.print(JsonUtil.loadFalseJson("请上传手机号")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(vcode)) { |
| | | out.print(JsonUtil.loadFalseJson("请上传验证码")); |
| | | return; |
| | | } |
| | | |
| | | if (!smsService.verifyLoginVCode(account, vcode,acceptData.getDetailSystem().getId(),acceptData.getVersion())) { |
| | | out.print(JsonUtil.loadFalseJson("验证码错误")); |
| | | return; |
| | | } |
| | | |
| | | LoginInfoDto loginInfoDto = new LoginInfoDto(); |
| | | loginInfoDto.setLoginType(LoginUser.LOGIN_TYPE_PHONE); |
| | | loginInfoDto.setSystemId(acceptData.getDetailSystem().getSystem().getId()); |
| | | loginInfoDto.setPhone(account); |
| | | loginInfoDto.setSmsCode(vcode); |
| | | loginInfoDto.setIpInfo(IPUtil.getRemotIP(request) + ":" + request.getRemotePort()); |
| | | try { |
| | | LoginUser user = userService.login(loginInfoDto); |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(user))); |
| | | } catch (LoginUserException e) { |
| | | //用户不存在 |
| | | if (e.getCode() == LoginUserException.CODE_NO_USER) { |
| | | //注册用户 |
| | | try { |
| | | userService.register(loginInfoDto); |
| | | //注册成功,开始登录 |
| | | try { |
| | | LoginUser user = userService.login(loginInfoDto); |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(user))); |
| | | } catch (LoginUserException e2) { |
| | | out.print(JsonUtil.loadFalseJson("登录出错,请稍后再试")); |
| | | } |
| | | |
| | | } catch (RegisterUserException e1) { |
| | | e1.printStackTrace(); |
| | | out.print(JsonUtil.loadFalseJson("登录出错,请稍后再试")); |
| | | } |
| | | } else { |
| | | out.print(JsonUtil.loadFalseJson(e.getMessage())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 更改用户信息 |
| | | * |
| | |
| | | return list("from DetailSystemConfig c where c.systemId=? and c.beizhu like ?", new BigInteger( systemId+""), "%" + searchKey + "%"); |
| | | } |
| | | |
| | | |
| | | |
| | | public List<DetailSystemConfig> listByValue(Long systemId, String searchKey) { |
| | | return list("from DetailSystemConfig c where c.systemId=? and c.value like ?", new BigInteger( systemId+""), "%" + searchKey + "%"); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.dao.user; |
| | | |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | import com.yeshi.buwan.domain.user.UserDPContentWatchStatistic; |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import java.lang.Long; |
| | | import java.util.Date; |
| | | import java.lang.String; |
| | | import java.util.ArrayList; |
| | | |
| | | |
| | | @Repository |
| | | public class UserDPContentWatchStatisticDao extends MongodbBaseDao<UserDPContentWatchStatistic>{ |
| | | |
| | | public void updateSelective(UserDPContentWatchStatistic bean) { |
| | | Query query = new Query(); |
| | | Update update=new Update(); |
| | | query.addCriteria(Criteria.where("id").is(bean.getId())); |
| | | if(bean.getDetailSystemId() != null) { |
| | | update.set("detailSystemId", bean.getDetailSystemId()); |
| | | } |
| | | if(bean.getDevice() != null) { |
| | | update.set("device", bean.getDevice()); |
| | | } |
| | | if(bean.getLoginUid() != null) { |
| | | update.set("loginUid", bean.getLoginUid()); |
| | | } |
| | | if(bean.getNovelDuration() != null) { |
| | | update.set("novelDuration", bean.getNovelDuration()); |
| | | } |
| | | if(bean.getDrawVideoNum() != null) { |
| | | update.set("drawVideoNum", bean.getDrawVideoNum()); |
| | | } |
| | | if(bean.getNewsNum() != null) { |
| | | update.set("newsNum", bean.getNewsNum()); |
| | | } |
| | | if(bean.getCreateTime() != null) { |
| | | update.set("createTime", bean.getCreateTime()); |
| | | } |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | |
| | | |
| | | public List<UserDPContentWatchStatistic> list(DaoQuery daoQuery){ |
| | | Query query=getQuery(daoQuery); |
| | | if(daoQuery.sortList!=null&&daoQuery.sortList.size()>0){ |
| | | query.with(new Sort(daoQuery.sortList)); |
| | | } |
| | | query.skip(daoQuery.start); |
| | | query.limit(daoQuery.count); |
| | | return findList(query); |
| | | } |
| | | |
| | | public long count(DaoQuery daoQuery){ |
| | | Query query=getQuery(daoQuery); |
| | | return count(query); |
| | | } |
| | | |
| | | private Query getQuery(DaoQuery daoQuery){ |
| | | List<Criteria> andList=new ArrayList<>(); |
| | | if(daoQuery.detailSystemId!=null){ |
| | | andList.add(Criteria.where("detailSystemId").is(daoQuery.detailSystemId)); |
| | | } |
| | | if(daoQuery.device!=null){ |
| | | andList.add(Criteria.where("device").is(daoQuery.device)); |
| | | } |
| | | if(daoQuery.loginUid!=null){ |
| | | andList.add(Criteria.where("loginUid").is(daoQuery.loginUid)); |
| | | } |
| | | if(daoQuery.novelDuration!=null){ |
| | | andList.add(Criteria.where("novelDuration").is(daoQuery.novelDuration)); |
| | | } |
| | | if(daoQuery.drawVideoNum!=null){ |
| | | andList.add(Criteria.where("drawVideoNum").is(daoQuery.drawVideoNum)); |
| | | } |
| | | if(daoQuery.newsNum!=null){ |
| | | andList.add(Criteria.where("newsNum").is(daoQuery.newsNum)); |
| | | } |
| | | if(daoQuery.minCreateTime!=null){ |
| | | andList.add(Criteria.where("createTime").gte(daoQuery.minCreateTime)); |
| | | } |
| | | if(daoQuery.maxCreateTime!=null){ |
| | | andList.add(Criteria.where("createTime").lt(daoQuery.maxCreateTime)); |
| | | } |
| | | Query query=new Query(); |
| | | Criteria[] ands=new Criteria[andList.size()]; |
| | | andList.toArray(ands); |
| | | if(ands.length>0){ |
| | | query.addCriteria(new Criteria().andOperator(ands)); |
| | | } |
| | | return query; |
| | | } |
| | | |
| | | public static class DaoQuery{ |
| | | public String detailSystemId; |
| | | public String device; |
| | | public String loginUid; |
| | | public Long novelDuration; |
| | | public Long drawVideoNum; |
| | | public Long newsNum; |
| | | public Date minCreateTime; |
| | | public Date maxCreateTime; |
| | | public int start; |
| | | public int count; |
| | | public List<Sort.Order> sortList; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.domain.user; |
| | | |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: UserDPContentWatchStatristic |
| | | * @description: 统计用户DP观看内容 |
| | | * @date 2021/12/29 17:49 |
| | | */ |
| | | @Document(collection = "userDPContentWatchStatristic") |
| | | public class UserDPContentWatchStatistic { |
| | | |
| | | @Id |
| | | private String id; |
| | | private String detailSystemId; |
| | | private String device; |
| | | private String loginUid; |
| | | |
| | | //阅读小说时间 |
| | | private Long novelDuration; |
| | | //小视频阅读数量 |
| | | private Long drawVideoNum; |
| | | //新闻阅读数量 |
| | | private Long newsNum; |
| | | |
| | | private Date createTime; |
| | | private Date updateTime; |
| | | |
| | | public static String createId(String detailSystemId, String device) { |
| | | return detailSystemId + "-" + StringUtil.Md5(device); |
| | | } |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getDetailSystemId() { |
| | | return detailSystemId; |
| | | } |
| | | |
| | | public void setDetailSystemId(String detailSystemId) { |
| | | this.detailSystemId = detailSystemId; |
| | | } |
| | | |
| | | public String getDevice() { |
| | | return device; |
| | | } |
| | | |
| | | public void setDevice(String device) { |
| | | this.device = device; |
| | | } |
| | | |
| | | public String getLoginUid() { |
| | | return loginUid; |
| | | } |
| | | |
| | | public void setLoginUid(String loginUid) { |
| | | this.loginUid = loginUid; |
| | | } |
| | | |
| | | public Long getNovelDuration() { |
| | | return novelDuration; |
| | | } |
| | | |
| | | public void setNovelDuration(Long novelDuration) { |
| | | this.novelDuration = novelDuration; |
| | | } |
| | | |
| | | public Long getDrawVideoNum() { |
| | | return drawVideoNum; |
| | | } |
| | | |
| | | public void setDrawVideoNum(Long drawVideoNum) { |
| | | this.drawVideoNum = drawVideoNum; |
| | | } |
| | | |
| | | public Long getNewsNum() { |
| | | return newsNum; |
| | | } |
| | | |
| | | public void setNewsNum(Long newsNum) { |
| | | this.newsNum = newsNum; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
| | |
| | | HttpServletRequest httpRequest = (HttpServletRequest) servletRequest; |
| | | String contentType = httpRequest.getContentType(); |
| | | if (contentType != null && contentType.contains("multipart/form-data")) { |
| | | httpRequest.setCharacterEncoding("UTF-8"); |
| | | MultipartResolver resolver = new CommonsMultipartResolver(httpRequest.getSession().getServletContext()); |
| | | MultipartHttpServletRequest multipartRequest = resolver.resolveMultipart(httpRequest); |
| | | // 将转化后的 request 放入过滤链中 |
| | |
| | | return configDao.list(systemId, key); |
| | | } |
| | | |
| | | public List<DetailSystemConfig> listConfigByValue(Long systemId, String value) { |
| | | return configDao.listByValue(systemId, value); |
| | | } |
| | | |
| | | @Cacheable(value = "configCache", key = "'getConfigAsMap-'+#system.id+'-'+#version") |
| | | public Map<String, String> getConfigAsMap(DetailSystem system, int version) { |
| | | Map<String, String> map = new HashMap<String, String>(); |
| | |
| | | import com.yeshi.buwan.dto.config.TencentSMSConfig; |
| | | import com.yeshi.buwan.exception.SMSException; |
| | | import com.yeshi.buwan.service.inter.SMSService; |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.RedisKeyEnum; |
| | | import com.yeshi.buwan.util.RedisManager; |
| | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | |
| | | @Override |
| | | public void sendBindVCode(String uid, String phone, int codeLength) throws SMSException { |
| | | String limitKey = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSLIMIT, uid + ""); |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSVCode, phone + "-" + 0); |
| | | if (!StringUtil.isNullOrEmpty(redisManager.getCommonString(limitKey))) |
| | | throw new SMSException(1001, "请过60秒再试"); |
| | | @Resource |
| | | private DetailSystemConfigService detailSystemConfigService; |
| | | |
| | | private void sendSMSCode(String phone, String msg) throws SMSException { |
| | | |
| | | String msgCode = StringUtil.getNumberVerifyCode(codeLength); |
| | | |
| | | TencentSMSConfig tencentSMSConfig = Constant.tencentSMSConfig; |
| | | |
| | | // 验证码模板 |
| | | String msg = tencentSMSConfig.getContentBind().replace("[签名]", tencentSMSConfig.getSign()).replace("[验证码]", |
| | | msgCode); |
| | | SmsSingleSenderResult result = TencentSMSUtil.sendSingleMsg(Integer.parseInt(tencentSMSConfig.getAppId()), tencentSMSConfig.getAppKey(), phone, msg); |
| | | if (result == null) |
| | | throw new SMSException(2, "短信发送失败"); |
| | |
| | | } else if (result.result != 0) {// 发送失败 |
| | | throw new SMSException(result.result, "短信发送失败"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void sendBindVCode(String uid, String phone, int codeLength) throws SMSException { |
| | | String limitKey = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSLIMIT, uid + ""); |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSVCode, phone + "-" + 0); |
| | | if (!StringUtil.isNullOrEmpty(redisManager.getCommonString(limitKey))) |
| | | throw new SMSException(1001, "请过60秒再试"); |
| | | |
| | | String msgCode = StringUtil.getNumberVerifyCode(codeLength); |
| | | // 验证码模板 |
| | | TencentSMSConfig tencentSMSConfig = Constant.tencentSMSConfig; |
| | | String msg = tencentSMSConfig.getContentBind().replace("[签名]", tencentSMSConfig.getSign()).replace("[验证码]", |
| | | msgCode); |
| | | sendSMSCode(phone, msg); |
| | | //保存验证码 |
| | | redisManager.cacheCommonString(key, msgCode, 60 * 5); |
| | | //60s后再发送 |
| | |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public void sendLoginVCode(String phone, int codeLength, String detailSystemId, int version) throws SMSException { |
| | | String limitKey = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSLIMIT, phone); |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSVCode, phone + "-" + 1); |
| | | if (!StringUtil.isNullOrEmpty(redisManager.getCommonString(limitKey))) |
| | | throw new SMSException(1001, "请过60秒再试"); |
| | | |
| | | String msgCode = StringUtil.getNumberVerifyCode(codeLength); |
| | | // 验证码模板 |
| | | TencentSMSConfig tencentSMSConfig = Constant.tencentSMSConfig; |
| | | String msg = tencentSMSConfig.getContentBind().replace("[签名]", detailSystemConfigService.getConfigValueByKey("tencent_sms_sign", detailSystemId, version)).replace("[验证码]", |
| | | msgCode); |
| | | sendSMSCode(phone, msg); |
| | | //保存验证码 |
| | | redisManager.cacheCommonString(key, msgCode, 60 * 5); |
| | | //60s后再发送 |
| | | redisManager.cacheCommonString(limitKey, "1", 60); |
| | | } |
| | | |
| | | @Override |
| | | public boolean verifyLoginVCode(String phone, String code, String detailSystemId, int version) { |
| | | |
| | | String value = detailSystemConfigService.getConfigValueByKey("test_phone_account", detailSystemId, version); |
| | | |
| | | //测试账号 |
| | | if (value != null) { |
| | | if (phone.equalsIgnoreCase(value.split("#")[0]) && code.equalsIgnoreCase(value.split("#")[1])) { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSVCode, phone + "-" + 1); |
| | | String cacheCode = redisManager.getCommonString(key); |
| | | if (cacheCode != null && cacheCode.equalsIgnoreCase(code)) { |
| | | redisManager.removeCommonString(key); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | |
| | | sh.setUser(user); |
| | | } |
| | | |
| | | searchDao.create(sh); |
| | | // searchDao.create(sh); |
| | | // 查询数据库 |
| | | |
| | | //专辑数量 |
| | |
| | | import com.yeshi.buwan.exception.user.LoginUserException; |
| | | import com.yeshi.buwan.exception.user.RegisterUserException; |
| | | import com.yeshi.buwan.service.inter.LoginUserService; |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import org.hibernate.HibernateException; |
| | | import org.hibernate.Session; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | |
| | | @Resource |
| | | private LoginUserService loginUserService; |
| | | |
| | | @Resource |
| | | private SystemConfigService systemConfigService; |
| | | |
| | | |
| | | // 用户操作 |
| | | public List<UserInfo> getUserList(int system, int page) { |
| | | return userDao.list("from UserInfo u where u.system.id=? order by u.createtime desc", |
| | | (page - 1) * Constant.pageCount, Constant.pageCount, new String[]{system + ""}); |
| | | } |
| | | |
| | | //设置昵称 |
| | | public void setNickName(Long uid, String nickName) { |
| | | LoginUser update = new LoginUser(); |
| | | update.setId(uid + ""); |
| | | update.setName(nickName); |
| | | loginUserDao.updateSelective(update); |
| | | } |
| | | |
| | | // 获取用户数量 |
| | |
| | | |
| | | loginUser = new LoginUser(); |
| | | loginUser.setLoginType(LoginUser.LOGIN_TYPE_PHONE); |
| | | loginUser.setName(null); |
| | | loginUser.setName(dto.getNickName()); |
| | | loginUser.setPhone(dto.getPhone()); |
| | | |
| | | loginUserExtra = new LoginUserExtra(); |
| | |
| | | loginUser.setId(uid + ""); |
| | | |
| | | if (StringUtil.isNullOrEmpty(loginUser.getName())) { |
| | | //TODO 昵称前缀 |
| | | // systemConfigService.getConfigValueByKeyCache(""); |
| | | //设置默认用户昵称 |
| | | String nickName = "无名氏"; |
| | | String nickName = "ID_" + uid; |
| | | LoginUser update = new LoginUser(); |
| | | update.setId(uid + ""); |
| | | update.setName(nickName); |
| | |
| | | import com.yeshi.buwan.dao.ad.DeviceAdStrategyDao; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.ad.DeviceAdStrategy; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.user.UserDPContentWatchStatistic; |
| | | import com.yeshi.buwan.service.imp.DetailSystemConfigService; |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | | import com.yeshi.buwan.service.inter.ad.DeviceAdStrategyService; |
| | | import com.yeshi.buwan.service.inter.user.UserDPContentWatchStatisticService; |
| | | import com.yeshi.buwan.service.inter.vip.VIPService; |
| | | import com.yeshi.buwan.util.RedisManager; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.vo.video.VideoDetailVO; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Resource |
| | | private DetailSystemConfigService detailSystemConfigService; |
| | | |
| | | @Resource |
| | | private UserDPContentWatchStatisticService userDPContentWatchStatisticService; |
| | | |
| | | private DeviceAdStrategy init(String id, String deviceId, String detailSystemId) { |
| | | DeviceAdStrategy strategy = new DeviceAdStrategy(); |
| | |
| | | strategy = init(id, deviceId, detailSystemId); |
| | | } |
| | | long now = System.currentTimeMillis(); |
| | | return loadAdWeight(new VideoDetailVO.VideoAdInfo(strategy.getDetailPVAExpireTime() < now, strategy.getDetailFSAExpireTime() < now), detailSystemId, version, channel); |
| | | return filterData(loadAdWeight(new VideoDetailVO.VideoAdInfo(strategy.getDetailPVAExpireTime() < now, strategy.getDetailFSAExpireTime() < now), detailSystemId, version, channel), detailSystemId, deviceId); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | long now = System.currentTimeMillis(); |
| | | return loadAdWeight(new VideoDetailVO.VideoAdInfo(strategy.getDetailShortVideoPVAExpireTime() < now, strategy.getDetailShortVideoFSAExpireTime() < now), detailSystemId, version, channel); |
| | | return filterData(loadAdWeight(new VideoDetailVO.VideoAdInfo(strategy.getDetailShortVideoPVAExpireTime() < now, strategy.getDetailShortVideoFSAExpireTime() < now), detailSystemId, version, channel), detailSystemId, deviceId); |
| | | } |
| | | |
| | | @Override |
| | |
| | | videoAdInfo.setFullVideo(videoAdInfo.isFullVideo() && shortVideo.isFullVideo()); |
| | | } |
| | | } |
| | | |
| | | |
| | | return filterData(videoAdInfo, detailSystemId, deviceId); |
| | | } |
| | | |
| | | |
| | | private VideoDetailVO.VideoAdInfo filterData(VideoDetailVO.VideoAdInfo videoAdInfo, String detailSystemId, String deviceId) { |
| | | DetailSystem ds = new DetailSystem(); |
| | | ds.setId(detailSystemId); |
| | | if (videoAdInfo != null) { |
| | | AcceptData acceptData = new AcceptData(); |
| | | acceptData.setUtdId(deviceId); |
| | | acceptData.setDetailSystem(ds); |
| | | boolean isDPUser = userDPContentWatchStatisticService.isDPUser(acceptData); |
| | | if (isDPUser) { |
| | | videoAdInfo.setFullVideo(false); |
| | | videoAdInfo.setPlayVideo(false); |
| | | } |
| | | } |
| | | return videoAdInfo; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void setVideoDetailAdStrategy(String deviceId, String detailSystemId, Long fsaExpireTime, Long pvaExpireTime) { |
| | | if (StringUtil.isNullOrEmpty(deviceId) || StringUtil.isNullOrEmpty(detailSystemId)) { |
New file |
| | |
| | | package com.yeshi.buwan.service.imp.user; |
| | | |
| | | import com.yeshi.buwan.dao.user.UserDPContentWatchStatisticDao; |
| | | import com.yeshi.buwan.domain.user.UserDPContentWatchStatistic; |
| | | import com.yeshi.buwan.service.inter.user.UserDPContentWatchStatisticService; |
| | | import com.yeshi.buwan.util.RedisManager; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: UserDPContentWatchStatisticServiceImpl |
| | | * @description: TODO |
| | | * @date 2021/12/29 18:04 |
| | | */ |
| | | @Service |
| | | public class UserDPContentWatchStatisticServiceImpl implements UserDPContentWatchStatisticService { |
| | | |
| | | @Resource |
| | | private UserDPContentWatchStatisticDao userDPContentWatchStatisticDao; |
| | | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | |
| | | private String getRedisKeyPrefix(AcceptData acceptData) { |
| | | return String.format("dpevent-%s-", getIdentityId(acceptData)); |
| | | } |
| | | |
| | | private UserDPContentWatchStatistic getBaseBean(AcceptData acceptData, String loginUid) { |
| | | UserDPContentWatchStatistic statistic = new UserDPContentWatchStatistic(); |
| | | statistic.setId(getIdentityId(acceptData)); |
| | | statistic.setDetailSystemId(acceptData.getDetailSystem().getId()); |
| | | String device = acceptData.getUtdId(); |
| | | if (StringUtil.isNullOrEmpty(device)) { |
| | | device = acceptData.getDevice(); |
| | | } |
| | | statistic.setDevice(device); |
| | | statistic.setLoginUid(loginUid); |
| | | return statistic; |
| | | } |
| | | |
| | | //增加小说阅读时长 |
| | | private void addNovelDuration(AcceptData acceptData, String loginUid, long ds) { |
| | | UserDPContentWatchStatistic statistic = getBaseBean(acceptData, loginUid); |
| | | UserDPContentWatchStatistic old = userDPContentWatchStatisticDao.get(statistic.getId()); |
| | | if (old == null) { |
| | | statistic.setNovelDuration(ds); |
| | | statistic.setCreateTime(new Date()); |
| | | userDPContentWatchStatisticDao.save(statistic); |
| | | } else { |
| | | if (old.getNovelDuration() == null) { |
| | | statistic.setNovelDuration(ds); |
| | | } else { |
| | | statistic.setNovelDuration(ds + old.getNovelDuration()); |
| | | } |
| | | userDPContentWatchStatisticDao.updateSelective(statistic); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void readNovel(AcceptData acceptData, long duration, String loginUid) { |
| | | long ds = duration / 1000; |
| | | //获取今日是否已经上传了 |
| | | String key = getRedisKeyPrefix(acceptData) + "novel-" + TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMdd"); |
| | | String old = redisManager.getCommonString(key); |
| | | if (StringUtil.isNullOrEmpty(old)) { |
| | | //增加阅读时长 |
| | | addNovelDuration(acceptData, loginUid, ds); |
| | | //今日首次添加 |
| | | redisManager.cacheCommonString(key, ds + "", 60 * 60 * 24); |
| | | } else { |
| | | //不是今日首次添加 |
| | | if (ds - Long.parseLong(old) > 0) { |
| | | addNovelDuration(acceptData, loginUid, ds - Long.parseLong(old)); |
| | | //增加阅读时长 |
| | | redisManager.cacheCommonString(key, ds + "", 60 * 60 * 24); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void playDrawVideo(AcceptData acceptData, String loginUid) { |
| | | UserDPContentWatchStatistic statistic = getBaseBean(acceptData, loginUid); |
| | | UserDPContentWatchStatistic old = userDPContentWatchStatisticDao.get(statistic.getId()); |
| | | if (old == null) { |
| | | statistic.setCreateTime(new Date()); |
| | | statistic.setDrawVideoNum(1L); |
| | | userDPContentWatchStatisticDao.save(statistic); |
| | | } else { |
| | | if (old.getDrawVideoNum() == null) { |
| | | statistic.setDrawVideoNum(1L); |
| | | } else { |
| | | statistic.setDrawVideoNum(1L + old.getDrawVideoNum()); |
| | | } |
| | | userDPContentWatchStatisticDao.updateSelective(statistic); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void readNews(AcceptData acceptData, String loginUid) { |
| | | UserDPContentWatchStatistic statistic = getBaseBean(acceptData, loginUid); |
| | | UserDPContentWatchStatistic old = userDPContentWatchStatisticDao.get(statistic.getId()); |
| | | if (old == null) { |
| | | statistic.setCreateTime(new Date()); |
| | | statistic.setNewsNum(1L); |
| | | userDPContentWatchStatisticDao.save(statistic); |
| | | } else { |
| | | if (old.getNewsNum() == null) { |
| | | statistic.setNewsNum(1L); |
| | | } else { |
| | | statistic.setNewsNum(1L + old.getNewsNum()); |
| | | } |
| | | userDPContentWatchStatisticDao.updateSelective(statistic); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String getIdentityId(AcceptData acceptData) { |
| | | String device = acceptData.getUtdId(); |
| | | if (StringUtil.isNullOrEmpty(device)) { |
| | | device = acceptData.getDevice(); |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(device)) { |
| | | return null; |
| | | } |
| | | return UserDPContentWatchStatistic.createId(acceptData.getDetailSystem().getId(), device); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isDPUser(AcceptData acceptData) { |
| | | String id = getIdentityId(acceptData); |
| | | if (StringUtil.isNullOrEmpty(id)) { |
| | | return false; |
| | | } |
| | | |
| | | UserDPContentWatchStatistic bean = userDPContentWatchStatisticDao.get(id); |
| | | if (bean == null) { |
| | | return false; |
| | | } |
| | | |
| | | //新闻阅读数量 |
| | | if (bean.getNewsNum() != null && bean.getNewsNum() >=1) { |
| | | return true; |
| | | } |
| | | |
| | | //短视频阅读数量 |
| | | if (bean.getDrawVideoNum() != null && bean.getDrawVideoNum() >= 5) { |
| | | return true; |
| | | } |
| | | |
| | | //小说阅读数量 |
| | | if (bean.getNovelDuration() != null && bean.getNovelDuration() >= 60) { |
| | | return true; |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | public boolean verifyBindVCode(String phone, String code); |
| | | |
| | | |
| | | /** |
| | | * @return void |
| | | * @author hxh |
| | | * @description 发送登录验证码 |
| | | * @date 11:33 2022/1/13 |
| | | * @param: phone |
| | | * @param: codeLength |
| | | **/ |
| | | public void sendLoginVCode(String phone, int codeLength,String detailSystemId,int version) throws SMSException; |
| | | |
| | | |
| | | /** |
| | | * @return boolean |
| | | * @author hxh |
| | | * @description /验证登录验证码 |
| | | * @date 11:33 2022/1/13 |
| | | * @param: phone |
| | | * @param: code |
| | | **/ |
| | | public boolean verifyLoginVCode(String phone, String code,String detailSystemId,int version); |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.inter.user; |
| | | |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: UserDPContentWatchStatisticService |
| | | * @description: TODO |
| | | * @date 2021/12/29 18:03 |
| | | */ |
| | | public interface UserDPContentWatchStatisticService { |
| | | |
| | | /** |
| | | * @return void |
| | | * @author hxh |
| | | * @description 阅读小说 |
| | | * @date 18:06 2021/12/29 |
| | | * @param: acceptData |
| | | * @param: duration |
| | | **/ |
| | | public void readNovel(AcceptData acceptData, long duration, String loginUid); |
| | | |
| | | /** |
| | | * @return void |
| | | * @author hxh |
| | | * @description 观看视频 |
| | | * @date 18:07 2021/12/29 |
| | | * @param: acceptData |
| | | **/ |
| | | public void playDrawVideo(AcceptData acceptData, String loginUid); |
| | | |
| | | |
| | | /** |
| | | * @return void |
| | | * @author hxh |
| | | * @description 阅读新闻 |
| | | * @date 18:08 2021/12/29 |
| | | * @param: acceptData |
| | | **/ |
| | | public void readNews(AcceptData acceptData, String loginUid); |
| | | |
| | | |
| | | public String getIdentityId(AcceptData acceptData); |
| | | |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 是否为看内容的用户 |
| | | * @date 18:40 2021/12/29 |
| | | * @param: acceptData |
| | | * @return boolean |
| | | **/ |
| | | public boolean isDPUser(AcceptData acceptData); |
| | | } |
| | |
| | | import java.net.MalformedURLException; |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.GeneratedValue; |
| | |
| | | return f.getPath(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | //// ridList.add("24"); |
| | | // ridList.add("25"); |
| | | // } |
| | | ridList.remove(25+""); |
| | | ridList.remove(28+""); |
| | | List<Long> ids = new ArrayList<>(); |
| | | if (ridList != null) { |
| | | for (String id : ridList) { |
| | |
| | | //韩剧 |
| | | if ("48".equalsIgnoreCase(acceptData.getDetailSystem().getId())) { |
| | | //正在上线 |
| | | if (appManager.isOnline(acceptData.getDetailSystem().getId(), acceptData.getVersion(), acceptData.getChannel())) { |
| | | //需要原生播放器 |
| | | if (oldId != null && oldId.startsWith("native_")) { |
| | | if (playUrl.getPlayType() == 1) { |
| | | //原生播放器播放 |
| | | playUrl.setPlayType(2); |
| | | playUrl.setUrl("https://jx.parwix.com:4433/player/?url=" + playUrl.getUrl()); |
| | | } |
| | | } |
| | | } |
| | | //TODO 上线的时候开启,防止误操作 |
| | | // if (appManager.isOnline(acceptData.getDetailSystem().getId(), acceptData.getVersion(), acceptData.getChannel())) { |
| | | // //需要原生播放器 |
| | | // if (oldId != null && oldId.startsWith("native_")) { |
| | | // if (playUrl.getPlayType() == 1) { |
| | | // //原生播放器播放 |
| | | // playUrl.setPlayType(2); |
| | | // playUrl.setUrl("https://jx.parwix.com:4433/player/?url=" + playUrl.getUrl()); |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | <dubbo:annotation package="com"/> |
| | | |
| | | |
| | | |
| | | |
| | | </beans> |
| | |
| | | log.config.kafka.isSend=true |
| | | log.config.kafka.bootstrapServers= 172.16.16.38:9092,172.16.16.38:9093,172.16.16.38:9094 |
| | | log.config.kafka.topic= log_buwan_search_key |
| | | log.config.kafka.topic_dp=log_buwan_dp_watch |
| | | log.config.kafka.batchSize=5 |
| | | log.config.kafka.lingerMs=1000 |
| | | log.config.kafka.compressionType=gzip |
| | |
| | | </appender> |
| | | |
| | | |
| | | |
| | | <appender name="KAFKA_DP_LOG" class="com.yeshi.buwan.log.KafkaAppender"> |
| | | <!-- encoder必须配置, 日志格式 --> |
| | | <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
| | | <!--<pattern>--> |
| | | <!--%red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %highlight(%-5level) %green([%thread]) %boldMagenta(%logger{10}) - %cyan(%msg%n)--> |
| | | <!--</pattern>--> |
| | | <!--为了便于分析将日志数据转为json格式--> |
| | | <pattern>${log.pattern}</pattern> |
| | | <!-- 控制台也要使用UTF-8,不要使用GBK,否则会中文乱码 --> |
| | | <charset>UTF-8</charset> |
| | | </encoder> |
| | | <bootstrapServers>${log.config.kafka.bootstrapServers}</bootstrapServers> |
| | | <topic>${log.config.kafka.topic_dp}</topic> |
| | | <batchSize>${log.config.kafka.batchSize}</batchSize> |
| | | <lingerMs>${log.config.kafka.lingerMs}</lingerMs> |
| | | <compressionType>${log.config.kafka.compressionType}</compressionType> |
| | | <retries>${log.config.kafka.retries}</retries> |
| | | <maxRequestSize>${log.config.kafka.maxRequestSize}</maxRequestSize> |
| | | <isSend>${log.config.kafka.isSend}</isSend> |
| | | </appender> |
| | | |
| | | |
| | | <!--name表示为哪一个logger指定层级和输出的方式 |
| | | additivity表示叠加祖先的输出方式(默认为true,会叠加),所以com.lxc.o2o以及其子类都会输出在控制台中,因为这个logger继承了root中的appender |
| | | level表示级别大于等于${log.level}的信息才会输出,输出方式为配置的appender, |
| | |
| | | <appender-ref ref="KAFKA_APPLE_PAY"></appender-ref> |
| | | </logger> |
| | | |
| | | <logger name="com.yeshi.buwan.controller.api.ClientEventController" level="INFO" additivity="false"> |
| | | <appender-ref ref="KAFKA_DP_LOG"></appender-ref> |
| | | </logger> |
| | | |
| | | |
| | | |
| | |
| | | shade: 0.8, |
| | | area: ['400px', '300px'], |
| | | yes: function (index) { |
| | | var arr = new Array(); |
| | | $(".check-item:checked").each(function () { |
| | | var vid = $(this).attr("key"); |
| | | arr.push(vid); |
| | | }); |
| | | if (arr.length == 0) { |
| | | layer.msg("请先选择数据"); |
| | | return false; |
| | | } |
| | | var ids = getCheckedItems(); |
| | | if (ids.length < 1) |
| | | layer.msg("未选择视频"); |
| | | var type = $("#dialog-chooselink .addType option:selected").val(); |
| | | addTop(arr, type); |
| | | addTop(ids, type); |
| | | layer.close(index); |
| | | $(".check-item").prop("checked", false); |
| | | }, |
| | |
| | | }); |
| | | |
| | | function addTop(arr, tid) { |
| | | console.log("选中的视频ID:",arr); |
| | | $.ajax({ |
| | | type: "post", |
| | | url: "api/top/addTop", |
| | |
| | | </select> |
| | | </div> |
| | | |
| | | <div class="col-lg-2"> |
| | | <select name="select" class="form-control search search-type col-lg-2"> |
| | | <option value="name" >按名称</option> |
| | | <option value="value" >按内容</option> |
| | | </select> |
| | | </div> |
| | | |
| | | <div class="form-group search col-lg-2" role="search" style="display: flex;"> |
| | | <input type="text" class="form-control search" id="kw" style="width: 200px;" placeholder="请输入名称"> |
| | | <button type="button" class="btn btn-default search-button" v-on:click="requestData">搜索 |
| | |
| | | requestData: function () { |
| | | $.post("api/config/configList", { |
| | | detailSystemId: $(".detailsystem").val(), |
| | | key: $("#kw").val() |
| | | key: $("#kw").val(), |
| | | type: $(".search-type").val() |
| | | }, function (data) { |
| | | if (data.code == 0) { |
| | | app.configs = data.configList; |
New file |
| | |
| | | package com.hxh.spring.test; |
| | | |
| | | import com.yeshi.buwan.util.FileUtil; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.util.HashSet; |
| | | import java.util.Scanner; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: CopyTest |
| | | * @description: TODO |
| | | * @date 2022/1/5 15:56 |
| | | */ |
| | | public class CopyTest { |
| | | |
| | | |
| | | private static Set<String> getFileNames(String path) throws Exception { |
| | | Set<String> sets = new HashSet<>(); |
| | | Scanner scanner = new Scanner(new FileInputStream(new File(path))); |
| | | while (scanner.hasNextLine()) { |
| | | sets.add(scanner.nextLine().trim()); |
| | | } |
| | | scanner.close(); |
| | | |
| | | return sets; |
| | | } |
| | | |
| | | private static void copyLayout() throws Exception { |
| | | Set<String> sets = getFileNames("C:\\Users\\Administrator\\Desktop\\新建文件夹 (3)\\layout.txt"); |
| | | |
| | | String fromBaseDir = "D:\\workspace\\Android\\buwan\\old\\HanJuPlayer\\app\\res\\layout\\"; |
| | | String toBaseDir = "C:\\Users\\Administrator\\Downloads\\android\\ZhiBo\\app\\src\\main\\res\\layout\\"; |
| | | String type = ".xml"; |
| | | for (String name : sets) { |
| | | FileUtil.copyFile(fromBaseDir + name + type, toBaseDir + name + type); |
| | | } |
| | | |
| | | } |
| | | |
| | | private static void copyImage() throws Exception { |
| | | Set<String> sets = getFileNames("C:\\Users\\Administrator\\Desktop\\新建文件夹 (3)\\drawable-xhdpi.txt"); |
| | | |
| | | String fromBaseDir = "D:\\workspace\\Android\\buwan\\old\\HanJuPlayer\\app\\res\\drawable-xhdpi\\"; |
| | | String toBaseDir = "C:\\Users\\Administrator\\Downloads\\android\\ZhiBo\\app\\src\\main\\res\\drawable-xhdpi\\"; |
| | | String type = ".png"; |
| | | for (String name : sets) { |
| | | FileUtil.copyFile(fromBaseDir + name + type, toBaseDir + name + type); |
| | | } |
| | | |
| | | } |
| | | |
| | | private static void copyDrawable() throws Exception { |
| | | Set<String> sets = getFileNames("C:\\Users\\Administrator\\Desktop\\新建文件夹 (3)\\drawable.txt"); |
| | | |
| | | String fromBaseDir = "D:\\workspace\\Android\\buwan\\old\\HanJuPlayer\\app\\res\\drawable\\"; |
| | | String toBaseDir = "C:\\Users\\Administrator\\Downloads\\android\\ZhiBo\\app\\src\\main\\res\\drawable\\"; |
| | | String type = ".xml"; |
| | | for (String name : sets) { |
| | | FileUtil.copyFile(fromBaseDir + name + type, toBaseDir + name + type); |
| | | } |
| | | |
| | | } |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | |
| | | copyImage(); |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | public class DES { |
| | | @org.junit.Test |
| | | public void test1() { |
| | | String st = "iDp+mknN2urZPWPAdmBTv1ME3YqW7QwsJH0zD9ebFH7kI5NtvSWSUq+Ngejm2MTGCkhiX7yXdRJgFDtIiyss77y1IW+a/txfPE+VQcR2JLpRsDic0lo8750mRvs9KyFs/RUdIo0u450gt3T4FlOrTM7Ixnci60xM+BWcfp15HoAml/8cPPY8u/SGFTfIFyhzLsxtcjMd8b+FzbFfwuETBXu/C26qQAanyQCxbGu2BV3HJSKdqLUFDPWE5ppCsUvTBtCnYaPS8GvolmgRhY/6VCHf7SAOyFd5QD4msVoPGl+n3cXkKAHWHiwdRNNImL9eYgV+2UbFpQ0SaUuuI19XnQ=="; |
| | | String st = "iDp+mknN2uptRUo51EW28wcdP2q0yp6iFgzTe1sLzcs/jyg32plI0rWA5ixujhGdNWb8QJY1JUs="; |
| | | System.out.println(DESUtil.decode(st)); |
| | | } |
| | | |
| | |
| | | |
| | | @org.junit.Test |
| | | public void test() { |
| | | for (int i = 0; i < 3; i++) { |
| | | boolean isS = MailSenderUtil.sendEmail("2780501319@qq.com", "ysyz17784739772@126.com", "weikou2014", |
| | | for (int i = 0; i < 1; i++) { |
| | | boolean isS = MailSenderUtil.sendEmail("1101184511@qq.com", "app_yzm_zc@163.com", "KZKSRTEMDWEQRAQR", |
| | | "布丸社区注册验证码:" + 123, "布丸社区注册验证码:" + 123); |
| | | } |
| | | } |
| | |
| | | import com.yeshi.buwan.dao.live.TVLiveProgramResourceDao; |
| | | import com.yeshi.buwan.dao.video.VideoResourceVersionMapDao; |
| | | import com.yeshi.buwan.domain.live.TVLiveProgramResource; |
| | | import com.yeshi.buwan.domain.user.UserDPContentWatchStatistic; |
| | | import com.yeshi.buwan.domain.video.StarInfo; |
| | | import com.yeshi.buwan.domain.video.VideoResourceVersionMap; |
| | | import com.yeshi.buwan.service.inter.video.VideoResourceVersionMapService; |
| | |
| | | @org.junit.Test |
| | | public void createDao() { |
| | | MongoDBDaoData.Builder builder = new MongoDBDaoData.Builder(); |
| | | builder.setBaseDaoClass(mongoBaseDao).setDaoPackageName(packageBaseName + ".dao.live"); |
| | | builder.setEntityClass(TVLiveProgramResource.class); |
| | | builder.setBaseDaoClass(mongoBaseDao).setDaoPackageName(packageBaseName + ".dao.user"); |
| | | builder.setEntityClass(UserDPContentWatchStatistic.class); |
| | | try { |
| | | SpringComponentGenerater.createMongoDao(builder.create(), PROJECT_PATH + "\\src\\main\\java\\com\\yeshi\\buwan\\dao\\live\\"); |
| | | SpringComponentGenerater.createMongoDao(builder.create(), PROJECT_PATH + "\\src\\main\\java\\com\\yeshi\\buwan\\dao\\user\\"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | import com.yeshi.buwan.service.imp.StatisticsService; |
| | | import com.yeshi.buwan.util.BeanUtil; |
| | | import com.yeshi.buwan.util.news.SouGouParser; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.test.context.ContextConfiguration; |
| | | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
| | | import org.springframework.test.context.web.WebAppConfiguration; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @RunWith(SpringJUnit4ClassRunner.class) //使用junit4进行测试 |
| | | @ContextConfiguration(locations = {"classpath:spring.xml"}) |
| | | @WebAppConfiguration |
| | | public class StatisticTest { |
| | | // @Test |
| | | public void updateSouGou() {// SouGouParser |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private StatisticsService statisticsService; |
| | | |
| | | @Test |
| | | public void playStatistics() { |
| | | final StatisticsService statisticsService = (StatisticsService) BeanUtil.getBean("statisticsService"); |
| | | statisticsService.categoryPlayStatistic(); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | @Test |
| | | public void addZhiBoAndroid() { |
| | | String[] resourceIds = null; |
| | | resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27"}; |
| | | for (String rid : resourceIds) { |
| | | try { |
| | | videoResourcePlayVersionMapService.add(new VideoResourcePlayVersionMap("50", 1, rid, null)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Test |
| | | public void listValid() { |
| | | List<String> resourceIds = videoResourcePlayVersionMapService.listResourceId("43", 105, null); |
| | | System.out.println(resourceIds); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @Test |
| | | public void addZhiBoAndroid() { |
| | | String[] resourceIds = null; |
| | | resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27"}; |
| | | for (String rid : resourceIds) { |
| | | try { |
| | | videoResourceVersionMapService.add(new VideoResourceVersionMap("50", 1, rid, null)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // resourceIds = new String[]{"25"}; |
| | | // for (String rid : resourceIds) { |
| | | // try { |
| | | // videoResourceVersionMapService.add(new VideoResourceVersionMap("47", 1, rid, "meizu")); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void listValid() { |
| | | List<String> resourceIds = videoResourceVersionMapService.listResourceId("43", 105, null); |
| | |
| | | import com.yeshi.buwan.exception.vip.VIPException; |
| | | import com.yeshi.buwan.exception.vip.VideoBuyRecordException; |
| | | import com.yeshi.buwan.job.OrderJob; |
| | | import com.yeshi.buwan.util.user.VipUtil; |
| | | import com.yeshi.buwan.util.vip.VIPOrderUtil; |
| | | import com.yeshi.buwan.videos.pptv.PPTVVipManager; |
| | | import com.yeshi.buwan.service.inter.order.OrderService; |
| | | import com.yeshi.buwan.service.inter.vip.VIPPriceService; |
| | |
| | | import org.springframework.test.context.ContextConfiguration; |
| | | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
| | | import org.springframework.test.context.web.WebAppConfiguration; |
| | | import org.yeshi.utils.alipay.AlipayH5PayUtil; |
| | | import org.yeshi.utils.wx.WXPayV3Util; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Scanner; |
| | | |
| | | @RunWith(SpringJUnit4ClassRunner.class) //使用junit4进行测试 |
| | | @ContextConfiguration(locations = {"classpath:spring.xml"}) |
| | | @WebAppConfiguration |
| | | //@RunWith(SpringJUnit4ClassRunner.class) //使用junit4进行测试 |
| | | //@ContextConfiguration(locations = {"classpath:spring.xml"}) |
| | | //@WebAppConfiguration |
| | | public class VIPTest { |
| | | |
| | | @Resource |
| | |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void refoundWX() { |
| | | //退款 |
| | | try { |
| | | Scanner scanner = new Scanner(new FileInputStream(new File("C:\\Users\\Administrator\\Desktop\\wx退款订单.txt"))); |
| | | while (scanner.hasNextLine()) { |
| | | String st = scanner.nextLine(); |
| | | String[] sts = st.split(" "); |
| | | String line = ""; |
| | | line += "buwan_vip_" + sts[0] + ","; |
| | | line += sts[1] + ","; |
| | | line += "影视大全VIP权益终止退回,"; |
| | | line += "buwan_vip_" + sts[0]; |
| | | System.out.println(line); |
| | | } |
| | | |
| | | scanner.close(); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | @Test |
| | | public void refoundAlipay() { |
| | | //退款 |
| | | try { |
| | | Scanner scanner = new Scanner(new FileInputStream(new File("C:\\Users\\Administrator\\Desktop\\退款\\alipay.txt"))); |
| | | while (scanner.hasNextLine()) { |
| | | String st = scanner.nextLine(); |
| | | String[] sts = st.split(" "); |
| | | String id = sts[0]; |
| | | String money = sts[1]; |
| | | String orderId = VIPOrderUtil.getOutOrderNo(OrderType.vip, id); |
| | | AlipayH5PayUtil.refund(VipUtil.getAlipayApp(), orderId, null, new BigDecimal(money), orderId); |
| | | } |
| | | |
| | | scanner.close(); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | // |
| | | |
| | | } |
| | | |
| | | |