|
@@ -0,0 +1,24 @@
|
|
|
+package com.ruoyi.demo.utils;
|
|
|
+
|
|
|
+import cn.hutool.crypto.SecureUtil;
|
|
|
+import com.ruoyi.demo.config.MtStarProperties;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.ZoneId;
|
|
|
+import java.time.ZoneOffset;
|
|
|
+
|
|
|
+@Component
|
|
|
+public class MtStarUtil {
|
|
|
+ @Autowired
|
|
|
+ MtStarProperties mtStarProperties;
|
|
|
+
|
|
|
+ public String sign(){
|
|
|
+ String accesSecretMd5 = SecureUtil.md5(mtStarProperties.getSecret());
|
|
|
+ long l = LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")); //10位
|
|
|
+ String s = SecureUtil.md5(mtStarProperties.getAuthtoken() + accesSecretMd5 + l);
|
|
|
+ return s;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|