mirror of
https://github.com/Gongxh0901/kunpolibrary
synced 2025-12-28 09:37:15 +00:00
仓库中添加内置的demo
This commit is contained in:
44
demo/assets/script/Net/task/NetAuth.ts
Normal file
44
demo/assets/script/Net/task/NetAuth.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @Author: Gongxh
|
||||
* @Date: 2024-05-20
|
||||
* @Description: 新版鉴权接口
|
||||
*/
|
||||
import { kunpo } from "../../header";
|
||||
import { INetResponse } from "../header";
|
||||
import { NetHelper } from "../NetHelper";
|
||||
import { NetTaskBase } from "../NetTaskBase";
|
||||
|
||||
interface IAuthResponse extends INetResponse {
|
||||
token: string;
|
||||
uid: number; // 用户id
|
||||
sdkId: string;
|
||||
channel: number;
|
||||
/** 注册渠道 */
|
||||
regChannel: number;
|
||||
}
|
||||
|
||||
/** 账户认证 */
|
||||
export class NetAuth extends NetTaskBase {
|
||||
name: string = "NetSocketAuth";
|
||||
url: string = '/api/game/auth';
|
||||
constructor() {
|
||||
super()
|
||||
}
|
||||
|
||||
public start(): void {
|
||||
let data = {
|
||||
channel: 25,
|
||||
token: kunpo.Platform.deviceId,
|
||||
openid: kunpo.Platform.deviceId,
|
||||
sdkChannel: 25,
|
||||
distinctId: ''
|
||||
}
|
||||
NetHelper.send(this.url, data, this);
|
||||
}
|
||||
|
||||
protected onTaskComplete(data: IAuthResponse): void {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
9
demo/assets/script/Net/task/NetAuth.ts.meta
Normal file
9
demo/assets/script/Net/task/NetAuth.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "10bbcb28-912a-4ba5-9bfd-a21668ee8763",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user