1
This commit is contained in:
parent
cd6a2c216a
commit
879964800b
@ -1,3 +1,3 @@
|
||||
{
|
||||
"list":[]
|
||||
"list":["test"]
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ const basewrap = require('./basewrap');
|
||||
const HERO_TYPE = 3;
|
||||
const GUN_TYPE = 7;
|
||||
const MATERIAL_TYPE = 10;
|
||||
const BLIND_BOX_TYPE = 12;
|
||||
|
||||
const MATERIAL_CHIP_SUBTYPE = 3;
|
||||
|
||||
@ -31,6 +32,11 @@ class Item extends basewrap.BaseWrap {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BLIND_BOX_TYPE:
|
||||
{
|
||||
return bcutils.BLIND_BOX_TYPE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
return bcutils.NONE_TYPE;
|
||||
|
@ -12,7 +12,7 @@ function add(clsNames, modName) {
|
||||
}
|
||||
|
||||
function init() {
|
||||
//add(['Present'], 'present');
|
||||
add(['Present'], 'present');
|
||||
create('Present', null).init();
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ class BoxOrder {
|
||||
};
|
||||
|
||||
const exec = new bchelper.ContractExecutor();
|
||||
exec.instanceName = 'factoryInstance';
|
||||
exec.instanceName = this.getMintInstance(idx);
|
||||
exec.suspend = this.suspend.bind(this);
|
||||
exec.getLogKey = this.getOrderId.bind(this);
|
||||
exec.getLogData = this.getOrderDb.bind(this);
|
||||
@ -400,28 +400,11 @@ class BoxOrder {
|
||||
}
|
||||
|
||||
getMintMethod(idx) {
|
||||
switch (this.orderDb['bc_mint_token_type' + idx]) {
|
||||
case C.TOKEN_TYPE_HERO:
|
||||
{
|
||||
return 'mintHeroTo';
|
||||
}
|
||||
break;
|
||||
case C.TOKEN_TYPE_EQUIP:
|
||||
{
|
||||
return 'mintEquipTo';
|
||||
}
|
||||
break;
|
||||
case C.TOKEN_TYPE_CHIP:
|
||||
{
|
||||
return 'mintChipTo';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
return '';
|
||||
break;
|
||||
}
|
||||
}
|
||||
return utils.getMintMethod (this.orderDb['bc_mint_token_type' + idx]);
|
||||
}
|
||||
|
||||
getMintInstance(idx) {
|
||||
return utils.getMintInstance (this.orderDb['bc_mint_token_type' + idx]);
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -102,7 +102,7 @@ class Present {
|
||||
};
|
||||
|
||||
const exec = new bchelper.ContractExecutor();
|
||||
exec.instanceName = 'factoryInstance';
|
||||
exec.instanceName = this.getMintInstance();
|
||||
exec.suspend = this.suspend.bind(this);
|
||||
exec.getLogKey = this.getTokenId.bind(this);
|
||||
exec.getLogData = this.getPresentDb.bind(this);
|
||||
@ -283,28 +283,11 @@ class Present {
|
||||
}
|
||||
|
||||
getMintMethod() {
|
||||
switch (this.presentDb['bc_mint_token_type']) {
|
||||
case C.TOKEN_TYPE_HERO:
|
||||
{
|
||||
return 'mintHeroTo';
|
||||
}
|
||||
break;
|
||||
case C.TOKEN_TYPE_EQUIP:
|
||||
{
|
||||
return 'mintEquipTo';
|
||||
}
|
||||
break;
|
||||
case C.TOKEN_TYPE_CHIP:
|
||||
{
|
||||
return 'mintChipTo';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
return '';
|
||||
break;
|
||||
}
|
||||
}
|
||||
return utils.getMintMethod(this.presentDb['bc_mint_token_type']);
|
||||
}
|
||||
|
||||
getMintInstance() {
|
||||
return utils.getMintInstance(this.presentDb['bc_mint_token_type']);
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -1,6 +1,7 @@
|
||||
const fs = require('fs');
|
||||
const events = require('events');
|
||||
const axios = require('axios').default;
|
||||
const C = require('./C');
|
||||
|
||||
const serverEnv = process.env['SERVER_ENV'];
|
||||
|
||||
@ -139,6 +140,58 @@ function isSameAccount(a, b) {
|
||||
return a.toLowerCase() == b.toLowerCase();
|
||||
}
|
||||
|
||||
function getMintInstance(tokenType) {
|
||||
switch (tokenType) {
|
||||
case C.TOKEN_TYPE_HERO:
|
||||
case C.TOKEN_TYPE_EQUIP:
|
||||
case C.TOKEN_TYPE_CHIP:
|
||||
{
|
||||
return 'factoryInstance';
|
||||
}
|
||||
break;
|
||||
case C.BLIND_BOX_TYPE_CHIP:
|
||||
{
|
||||
return 'boxproxyInstance';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
return '';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getMintMethod(tokenType) {
|
||||
switch (tokenType) {
|
||||
case C.TOKEN_TYPE_HERO:
|
||||
{
|
||||
return 'mintHeroTo';
|
||||
}
|
||||
break;
|
||||
case C.TOKEN_TYPE_EQUIP:
|
||||
{
|
||||
return 'mintEquipTo';
|
||||
}
|
||||
break;
|
||||
case C.TOKEN_TYPE_CHIP:
|
||||
{
|
||||
return 'mintChipTo';
|
||||
}
|
||||
break;
|
||||
case C.BLIND_BOX_TYPE_CHIP:
|
||||
{
|
||||
return 'mintBoxTo';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
return '';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.rspErr = rspErr;
|
||||
exports.rspOk = rspOk;
|
||||
exports.rspData = rspData;
|
||||
@ -158,3 +211,5 @@ exports.jsonEncode = jsonEncode;
|
||||
exports.jsonDecode = jsonDecode;
|
||||
exports.httpGet = httpGet;
|
||||
exports.isSameAccount = isSameAccount;
|
||||
exports.getMintInstance = getMintInstance;
|
||||
exports.getMintMethod = getMintMethod;
|
||||
|
Loading…
x
Reference in New Issue
Block a user