Skip to content

Commit 233f31c

Browse files
committed
project restart
1 parent 3cc6e78 commit 233f31c

File tree

6 files changed

+372
-42
lines changed

6 files changed

+372
-42
lines changed

luna-commons-ali/README.md

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ git clone https://github.com/czy1024/luna-commons.git
8282
<version>1.0-SNAPSHOT</version>
8383
</dependency>
8484
```
85+
将com/luna/**/config 下的配置文件复制到自己的项目中
8586
在配置文件application.properties加入可选配置
8687

8788
```text#阿里oss服务器
@@ -106,42 +107,7 @@ git clone https://github.com/czy1024/luna-commons.git
106107
luna.alipay.gatewayUrl=https://openapi.alipaydev.com/gateway.do
107108
```
108109

109-
引用示例
110-
111-
```java
112-
package com.luna.springdemo;
113-
114-
115-
import com.luna.springdemo.baidu.BaiduConfig;
116-
import org.junit.Test;
117-
import org.junit.runner.RunWith;
118-
import org.springframework.boot.test.context.SpringBootTest;
119-
import org.springframework.test.context.junit4.SpringRunner;
120-
121-
import javax.annotation.Resource;
122-
import java.io.IOException;
123-
124-
/**
125-
* @author Luna@win10
126-
* @date 2020/5/6 12:46
127-
*/
128-
@SpringBootTest
129-
@RunWith(SpringRunner.class)
130-
public class BaiduApiTest {
131-
132-
@Resource
133-
BaiduConfig baiduConfig;
134-
135-
@Test
136-
public void aTest() throws IOException {
137-
System.out.println(baiduConfig.getAppId());
138-
}
139-
140-
}
141-
142-
```
143-
144-
结果
110+
[引用示例见](./luna-commons-baidu/README)
145111

146112

147113
### 文件目录说明

luna-commons-baidu/README.md

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
2+
3+
# ProjectName
4+
5+
luna-commons-baidu
6+
7+
<!-- PROJECT SHIELDS -->
8+
9+
[![Contributors][contributors-shield]][contributors-url]
10+
[![Forks][forks-shield]][forks-url]
11+
[![Stargazers][stars-shield]][stars-url]
12+
[![Issues][issues-shield]][issues-url]
13+
[![MIT License][license-shield]][license-url]
14+
[![LinkedIn][linkedin-shield]][linkedin-url]
15+
16+
<!-- PROJECT LOGO -->
17+
<br />
18+
19+
<p align="center">
20+
<a href="https://github.com/czy1024/luna-commons/">
21+
<img src="images/logo.png" alt="Logo" width="80" height="80">
22+
</a>
23+
24+
<h3 align="center">"完美的"开发工具</h3>
25+
<p align="center">
26+
市场上许多界面和工具的集合,例如ftp,httpd等文件与工具操作,包括但不限于图像处理、人脸识别等的api。让你免去寻找工具的烦恼
27+
<br />
28+
<a href="https://github.com/czy1024/luna-commons"><strong>探索本项目的文档 »</strong></a>
29+
<br />
30+
<br />
31+
<a href="">查看Demo</a>
32+
·
33+
<a href="">报告Bug</a>
34+
·
35+
<a href="https://github.com/czy1024/luna-commons/issues">提出新特性</a>
36+
</p>
37+
38+
</p>
39+
40+
41+
42+
## 目录
43+
44+
- [上手指南](#上手指南)
45+
- [开发前的配置要求](#开发前的配置要求)
46+
- [安装步骤](#安装步骤)
47+
- [文件目录说明](#文件目录说明)
48+
- [部署](#部署)
49+
50+
51+
### 上手指南
52+
53+
54+
###### **安装步骤**
55+
56+
1. Get a free API Key at [https://account.aliyun.com](https://account.aliyun.com)
57+
2. 找到config目录下的xxxConfigValue,application.properties
58+
3. Clone the repo
59+
60+
```sh
61+
git clone https://github.com/czy1024/luna-commons.git
62+
```
63+
64+
引入项目依赖
65+
66+
```xml
67+
<repositories>
68+
<repository>
69+
<id>luna-commons-mvn-repo-baidu</id>
70+
<url>https://raw.github.com/czy1024/luna-commons/mvn-repo-luna-commons-baidu/</url>
71+
<snapshots>
72+
<enabled>true</enabled>
73+
<updatePolicy>always</updatePolicy>
74+
</snapshots>
75+
</repository>
76+
</repositories>
77+
78+
79+
<dependency>
80+
<groupId>com.luna</groupId>
81+
<artifactId>luna-commons-ali</artifactId>
82+
<version>1.0-SNAPSHOT</version>
83+
</dependency>
84+
```
85+
将com/luna/**/config 下的配置文件复制到自己的项目中
86+
在配置文件application.properties加入可选配置
87+
88+
```text
89+
# 百度API
90+
luna.baidu.appKey=xxxx
91+
luna.baidu.secretKey=xxx
92+
luna.baidu.appId=xxx
93+
luna.baidu.jsKey=xxx
94+
95+
```
96+
97+
引用示例
98+
99+
```java
100+
101+
/**
102+
* @author Luna@win10
103+
* @date 2020/5/6 12:46
104+
*/
105+
@SpringBootTest
106+
@RunWith(SpringRunner.class)
107+
public class BaiduApiTest {
108+
109+
@Resource
110+
BaiduConfig baiduConfig;
111+
112+
@Test
113+
public void aTest() throws IOException {
114+
System.out.println(baiduConfig.getAppId());
115+
}
116+
117+
}
118+
119+
```
120+
121+
结果即刻得到配置数据,进而调用api里的静态方法完成调用
122+
123+
124+
### 文件目录说明
125+
eg:
126+
127+
```
128+
luna-commons-ali
129+
├── README.md
130+
├── src
131+
│ ├── /config/
132+
│ ├── /entity/
133+
│ ├── /oss/
134+
│ ├── /pay/
135+
│──── /resource/
136+
└── pom.xml
137+
138+
```
139+
140+
### 部署
141+
142+
暂无
143+
144+
145+
146+
147+
148+
149+
<!-- links -->
150+
[your-project-path]:czy1024/luna-commons
151+
[contributors-shield]: https://img.shields.io/github/contributors/czy1024/luna-commons.svg?style=flat-square
152+
[contributors-url]: https://github.com/czy1024/luna-commons/graphs/contributors
153+
[forks-shield]: https://img.shields.io/github/forks/czy1024/luna-commons.svg?style=flat-square
154+
[forks-url]: https://github.com/czy1024/luna-commons/network/members
155+
[stars-shield]: https://img.shields.io/github/stars/czy1024/luna-commons.svg?style=flat-square
156+
[stars-url]: https://github.com/czy1024/luna-commons/stargazers
157+
[issues-shield]: https://img.shields.io/github/issues/czy1024/luna-commons.svg?style=flat-square
158+
[issues-url]: https://img.shields.io/github/issues/czy1024/luna-commons.svg
159+
[license-shield]: https://img.shields.io/github/license/czy1024/luna-commons.svg?style=flat-square
160+
[license-url]: https://github.com/czy1024/luna-commons/blob/master/LICENSE.txt
161+
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=flat-square&logo=linkedin&colorB=555
162+
[linkedin-url]: https://linkedin.com/in/shaojintian
163+
164+
165+
166+

luna-commons-baidu/log/server.log

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,20 @@ You may wish to exclude one of them to ensure predictable runtime behavior
1717
2020-07-17 14:52:43,114 INFO [main] (GetBaiduKey.java:42) - 执行定时任务获取百度Key
1818
2020-07-17 14:52:44,493 INFO [main] (GetBaiduKey.java:79) - get token success!
1919
2020-07-17 14:52:44,505 INFO [SpringContextShutdownHook] (ExecutorConfigurationSupport.java:208) - Shutting down ExecutorService 'taskScheduler'
20+
2020-07-17 19:37:48,202 WARN [main] (DuplicateJsonObjectContextCustomizerFactory.java:78) -
21+
22+
Found multiple occurrences of org.json.JSONObject on the class path:
23+
24+
jar:file:/D:/maven/repository/org/json/json/20160810/json-20160810.jar!/org/json/JSONObject.class
25+
jar:file:/D:/maven/repository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar!/org/json/JSONObject.class
26+
27+
You may wish to exclude one of them to ensure predictable runtime behavior
28+
29+
2020-07-17 19:37:48,215 INFO [main] (StartupInfoLogger.java:55) - Starting OcrTest on luna with PID 13432 (started by improve in D:\myproject\luna-commons-loc\luna-commons-baidu)
30+
2020-07-17 19:37:48,216 INFO [main] (SpringApplication.java:655) - The following profiles are active: dev
31+
2020-07-17 19:37:48,568 INFO [main] (RepositoryConfigurationDelegate.java:249) - Multiple Spring Data modules found, entering strict repository configuration mode!
32+
2020-07-17 19:37:48,570 INFO [main] (RepositoryConfigurationDelegate.java:127) - Bootstrapping Spring Data Redis repositories in DEFAULT mode.
33+
2020-07-17 19:37:48,600 INFO [main] (RepositoryConfigurationDelegate.java:187) - Finished Spring Data repository scanning in 15ms. Found 0 Redis repository interfaces.
34+
2020-07-17 19:37:49,459 INFO [main] (ExecutorConfigurationSupport.java:171) - Initializing ExecutorService 'taskScheduler'
35+
2020-07-17 19:37:49,510 INFO [main] (StartupInfoLogger.java:61) - Started OcrTest in 5.146 seconds (JVM running for 7.703)
36+
2020-07-17 19:37:55,627 INFO [SpringContextShutdownHook] (ExecutorConfigurationSupport.java:208) - Shutting down ExecutorService 'taskScheduler'

luna-commons-baidu/src/test/java/com/luna/baidu/tests/OcrTest.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
package com.luna.baidu.tests;
22

3-
import com.luna.baidu.config.BaiduConfigValue;
4-
import com.luna.baidu.config.GetBaiduKey;
53
import org.junit.Test;
4+
import org.springframework.beans.factory.annotation.Autowired;
65

76
import com.luna.baidu.BaiduApplicationTest;
8-
import org.springframework.beans.factory.annotation.Autowired;
7+
import com.luna.baidu.api.BaiduApiContent;
8+
import com.luna.baidu.api.BaiduFaceApi;
9+
import com.luna.baidu.config.BaiduConfigValue;
10+
import com.luna.baidu.config.GetBaiduKey;
11+
import com.luna.common.utils.Base64Util;
12+
import com.luna.common.utils.ImageUtils;
913

1014
/**
1115
* @Package: com.luna.baidu.tests
@@ -25,6 +29,7 @@ public class OcrTest extends BaiduApplicationTest {
2529
@Test
2630
public void atest() {
2731
System.out.println(baiduConfigValue.getAppKey());
28-
getBaiduKey.getAuth();
32+
BaiduApiContent.BAIDU_KEY="25.2634aa914e737196878361a42128d998.315360000.1910247307.282335-19618961";
33+
boolean b = BaiduFaceApi.checkLive(Base64Util.encodeBase64String(ImageUtils.getBytes("C:\\Users\\improve\\Pictures\\Saved Pictures\\girl.png")));
2934
}
3035
}

0 commit comments

Comments
 (0)