Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
W
wenyuanwall
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
3rdeye
wenyuanwall
Commits
1cf37d07
Commit
1cf37d07
authored
Nov 17, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ad
parent
8c172da7
Pipeline
#17959
passed with stages
in 2 minutes and 46 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
154 additions
and
9 deletions
+154
-9
src/app/api/models.ts
src/app/api/models.ts
+2
-0
src/app/api/models/ad-return-message-dto.ts
src/app/api/models/ad-return-message-dto.ts
+25
-0
src/app/api/models/ad.ts
src/app/api/models/ad.ts
+43
-0
src/app/api/services/api.service.ts
src/app/api/services/api.service.ts
+59
-4
src/app/app.component.html
src/app/app.component.html
+2
-2
src/app/app.component.ts
src/app/app.component.ts
+23
-3
No files found.
src/app/api/models.ts
View file @
1cf37d07
export
{
Blacklist
}
from
'
./models/blacklist
'
;
export
{
Blacklist
}
from
'
./models/blacklist
'
;
export
{
BlacklistAccount
}
from
'
./models/blacklist-account
'
;
export
{
BlacklistAccount
}
from
'
./models/blacklist-account
'
;
export
{
BlacklistAccountPaginatedReturnMessageDto
}
from
'
./models/blacklist-account-paginated-return-message-dto
'
;
export
{
BlacklistAccountPaginatedReturnMessageDto
}
from
'
./models/blacklist-account-paginated-return-message-dto
'
;
export
{
Ad
}
from
'
./models/ad
'
;
export
{
AdReturnMessageDto
}
from
'
./models/ad-return-message-dto
'
;
export
{
StringReturnMessageDto
}
from
'
./models/string-return-message-dto
'
;
export
{
StringReturnMessageDto
}
from
'
./models/string-return-message-dto
'
;
src/app/api/models/ad-return-message-dto.ts
0 → 100644
View file @
1cf37d07
/* tslint:disable */
/* eslint-disable */
import
{
Ad
}
from
'
./ad
'
;
export
interface
AdReturnMessageDto
{
/**
* Return data.
*/
data
?:
Ad
;
/**
* Return message
*/
message
:
string
;
/**
* Return code
*/
statusCode
:
number
;
/**
* Whether success.
*/
success
:
boolean
;
}
src/app/api/models/ad.ts
0 → 100644
View file @
1cf37d07
/* tslint:disable */
/* eslint-disable */
export
interface
Ad
{
/**
* Ad click count
*/
clickCount
:
number
;
/**
* Ad content
*/
content
:
string
;
createTime
:
string
;
deleteTime
:
string
;
/**
* Ad is enabled
*/
enabled
:
boolean
;
id
:
number
;
/**
* Ad link
*/
link
?:
string
;
/**
* The nth page, starting with 1.
*/
pageCount
?:
number
;
/**
* Records per page.
*/
recordsPerPage
?:
number
;
updateTime
:
string
;
/**
* Ad view count
*/
viewCount
:
number
;
}
src/app/api/services/api.service.ts
View file @
1cf37d07
...
@@ -9,6 +9,7 @@ import { RequestBuilder } from '../request-builder';
...
@@ -9,6 +9,7 @@ import { RequestBuilder } from '../request-builder';
import
{
Observable
}
from
'
rxjs
'
;
import
{
Observable
}
from
'
rxjs
'
;
import
{
map
,
filter
}
from
'
rxjs/operators
'
;
import
{
map
,
filter
}
from
'
rxjs/operators
'
;
import
{
AdReturnMessageDto
}
from
'
../models/ad-return-message-dto
'
;
import
{
BlacklistAccountPaginatedReturnMessageDto
}
from
'
../models/blacklist-account-paginated-return-message-dto
'
;
import
{
BlacklistAccountPaginatedReturnMessageDto
}
from
'
../models/blacklist-account-paginated-return-message-dto
'
;
import
{
StringReturnMessageDto
}
from
'
../models/string-return-message-dto
'
;
import
{
StringReturnMessageDto
}
from
'
../models/string-return-message-dto
'
;
...
@@ -124,7 +125,7 @@ export class ApiService extends BaseService {
...
@@ -124,7 +125,7 @@ export class ApiService extends BaseService {
/**
/**
* Path part for operation adControllerGetAd
* Path part for operation adControllerGetAd
*/
*/
static
readonly
AdControllerGetAdPath
=
'
/api/ad
'
;
static
readonly
AdControllerGetAdPath
=
'
/api/ad
/random
'
;
/**
/**
* Get ad.
* Get ad.
...
@@ -137,7 +138,7 @@ export class ApiService extends BaseService {
...
@@ -137,7 +138,7 @@ export class ApiService extends BaseService {
* This method doesn't expect any request body.
* This method doesn't expect any request body.
*/
*/
adControllerGetAd$Response
(
params
?:
{
adControllerGetAd$Response
(
params
?:
{
}):
Observable
<
StrictHttpResponse
<
String
ReturnMessageDto
>>
{
}):
Observable
<
StrictHttpResponse
<
Ad
ReturnMessageDto
>>
{
const
rb
=
new
RequestBuilder
(
this
.
rootUrl
,
ApiService
.
AdControllerGetAdPath
,
'
get
'
);
const
rb
=
new
RequestBuilder
(
this
.
rootUrl
,
ApiService
.
AdControllerGetAdPath
,
'
get
'
);
if
(
params
)
{
if
(
params
)
{
...
@@ -149,7 +150,7 @@ export class ApiService extends BaseService {
...
@@ -149,7 +150,7 @@ export class ApiService extends BaseService {
})).
pipe
(
})).
pipe
(
filter
((
r
:
any
)
=>
r
instanceof
HttpResponse
),
filter
((
r
:
any
)
=>
r
instanceof
HttpResponse
),
map
((
r
:
HttpResponse
<
any
>
)
=>
{
map
((
r
:
HttpResponse
<
any
>
)
=>
{
return
r
as
StrictHttpResponse
<
String
ReturnMessageDto
>
;
return
r
as
StrictHttpResponse
<
Ad
ReturnMessageDto
>
;
})
})
);
);
}
}
...
@@ -165,9 +166,63 @@ export class ApiService extends BaseService {
...
@@ -165,9 +166,63 @@ export class ApiService extends BaseService {
* This method doesn't expect any request body.
* This method doesn't expect any request body.
*/
*/
adControllerGetAd
(
params
?:
{
adControllerGetAd
(
params
?:
{
}):
Observable
<
String
ReturnMessageDto
>
{
}):
Observable
<
Ad
ReturnMessageDto
>
{
return
this
.
adControllerGetAd$Response
(
params
).
pipe
(
return
this
.
adControllerGetAd$Response
(
params
).
pipe
(
map
((
r
:
StrictHttpResponse
<
AdReturnMessageDto
>
)
=>
r
.
body
as
AdReturnMessageDto
)
);
}
/**
* Path part for operation adControllerClickAd
*/
static
readonly
AdControllerClickAdPath
=
'
/api/ad/click/{id}
'
;
/**
* Click ad.
*
*
*
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `adControllerClickAd()` instead.
*
* This method doesn't expect any request body.
*/
adControllerClickAd$Response
(
params
:
{
id
:
number
;
}):
Observable
<
StrictHttpResponse
<
StringReturnMessageDto
>>
{
const
rb
=
new
RequestBuilder
(
this
.
rootUrl
,
ApiService
.
AdControllerClickAdPath
,
'
get
'
);
if
(
params
)
{
rb
.
path
(
'
id
'
,
params
.
id
,
{});
}
return
this
.
http
.
request
(
rb
.
build
({
responseType
:
'
json
'
,
accept
:
'
application/json
'
})).
pipe
(
filter
((
r
:
any
)
=>
r
instanceof
HttpResponse
),
map
((
r
:
HttpResponse
<
any
>
)
=>
{
return
r
as
StrictHttpResponse
<
StringReturnMessageDto
>
;
})
);
}
/**
* Click ad.
*
*
*
* This method provides access to only to the response body.
* To access the full response (for headers, for example), `adControllerClickAd$Response()` instead.
*
* This method doesn't expect any request body.
*/
adControllerClickAd
(
params
:
{
id
:
number
;
}):
Observable
<
StringReturnMessageDto
>
{
return
this
.
adControllerClickAd$Response
(
params
).
pipe
(
map
((
r
:
StrictHttpResponse
<
StringReturnMessageDto
>
)
=>
r
.
body
as
StringReturnMessageDto
)
map
((
r
:
StrictHttpResponse
<
StringReturnMessageDto
>
)
=>
r
.
body
as
StringReturnMessageDto
)
);
);
}
}
...
...
src/app/app.component.html
View file @
1cf37d07
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"row"
*ngIf=
"ad"
>
<div
class=
"row"
*ngIf=
"ad"
>
<ul
class=
"list-group"
>
<ul
class=
"list-group"
(click)=
"onAdClick()"
>
<li
class=
"list-group-item list-group-item-info"
[innerHTML]=
"ad"
></li>
<li
class=
"list-group-item list-group-item-info"
[innerHTML]=
"ad
['content']
"
></li>
</ul>
</ul>
</div>
</div>
<br
*ngIf=
"ad"
>
<br
*ngIf=
"ad"
>
...
...
src/app/app.component.ts
View file @
1cf37d07
...
@@ -4,6 +4,7 @@ import { BlacklistAccount } from './api/models/blacklist-account';
...
@@ -4,6 +4,7 @@ import { BlacklistAccount } from './api/models/blacklist-account';
import
{
ApiService
}
from
'
./api/services/api.service
'
;
import
{
ApiService
}
from
'
./api/services/api.service
'
;
import
{
lastValueFrom
}
from
'
rxjs
'
;
import
{
lastValueFrom
}
from
'
rxjs
'
;
import
*
as
moment
from
'
moment
'
;
import
*
as
moment
from
'
moment
'
;
import
{
Ad
}
from
'
./api/models
'
;
@
Component
({
@
Component
({
selector
:
'
app-root
'
,
selector
:
'
app-root
'
,
...
@@ -14,7 +15,7 @@ export class AppComponent implements AfterViewInit {
...
@@ -14,7 +15,7 @@ export class AppComponent implements AfterViewInit {
search
=
''
;
search
=
''
;
displayingAccount
=
''
;
displayingAccount
=
''
;
title
=
'
蔷蔷挂人查询
'
;
title
=
'
蔷蔷挂人查询
'
;
ad
=
''
;
ad
:
Ad
|
null
=
null
;
result
?:
BlacklistAccount
[];
result
?:
BlacklistAccount
[];
constructor
(
public
toast
:
ToastService
,
private
api
:
ApiService
)
{}
constructor
(
public
toast
:
ToastService
,
private
api
:
ApiService
)
{}
...
@@ -28,13 +29,32 @@ export class AppComponent implements AfterViewInit {
...
@@ -28,13 +29,32 @@ export class AppComponent implements AfterViewInit {
async
initAd
()
{
async
initAd
()
{
try
{
try
{
const
ad
=
await
lastValueFrom
(
this
.
api
.
adControllerGetAd
());
const
{
data
:
ad
}
=
await
lastValueFrom
(
this
.
api
.
adControllerGetAd
());
this
.
ad
=
ad
.
data
!
;
if
(
ad
)
{
this
.
ad
=
ad
;
}
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
`Failed to load ad:
${(
e
as
Error
).
toString
()}
`
);
console
.
log
(
`Failed to load ad:
${(
e
as
Error
).
toString
()}
`
);
}
}
}
}
openInNewTab
(
href
:
string
)
{
Object
.
assign
(
document
.
createElement
(
'
a
'
),
{
target
:
'
_blank
'
,
rel
:
'
noopener noreferrer
'
,
href
,
}).
click
();
}
async
onAdClick
()
{
const
clickResult
=
await
lastValueFrom
(
this
.
api
.
adControllerClickAd
({
id
:
this
.
ad
!
.
id
})
);
if
(
clickResult
?.
data
)
{
this
.
openInNewTab
(
clickResult
.
data
);
}
}
async
onSearch
()
{
async
onSearch
()
{
this
.
result
=
undefined
;
this
.
result
=
undefined
;
const
search
=
this
.
search
.
trim
();
const
search
=
this
.
search
.
trim
();
...
...
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