Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
modulesServer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
standardized
modulesServer
Commits
15a997e9
Commit
15a997e9
authored
Dec 01, 2021
by
chenjinjing
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://123.207.147.179:8888/standardized/modulesServer
parents
dee978d4
864b6308
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
bizError.ts
src/util/bizError.ts
+11
-1
psd.ts
src/util/psd.ts
+4
-1
No files found.
src/util/bizError.ts
View file @
15a997e9
import
{
logError
}
from
"./log"
;
export
class
BizError
extends
Error
{
export
class
BizError
extends
Error
{
//接入日志
constructor
(...
msgs
)
{
let
msgStr
=
''
;
msgs
.
forEach
(
once
=>
{
msgStr
+=
once
+
' '
;
});
logError
(
msgs
);
super
(
msgStr
)
}
}
}
\ No newline at end of file
src/util/psd.ts
View file @
15a997e9
import
{
upImgPathConfig
}
from
"../serverConfig"
;
import
{
upImgPathConfig
}
from
"../serverConfig"
;
import
{
BizError
}
from
"./bizError"
;
import
{
logError
}
from
"./log"
;
import
{
logError
}
from
"./log"
;
var
PSD
=
require
(
'node-psd'
);
var
PSD
=
require
(
'node-psd'
);
...
@@ -8,6 +9,7 @@ const path = require('path');
...
@@ -8,6 +9,7 @@ const path = require('path');
* @param fileName psd文件名称,记得不带.psd
* @param fileName psd文件名称,记得不带.psd
*/
*/
export
async
function
psdForPng
(
fileName
:
string
)
{
export
async
function
psdForPng
(
fileName
:
string
)
{
fileName
=
"1213"
const
psdName
=
fileName
+
".psd"
;
const
psdName
=
fileName
+
".psd"
;
const
pngName
=
fileName
+
".png"
;
const
pngName
=
fileName
+
".png"
;
...
@@ -23,6 +25,6 @@ export async function psdForPng(fileName:string) {
...
@@ -23,6 +25,6 @@ export async function psdForPng(fileName:string) {
psd
.
image
.
saveAsPng
(
pngFilePath
);
psd
.
image
.
saveAsPng
(
pngFilePath
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
logError
(
psdName
,
"转png失败"
,
err
.
message
||
err
.
msg
);
throw
new
BizError
(
psdName
,
"转png失败"
,
err
.
message
||
err
.
msg
);
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
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