External module: msg服务调用
Index
Interfaces
Functions
Functions
active_login
▸ active_login(spaceid: string
, policyno: string
, wx_user_info: IUserInfo
): Promise
<IRes
>
Defined in msg/active-login.ts:51
微信授权登录
example:
import active_login from '@dfeidao/atom-wxapp/msg/active-login';
const info = await active_login('web_test', '001', {});
Parameters:
Name | Type | Description |
---|---|---|
spaceid | string |
|
policyno | string |
策略编号(项目经理提供) |
wx_user_info | IUserInfo |
微信用户信息 |
Returns: Promise
<IRes
>
check_isonline
▸ check_isonline(): Promise
<boolean
>
Defined in msg/check-isonline.ts:16
验证sessionid是否在线
example:
import check_isonline from '@dfeidao/atom-wxapp/msg/check-isonline';
const info = await check_isonline();
execute
▸ execute<T
>(service_name: string
, condition: any
, usercode: string
, spaceid: string
, systemid: string
, emptydataflag: number
, refsystemid?: undefined
| string
): Promise
<T
>
Defined in msg/execute.ts:22
调用过帐服务
example:
import execute from '@dfeidao/atom-wxapp/msg/execute';
const res = await execute('servce_name', {}, 'usercode', 'web_test', '6611', 0, '');
Type parameters:
T
Parameters:
Name | Type | Description |
---|---|---|
service_name | string |
服务名称 |
condition | any |
参数 |
usercode | string |
用户名 |
spaceid | string |
项目spaceid |
systemid | string |
项目systemid |
emptydataflag | number |
空数据标识 |
Optional refsystemid |
undefined | string |
项目refsystemid |
refunds
▸ refunds(trade_no: string
, fee: string
, out_refund_no: string
): Promise
<Object
>
Defined in msg/refunds.ts:18
微信申请退款
example:
import nodejs from '@dfeidao/atom-wxapp/msg/nodejs';
const res = await nodejs('trade_no', '0.2', 'out_refund_no');
Parameters:
Name | Type | Description |
---|---|---|
trade_no | string |
订单单号 |
fee | string |
退款金额 |
out_refund_no | string |
退款单号 |
Returns: Promise
<Object
>
user_login
▸ user_login(service: string
, usr: string
, psw: string
): Promise
<IUserInfo>
Defined in msg/user-login.ts:79
用户登录
example:
import login from '@dfeidao/atom-wxapp/msg/user-login';
login('xxx', { usr: 'username', psw: '123456' });
example:
import nodejs from '@dfeidao/atom-nodejs';
import log from '@dfeidao/atom-nodejs/logger/log';
import { IncomingHttpHeaders } from 'http';
interface Message {
usr: string;
psw: string;
}
interface IWebResult {
data: unknown;
cookie?: {
[name: string]: string;
} \| null;
content_type?: string;
headers?: {
[key: string]: string[];
};
attachment?: string;
redirect?: string;
status_code?: number;
}
export default async function atom(message: Message, action_id: string, * session_id: string, headers: IncomingHttpHeaders): Promise<IWebResult> {
log('Service begin', __filename, 'action_id:' + action_id);
const usrinfo = await nodejs.msg.user_login(action_id, session_id, * message.usr, message.psw);
log('Service end', __filename, 'action_id:' + action_id);
return {
cookie: {
'sessionid': usrinfo.sessionID
},
data: usrinfo
};
}
Parameters:
Name | Type | Description |
---|---|---|
service | string |
服务名,该服务当务必返回cookie且包含sessionid,详见下面的示例 |
usr | string |
用户名 |
psw | string |
密码 |
Returns: Promise
<IUserInfo>