156 Star 1.1K Fork 530

smartboot / smart-license

 / 详情

在线申请时间错误

已关闭
创建于  
2023-09-21 17:15

http://82.157.162.230:8080/#/license 生成文件代码调试发现申请时间2037年

error:

      long applyTime = readLong(inputStream);
        if (applyTime > System.currentTimeMillis()) {
            throw new LicenseException("invalid license");
        }

评论 (6)

蛋挞王子 创建了任务

亲测没问题
输入图片说明

那我再下载一个试试

大哥,有点迷茫。生成:输入图片说明

maven:

  <dependency>
            <groupId>org.smartboot.license</groupId>
            <artifactId>license-client</artifactId>
            <version>2.0</version>
        </dependency>

代码:

@Component
public class LicenseTest implements ApplicationRunner {
    @Override
    public void run(ApplicationArguments args) throws Exception {
        License license = new License(entity -> {
            System.err.println("过期啦");
            System.exit(-1);
        }, 3000);
        try (InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("License.shield")) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            byte[] bytes = new byte[1024];
            int size;
            while ((size = inputStream.read(bytes)) > 0) {
                byteArrayOutputStream.write(bytes, 0, size);
            }
            LicenseEntity entity = license.loadLicense(byteArrayOutputStream.toByteArray());
            System.err.println(IoUtils.toString(entity.getData()));

//            properties.load(new ByteArrayInputStream(entity.getData()));
//            System.out.println(properties);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

    }
}

日期:
输入图片说明

是哪里操作姿势不对吗

源码client测试正常,原因是maven打包resources资源的时候对这个文件变更了,使用插件后正常:

 <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <!-- 不过滤文件扩展名-->
                    <nonFilteredFileExtensions>
                        <nonFilteredFileExtension>lic</nonFilteredFileExtension>
                    </nonFilteredFileExtensions>
                </configuration>
            </plugin>
蛋挞王子 任务状态待办的 修改为已关闭

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(2)
1035203 lunxian8 1583457683 351975 smartdms 1578921064
Java
1
https://gitee.com/smartboot/smart-license.git
git@gitee.com:smartboot/smart-license.git
smartboot
smart-license
smart-license

搜索帮助