提交修改
This commit is contained in:
parent
b55a0b829c
commit
4e3eaafef7
@ -55,6 +55,14 @@ public class ApiConstants {
|
||||
public static String TOKEN = "token";
|
||||
|
||||
|
||||
public static String ACCESS_TOKEN_EQUALS= "access_token=";
|
||||
|
||||
|
||||
public static String QUESTION_MARK= "?";
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 任务调度参数key
|
||||
*/
|
||||
|
||||
@ -6,9 +6,15 @@ import lombok.Data;
|
||||
@Data
|
||||
public class VVAdminDTO {
|
||||
|
||||
|
||||
private String username;
|
||||
|
||||
|
||||
/***
|
||||
* token
|
||||
*/
|
||||
private String token;
|
||||
/***
|
||||
* 过期时间
|
||||
*/
|
||||
private Long expireTime;
|
||||
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.heyu.api.aop;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.heyu.api.common.LogAspect;
|
||||
import com.heyu.api.data.constants.ApiConstants;
|
||||
import com.heyu.api.data.dto.BuyerDTO;
|
||||
import com.heyu.api.data.dto.VVRequestLogDTO;
|
||||
import com.heyu.api.data.utils.*;
|
||||
@ -115,6 +116,7 @@ public class ZhenZhenLogAop {
|
||||
buyerId = buyerDTO.getBuyerId();
|
||||
}
|
||||
}
|
||||
|
||||
for (Object argArr : argArrs) {
|
||||
argArr.getClass().getDeclaredMethods();
|
||||
|
||||
@ -149,8 +151,6 @@ public class ZhenZhenLogAop {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else if (uri.startsWith("/mm/")) {
|
||||
// 登录不拦截
|
||||
if (!"/mm/admin/login".equals(uri)) {
|
||||
@ -161,13 +161,11 @@ public class ZhenZhenLogAop {
|
||||
}
|
||||
}
|
||||
result = point.proceed();
|
||||
|
||||
if (result instanceof R) {
|
||||
R r = (R) result;
|
||||
Object object = r.getData();
|
||||
convertImage(object);
|
||||
convertImage(object,token);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("LogAop set error " + sb.toString(), e);
|
||||
} finally {
|
||||
@ -179,25 +177,25 @@ public class ZhenZhenLogAop {
|
||||
}
|
||||
|
||||
|
||||
public static void convertImage(Object object) {
|
||||
public static void convertImage(Object object,String token) {
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
if (object instanceof List) {
|
||||
List list = (List) object;
|
||||
for (Object o : list) {
|
||||
convertImage(o);
|
||||
convertImage(o,token);
|
||||
}
|
||||
} else if (object instanceof Map) {
|
||||
Map map = (Map) object;
|
||||
for (Object key : map.keySet()) {
|
||||
Object value = map.get(key);
|
||||
convertImage(value);
|
||||
convertImage(value,token);
|
||||
}
|
||||
} else if (object.getClass().isArray()) {
|
||||
Object[] array = (Object[]) object;
|
||||
for (Object o : array) {
|
||||
convertImage(o);
|
||||
convertImage(o,token);
|
||||
}
|
||||
} else if (SanUtils.isBasicDataTypes(object.getClass())) {
|
||||
return;
|
||||
@ -219,15 +217,23 @@ public class ZhenZhenLogAop {
|
||||
if (method.getReturnType() == String.class) {
|
||||
String str = (String) image;
|
||||
if (str != null
|
||||
&& str.startsWith("https://heyuimage.ihzhy.com")) {
|
||||
String setMethodName = "set" + method.getName().substring(3);
|
||||
&& str.startsWith("https://heyuimage.ihzhy.com")
|
||||
) {
|
||||
String newImage = str;
|
||||
if (str.contains(ApiConstants.ACCESS_TOKEN_EQUALS)) {
|
||||
String urlArray[] = str.split(ApiConstants.ACCESS_TOKEN_EQUALS);
|
||||
newImage = urlArray[0] + ApiConstants.QUESTION_MARK + ApiConstants.ACCESS_TOKEN_EQUALS + token;
|
||||
} else {
|
||||
newImage = str + ApiConstants.QUESTION_MARK + ApiConstants.ACCESS_TOKEN_EQUALS + token;
|
||||
}
|
||||
String setMethodName = ApiConstants.set + method.getName().substring(3);
|
||||
Method setMethod = methodMap.get(setMethodName);
|
||||
String newImage = image + "?key=xxxxxxx";
|
||||
|
||||
setMethod.invoke(object, new Object[]{newImage});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
convertImage(image);
|
||||
convertImage(image,token);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -8,6 +8,7 @@ import com.heyu.api.data.dao.vv.VvLoginLogDao;
|
||||
import com.heyu.api.data.dto.vv.VVAdminDTO;
|
||||
import com.heyu.api.data.entity.vv.VvAdminEntity;
|
||||
import com.heyu.api.data.entity.vv.VvLoginLogEntity;
|
||||
import com.heyu.api.data.utils.DateUtils;
|
||||
import com.heyu.api.data.utils.MD5Utils;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.data.utils.RedisUtils;
|
||||
@ -17,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/mm/user/")
|
||||
@ -25,21 +28,13 @@ public class AdminLoginController {
|
||||
@Autowired
|
||||
private VvAdminDao vvAdminDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
private VvLoginLogDao vvLoginLogDao;
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private RedisUtils redisUtils;
|
||||
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
*
|
||||
*
|
||||
* mmToken
|
||||
*
|
||||
* token
|
||||
@ -54,24 +49,23 @@ public class AdminLoginController {
|
||||
@RequestMapping("/login")
|
||||
public R list(@RequestBody VVAdminRequest vvAdminRequest) {
|
||||
VVAdminDTO vvAdminDTO = new VVAdminDTO();
|
||||
|
||||
VvAdminEntity vvAdminEntity = vvAdminDao.selectVvAdminByUserName(vvAdminRequest.getUsername());
|
||||
// admin123 != '1' or 1 = 1
|
||||
if (vvAdminEntity.getPassword().equals(vvAdminRequest.getPassword())) {
|
||||
vvAdminDTO.setUsername(vvAdminRequest.getUsername());
|
||||
String token = MD5Utils.getMD5(System.currentTimeMillis() + "admin");
|
||||
String token = MD5Utils.getMD5(System.currentTimeMillis() + vvAdminRequest.getUsername());
|
||||
vvAdminDTO.setToken(token);
|
||||
vvAdminDTO.setUsername(vvAdminRequest.getUsername());
|
||||
vvAdminDTO.setExpireTime(DateUtils.addDays(new Date(), 7).getTime());
|
||||
|
||||
VvLoginLogEntity vvLoginLogEntity = new VvLoginLogEntity();
|
||||
|
||||
vvLoginLogDao.deleteVvLoginLogRealByUserName(vvAdminRequest.getUsername());
|
||||
|
||||
vvLoginLogEntity.setUsername(vvAdminRequest.getUsername());
|
||||
|
||||
redisUtils.set(token,vvAdminRequest.getUsername(), RedisConstans.SECOND_OF_ONE_7_DAY);
|
||||
redisUtils.set(token, vvAdminRequest.getUsername(), RedisConstans.SECOND_OF_ONE_7_DAY);
|
||||
|
||||
vvLoginLogEntity.setToken(token);
|
||||
vvLoginLogDao.insertOrUpdateVvLoginLog(vvLoginLogEntity);
|
||||
|
||||
return R.ok().setData(vvAdminDTO);
|
||||
}
|
||||
return R.ok("密码错误");
|
||||
|
||||
@ -166,6 +166,8 @@ public class AppOrderController {
|
||||
|
||||
/***
|
||||
* 订单添加
|
||||
*
|
||||
* http://localhost:8888/app/order/add
|
||||
*/
|
||||
@Describe("添加订单")
|
||||
@RequestMapping("/add")
|
||||
@ -294,11 +296,6 @@ public class AppOrderController {
|
||||
vvProductDao.updateShowSaleCountAndSaleCount(map.getValue(), map.getValue(), map.getKey());
|
||||
}
|
||||
|
||||
|
||||
if(true){
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
DirectAPIv3JsapiPrepayResponse jsapiPrepayResponse = jsapiPrepay.prePay(vvTradeOrderEntity.getId(),
|
||||
BigDecimalUtil.multiply(vvTradeOrderEntity.getPayAmount(), new BigDecimal(100)).longValue(),
|
||||
vvBuyerEntity.getOpenid()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user