Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
何阳
/
FaceApp
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c9a9c202
authored
Jul 15, 2024
by
何阳
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
NEW:1. 修复了人脸图片拉取,后端模板没有替换的问题
parent
f87cba62
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
10 deletions
FaceServer/Properties/AssemblyInfo.cs
FaceServer/Server/FaceDataSet.cs
FaceServer/Properties/AssemblyInfo.cs
View file @
c9a9c202
...
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
...
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.
1
")]
[assembly: AssemblyVersion("1.0.0.
2
")]
[assembly: AssemblyFileVersion("1.0.0.
1
")]
[assembly: AssemblyFileVersion("1.0.0.
2
")]
FaceServer/Server/FaceDataSet.cs
View file @
c9a9c202
...
@@ -71,18 +71,31 @@ namespace FaceServer.Server
...
@@ -71,18 +71,31 @@ namespace FaceServer.Server
}
}
public
static
async
Task
<
Result
<
byte
[],
string
>>
GetImage
(
string
imageUrl
)
public
static
async
Task
<
Result
<
byte
[],
string
>>
GetImage
(
string
imageUrl
)
{
{
var
respond
=
await
client
.
GetAsync
(
imag
eUrl
);
var
baseUrl
=
new
Uri
(
Config
.
Bas
eUrl
);
if
(
imageUrl
.
Contains
(
"{host}"
))
if
(
respond
.
StatusCode
!=
System
.
Net
.
HttpStatusCode
.
OK
)
{
{
var
rawError
=
await
respond
.
Content
.
ReadAsStringAsync
();
imageUrl
=
imageUrl
.
Replace
(
"{host}"
,
baseUrl
.
Authority
);
JObject
errorObject
=
(
JObject
)
JsonConvert
.
DeserializeObject
(
rawError
);
return
$"Failed to get image. Code:
{
errorObject
[
"code"
]}
, msg:
{
errorObject
[
"msg"
]}
"
;
}
}
try
{
var
respond
=
await
client
.
GetAsync
(
imageUrl
);
if
(
respond
.
StatusCode
!=
System
.
Net
.
HttpStatusCode
.
OK
)
{
var
rawError
=
await
respond
.
Content
.
ReadAsStringAsync
();
JObject
errorObject
=
(
JObject
)
JsonConvert
.
DeserializeObject
(
rawError
);
return
$"Failed to get image. Code:
{
errorObject
[
"code"
]}
, msg:
{
errorObject
[
"msg"
]}
"
;
}
var
imageBytes
=
await
respond
.
Content
.
ReadAsByteArrayAsync
();
var
imageBytes
=
await
respond
.
Content
.
ReadAsByteArrayAsync
();
return
imageBytes
;
return
imageBytes
;
}
catch
(
Exception
ex
)
{
Log
.
Error
(
ex
,
$"下载图片失败:
{
imageUrl
}
"
);
return
$"下载图片失败:
{
imageUrl
}
"
;
}
}
}
public
static
async
Task
<
Result
<
OssFile
,
string
>>
QueryFileAsync
(
User
usr
)
public
static
async
Task
<
Result
<
OssFile
,
string
>>
QueryFileAsync
(
User
usr
)
{
{
...
...
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