update example for v1.31b

This commit is contained in:
Freddie Wang 2021-04-17 20:47:38 +08:00
parent 96805263fc
commit a9515e3b9e
3 changed files with 7 additions and 3 deletions

View File

@ -11,12 +11,14 @@ export const example: EPR = async (info, data, send) => {
/*
Access data from request like this
NOTE: all card number will be automatically converted to refid.
NOTE: all card number will be automatically converted to refid|dataid.
This is to support older game that doesn't use cardmng,
yet still allow them to register with internal profile manager.
And they can show up in WebUI as a profile, along with card binding feature.
*/
const refid = $(data).attr().card;
const ids = $(data).attr().card.split('|');
const refid = ids[0];
const dataid = ids[1];
/* Access config like this */
const event = U.GetConfig('event');
@ -42,7 +44,7 @@ export const example: EPR = async (info, data, send) => {
Send your response like this
There are more methods for sending request.
*/
send.pugFile('templates/example.pug', { refid, event });
send.pugFile('templates/example.pug', { refid, event, datid: dataid });
/* Or you can send ejs template (plain xml works as well) */
// send.xmlFile('templates/example.xml', { refid, event });

View File

@ -2,4 +2,5 @@
Learn pug here: https://pugjs.org/api/getting-started.html
example(status="0")
refid(__type="str") #{refid}
datid(__type="str") #{datid}
event(__type="str") #{event}

View File

@ -3,5 +3,6 @@
-->
<example status="0">
<refid __type="str"> <%= refid %> </refid>
<datid __type="str"> <%= datid %> </datid>
<event __type="str"> <%= event %> </event>
</example>