迅睿CMS框架是一款PHP8高性能·簡單易用的CMS開源開發(fā)框架,基于MIT開源許可協(xié)議發(fā)布,免費且不限制商業(yè)使用,是免費開源的產(chǎn)品,以萬端互聯(lián)為設(shè)計理念,支持的微信公眾號、小程序、APP客戶端、移動端網(wǎng)站、PC網(wǎng)站等多終端式管理系統(tǒng)。
聯(lián)系官方銷售客服
1835022288
028-61286886
你是怎么寫的接口
@Before(YgwAuthInterceptor.class)
@ControllerMapping(value = "/ws/rebate", viewdir = "/")
public class UseRebateController extends YgwController{
UseRebateService useRebateService = new UseRebateService();
/**
*
*/
public void deductRebate() {
PlatformRebateRequest request= (PlatformRebateRequest) getBody(PlatformRebateRequest.class);
renderJson(useRebateService.deductRebate(request));
}
2.YgwAuthInterceptor
public class YgwAuthInterceptor implements Interceptor {
@Override
public void intercept(Invocation inv) {
YgwController controller = (YgwController) inv.getController();
Header header = controller.getHeader();
if (header == null
|| StringUtils.isEmpty(header.getBusinessCode())
|| StringUtils.isEmpty(header.getSign())) {
controller.renderText("{\"code\":\"403\", \"msg\":\"接口驗證失敗,驗證信息不能為空\"}");
return;
// 時間戳最多只能用1個小時
if (System.currentTimeMillis() - header.getTimestamp() > 3600000) {
controller.renderText("{\"code\":\"403\", \"msg\":\"接口驗證失敗,時間戳超時\"}");
String body;
try {
body = EncryptUtils.desDecrypt(controller.getPara("body"), Constant.DESKEY);
} catch (Exception e) {
controller.renderText("{\"code\":\"403\", \"msg\":\"接口驗證失敗,Body解密失敗\"}");
String sign = header.getBusinessCode() + "|" + header.getTimestamp() + "|" + body + "|" + Constant.YGW_DESKEY;
if (header.getSign().equals(EncryptUtils.encrypt(sign))) {
inv.invoke();
controller.renderText("{\"code\":\"403\", \"msg\":\"接口驗證失敗,簽名錯誤\"}");
我用postman測試,返回這個{\"code\":\"403\", \"msg\":\"接口驗證失敗,驗證信息不能為空\"}
看不懂這個,我們是xunruicms,你這些語法完全跟xunruicms不相關(guān)了
你是怎么寫的接口
@Before(YgwAuthInterceptor.class)
@ControllerMapping(value = "/ws/rebate", viewdir = "/")
public class UseRebateController extends YgwController{
UseRebateService useRebateService = new UseRebateService();
/**
*
*/
public void deductRebate() {
PlatformRebateRequest request= (PlatformRebateRequest) getBody(PlatformRebateRequest.class);
renderJson(useRebateService.deductRebate(request));
}
}
2.YgwAuthInterceptor
public class YgwAuthInterceptor implements Interceptor {
@Override
public void intercept(Invocation inv) {
YgwController controller = (YgwController) inv.getController();
Header header = controller.getHeader();
if (header == null
|| StringUtils.isEmpty(header.getBusinessCode())
|| StringUtils.isEmpty(header.getSign())) {
controller.renderText("{\"code\":\"403\", \"msg\":\"接口驗證失敗,驗證信息不能為空\"}");
return;
}
// 時間戳最多只能用1個小時
if (System.currentTimeMillis() - header.getTimestamp() > 3600000) {
controller.renderText("{\"code\":\"403\", \"msg\":\"接口驗證失敗,時間戳超時\"}");
return;
}
String body;
try {
body = EncryptUtils.desDecrypt(controller.getPara("body"), Constant.DESKEY);
} catch (Exception e) {
controller.renderText("{\"code\":\"403\", \"msg\":\"接口驗證失敗,Body解密失敗\"}");
return;
}
String sign = header.getBusinessCode() + "|" + header.getTimestamp() + "|" + body + "|" + Constant.YGW_DESKEY;
if (header.getSign().equals(EncryptUtils.encrypt(sign))) {
inv.invoke();
return;
}
controller.renderText("{\"code\":\"403\", \"msg\":\"接口驗證失敗,簽名錯誤\"}");
}
我用postman測試,返回這個{\"code\":\"403\", \"msg\":\"接口驗證失敗,驗證信息不能為空\"}
看不懂這個,我們是xunruicms,你這些語法完全跟xunruicms不相關(guān)了