Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
d3dfb7ac
Commit
d3dfb7ac
authored
Jul 28, 2018
by
Menethil
Browse files
Merge remote-tracking branch 'origin/master'
parents
1b914cc2
70c32ff9
Changes
25
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
d3dfb7ac
...
...
@@ -8,13 +8,10 @@ deploy:
-
rm -rf /root/spring_boot/*.jar
-
rm -rf /etc/init.d/litemall-*
-
cp -rf litemall-admin-api/target/litemall-admin-api-*-exec.jar /root/spring_boot/litemall-admin-api.jar
-
cp -rf litemall-os-api/target/litemall-os-api-*-exec.jar /root/spring_boot/litemall-os-api.jar
-
cp -rf litemall-wx-api/target/litemall-wx-api-*-exec.jar /root/spring_boot/litemall-wx-api.jar
-
sudo chmod 777 /root/spring_boot/*.jar
-
sudo ln -f -s /root/spring_boot/litemall-admin-api.jar /etc/init.d/litemall-admin-api
-
sudo ln -f -s /root/spring_boot/litemall-os-api.jar /etc/init.d/litemall-os-api
-
sudo ln -f -s /root/spring_boot/litemall-wx-api.jar /etc/init.d/litemall-wx-api
-
sudo /etc/init.d/litemall-os-api restart
-
sudo /etc/init.d/litemall-wx-api restart
-
sudo /etc/init.d/litemall-admin-api restart
-
systemctl stop nginx
...
...
deploy/.gitignore
View file @
d3dfb7ac
...
...
@@ -3,5 +3,4 @@
/litemall-db/litemall_table.sql
/litemall-db/litemall_data.sql
/litemall-api/litemall-admin-api.jar
/litemall-api/litemall-wx-api.jar
/litemall-api/litemall-os-api.jar
/litemall-api/litemall-wx-api.jar
\ No newline at end of file
deploy/bin/deploy.sh
View file @
d3dfb7ac
...
...
@@ -18,12 +18,10 @@ sudo service litemall-wx-api stop
sudo
service litemall-admin-api stop
#部署Spring Boot应用成服务
sudo ln
-f
-s
/home/ubuntu/deploy/litemall-api/litemall-os-api.jar /etc/init.d/litemall-os-api
sudo ln
-f
-s
/home/ubuntu/deploy/litemall-api/litemall-wx-api.jar /etc/init.d/litemall-wx-api
sudo ln
-f
-s
/home/ubuntu/deploy/litemall-api/litemall-admin-api.jar /etc/init.d/litemall-admin-api
#启动服务
sudo
service litemall-os-api restart
sudo
service litemall-wx-api restart
sudo
service litemall-admin-api restart
...
...
deploy/litemall-api/README.md
View file @
d3dfb7ac
开发者需要注意的是
litemall-os-api.jar、
litemall-wx-api.jar和litemall-admin-api.jar
三
个模块内部
litemall-wx-api.jar和litemall-admin-api.jar
两
个模块内部
已经有默认的开发配置文件,但是这些配置文件可能仅仅适用于开发阶段。
为了应用部署阶段时期的配置文件,开发者可以在config文件夹里面的同名配置文件中
...
...
deploy/litemall-api/config/application-os.yml
deleted
100644 → 0
View file @
1b914cc2
deploy/util/package.sh
View file @
d3dfb7ac
...
...
@@ -31,6 +31,5 @@ tar -zcvf ./deploy/litemall-admin/dist.tar -C ./litemall-admin/dist .
# 这里我们需要的是可执行jar
mvn clean
mvn package
cp
-f
./litemall-os-api/target/litemall-os-api-
*
-exec
.jar ./deploy/litemall-api/litemall-os-api.jar
cp
-f
./litemall-wx-api/target/litemall-wx-api-
*
-exec
.jar ./deploy/litemall-api/litemall-wx-api.jar
cp
-f
./litemall-admin-api/target/litemall-admin-api-
*
-exec
.jar ./deploy/litemall-api/litemall-admin-api.jar
\ No newline at end of file
litemall-
os
-api/src/main/java/org/linlinjava/litemall/
os/web/Os
StorageController.java
→
litemall-
admin
-api/src/main/java/org/linlinjava/litemall/
admin/web/Admin
StorageController.java
View file @
d3dfb7ac
package
org.linlinjava.litemall.
os
.web
;
package
org.linlinjava.litemall.
admin
.web
;
import
org.linlinjava.litemall.core.storage.StorageService
;
import
org.linlinjava.litemall.core.util.CharUtil
;
...
...
@@ -21,8 +21,8 @@ import java.util.List;
import
java.util.Map
;
@RestController
@RequestMapping
(
"/
os
/storage"
)
public
class
Os
StorageController
{
@RequestMapping
(
"/
admin
/storage"
)
public
class
Admin
StorageController
{
@Autowired
private
StorageService
storageService
;
...
...
@@ -110,38 +110,4 @@ public class OsStorageController {
storageService
.
delete
(
litemallStorage
.
getKey
());
return
ResponseUtil
.
ok
();
}
@GetMapping
(
"/fetch/{key:.+}"
)
public
ResponseEntity
<
Resource
>
fetch
(
@PathVariable
String
key
)
{
LitemallStorage
litemallStorage
=
litemallStorageService
.
findByKey
(
key
);
if
(
key
==
null
){
ResponseEntity
.
notFound
();
}
String
type
=
litemallStorage
.
getType
();
MediaType
mediaType
=
MediaType
.
parseMediaType
(
type
);
Resource
file
=
storageService
.
loadAsResource
(
key
);
if
(
file
==
null
)
{
ResponseEntity
.
notFound
();
}
return
ResponseEntity
.
ok
().
contentType
(
mediaType
).
body
(
file
);
}
@GetMapping
(
"/download/{key:.+}"
)
public
ResponseEntity
<
Resource
>
download
(
@PathVariable
String
key
)
{
LitemallStorage
litemallStorage
=
litemallStorageService
.
findByKey
(
key
);
if
(
key
==
null
){
ResponseEntity
.
notFound
();
}
String
type
=
litemallStorage
.
getType
();
MediaType
mediaType
=
MediaType
.
parseMediaType
(
type
);
Resource
file
=
storageService
.
loadAsResource
(
key
);
if
(
file
==
null
)
{
ResponseEntity
.
notFound
();
}
return
ResponseEntity
.
ok
().
contentType
(
mediaType
).
header
(
HttpHeaders
.
CONTENT_DISPOSITION
,
"attachment; filename=\""
+
file
.
getFilename
()
+
"\""
).
body
(
file
);
}
}
litemall-admin/config/dep.env.js
View file @
d3dfb7ac
module
.
exports
=
{
NODE_ENV
:
'
"production"
'
,
ENV_CONFIG
:
'
"dep"
'
,
BASE_API
:
'
"http://122.152.206.172:8083/admin"
'
,
OS_API
:
'
"http://122.152.206.172:8081/os"
'
BASE_API
:
'
"http://122.152.206.172:8083/admin"
'
}
litemall-admin/config/dev.env.js
View file @
d3dfb7ac
module
.
exports
=
{
NODE_ENV
:
'
"development"
'
,
ENV_CONFIG
:
'
"dev"
'
,
BASE_API
:
'
"http://localhost:8083/admin"
'
,
OS_API
:
'
"http://localhost:8081/os"
'
BASE_API
:
'
"http://localhost:8083/admin"
'
}
litemall-admin/config/prod.env.js
View file @
d3dfb7ac
module
.
exports
=
{
NODE_ENV
:
'
"production"
'
,
ENV_CONFIG
:
'
"prod"
'
,
BASE_API
:
'
"https://www.example.com/admin"
'
,
OS_API
:
'
"https://www.example.com/os"
'
BASE_API
:
'
"https://www.example.com/admin"
'
}
litemall-admin/src/api/storage.js
View file @
d3dfb7ac
import
axios
from
'
axios
'
import
{
Message
}
from
'
element-ui
'
// create an axios instance
const
service
=
axios
.
create
({
baseURL
:
process
.
env
.
OS_API
,
// api的base_url
timeout
:
5000
// request timeout
})
// respone interceptor
service
.
interceptors
.
response
.
use
(
response
=>
{
return
response
},
error
=>
{
console
.
log
(
'
err
'
+
error
)
// for debug
Message
({
message
:
'
对象存储服务访问超时,请检查链接是否能够访问。
'
,
type
:
'
error
'
,
duration
:
5
*
1000
})
return
Promise
.
reject
(
error
)
})
import
request
from
'
@/utils/request
'
export
function
listStorage
(
query
)
{
return
service
({
return
request
({
url
:
'
/storage/list
'
,
method
:
'
get
'
,
params
:
query
...
...
@@ -30,7 +9,7 @@ export function listStorage(query) {
}
export
function
createStorage
(
data
)
{
return
service
({
return
request
({
url
:
'
/storage/create
'
,
method
:
'
post
'
,
data
...
...
@@ -38,7 +17,7 @@ export function createStorage(data) {
}
export
function
readStorage
(
data
)
{
return
service
({
return
request
({
url
:
'
/storage/read
'
,
method
:
'
get
'
,
data
...
...
@@ -46,7 +25,7 @@ export function readStorage(data) {
}
export
function
updateStorage
(
data
)
{
return
service
({
return
request
({
url
:
'
/storage/update
'
,
method
:
'
post
'
,
data
...
...
@@ -54,12 +33,12 @@ export function updateStorage(data) {
}
export
function
deleteStorage
(
data
)
{
return
service
({
return
request
({
url
:
'
/storage/delete
'
,
method
:
'
post
'
,
data
})
}
const
uploadPath
=
process
.
env
.
OS
_API
+
'
/storage/create
'
const
uploadPath
=
process
.
env
.
BASE
_API
+
'
/storage/create
'
export
{
uploadPath
}
litemall-all/pom.xml
View file @
d3dfb7ac
...
...
@@ -12,12 +12,6 @@
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-tomcat
</artifactId>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.linlinjava
</groupId>
<artifactId>
litemall-core
</artifactId>
...
...
@@ -28,11 +22,6 @@
<artifactId>
litemall-db
</artifactId>
</dependency>
<dependency>
<groupId>
org.linlinjava
</groupId>
<artifactId>
litemall-os-api
</artifactId>
</dependency>
<dependency>
<groupId>
org.linlinjava
</groupId>
<artifactId>
litemall-wx-api
</artifactId>
...
...
@@ -46,44 +35,7 @@
</dependencies>
<build>
<resources>
<resource>
<directory>
src/main/resources
</directory>
</resource>
<resource>
<directory>
src/main/java
</directory>
<includes>
<include>
**/*.properties
</include>
<include>
**/*.xml
</include>
</includes>
<filtering>
false
</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>
maven-resources-plugin
</artifactId>
<executions>
<execution>
<id>
copy-resources
</id>
<phase>
validate
</phase>
<goals>
<goal>
copy-resources
</goal>
</goals>
<configuration>
<outputDirectory>
${basedir}/target/classes/static
</outputDirectory>
<resources>
<resource>
<directory>
../litemall-admin/dist
</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
...
...
litemall-all/src/main/java/org/linlinjava/litemall/Application.java
View file @
d3dfb7ac
...
...
@@ -10,7 +10,6 @@ import org.springframework.boot.web.support.SpringBootServletInitializer;
"org.linlinjava.litemall"
,
"org.linlinjava.litemall.core"
,
"org.linlinjava.litemall.db"
,
"org.linlinjava.litemall.os"
,
"org.linlinjava.litemall.wx"
,
"org.linlinjava.litemall.admin"
})
@MapperScan
(
"org.linlinjava.litemall.db.dao"
)
...
...
litemall-all/src/test/java/org/linlinjava/litemall/allinone/AllinoneConfigTest.java
View file @
d3dfb7ac
...
...
@@ -24,11 +24,8 @@ public class AllinoneConfigTest {
// 测试获取application-wx.yml配置信息
System
.
out
.
println
(
environment
.
getProperty
(
"litemall.wx.app-id"
));
// 测试获取application-admin.yml配置信息
// System.out.println(environment.getProperty(""));
// 测试获取application-os.yml配置信息
// System.out.println(environment.getProperty(""));
// 测试获取application.yml配置信息
System
.
out
.
println
(
environment
.
getProperty
(
"logging.level.org.linlinjava.litemall.os"
));
System
.
out
.
println
(
environment
.
getProperty
(
"logging.level.org.linlinjava.litemall.wx"
));
System
.
out
.
println
(
environment
.
getProperty
(
"logging.level.org.linlinjava.litemall.admin"
));
System
.
out
.
println
(
environment
.
getProperty
(
"logging.level.org.linlinjava.litemall"
));
...
...
litemall-core/src/main/java/org/linlinjava/litemall/core/storage/LocalStorage.java
View file @
d3dfb7ac
...
...
@@ -110,10 +110,7 @@ public class LocalStorage implements Storage {
@Override
public
String
generateUrl
(
String
keyName
)
{
String
url
=
address
+
":"
+
port
+
"/os/storage/fetch/"
+
keyName
;
if
(!
url
.
startsWith
(
"http"
))
{
url
=
"http://"
+
url
;
}
String
url
=
address
+
keyName
;
return
url
;
}
}
\ No newline at end of file
litemall-core/src/main/resources/application-core.yml
View file @
d3dfb7ac
...
...
@@ -88,7 +88,7 @@ litemall:
# 本地对象存储配置信息
local
:
storagePath
:
storage
address
:
http://
127.0.0.1
address
:
http://
localhost:8082/wx/storage/fetch/
port
:
8081
# 阿里云对象存储配置信息
aliyun
:
...
...
litemall-os-api/.gitignore
deleted
100644 → 0
View file @
1b914cc2
/target/
/litemall-os-api.iml
/storage/
litemall-os-api/pom.xml
deleted
100644 → 0
View file @
1b914cc2
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
litemall-os-api
</artifactId>
<packaging>
jar
</packaging>
<parent>
<groupId>
org.linlinjava
</groupId>
<artifactId>
litemall
</artifactId>
<version>
0.1.0
</version>
</parent>
<dependencies>
<dependency>
<groupId>
org.linlinjava
</groupId>
<artifactId>
litemall-core
</artifactId>
</dependency>
<dependency>
<groupId>
org.linlinjava
</groupId>
<artifactId>
litemall-db
</artifactId>
</dependency>
<dependency>
<groupId>
com.qcloud
</groupId>
<artifactId>
cos_api
</artifactId>
<version>
5.4.4
</version>
<exclusions>
<exclusion>
<artifactId>
slf4j-log4j12
</artifactId>
<groupId>
org.slf4j
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
com.aliyun.oss
</groupId>
<artifactId>
aliyun-sdk-oss
</artifactId>
<version>
2.5.0
</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>
src/main/resources
</directory>
</resource>
<resource>
<directory>
src/main/java
</directory>
<includes>
<include>
**/*.properties
</include>
<include>
**/*.xml
</include>
</includes>
<filtering>
false
</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<configuration>
<executable>
true
</executable>
</configuration>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
<configuration>
<classifier>
exec
</classifier>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
litemall-os-api/src/main/java/org/linlinjava/litemall/os/Application.java
deleted
100644 → 0
View file @
1b914cc2
package
org.linlinjava.litemall.os
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
(
scanBasePackages
={
"org.linlinjava.litemall.core"
,
"org.linlinjava.litemall.os"
,
"org.linlinjava.litemall.db"
})
@MapperScan
(
"org.linlinjava.litemall.db.dao"
)
public
class
Application
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
Application
.
class
,
args
);
}
}
\ No newline at end of file
litemall-os-api/src/main/java/org/linlinjava/litemall/os/web/OsIndexController.java
deleted
100644 → 0
View file @
1b914cc2
package
org.linlinjava.litemall.os.web
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/os/index"
)
public
class
OsIndexController
{
private
final
Log
logger
=
LogFactory
.
getLog
(
OsIndexController
.
class
);
@RequestMapping
(
"/index"
)
public
Object
index
(){
return
ResponseUtil
.
ok
(
"hello world, this is os service"
);
}
}
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment