HJ_Server/src/api_o2s/ApiAddHuoDong.ts
DESKTOP-15R5JU0\legu 97e070ea81 init
2023-11-17 12:02:12 +08:00

22 lines
887 B
TypeScript

import { ApiCall } from "tsrpc";
import { ReqAddHuoDong, ResAddHuoDong } from "../monopoly/protocols/PtlAddHuoDong";
import { HuoDongFun } from "../public/huodongfun";
import { PublicShared } from "../shared/public/public";
export default async function (call: ApiCall<ReqAddHuoDong, ResAddHuoDong>) {
let _hd = call.req
if (_hd["ttype"] == 0) {
if (_hd["stime"] == -1) { // 永久活动
_hd["stime"] = 0
_hd["rtime"] = 0
_hd["etime"] = 0
_hd["showtime"] = "永久"
} else { // 不是永久活动,直接使用传输时间;检测显示时间
let _st = PublicShared.fmtTime(_hd["stime"])
let _rt = PublicShared.fmtTime(_hd["rtime"])
_hd["showtime"] = _st + " - " + _rt
}
}
call.succ({ insertId: await HuoDongFun.addHuoDong(_hd) });
}