| | |
| | | package com.yeshi.buwan.controller.parser.web; |
| | | |
| | | import com.yeshi.buwan.domain.Attention; |
| | | import com.yeshi.buwan.domain.Comment2; |
| | | import com.yeshi.buwan.domain.CommentReply; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.user.LoginUser; |
| | | import com.yeshi.buwan.service.imp.*; |
| | | import com.yeshi.buwan.service.imp.push.PushService; |
| | | import com.yeshi.buwan.util.*; |
| | | import com.yeshi.buwan.util.JuHe.VideoResourceUtil; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.yeshi.utils.exception.MailSendException; |
| | | import org.yeshi.utils.mail.EmailApiUtil; |
| | | import org.yeshi.utils.mail.EmailInfo; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.File; |
| | | import java.io.PrintWriter; |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import org.springframework.stereotype.Controller; |
| | | |
| | | import com.yeshi.buwan.domain.Attention; |
| | | import com.yeshi.buwan.domain.Comment2; |
| | | import com.yeshi.buwan.domain.CommentReply; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.user.LoginUser; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.service.imp.AttentionService; |
| | | import com.yeshi.buwan.service.imp.CommentService; |
| | | import com.yeshi.buwan.service.imp.SearchService; |
| | | import com.yeshi.buwan.service.imp.SystemService; |
| | | import com.yeshi.buwan.service.imp.UserService; |
| | | import com.yeshi.buwan.service.imp.push.PushService; |
| | | import com.yeshi.buwan.util.COSManager; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.Utils; |
| | | import com.yeshi.buwan.util.VideoPictureUtil; |
| | | import com.yeshi.buwan.util.JuHe.VideoResourceUtil; |
| | | import com.yeshi.buwan.util.email.MailSenderUtil; |
| | | |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | |
| | | @Controller |
| | | public class WebUserParser { |
| | | @Resource |
| | | private SystemService systemService; |
| | | @Resource |
| | | private SystemService systemService; |
| | | |
| | | @Resource |
| | | private SearchService searchService; |
| | | @Resource |
| | | private SearchService searchService; |
| | | |
| | | @Resource |
| | | private VideoResourceUtil videoResouceUtil; |
| | | @Resource |
| | | private VideoResourceUtil videoResouceUtil; |
| | | |
| | | @Resource |
| | | private UserService userService; |
| | | @Resource |
| | | private UserService userService; |
| | | |
| | | @Resource |
| | | private AttentionService attentionService; |
| | | @Resource |
| | | private AttentionService attentionService; |
| | | |
| | | @Resource |
| | | private CommentService commentService; |
| | | @Resource |
| | | private CommentService commentService; |
| | | |
| | | @Resource |
| | | private PushService pushService; |
| | | @Resource |
| | | private PushService pushService; |
| | | |
| | | // 首页 |
| | | public void suggestSearch(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | String key = request.getParameter("Key"); |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | // 首页 |
| | | public void suggestSearch(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | String key = request.getParameter("Key"); |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | |
| | | if (!StringUtil.isNullOrEmpty(key)) |
| | | key = StringUtil.getUTF8String(key, "ISO-8859-1"); |
| | | if (!StringUtil.isNullOrEmpty(key)) |
| | | key = StringUtil.getUTF8String(key, "ISO-8859-1"); |
| | | |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); |
| | | List<String> list = null; |
| | | if (!StringUtil.isNullOrEmpty(key)) |
| | | list = searchService.suggestSearch(key, system); |
| | | else |
| | | list = searchService.getHotSearchList(detailSystem.getId()); |
| | | JSONArray array = new JSONArray(); |
| | | if (list != null) |
| | | for (String st : list) |
| | | array.add(st); |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); |
| | | List<String> list = null; |
| | | if (!StringUtil.isNullOrEmpty(key)) |
| | | list = searchService.suggestSearch(key, system); |
| | | else |
| | | list = searchService.getHotSearchList(detailSystem.getId()); |
| | | JSONArray array = new JSONArray(); |
| | | if (list != null) |
| | | for (String st : list) |
| | | array.add(st); |
| | | |
| | | out.print(JsonUtil.loadTrueJsonNoencript(array.toString())); |
| | | } |
| | | out.print(JsonUtil.loadTrueJsonNoencript(array.toString())); |
| | | } |
| | | |
| | | public void search(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | String key = request.getParameter("Key"); |
| | | String page = request.getParameter("Page"); |
| | | String contentType = request.getParameter("ContentType"); |
| | | String channel=request.getParameter("Channel"); |
| | | public void search(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | String key = request.getParameter("Key"); |
| | | String page = request.getParameter("Page"); |
| | | String contentType = request.getParameter("ContentType"); |
| | | String channel = request.getParameter("Channel"); |
| | | |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | |
| | | int pageIndex = 1; |
| | | if (!StringUtil.isNullOrEmpty(page)) |
| | | pageIndex = Integer.parseInt(page); |
| | | if (!StringUtil.isNullOrEmpty(key)) |
| | | key = StringUtil.getUTF8String(key, "ISO-8859-1"); |
| | | int pageIndex = 1; |
| | | if (!StringUtil.isNullOrEmpty(page)) |
| | | pageIndex = Integer.parseInt(page); |
| | | if (!StringUtil.isNullOrEmpty(key)) |
| | | key = StringUtil.getUTF8String(key, "ISO-8859-1"); |
| | | |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(detailSystem, Integer.parseInt("1"),channel); |
| | | String cacheMD5 = "0"; |
| | | if (resourceList != null && resourceList.size() > 0) |
| | | for (Long l : resourceList) |
| | | cacheMD5 += "#" + l; |
| | | cacheMD5 = StringUtil.Md5(cacheMD5); |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(detailSystem, Integer.parseInt("1"), channel); |
| | | String cacheMD5 = "0"; |
| | | if (resourceList != null && resourceList.size() > 0) |
| | | for (Long l : resourceList) |
| | | cacheMD5 += "#" + l; |
| | | cacheMD5 = StringUtil.Md5(cacheMD5); |
| | | |
| | | List<VideoInfo> list = (List<VideoInfo>) searchService.search(detailSystem.getId(), request.getRemoteAddr(), |
| | | uid, key, pageIndex, (StringUtil.isNullOrEmpty(contentType) ? 0 : Integer.parseInt(contentType)), |
| | | system, resourceList, cacheMD5); |
| | | JSONArray array = new JSONArray(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | ((VideoInfo) list.get(i)) |
| | | .setPicture(VideoPictureUtil.getShowPicture((VideoInfo) list.get(i), platform, "0")); |
| | | array.add(StringUtil.outPutResultJson(list.get(i))); |
| | | } |
| | | List<VideoInfo> list = (List<VideoInfo>) searchService.search(detailSystem.getId(), request.getRemoteAddr(), |
| | | uid, key, pageIndex, (StringUtil.isNullOrEmpty(contentType) ? 0 : Integer.parseInt(contentType)), |
| | | system, resourceList, cacheMD5); |
| | | JSONArray array = new JSONArray(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | ((VideoInfo) list.get(i)) |
| | | .setPicture(VideoPictureUtil.getShowPicture((VideoInfo) list.get(i), platform, "0")); |
| | | array.add(StringUtil.outPutResultJson(list.get(i))); |
| | | } |
| | | |
| | | out.print(JsonUtil.loadTrueJsonNoencript(array.toString())); |
| | | } |
| | | out.print(JsonUtil.loadTrueJsonNoencript(array.toString())); |
| | | } |
| | | |
| | | public void login(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | String account = request.getParameter("Email");// 邮箱 |
| | | String pwd = request.getParameter("Pwd");// 密码 |
| | | public void login(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | String account = request.getParameter("Email");// 邮箱 |
| | | String pwd = request.getParameter("Pwd");// 密码 |
| | | |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(account)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Email")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(account)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Email")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(pwd)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Pwd")); |
| | | return; |
| | | } |
| | | LoginUser lu = new LoginUser(); |
| | | lu.setLoginType(3); |
| | | lu.setOpenid(account); |
| | | lu.setPwd(StringUtil.Md5(pwd)); |
| | | lu = userService.loginByEmail(lu); |
| | | if (lu != null) |
| | | out.print(JsonUtil.loadTrueJsonNoencript(StringUtil.outPutResultJson(lu))); |
| | | else |
| | | out.print(JsonUtil.loadFalseJsonNoencript("用户名或密码错误")); |
| | | } |
| | | if (StringUtil.isNullOrEmpty(pwd)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Pwd")); |
| | | return; |
| | | } |
| | | LoginUser lu = new LoginUser(); |
| | | lu.setLoginType(3); |
| | | lu.setOpenid(account); |
| | | lu.setPwd(StringUtil.Md5(pwd)); |
| | | lu = userService.loginByEmail(lu); |
| | | if (lu != null) |
| | | out.print(JsonUtil.loadTrueJsonNoencript(StringUtil.outPutResultJson(lu))); |
| | | else |
| | | out.print(JsonUtil.loadFalseJsonNoencript("用户名或密码错误")); |
| | | } |
| | | |
| | | public void thirdlogin(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | public void thirdlogin(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | |
| | | String name = request.getParameter("Name"); |
| | | String portrait = request.getParameter("Portrait"); |
| | | String openid = request.getParameter("OpenId"); |
| | | String sex = request.getParameter("Sex");// 1-男 2-女 |
| | | String loginType = request.getParameter("LoginType");// 登录类型 |
| | | String name = request.getParameter("Name"); |
| | | String portrait = request.getParameter("Portrait"); |
| | | String openid = request.getParameter("OpenId"); |
| | | String sex = request.getParameter("Sex");// 1-男 2-女 |
| | | String loginType = request.getParameter("LoginType");// 登录类型 |
| | | |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(name)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Name")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(name)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Name")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(portrait)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Portrait")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(portrait)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Portrait")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(openid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Openid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(openid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Openid")); |
| | | return; |
| | | } |
| | | |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); |
| | | |
| | | // LoginUser lu = userService.getLoginUser(openid, detailSystem.getId(), Integer.parseInt(loginType), portrait, |
| | | // name,UserParser.getIp(request)+":"+request.getRemotePort()); |
| | |
| | | // object.put("Portrait", lu.getPortrait()); |
| | | // out.print(JsonUtil.loadTrueJsonNoencript(object.toString())); |
| | | // } else { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("登录失败")); |
| | | out.print(JsonUtil.loadFalseJsonNoencript("登录失败")); |
| | | // } |
| | | } |
| | | } |
| | | |
| | | private String savePortrait(HttpServletRequest request) { |
| | | String base64 = request.getParameter("Portrait"); |
| | | if (StringUtil.isNullOrEmpty(base64)) |
| | | return ""; |
| | | if (base64.startsWith("http")) |
| | | return base64; |
| | | private String savePortrait(HttpServletRequest request) { |
| | | String base64 = request.getParameter("Portrait"); |
| | | if (StringUtil.isNullOrEmpty(base64)) |
| | | return ""; |
| | | if (base64.startsWith("http")) |
| | | return base64; |
| | | |
| | | String fileName = "portrait_" + System.currentTimeMillis() + ".jpg"; |
| | | // 定义上传路径 |
| | | String path = request.getSession().getServletContext().getRealPath("upload") + "/" + fileName; |
| | | if (!new File(request.getSession().getServletContext().getRealPath("upload") + "/").exists()) |
| | | new File(request.getSession().getServletContext().getRealPath("upload") + "/").mkdirs(); |
| | | boolean isS = StringUtil.generateImageFromBase64(base64, path); |
| | | if (!isS) |
| | | return ""; |
| | | String fileName = "portrait_" + System.currentTimeMillis() + ".jpg"; |
| | | // 定义上传路径 |
| | | String path = request.getSession().getServletContext().getRealPath("upload") + "/" + fileName; |
| | | if (!new File(request.getSession().getServletContext().getRealPath("upload") + "/").exists()) |
| | | new File(request.getSession().getServletContext().getRealPath("upload") + "/").mkdirs(); |
| | | boolean isS = StringUtil.generateImageFromBase64(base64, path); |
| | | if (!isS) |
| | | return ""; |
| | | |
| | | try { |
| | | String result = COSManager.getInstance().uploadFile(new File(path), fileName); |
| | | if (!StringUtil.isNullOrEmpty(result)) |
| | | return result; |
| | | } catch (IllegalStateException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ""; |
| | | } |
| | | try { |
| | | String result = COSManager.getInstance().uploadFile(new File(path), fileName); |
| | | if (!StringUtil.isNullOrEmpty(result)) |
| | | return result; |
| | | } catch (IllegalStateException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | public void register(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | public void register(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | |
| | | String device = request.getParameter("Device"); |
| | | String account = request.getParameter("Email");// 邮箱 |
| | | String pwd = request.getParameter("Pwd");// 密码 |
| | | String nickName = request.getParameter("NickName");// 昵称 |
| | | String device = request.getParameter("Device"); |
| | | String account = request.getParameter("Email");// 邮箱 |
| | | String pwd = request.getParameter("Pwd");// 密码 |
| | | String nickName = request.getParameter("NickName");// 昵称 |
| | | |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(account)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Account")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(account)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Account")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(pwd)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Pwd")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(pwd)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Pwd")); |
| | | return; |
| | | } |
| | | |
| | | nickName = StringUtil.getUTF8String(nickName, "ISO-8859-1"); |
| | | nickName = StringUtil.getUTF8String(nickName, "ISO-8859-1"); |
| | | |
| | | if (StringUtil.isNullOrEmpty(nickName)) |
| | | nickName = "无名氏"; |
| | | if (StringUtil.isNullOrEmpty(nickName)) |
| | | nickName = "无名氏"; |
| | | |
| | | DetailSystem ds = systemService.getDetailSystemByPackage(packageName); |
| | | // 注册 --用户名,昵称,密码 |
| | | LoginUser user = new LoginUser(); |
| | | user.setCreatetime(System.currentTimeMillis() + ""); |
| | | user.setDetailsystem(ds.getId()); |
| | | user.setDevice(device); |
| | | user.setLoginType(3); |
| | | user.setName(nickName); |
| | | user.setOpenid(account); |
| | | user.setPwd(StringUtil.Md5(pwd)); |
| | | user.setPortrait(savePortrait(request)); |
| | | DetailSystem ds = systemService.getDetailSystemByPackage(packageName); |
| | | // 注册 --用户名,昵称,密码 |
| | | LoginUser user = new LoginUser(); |
| | | user.setCreatetime(System.currentTimeMillis() + ""); |
| | | user.setDetailsystem(ds.getId()); |
| | | user.setDevice(device); |
| | | user.setLoginType(3); |
| | | user.setName(nickName); |
| | | user.setOpenid(account); |
| | | user.setPwd(StringUtil.Md5(pwd)); |
| | | user.setPortrait(savePortrait(request)); |
| | | |
| | | String result = userService.registerByEmail(user); |
| | | if (result.contains("成功")) |
| | | out.print(JsonUtil.loadTrueJsonNoencript("注册成功")); |
| | | else |
| | | out.print(JsonUtil.loadFalseJsonNoencript(result)); |
| | | } |
| | | String result = userService.registerByEmail(user); |
| | | if (result.contains("成功")) |
| | | out.print(JsonUtil.loadTrueJsonNoencript("注册成功")); |
| | | else |
| | | out.print(JsonUtil.loadFalseJsonNoencript(result)); |
| | | } |
| | | |
| | | public void getUserInfo(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | String loginUid = request.getParameter("LoginUid"); |
| | | public void getUserInfo(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | String loginUid = request.getParameter("LoginUid"); |
| | | |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(loginUid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传LoginUid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(loginUid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传LoginUid")); |
| | | return; |
| | | } |
| | | |
| | | LoginUser user = userService.getLoginUser(loginUid); |
| | | if (user != null) |
| | | out.print(JsonUtil.loadTrueJsonNoencript(StringUtil.outPutResultJson(user))); |
| | | else |
| | | out.print(JsonUtil.loadFalseJsonNoencript("用户不存在")); |
| | | } |
| | | LoginUser user = userService.getLoginUser(loginUid); |
| | | if (user != null) |
| | | out.print(JsonUtil.loadTrueJsonNoencript(StringUtil.outPutResultJson(user))); |
| | | else |
| | | out.print(JsonUtil.loadFalseJsonNoencript("用户不存在")); |
| | | } |
| | | |
| | | public void updateUserInfo(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | public void updateUserInfo(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | |
| | | String nickName = request.getParameter("NickName");// 昵称 |
| | | String sex = request.getParameter("Sex");// 性别 0-女 1-男 |
| | | String birthDay = request.getParameter("BirthDay");// 生日 |
| | | String personalSign = request.getParameter("PersonalSign");// 个性签名 |
| | | String loginUid = request.getParameter("LoginUid");// 个性签名 |
| | | String nickName = request.getParameter("NickName");// 昵称 |
| | | String sex = request.getParameter("Sex");// 性别 0-女 1-男 |
| | | String birthDay = request.getParameter("BirthDay");// 生日 |
| | | String personalSign = request.getParameter("PersonalSign");// 个性签名 |
| | | String loginUid = request.getParameter("LoginUid");// 个性签名 |
| | | |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(loginUid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传LoginUid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(loginUid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传LoginUid")); |
| | | return; |
| | | } |
| | | |
| | | // 注册 --用户名,昵称,密码 |
| | | LoginUser user = userService.getLoginUser(loginUid); |
| | | if (user != null) { |
| | | if (!StringUtil.isNullOrEmpty(nickName)) |
| | | user.setName(StringUtil.getUTF8String(nickName, "ISO-8859-1")); |
| | | String potrait = savePortrait(request); |
| | | if (!StringUtil.isNullOrEmpty(potrait)) |
| | | user.setPortrait(potrait); |
| | | if (!StringUtil.isNullOrEmpty(sex)) |
| | | user.setSex(sex); |
| | | if (!StringUtil.isNullOrEmpty(personalSign)) |
| | | user.setSign(StringUtil.getUTF8String(personalSign, "ISO-8859-1")); |
| | | if (!StringUtil.isNullOrEmpty(birthDay)) |
| | | user.setBirthday(birthDay); |
| | | userService.updateLoginUserInfo(user); |
| | | } |
| | | out.print(JsonUtil.loadTrueJsonNoencript(StringUtil.outPutResultJson(user))); |
| | | } |
| | | // 注册 --用户名,昵称,密码 |
| | | LoginUser user = userService.getLoginUser(loginUid); |
| | | if (user != null) { |
| | | if (!StringUtil.isNullOrEmpty(nickName)) |
| | | user.setName(StringUtil.getUTF8String(nickName, "ISO-8859-1")); |
| | | String potrait = savePortrait(request); |
| | | if (!StringUtil.isNullOrEmpty(potrait)) |
| | | user.setPortrait(potrait); |
| | | if (!StringUtil.isNullOrEmpty(sex)) |
| | | user.setSex(sex); |
| | | if (!StringUtil.isNullOrEmpty(personalSign)) |
| | | user.setSign(StringUtil.getUTF8String(personalSign, "ISO-8859-1")); |
| | | if (!StringUtil.isNullOrEmpty(birthDay)) |
| | | user.setBirthday(birthDay); |
| | | userService.updateLoginUserInfo(user); |
| | | } |
| | | out.print(JsonUtil.loadTrueJsonNoencript(StringUtil.outPutResultJson(user))); |
| | | } |
| | | |
| | | public void getAttentionList(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | String loginUid = request.getParameter("LoginUid"); |
| | | String page = request.getParameter("Page"); |
| | | public void getAttentionList(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | String loginUid = request.getParameter("LoginUid"); |
| | | String page = request.getParameter("Page"); |
| | | |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(loginUid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传LoginUid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(loginUid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传LoginUid")); |
| | | return; |
| | | } |
| | | |
| | | int pageIndex = StringUtil.isNullOrEmpty(page) ? 1 : Integer.parseInt(page); |
| | | int pageIndex = StringUtil.isNullOrEmpty(page) ? 1 : Integer.parseInt(page); |
| | | |
| | | List<Attention> list = attentionService.getAttentionVideoListByLoginUid(Long.parseLong(loginUid), pageIndex); |
| | | JSONObject object = new JSONObject(); |
| | | object.put("count", (new StringBuilder(String.valueOf(list.size()))).toString()); |
| | | JSONArray array = new JSONArray(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | JSONObject ob = new JSONObject(); |
| | | ob.put("Id", list.get(i).getId()); |
| | | // if |
| | | // (!StringUtil.isNullOrEmpty(list.get(i).getVideoInfo().getHpicture())) |
| | | // list.get(i).getVideoInfo().setPicture(list.get(i).getVideoInfo().getHpicture()); |
| | | List<Attention> list = attentionService.getAttentionVideoListByLoginUid(Long.parseLong(loginUid), pageIndex); |
| | | JSONObject object = new JSONObject(); |
| | | object.put("count", (new StringBuilder(String.valueOf(list.size()))).toString()); |
| | | JSONArray array = new JSONArray(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | JSONObject ob = new JSONObject(); |
| | | ob.put("Id", list.get(i).getId()); |
| | | // if |
| | | // (!StringUtil.isNullOrEmpty(list.get(i).getVideoInfo().getHpicture())) |
| | | // list.get(i).getVideoInfo().setPicture(list.get(i).getVideoInfo().getHpicture()); |
| | | |
| | | if (list.get(i).getVideoInfo().getVideoDetailList() != null |
| | | && list.get(i).getVideoInfo().getVideoDetailList().size() > 0) |
| | | list.get(i).getVideoInfo().getVideoDetailList().get(0) |
| | | .setPicture(VideoPictureUtil.getShowPicture(list.get(i).getVideoInfo(), platform, "0")); |
| | | ob.put("VideoInfo", StringUtil.outPutResultJson(Utils.convertVideo(list.get(i).getVideoInfo()))); |
| | | array.add(ob); |
| | | } |
| | | object.put("data", array); |
| | | out.print(JsonUtil.loadTrueJsonNoencript(object.toString())); |
| | | } |
| | | if (list.get(i).getVideoInfo().getVideoDetailList() != null |
| | | && list.get(i).getVideoInfo().getVideoDetailList().size() > 0) |
| | | list.get(i).getVideoInfo().getVideoDetailList().get(0) |
| | | .setPicture(VideoPictureUtil.getShowPicture(list.get(i).getVideoInfo(), platform, "0")); |
| | | ob.put("VideoInfo", StringUtil.outPutResultJson(Utils.convertVideo(list.get(i).getVideoInfo()))); |
| | | array.add(ob); |
| | | } |
| | | object.put("data", array); |
| | | out.print(JsonUtil.loadTrueJsonNoencript(object.toString())); |
| | | } |
| | | |
| | | public void addAttention(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | String loginUid = request.getParameter("LoginUid"); |
| | | String videoid = request.getParameter("VideoId"); |
| | | public void addAttention(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | String loginUid = request.getParameter("LoginUid"); |
| | | String videoid = request.getParameter("VideoId"); |
| | | |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(loginUid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传LoginUid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(loginUid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传LoginUid")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(videoid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传VideoId")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(videoid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传VideoId")); |
| | | return; |
| | | } |
| | | |
| | | Attention at = new Attention(); |
| | | at.setCreatetime(System.currentTimeMillis() + ""); |
| | | at.setLoginUser(new LoginUser(loginUid)); |
| | | at.setShow(true); |
| | | at.setVideoInfo(new VideoInfo(videoid)); |
| | | boolean isS = attentionService.addAttention(at); |
| | | if (isS) |
| | | out.print(JsonUtil.loadTrueJsonNoencript("")); |
| | | else |
| | | out.print(JsonUtil.loadFalseJsonNoencript("关注失败")); |
| | | } |
| | | Attention at = new Attention(); |
| | | at.setCreatetime(System.currentTimeMillis() + ""); |
| | | at.setLoginUser(new LoginUser(loginUid)); |
| | | at.setShow(true); |
| | | at.setVideoInfo(new VideoInfo(videoid)); |
| | | boolean isS = attentionService.addAttention(at); |
| | | if (isS) |
| | | out.print(JsonUtil.loadTrueJsonNoencript("")); |
| | | else |
| | | out.print(JsonUtil.loadFalseJsonNoencript("关注失败")); |
| | | } |
| | | |
| | | public void cancelAttention(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | String loginUid = request.getParameter("LoginUid"); |
| | | String videoid = request.getParameter("VideoId"); |
| | | public void cancelAttention(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | String loginUid = request.getParameter("LoginUid"); |
| | | String videoid = request.getParameter("VideoId"); |
| | | |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(loginUid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传LoginUid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(loginUid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传LoginUid")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(videoid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传VideoId")); |
| | | return; |
| | | } |
| | | |
| | | boolean isS = attentionService.deleteAttention(Long.parseLong(videoid), Long.parseLong(loginUid)); |
| | | if (isS) |
| | | out.print(JsonUtil.loadTrueJsonNoencript("")); |
| | | else |
| | | out.print(JsonUtil.loadFalseJsonNoencript("关注失败")); |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(videoid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传VideoId")); |
| | | return; |
| | | } |
| | | public void getVideoCommentList(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | |
| | | boolean isS = attentionService.deleteAttention(Long.parseLong(videoid), Long.parseLong(loginUid)); |
| | | if (isS) |
| | | out.print(JsonUtil.loadTrueJsonNoencript("")); |
| | | else |
| | | out.print(JsonUtil.loadFalseJsonNoencript("关注失败")); |
| | | } |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String version = request.getParameter("Version"); |
| | | String packageName = request.getParameter("Package"); |
| | | |
| | | public void getVideoCommentList(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String videoId = request.getParameter("VideoId"); |
| | | String thirdType = request.getParameter("ThirdType"); |
| | | String page = request.getParameter("Page"); |
| | | |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String version = request.getParameter("Version"); |
| | | String packageName = request.getParameter("Package"); |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | |
| | | String videoId = request.getParameter("VideoId"); |
| | | String thirdType = request.getParameter("ThirdType"); |
| | | String page = request.getParameter("Page"); |
| | | if (StringUtil.isNullOrEmpty(videoId)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传videoId")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(page)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传page")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(videoId)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传videoId")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(thirdType)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传thirdType")); |
| | | return; |
| | | } |
| | | int pageIndex = Integer.parseInt(page); |
| | | |
| | | if (StringUtil.isNullOrEmpty(page)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传page")); |
| | | return; |
| | | } |
| | | java.util.List<Comment2> list1 = commentService.getComment2List(videoId, thirdType, pageIndex); |
| | | List<Comment2> list = new ArrayList<>(); |
| | | if (list1 != null) |
| | | for (Comment2 cm : list1) |
| | | list.add(cm); |
| | | long count = commentService.getComment2ListCount(videoId, thirdType); |
| | | |
| | | if (StringUtil.isNullOrEmpty(thirdType)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传thirdType")); |
| | | return; |
| | | } |
| | | int pageIndex = Integer.parseInt(page); |
| | | JSONObject object = new JSONObject(); |
| | | JSONArray array = new JSONArray(); |
| | | for (int j = 0; j < list.size(); j++) { |
| | | JSONObject obj = JSONObject.fromObject(StringUtil.outPutResultJson(list.get(j))); |
| | | JSONArray ar = new JSONArray(); |
| | | if (list.get(j).getReplyList() != null) |
| | | for (CommentReply cr : list.get(j).getReplyList()) |
| | | ar.add(StringUtil.outPutResultJson(cr)); |
| | | obj.put("ReplyList", ar); |
| | | array.add(obj); |
| | | } |
| | | object.put("data", array); |
| | | object.put("count", count); |
| | | out.print(JsonUtil.loadTrueJsonNoencript(object.toString())); |
| | | } |
| | | |
| | | java.util.List<Comment2> list1 = commentService.getComment2List(videoId, thirdType, pageIndex); |
| | | List<Comment2> list = new ArrayList<>(); |
| | | if (list1 != null) |
| | | for (Comment2 cm : list1) |
| | | list.add(cm); |
| | | long count = commentService.getComment2ListCount(videoId, thirdType); |
| | | public void getMyCommentReply(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String page = request.getParameter("Page"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String loginUid = request.getParameter("LoginUid"); |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传LoginUid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | |
| | | JSONObject object = new JSONObject(); |
| | | JSONArray array = new JSONArray(); |
| | | for (int j = 0; j < list.size(); j++) { |
| | | JSONObject obj = JSONObject.fromObject(StringUtil.outPutResultJson(list.get(j))); |
| | | JSONArray ar = new JSONArray(); |
| | | if (list.get(j).getReplyList() != null) |
| | | for (CommentReply cr : list.get(j).getReplyList()) |
| | | ar.add(StringUtil.outPutResultJson(cr)); |
| | | obj.put("ReplyList", ar); |
| | | array.add(obj); |
| | | } |
| | | object.put("data", array); |
| | | object.put("count", count); |
| | | out.print(JsonUtil.loadTrueJsonNoencript(object.toString())); |
| | | } |
| | | if (StringUtil.isNullOrEmpty(loginUid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传LoginUid")); |
| | | return; |
| | | } |
| | | |
| | | public void getMyCommentReply(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String page = request.getParameter("Page"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String loginUid = request.getParameter("LoginUid"); |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传LoginUid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | int pageIndex = StringUtil.getPage(page); |
| | | if (pageIndex == 0) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Page")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(loginUid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传LoginUid")); |
| | | return; |
| | | } |
| | | List<CommentReply> list = commentService.getCommentReplyList(loginUid, pageIndex); |
| | | long count = commentService.getCommentReplyListCount(loginUid); |
| | | |
| | | int pageIndex = StringUtil.getPage(page); |
| | | if (pageIndex == 0) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Page")); |
| | | return; |
| | | } |
| | | JSONObject object = new JSONObject(); |
| | | |
| | | List<CommentReply> list = commentService.getCommentReplyList(loginUid, pageIndex); |
| | | long count = commentService.getCommentReplyListCount(loginUid); |
| | | JSONArray array = new JSONArray(); |
| | | for (int i = 0; i < list.size(); i++) |
| | | array.add(StringUtil.outPutResultJson(list.get(i))); |
| | | commentService.setCommentReplyRead(loginUid); |
| | | object.put("data", array); |
| | | object.put("count", count); |
| | | out.print(JsonUtil.loadTrueJsonNoencript(object.toString())); |
| | | } |
| | | |
| | | JSONObject object = new JSONObject(); |
| | | public void replayComment(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String commentReplyId = request.getParameter("CommentReplyId"); |
| | | String commentId = request.getParameter("CommentId"); |
| | | String content = request.getParameter("Content"); |
| | | String loginUid = request.getParameter("LoginUid"); |
| | | |
| | | JSONArray array = new JSONArray(); |
| | | for (int i = 0; i < list.size(); i++) |
| | | array.add(StringUtil.outPutResultJson(list.get(i))); |
| | | commentService.setCommentReplyRead(loginUid); |
| | | object.put("data", array); |
| | | object.put("count", count); |
| | | out.print(JsonUtil.loadTrueJsonNoencript(object.toString())); |
| | | } |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | |
| | | public void replayComment(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String commentReplyId = request.getParameter("CommentReplyId"); |
| | | String commentId = request.getParameter("CommentId"); |
| | | String content = request.getParameter("Content"); |
| | | String loginUid = request.getParameter("LoginUid"); |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传LoginUid")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传LoginUid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(commentId)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传commentId")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(loginUid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传commentId")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(commentId)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传commentId")); |
| | | return; |
| | | } |
| | | if (StringUtil.match("[\\d]{6,}", content)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("信息格式不正确")); |
| | | return; |
| | | } |
| | | content = StringUtil.getUTF8String(content, "ISO-8859-1"); |
| | | Serializable repid = commentService.replyComment(commentId, commentReplyId, loginUid, content); |
| | | if (repid != null) { |
| | | pushService.pushCommentReplay(commentId, commentReplyId, repid + ""); |
| | | } |
| | | out.print(JsonUtil.loadTrueJsonNoencript("")); |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(loginUid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传commentId")); |
| | | return; |
| | | } |
| | | public void comment(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | |
| | | if (StringUtil.match("[\\d]{6,}", content)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("信息格式不正确")); |
| | | return; |
| | | } |
| | | content = StringUtil.getUTF8String(content, "ISO-8859-1"); |
| | | Serializable repid = commentService.replyComment(commentId, commentReplyId, loginUid, content); |
| | | if (repid != null) { |
| | | pushService.pushCommentReplay(commentId, commentReplyId, repid + ""); |
| | | } |
| | | out.print(JsonUtil.loadTrueJsonNoencript("")); |
| | | } |
| | | String system = request.getParameter("System"); |
| | | String videoId = request.getParameter("VideoId"); |
| | | String thirdType = request.getParameter("ThirdType"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | String content = request.getParameter("Content"); |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | |
| | | public void comment(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传LoginUid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | |
| | | String system = request.getParameter("System"); |
| | | String videoId = request.getParameter("VideoId"); |
| | | String thirdType = request.getParameter("ThirdType"); |
| | | String sign = request.getParameter("Sign"); |
| | | String platform = request.getParameter("Platform"); |
| | | String packageName = request.getParameter("Package"); |
| | | String content = request.getParameter("Content"); |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(videoId)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传VideoId")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传LoginUid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(videoId)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传VideoId")); |
| | | return; |
| | | } |
| | | if (StringUtil.match("[\\d]{6,}", content)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("信息格式不正确")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(platform)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Platform")); |
| | | return; |
| | | } |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); |
| | | |
| | | if (StringUtil.match("[\\d]{6,}", content)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("信息格式不正确")); |
| | | return; |
| | | } |
| | | Comment2 comment = new Comment2(); |
| | | comment.setContent(content); |
| | | comment.setCreatetime(System.currentTimeMillis() + ""); |
| | | comment.setShow(true); |
| | | comment.setThirdType(thirdType); |
| | | comment.setUser(new LoginUser(uid)); |
| | | comment.setVideo(new VideoInfo(videoId)); |
| | | comment.setDetailsystem(detailSystem.getId()); |
| | | commentService.addComment2(comment); |
| | | |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); |
| | | out.print(JsonUtil.loadTrueJsonNoencript("")); |
| | | |
| | | Comment2 comment = new Comment2(); |
| | | comment.setContent(content); |
| | | comment.setCreatetime(System.currentTimeMillis() + ""); |
| | | comment.setShow(true); |
| | | comment.setThirdType(thirdType); |
| | | comment.setUser(new LoginUser(uid)); |
| | | comment.setVideo(new VideoInfo(videoId)); |
| | | comment.setDetailsystem(detailSystem.getId()); |
| | | commentService.addComment2(comment); |
| | | } |
| | | |
| | | out.print(JsonUtil.loadTrueJsonNoencript("")); |
| | | /** |
| | | * 发送验证码 |
| | | * |
| | | * @param uid |
| | | * @param request |
| | | * @param out |
| | | */ |
| | | public void sendVerifyCode(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String packageName = request.getParameter("Package");// 包名 |
| | | String platform = request.getParameter("Platform"); |
| | | String version = request.getParameter("Version"); |
| | | String device = request.getParameter("Device"); |
| | | final String account = request.getParameter("Email");// 邮箱 |
| | | final String code = request.getParameter("Code");// 验证码 |
| | | |
| | | } |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | |
| | | /** |
| | | * 发送验证码 |
| | | * |
| | | * @param uid |
| | | * @param request |
| | | * @param out |
| | | */ |
| | | public void sendVerifyCode(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String packageName = request.getParameter("Package");// 包名 |
| | | String platform = request.getParameter("Platform"); |
| | | String version = request.getParameter("Version"); |
| | | String device = request.getParameter("Device"); |
| | | final String account = request.getParameter("Email");// 邮箱 |
| | | final String code = request.getParameter("Code");// 验证码 |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(account)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Email")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(account)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Email")); |
| | | return; |
| | | } |
| | | request.getSession().setAttribute(account, code); |
| | | new Thread(new Runnable() { |
| | | public void run() { |
| | | |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | EmailInfo emailInfo = new EmailInfo(); |
| | | emailInfo.setToEmail(account); |
| | | emailInfo.setTitle("布丸社区注册验证码:" + code); |
| | | emailInfo.setFromEmail("buwanysdq@163.com"); |
| | | emailInfo.setFormEmailPwd("weikou2014"); |
| | | emailInfo.setContent("布丸社区注册验证码:" + code); |
| | | emailInfo.setApp("影视"); |
| | | |
| | | request.getSession().setAttribute(account, code); |
| | | new Thread(new Runnable() { |
| | | public void run() { |
| | | boolean isS = MailSenderUtil.sendEmail(account, "buwanysdq@163.com", "weikou2014", "布丸社区注册验证码:" + code, |
| | | "布丸社区注册验证码:" + code); |
| | | } |
| | | }).start(); |
| | | out.print(JsonUtil.loadTrueJsonNoencript("验证码发送成功")); |
| | | } |
| | | try { |
| | | EmailApiUtil.sendEmail(emailInfo); |
| | | } catch (MailSendException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }).start(); |
| | | out.print(JsonUtil.loadTrueJsonNoencript("验证码发送成功")); |
| | | } |
| | | |
| | | // 设置密码 |
| | | public void setPwd(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String packageName = request.getParameter("Package");// 包名 |
| | | String platform = request.getParameter("Platform"); |
| | | String version = request.getParameter("Version"); |
| | | String device = request.getParameter("Device"); |
| | | String email = request.getParameter("Email");// 个性签名 |
| | | String pwd = request.getParameter("Pwd");// 密码 |
| | | // 设置密码 |
| | | public void setPwd(String uid, HttpServletRequest request, PrintWriter out) { |
| | | String method = request.getParameter("Method"); |
| | | String system = request.getParameter("System"); |
| | | String sign = request.getParameter("Sign"); |
| | | String packageName = request.getParameter("Package");// 包名 |
| | | String platform = request.getParameter("Platform"); |
| | | String version = request.getParameter("Version"); |
| | | String device = request.getParameter("Device"); |
| | | String email = request.getParameter("Email");// 个性签名 |
| | | String pwd = request.getParameter("Pwd");// 密码 |
| | | |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Method")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Uid")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(system)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传System")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(email)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Email")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(email)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Email")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(pwd)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Pwd")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(pwd)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Pwd")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(sign)) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("请上传Sign")); |
| | | return; |
| | | } |
| | | |
| | | // 注册 --用户名,昵称,密码 |
| | | LoginUser user = userService.getLoginUserByOpenId(email); |
| | | if (user == null) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("该用户不存在")); |
| | | } else { |
| | | user.setPwd(StringUtil.Md5(pwd)); |
| | | userService.updateLoginUserInfo(user); |
| | | out.print(JsonUtil.loadTrueJsonNoencript("密码设置成功")); |
| | | } |
| | | // 注册 --用户名,昵称,密码 |
| | | LoginUser user = userService.getLoginUserByOpenId(email); |
| | | if (user == null) { |
| | | out.print(JsonUtil.loadFalseJsonNoencript("该用户不存在")); |
| | | } else { |
| | | user.setPwd(StringUtil.Md5(pwd)); |
| | | userService.updateLoginUserInfo(user); |
| | | out.print(JsonUtil.loadTrueJsonNoencript("密码设置成功")); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |