-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(kimi): 移除KimiService,使用GenerateService
- Loading branch information
Showing
11 changed files
with
154 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './services/generate.service'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export enum ResStatus { | ||
Success = 200, | ||
AuthError = 400, | ||
ServerError = 500, | ||
} | ||
|
||
export interface Res<T=any>{ | ||
status: ResStatus; | ||
msg:string; | ||
data:T | ||
} |
8 changes: 4 additions & 4 deletions
8
src/app/services/kimi.service.spec.ts → .../shared/services/generate.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { HttpClient } from '@angular/common/http'; | ||
import { inject, Injectable } from '@angular/core'; | ||
import { map, Observable } from 'rxjs'; | ||
import { Res, ResStatus } from '../models/http.model'; | ||
import { BattleCharacter, Env, InitCharacter } from '@models'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class GenerateService { | ||
private http = inject(HttpClient); | ||
|
||
getCharacterList(length: number):Observable<InitCharacter[]> { | ||
return this.http.get<Res<InitCharacter[]>>('/api/generate/character', { | ||
params: { length } | ||
}).pipe(map(res=>{ | ||
if(res.status === ResStatus.Success){ | ||
return res.data; | ||
}else{ | ||
return [] | ||
} | ||
})); | ||
} | ||
|
||
getEnvList(length: number):Observable<{ envs: Env[]; galaxiesId: string }> { | ||
return this.http.get<Res<{ envs: Env[]; galaxiesId: string }>>('/api/generate/env', { | ||
params: { length } | ||
}).pipe(map(res=>{ | ||
if(res.status === ResStatus.Success){ | ||
return res.data; | ||
}else{ | ||
return { | ||
envs:[], | ||
galaxiesId: '' | ||
} | ||
} | ||
})); | ||
} | ||
|
||
getEnemyList(length: number,level:number):Observable<BattleCharacter[]> { | ||
return this.http.get<Res<BattleCharacter[]>>('/api/generate/enemy', { | ||
params: { length,level } | ||
}).pipe(map(res=>{ | ||
if(res.status === ResStatus.Success){ | ||
return res.data; | ||
}else{ | ||
return [] | ||
} | ||
})); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26d358b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
wanjie – ./
wanjie.vercel.app
wanjie-encaiks-projects.vercel.app
wanjie-git-main-encaiks-projects.vercel.app