Commit 93fd97cc authored by yanzg's avatar yanzg

添加对Android的支持

parent 3b5a7ee8
......@@ -9,6 +9,7 @@ import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.util.helper.StringHelper;
import com.yanzuoguang.util.log.Log;
import com.yanzuoguang.util.vo.LogVo;
import com.yanzuoguang.util.vo.Ref;
import com.yanzuoguang.util.vo.ResponseResult;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
......@@ -61,6 +62,7 @@ public class WebAspect extends BaseRequestAspect {
ResponseResult responseResult = null;
long start = System.currentTimeMillis();
String name = joinPoint.getSignature().getName();
Ref<Boolean> flag = new Ref<>(false);
try {
logger.info("[ {} ] request params is {}", name, joinPoint.getArgs());
tokenServiceCall.tokenInit();
......@@ -74,7 +76,7 @@ public class WebAspect extends BaseRequestAspect {
long end = System.currentTimeMillis();
logger.info("[ {} ] time ({})ms, result is {}", name, (end - start), responseResult);
tokenFinish(flag);
return result;
} catch (Exception e) {
long end = System.currentTimeMillis();
......@@ -86,12 +88,26 @@ public class WebAspect extends BaseRequestAspect {
throw e;
}
} finally {
tokenServiceCall.tokenFinish();
tokenFinish(flag);
Log.threadCommit();
saveInterLogs(joinPoint, responseResult);
}
}
/**
* 执行结束函数
*
* @param flag 结束函数
* @return 结束函数
*/
private void tokenFinish(Ref<Boolean> flag) {
if (flag.value == true) {
return;
}
flag.value = true;
tokenServiceCall.tokenFinish();
}
/**
* 获取返回的至类型
*
......
......@@ -86,7 +86,7 @@ public class TokenHelper {
cache.put(id, tokenData);
}
}
if (tokenData.getData() == null) {
if (tokenData == null || tokenData.getData() == null) {
if (checkFlag) {
throw new CodeException("请先登录");
}
......
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