Commit ee37a593 authored by Quxl's avatar Quxl

x

parent 34499791
...@@ -152,7 +152,7 @@ public class CinemaController { ...@@ -152,7 +152,7 @@ public class CinemaController {
@ApiImplicitParam(paramType="query", name="start_date", value="开始日期"), @ApiImplicitParam(paramType="query", name="start_date", value="开始日期"),
@ApiImplicitParam(paramType="query", name="end_date", value="结束日期"), @ApiImplicitParam(paramType="query", name="end_date", value="结束日期"),
}) })
public Object getShowtimeList(Integer cinema_id, Date start_date, Date end_date) { public Object getShowtimeList(Integer cinema_id, @DateTimeFormat(pattern="yyyy-MM-dd")Date start_date, @DateTimeFormat(pattern="yyyy-MM-dd")Date end_date) {
if(start_date == null) { if(start_date == null) {
start_date = DateUtil.start(new Date()); start_date = DateUtil.start(new Date());
} else { } else {
......
package com.egolm.film.config.interceptor; package com.egolm.film.config.interceptor;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
...@@ -34,7 +35,7 @@ public class WebApiInterceptor extends HandlerInterceptorAdapter { ...@@ -34,7 +35,7 @@ public class WebApiInterceptor extends HandlerInterceptorAdapter {
parameterMap.remove("sign"); parameterMap.remove("sign");
StringBuffer string = this.toString(parameterMap); StringBuffer string = this.toString(parameterMap);
String sign_tmp = StringUtil.toMD5HexString(string + md5key); String sign_tmp = StringUtil.toMD5HexString(string + md5key);
if(sign_tmp.equals(sign_string)) { if(sign_tmp.toLowerCase().equals(sign_string.toLowerCase())) {
return super.preHandle(req, resp, handler); return super.preHandle(req, resp, handler);
} else { } else {
throw new XRException("数据签名错误"); throw new XRException("数据签名错误");
...@@ -64,13 +65,15 @@ public class WebApiInterceptor extends HandlerInterceptorAdapter { ...@@ -64,13 +65,15 @@ public class WebApiInterceptor extends HandlerInterceptorAdapter {
} }
public static void main(String[] args) { public static void main(String[] args) {
String md5key = "564cc4130ee949d4ae25b5681e784583";
String timestamp = String.valueOf(System.currentTimeMillis()); String timestamp = String.valueOf(System.currentTimeMillis());
String sign = StringUtil.toMD5HexString(timestamp + md5key); Map<String, String> params = new HashMap<String, String>();
System.out.println("10.10.0.111:20002/film/webapi/getFilmList?timestamp=" + timestamp + "&sign=" + sign); params.put("timestamp", timestamp);
String sign = sign(params);
System.out.println("http://10.10.0.111:20002/film/webapi/getFilmList?timestamp=" + timestamp + "&sign=" + sign);
} }
public String sign(Map<String, String> params) { public static String sign(Map<String, String> params) {
String md5key = "564cc4130ee949d4ae25b5681e784583";
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
Map<String, String> sortMap = Map<String, String> sortMap =
new TreeMap<String, String>(params); new TreeMap<String, String>(params);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment