dengyinhuan
2 years ago
24 changed files with 57042 additions and 220 deletions
@ -0,0 +1,19 @@ |
|||||
|
pipeline { |
||||
|
agent { |
||||
|
node{ |
||||
|
label 'jnlp-slave' |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
stages { |
||||
|
stage('Highways4Good Api ......') { |
||||
|
steps { |
||||
|
sh 'switch-auth.sh anxinyun' |
||||
|
buildName "#${BUILD_NUMBER} ~/fs-cloud/${JOB_NAME}:${IMAGE_VERSION}" |
||||
|
buildDescription "registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION}" |
||||
|
sh 'docker build -t registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION} ./api' |
||||
|
sh 'docker push registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION}' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
pipeline { |
||||
|
agent { |
||||
|
node{ |
||||
|
label 'jnlp-slave' |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
stages { |
||||
|
stage('Highways4Good Web......') { |
||||
|
steps { |
||||
|
sh 'switch-auth.sh anxinyun' |
||||
|
buildName "#${BUILD_NUMBER} ~/fs-cloud/${JOB_NAME}:${IMAGE_VERSION}" |
||||
|
buildDescription "registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION}" |
||||
|
sh 'docker build -t registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION} ./web' |
||||
|
sh 'docker push registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION}' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
{ |
||||
|
// 使用 IntelliSense 了解相关属性。 |
||||
|
// 悬停以查看现有属性的描述。 |
||||
|
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 |
||||
|
"version": "0.2.0", |
||||
|
"configurations": [ |
||||
|
{ |
||||
|
"type": "node", |
||||
|
"request": "launch", |
||||
|
"name": "启动程序", |
||||
|
"skipFiles": [ |
||||
|
"<node_internals>/**" |
||||
|
], |
||||
|
"program": "${workspaceFolder}\\index.js" |
||||
|
} |
||||
|
] |
||||
|
} |
Binary file not shown.
@ -0,0 +1,126 @@ |
|||||
|
try { |
||||
|
const { Pool, Client } = require('pg') |
||||
|
const request = require('superagent'); |
||||
|
const Hex = require('crypto-js/enc-hex'); |
||||
|
const MD5 = require('crypto-js/md5'); |
||||
|
const XLSX = require('xlsx') |
||||
|
const path = require('path') |
||||
|
const fs = require("fs"); |
||||
|
const qiniu = require('qiniu'); |
||||
|
const uuidv4 = require('uuid/v4'); |
||||
|
|
||||
|
// 连接数据库
|
||||
|
const pool = new Pool({ |
||||
|
user: 'postgres', |
||||
|
host: '10.8.30.32', |
||||
|
database: 'highways4good', |
||||
|
password: '123', |
||||
|
port: 5432, |
||||
|
}) |
||||
|
// 7niu 验证
|
||||
|
const accessKey = 'XuDgkao6cL0HidoMAPnA5OB10Mc_Ew08mpIfRJK5' |
||||
|
const secretKey = 'yewcieZLzKZuDfig0wLZ9if9jKp2P_1jd3CMJPSa' |
||||
|
const bucket = 'dev-highways4good' |
||||
|
|
||||
|
|
||||
|
|
||||
|
const fun = async () => { |
||||
|
// note: we don't try/catch this because if connecting throws an exception
|
||||
|
// we don't need to dispose of the client (it will be undefined)
|
||||
|
const client = await pool.connect() |
||||
|
try { |
||||
|
await client.query('BEGIN') |
||||
|
|
||||
|
console.log(`开始`); |
||||
|
const upload7niu = |
||||
|
async (filePath, filename) => { |
||||
|
return new Promise((resolve, reject) => { |
||||
|
try { |
||||
|
const uploadPath = 'images' |
||||
|
// 7niu 鉴权
|
||||
|
const mac = new qiniu.auth.digest.Mac(accessKey, secretKey); |
||||
|
const config = { |
||||
|
scope: bucket, |
||||
|
// expires: 3600,
|
||||
|
returnBody: '{"key":"$(key)","hash":"$(etag)","fsize":$(fsize),"bucket":"$(bucket)","name":"$(x:name)"}' |
||||
|
} |
||||
|
var putPolicy = new qiniu.rs.PutPolicy(config); |
||||
|
var uploadToken = putPolicy.uploadToken(mac); |
||||
|
// 上传文件
|
||||
|
var formUploader = new qiniu.form_up.FormUploader(config); |
||||
|
var putExtra = new qiniu.form_up.PutExtra(); |
||||
|
let key = path.posix.join(uploadPath, uuidv4(), filename); |
||||
|
formUploader.putFile(uploadToken, key, filePath, putExtra, function (respErr, |
||||
|
respBody, respInfo) { |
||||
|
if (respErr) { |
||||
|
reject(respErr); |
||||
|
throw respErr; |
||||
|
} |
||||
|
if (respInfo.statusCode == 200) { |
||||
|
console.log(respBody); |
||||
|
let qnkey = respBody.key; |
||||
|
resolve({ key: qnkey, url: `/${qnkey}` }); |
||||
|
} else { |
||||
|
console.log(respInfo.statusCode); |
||||
|
console.log(respBody); |
||||
|
reject(new Error('failed to upload.')); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
} catch (err) { |
||||
|
reject(err); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// 读取数据文件
|
||||
|
let workbook = XLSX.readFile(path.join(__dirname, './data/养护内容.xlsx')); |
||||
|
let firstSheetName = workbook.SheetNames[0]; |
||||
|
let worksheet = workbook.Sheets[firstSheetName]; |
||||
|
let res = XLSX.utils.sheet_to_json(worksheet, { |
||||
|
defval: '' |
||||
|
}); |
||||
|
// console.log(res);
|
||||
|
res.sort((a, b) => { return Date.parse(a['时间']) - Date.parse(b['时间']) }); |
||||
|
|
||||
|
// 读取全部图片
|
||||
|
let pic = []; |
||||
|
fs.readdirSync(path.join(__dirname, '/data/图片')).forEach((filename) => { |
||||
|
pic.push({ |
||||
|
path: `./data/图片/${filename}`, |
||||
|
name: filename |
||||
|
}) |
||||
|
}); |
||||
|
|
||||
|
for (let r of res) { |
||||
|
console.log(r); |
||||
|
let picList = pic.filter(p => { |
||||
|
const { name } = p |
||||
|
const no = name.split('-')[0] |
||||
|
return no == r['编号'] |
||||
|
}) |
||||
|
console.log(picList); |
||||
|
// 将图片上传至 7niu
|
||||
|
for (let p of picList) { |
||||
|
await upload7niu(path.join(__dirname, p.path), p.name) |
||||
|
} |
||||
|
break |
||||
|
} |
||||
|
|
||||
|
// await client.query('ROLLBACK')
|
||||
|
await client.query('COMMIT') |
||||
|
console.log('执行完毕~') |
||||
|
} catch (e) { |
||||
|
await client.query('ROLLBACK') |
||||
|
console.log('执行错误~') |
||||
|
throw e |
||||
|
} finally { |
||||
|
client.release(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
fun() |
||||
|
} catch (error) { |
||||
|
console.error(error) |
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
{ |
||||
|
"name": "appkey-generator", |
||||
|
"version": "1.0.0", |
||||
|
"description": "tool", |
||||
|
"main": "index.js", |
||||
|
"scripts": { |
||||
|
"test": "mocha", |
||||
|
"start": "set NODE_ENV=development&&node index" |
||||
|
}, |
||||
|
"author": "liu", |
||||
|
"license": "ISC", |
||||
|
"dependencies": { |
||||
|
"crypto-js": "^4.1.1", |
||||
|
"pg": "^7.18.2", |
||||
|
"qiniu": "^7.7.0", |
||||
|
"superagent": "^8.0.0", |
||||
|
"uuid": "3.1.0", |
||||
|
"xlsx": "^0.17.1" |
||||
|
} |
||||
|
} |
File diff suppressed because it is too large
@ -1,13 +1,32 @@ |
|||||
import React from 'react' |
import React, { useEffect, useState } from 'react' |
||||
import Left from './left' |
import Left from './left' |
||||
import Right from './right' |
import Right from './right' |
||||
|
import { connect } from 'react-redux' |
||||
|
import { getBusTierList } from '../../../actions/example' |
||||
|
|
||||
|
const Operation = (props) => { |
||||
|
|
||||
|
const [roadData, setRoadData] = useState() |
||||
|
const [loading, setLoading] = useState(true) |
||||
|
const { dispatch } = props |
||||
|
useEffect(() => { |
||||
|
dispatch(getBusTierList()).then(res => { |
||||
|
setLoading(false) |
||||
|
setRoadData(res.payload.data || {}) |
||||
|
}) |
||||
|
}, []) |
||||
|
|
||||
const Operation = () => { |
|
||||
return ( |
return ( |
||||
<div style={{ display: 'flex', width: '100%',height: '100%',justifyContent: 'space-between' }}> |
<div style={{ display: 'flex', width: '100%',height: '100%',justifyContent: 'space-between' }}> |
||||
<Left /> |
<Left roadData={roadData} loading={loading} /> |
||||
<Right /> |
<Right roadData={roadData} loading={loading} /> |
||||
</div> |
</div> |
||||
) |
) |
||||
} |
} |
||||
export default Operation |
function mapStateToProps(state) { |
||||
|
|
||||
|
return { |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
export default connect(mapStateToProps)(Operation) |
@ -0,0 +1,31 @@ |
|||||
|
.busList { |
||||
|
width: 100%; |
||||
|
height: 96%; |
||||
|
overflow-x: hidden; |
||||
|
overflow-y: auto; |
||||
|
.ant-tree .ant-tree-node-content-wrapper.ant-tree-node-selected{ |
||||
|
background: none; |
||||
|
background-color: none !important; |
||||
|
border: 1px solid rgba(10, 114, 255, 1); |
||||
|
} |
||||
|
.ant-tree .ant-tree-node-content-wrapper:hover { |
||||
|
background-color: none; |
||||
|
background: none; |
||||
|
// border: 1px solid rgba(10, 114, 255, 1); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.busList::-webkit-scrollbar-track { |
||||
|
background-color: rgba(3, 60, 158, 0.3); |
||||
|
border-radius: 1px |
||||
|
} |
||||
|
|
||||
|
.busList::-webkit-scrollbar { |
||||
|
width: 5px; |
||||
|
} |
||||
|
|
||||
|
.busList::-webkit-scrollbar-thumb { |
||||
|
background-color: rgba(28, 96, 254, 1); |
||||
|
border-radius: 1px |
||||
|
} |
Loading…
Reference in new issue