Commit e57972ae authored by mxm-web-develop's avatar mxm-web-develop

1123123

parent 33a58a41
import { AxiosInstance } from "axios";
declare class Common { declare class Common {
protected _axios: AxiosInstance;
protected _url: any;
protected _config: any;
constructor(url: string, config?: any); constructor(url: string, config?: any);
dosome(): void;
} }
export default Common; export default Common;
export declare function test_dec(appName: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void; export declare function test_dec(appName: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
export declare function LocLogin(appName: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void; export declare function LocLogin(appName: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => Promise<void>;
...@@ -5,11 +5,10 @@ interface Coinfg { ...@@ -5,11 +5,10 @@ interface Coinfg {
options?: any; options?: any;
} }
declare class FZMAPI { declare class FZMAPI {
Common: Common; _url: string;
Suyuan: Suyuan; _config: Coinfg | undefined;
Browser: Browser;
protected config: Coinfg | undefined;
constructor(url: string, config?: Coinfg | undefined); constructor(url: string, config?: Coinfg | undefined);
SuyuanModlue: () => Suyuan;
} }
export { Common as commonApi, Suyuan as suyuanApi, Browser as browserApi }; export { Common as commonApi, Suyuan as suyuanApi, Browser as browserApi };
export default FZMAPI; export default FZMAPI;
import t from"axios";class e{constructor(t,e){}dosome(){console.log(111)}} import s from"axios";import{setStore as e}from"mxm-usrstorage";class t{_axios;_url;_config;constructor(e,t){t&&t.url?(this._url=t.url,this._axios=s.create({baseURL:t.url,...t})):(this._url=e,this._axios=s.create({baseURL:e,...t})),this._config=t,this._axios.interceptors.response.use((s=>(s=>{if(200===s.status&&"OK"===s.statusText)return s.data;throw new Error(s.statusText)})(s)),(s=>Promise.reject(s)))}}var i={login:"/api/user/login",isSetPwd:"/api/user/isSetPwd",keyAdd:"/api/appKey/add",keyDelete:"/api/appKey/delete",keyList:"/api/appKey/list",register:"/api/user/register",send:"/api/user/send",sendEmail:"/api/user/sendEmail",sendSms:"/api/user/sendSms",setPhone:"/api/user/setPhone",setPhoneCode:"/api/user/setPhoneCode",setPwd:"/api/user/setPwd",setPwdCode:"/api/user/setPwdCode",user:"api/user",add:"/api/users/add"};class r extends t{constructor(s,e){super(s,e)}async login(s){const t=await this._axios.post(i.login,s);return t&&e({app:this.constructor.name}),t}async isSetPwd(s){return await this._axios.post(i.isSetPwd,s)}async keyAdd(s){return await this._axios.post(i.keyAdd,s)}async keyDelete(s){return await this._axios.delete(i.keyDelete,{params:s})}async keyList(s){return await this._axios.post(i.keyList,s)}}class a extends t{static _version;constructor(s,e){super(s,e),a._version="v.1.0.1"}userModule=()=>new r(this._url,this._config)}class o{constructor(s,e){}kill(){console.log(222)}}class n{_url;_config;constructor(s,e){this._url=s,this._config=e}SuyuanModlue=()=>new a(this._url,this._config)}export{o as browserApi,t as commonApi,n as default,a as suyuanApi};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function o(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}class s{_axios;_url;_config;constructor(e,o){o&&o.url?(this._url=o.url,this._axios=t.create({baseURL:o.url,...o})):(this._url=e,this._axios=t.create({baseURL:e,...o})),this._config=o,this._axios.interceptors.response.use((t=>(t=>{if(200===t.status&&"OK"===t.statusText)return t.data;throw new Error(t.statusText)})(t)),(t=>Promise.reject(t)))}userModule=()=>new r(this._url,this._config)}class r extends s{constructor(t,e){super(t,e)}async login(t){return await this._axios.post("/api/user/login",t)}}!function(t,e,o,s){var r,n=arguments.length,i=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,o):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,o,s);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(i=(n<3?r(i):n>3?r(e,o,i):r(e,o))||i);n>3&&i&&Object.defineProperty(e,o,i)}([function(t,e,o){console.log(t)},o("design:type",Function),o("design:paramtypes",[Object]),o("design:returntype",Promise)],r.prototype,"login",null);class n{constructor(t,e){}kill(){console.log(222)}}class i{Common;Suyuan;Browser;config;constructor(t,o){this.config=o,this.Common=new e(t,this.config),this.Browser=new n(t,this.config),this.Suyuan=new s(t,this.config)}}export{n as browserApi,e as commonApi,i as default,s as suyuanApi};
import { IsSetPwd_REQ, KeyAdd_REQ, Login_REQ, KeyList_REQ } from "./req.types";
import { KeyAdd_RES, keyList_RES, Login_RES } from "./res.types";
import Common from "../common";
declare class User extends Common {
constructor(url: any, config?: any);
login(data: Login_REQ): Promise<Login_RES>;
isSetPwd(data: IsSetPwd_REQ): Promise<{
is_set_pwd: number;
}>;
keyAdd(data: KeyAdd_REQ): Promise<KeyAdd_RES>;
keyDelete(id: number): Promise<{
id: number;
}>;
keyList(data: KeyList_REQ): Promise<keyList_RES>;
}
export default User;
declare const _default: {
user: {
login: string;
isSetPwd: string;
keyAdd: string;
keyDelete: string;
keyList: string;
register: string;
send: string;
sendEmail: string;
sendSms: string;
setPhone: string;
setPhoneCode: string;
setPwd: string;
setPwdCode: string;
user: string;
add: string;
};
};
export default _default;
import { AxiosInstance } from "axios"; import User from "./User";
import { Login } from "./req.types"; import Common from "../common";
declare class Suyuan { declare class Suyuan extends Common {
protected _axios: AxiosInstance; static _version: string;
protected _url: any;
protected _config: any;
constructor(url: string, config?: any); constructor(url: string, config?: any);
userModule: () => User; userModule: () => User;
} }
declare class User extends Suyuan {
constructor(url: any, config?: any);
login(data: Login): Promise<{
id: number;
token: string;
}>;
}
export default Suyuan; export default Suyuan;
export interface Login { export interface Login_REQ {
country?: string; country?: string;
email?: string; email?: string;
code?: string; code?: string;
...@@ -6,3 +6,16 @@ export interface Login { ...@@ -6,3 +6,16 @@ export interface Login {
phone?: string; phone?: string;
pwd?: string; pwd?: string;
} }
export interface IsSetPwd_REQ {
"country": string;
"phone": string;
"email": string;
}
export interface KeyAdd_REQ {
"app_id": string;
"app_key": string;
}
export interface KeyList_REQ {
"page": number;
"page_size": number;
}
...@@ -4,3 +4,26 @@ export interface ResConstruction<T> { ...@@ -4,3 +4,26 @@ export interface ResConstruction<T> {
"msg": string; "msg": string;
"data": T; "data": T;
} }
export interface Login_RES {
id: number;
token: string;
}
export interface KeyAdd_RES {
"id": 0;
"user_id": 0;
"app_id": string;
"app_key": string;
"app_secret": string;
}
interface keyItem {
"id": number;
"user_id": number;
"app_id": string;
"app_key": string;
"app_secret": string;
}
export interface keyList_RES {
"total": number;
"results": keyItem[];
}
export {};
import FZMAPI from "./index"; import FZMAPI from "./index";
const api = new FZMAPI("http://121.37.141.165:46790") const api = new FZMAPI('http://111213')
// api.userModule.login() api.SuyuanModlue().userModule().keyAdd({
// api.keyAdd() "app_id": "string",
// api.UserModule.login( "app_key": "string"
// { })
// login_type:0, \ No newline at end of file
// phone: '13800000000',
// pwd:'770a6e7a2eada8facf51f1240c0b3612'
// }
// )
// api.login({
// login_type:0,
// phone: '13800000000',
// pwd:'770a6e7a2eada8facf51f1240c0b3612'
// })
export default {
}
\ No newline at end of file
...@@ -49,6 +49,7 @@ class User extends Common { ...@@ -49,6 +49,7 @@ class User extends Common {
data data
); );
} }
/** /**
* 添加用户接口密钥 * 添加用户接口密钥
* ```ts * ```ts
......
...@@ -14,9 +14,10 @@ import constants from "./constants"; ...@@ -14,9 +14,10 @@ import constants from "./constants";
import User from "./User"; import User from "./User";
import Common from "../common"; import Common from "../common";
class Suyuan extends Common { class Suyuan extends Common {
static _version: string
constructor(url: string, config?: any) { constructor(url: string, config?: any) {
super(url, config); super(url, config);
Suyuan._version ='v.1.0.1'
// this.userModule = new User(this._url, this._config); // this.userModule = new User(this._url, this._config);
} }
userModule = () => new User(this._url, this._config); userModule = () => new User(this._url, this._config);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment