拍卖行:初步实现添加拍品的测试接口
This commit is contained in:
@@ -53,11 +53,11 @@ export class AuctionHandler {
|
||||
const serverId: number = session.get('serverId');
|
||||
if (!guildCode) return resResult(STATUS.GUILD_NOT_FOUND)
|
||||
|
||||
const result = await genAuction(guildCode, sourceType, sourceCode, serverId, rewards);
|
||||
if (!result) {
|
||||
const lots = await genAuction(guildCode, sourceType, sourceCode, serverId, rewards);
|
||||
if (!lots) {
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
}
|
||||
|
||||
return resResult(STATUS.SUCCESS, { result });
|
||||
return resResult(STATUS.SUCCESS, { lots });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,21 @@
|
||||
import { LOT_CODE_LEN, AUCTION_STAGE, AUCTION_SOURCE, AUCTION_TIME } from './../consts';
|
||||
import { LOT_CODE_LEN, AUCTION_STAGE, AUCTION_TIME } from './../consts';
|
||||
import { ItemReward } from "../domain/dbGeneral";
|
||||
import { genCode } from '../pubUtils/util';
|
||||
import { LotModel, LotParam } from '../db/Lot';
|
||||
import { getNextTime } from '../pubUtils/timeUtil';
|
||||
import { getGoodById } from '../pubUtils/data';
|
||||
|
||||
// ! 获取底价,假数据
|
||||
function getBasePrice(gid: number, count: number) {
|
||||
const good = getGoodById(gid);
|
||||
return (good ? good.quality * 100 : 100) * count;
|
||||
}
|
||||
|
||||
// ! 获取一口价,假数据
|
||||
function getMaxPrice(gid: number, count: number) {
|
||||
const good = getGoodById(gid);
|
||||
return (good ? good.quality * 200 : 200) * count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 生成拍卖数据
|
||||
@@ -22,7 +35,7 @@ export async function genAuction(guildCode: string, sourceType: number, sourceCo
|
||||
return {
|
||||
auctionStage: AUCTION_STAGE.DEFAULT, sourceType,
|
||||
sourceCode, serverId, guildCode, code, gid: id, count, begin, end,
|
||||
maxPrice: 100, curPrice: 10, // ! 此行为临时数据
|
||||
maxPrice: getMaxPrice(id, count), curPrice: getBasePrice(id, count),
|
||||
}
|
||||
});
|
||||
const result = await LotModel.createRecs(lots);
|
||||
@@ -30,6 +43,7 @@ export async function genAuction(guildCode: string, sourceType: number, sourceCo
|
||||
}
|
||||
|
||||
/**
|
||||
* ! 目前返回假数据
|
||||
* @description 获取活动参加者
|
||||
* @export
|
||||
* @param {string} guildCode
|
||||
@@ -37,5 +51,11 @@ export async function genAuction(guildCode: string, sourceType: number, sourceCo
|
||||
* @param {string} sourceCode
|
||||
*/
|
||||
export async function participants(guildCode: string, sourceType: number, sourceCode: string) {
|
||||
|
||||
return [{
|
||||
roleId: 'rM8NZtlfzD',
|
||||
position: 1,
|
||||
}, {
|
||||
roleId: 'EjX79SEddK',
|
||||
position: 2,
|
||||
}];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user