diff --git a/packages/leaa-api/.gitignore b/packages/leaa-api/.gitignore index 4c4cf81b..a9ace33d 100644 --- a/packages/leaa-api/.gitignore +++ b/packages/leaa-api/.gitignore @@ -5,6 +5,9 @@ #Accests /public/attachments /public/buildinfo.json + +/public/assets/divisions/*.json + /src/assets/dicts/* !/src/assets/dicts/.gitkeep /src/assets/divisions/* diff --git a/packages/leaa-api/deploy-build.sh b/packages/leaa-api/deploy-build.sh index 04da1682..5448e49e 100644 --- a/packages/leaa-api/deploy-build.sh +++ b/packages/leaa-api/deploy-build.sh @@ -40,6 +40,9 @@ if [[ $KEY = "" ]]; then cp -fr ./public/robots.txt ${API_DIR}/public cp -fr ./public/get-weixin-code.html ${API_DIR}/public cp -fr ./public/buildinfo.json ${API_DIR}/public + + mkdir -p ${API_DIR}/public/assets/divisions + cp -fr ./public/assets/divisions/source ${API_DIR}/public/assets/divisions else echo "CANCEL" fi diff --git a/packages/leaa-api/src/modules/division/source/china/_README.md b/packages/leaa-api/public/assets/divisions/source/china/_README.md similarity index 100% rename from packages/leaa-api/src/modules/division/source/china/_README.md rename to packages/leaa-api/public/assets/divisions/source/china/_README.md diff --git a/packages/leaa-api/src/modules/division/source/china/areas.json b/packages/leaa-api/public/assets/divisions/source/china/areas.json similarity index 100% rename from packages/leaa-api/src/modules/division/source/china/areas.json rename to packages/leaa-api/public/assets/divisions/source/china/areas.json diff --git a/packages/leaa-api/src/modules/division/source/china/cities.json b/packages/leaa-api/public/assets/divisions/source/china/cities.json similarity index 100% rename from packages/leaa-api/src/modules/division/source/china/cities.json rename to packages/leaa-api/public/assets/divisions/source/china/cities.json diff --git a/packages/leaa-api/src/modules/division/source/china/provinces.json b/packages/leaa-api/public/assets/divisions/source/china/provinces.json similarity index 100% rename from packages/leaa-api/src/modules/division/source/china/provinces.json rename to packages/leaa-api/public/assets/divisions/source/china/provinces.json diff --git a/packages/leaa-api/src/configs/attachment.config.ts b/packages/leaa-api/src/configs/attachment.config.ts index 2330d06f..385ec1a7 100644 --- a/packages/leaa-api/src/configs/attachment.config.ts +++ b/packages/leaa-api/src/configs/attachment.config.ts @@ -6,7 +6,6 @@ import { envConfig } from '@leaa/api/src/modules/config/config.module'; const dev = process.env.NODE_ENV !== 'production'; const SAVE_SUB_DIR = moment().format('YYYY/MM'); - const SAVE_DIR_BY_DISK = path.join(`./${envConfig.PUBLIC_DIR}/${envConfig.ATTACHMENT_DIR}/${SAVE_SUB_DIR}`); const SAVE_DIR_BY_DB = `attachments/${SAVE_SUB_DIR}/`; diff --git a/packages/leaa-api/src/configs/division.config.ts b/packages/leaa-api/src/configs/division.config.ts index 1fbc3342..6d3ade97 100644 --- a/packages/leaa-api/src/configs/division.config.ts +++ b/packages/leaa-api/src/configs/division.config.ts @@ -1,6 +1,7 @@ import path from 'path'; +import { envConfig } from '@leaa/api/src/modules/config/config.module'; -const DIVISION_DIR = path.resolve(__dirname, '../assets/divisions'); +const DIVISION_DIR = path.resolve(__dirname, `../../${envConfig.PUBLIC_DIR}/assets/divisions`); const DIVISION_OF_CHINA_FILE_PATH = `${DIVISION_DIR}/division_of_china.json`; export const divisionConfig = { diff --git a/packages/leaa-api/src/modules/division/division.service.ts b/packages/leaa-api/src/modules/division/division.service.ts index eae7bdc9..46f0b65e 100755 --- a/packages/leaa-api/src/modules/division/division.service.ts +++ b/packages/leaa-api/src/modules/division/division.service.ts @@ -1,5 +1,4 @@ import fs from 'fs'; -import path from 'path'; import mkdirp from 'mkdirp'; import { Injectable } from '@nestjs/common'; import { Repository, FindOneOptions, getConnection } from 'typeorm'; @@ -139,7 +138,7 @@ export class DivisionService { /* eslint-disable no-restricted-syntax */ /* eslint-disable no-await-in-loop */ - const DIVISION_SOURCE_DIR = path.resolve(__dirname, './source/china'); + const DIVISION_SOURCE_DIR = `${divisionConfig.DIVISION_DIR}/source/china`; // prettier-ignore // eslint-disable-next-line max-len