Commit f24d22a0 authored by qinhaitao's avatar qinhaitao

fix: 🐛 更新useStock问题

parent a25d0594
...@@ -258,7 +258,10 @@ var BaseController = /** @class */ (function () { ...@@ -258,7 +258,10 @@ var BaseController = /** @class */ (function () {
v.name || '', v.name || '',
v.type == 1 ? '/' : v.receiveName || '', v.type == 1 ? '/' : v.receiveName || '',
v.type == 1 ? '/' : v.phone || '未填', v.type == 1 ? '/' : v.phone || '未填',
v.type == 1 ? '/' : v.province ? v.province + v.city + v.area + v.addressdetail : '未填', v.type == 1 ? '/' : v.province ? v.province : '未填',
v.type == 1 ? '/' : v.city ? v.city : '未填',
v.type == 1 ? '/' : v.area ? v.area : '未填',
v.type == 1 ? '/' : v.addressdetail ? v.addressdetail : '未填',
v.type == 1 ? '/' : shipMsg[v.shipStatus], v.type == 1 ? '/' : shipMsg[v.shipStatus],
v.type == 1 ? '/' : v.shipCompany || '/', v.type == 1 ? '/' : v.shipCompany || '/',
v.type == 1 ? '/' : v.shipNum || '/' v.type == 1 ? '/' : v.shipNum || '/'
...@@ -346,8 +349,8 @@ var BaseController = /** @class */ (function () { ...@@ -346,8 +349,8 @@ var BaseController = /** @class */ (function () {
awardslist.map(function (item) { awardslist.map(function (item) {
var ad = item.province + item.city + item.area + item.addressdetail, type0 = item.type; var ad = item.province + item.city + item.area + item.addressdetail, type0 = item.type;
item.prizeId = item._id; item.prizeId = item._id;
item.createTime = utils_1.formatTime(new Date(item.createTime)) || ''; item.createTime = utils_1.formatTime(new Date(item.createTime + constants_1.EIGHT_HOURS)) || '';
item.receiveTime = item.receiveTime ? utils_1.formatTime(new Date(item.receiveTime)) : '未填'; item.receiveTime = item.receiveTime ? utils_1.formatTime(new Date(item.receiveTime + constants_1.EIGHT_HOURS)) : '未填';
item.prizeDataType = prizePoolType[item.prizeDataType]; item.prizeDataType = prizePoolType[item.prizeDataType];
item.type = prizeKind[item.type]; item.type = prizeKind[item.type];
item.receiveName = type0 == 3 ? item.receiveName || '未填' : '/'; item.receiveName = type0 == 3 ? item.receiveName || '未填' : '/';
......
...@@ -7,7 +7,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi ...@@ -7,7 +7,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
o[k2] = m[k]; o[k2] = m[k];
})); }));
var __exportStar = (this && this.__exportStar) || function(m, exports) { var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
/** @format */ /** @format */
......
...@@ -12,7 +12,7 @@ export default class ActivityConfigService { ...@@ -12,7 +12,7 @@ export default class ActivityConfigService {
success: any[]; success: any[];
failed: any[]; failed: any[];
}>; }>;
updateOnePrizeById(id: any, data: any): Promise<any>; updateOnePrizeById(id: any, data: IActivityPrize): Promise<any>;
insertPrizeByActivityId(activityId: any, data: any): Promise<any>; insertPrizeByActivityId(activityId: any, data: any): Promise<any>;
getAllOldPrizeList(activityId: string): Promise<any>; getAllOldPrizeList(activityId: string): Promise<any>;
diffPrizeList(activityId: string, pirzeList: Array<IActivityPrize>): Promise<{ diffPrizeList(activityId: string, pirzeList: Array<IActivityPrize>): Promise<{
......
...@@ -237,10 +237,21 @@ var ActivityConfigService = /** @class */ (function () { ...@@ -237,10 +237,21 @@ var ActivityConfigService = /** @class */ (function () {
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: return [4 /*yield*/, this.activityconfigPrizeDao.update({ case 0:
if (data.switchStock === constants_1.STOCK_TYPE.NO_LIMIT) {
data.useStock = 0;
}
else {
delete data.useStock;
}
return [4 /*yield*/, this.activityconfigPrizeDao.update({
_id: id _id: id
}, { }, {
$set: __assign(__assign({}, data), { updateTime: Date.now(), deleteStatus: constants_1.DELETE_STATUS.EXIST }) $set: {
data: data,
updateTime: Date.now(),
deleteStatus: constants_1.DELETE_STATUS.EXIST
}
})]; })];
case 1: return [2 /*return*/, _a.sent()]; case 1: return [2 /*return*/, _a.sent()];
} }
......
"use strict"; "use strict";
/** @format */ /** @format */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.AwardsService = exports.InstanceService = exports.SellerService = exports.TaobaoTopService = exports.ActivityconfigService = void 0;
var activityconfig_service_1 = require("./activityconfig.service"); var activityconfig_service_1 = require("./activityconfig.service");
Object.defineProperty(exports, "ActivityconfigService", { enumerable: true, get: function () { return activityconfig_service_1.default; } }); Object.defineProperty(exports, "ActivityconfigService", { enumerable: true, get: function () { return activityconfig_service_1.default; } });
var taobaoTop_service_1 = require("./taobaoTop.service"); var taobaoTop_service_1 = require("./taobaoTop.service");
......
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":";AAAA,cAAc;;AAEd,mEAA2E;AAAlE,+HAAA,OAAO,OAAyB;AACzC,yDAAiE;AAAxD,qHAAA,OAAO,OAAoB;AACpC,mDAA2D;AAAlD,+GAAA,OAAO,OAAiB;AACjC,uDAA+D;AAAtD,mHAAA,OAAO,OAAmB;AACnC,mDAA2D;AAAlD,+GAAA,OAAO,OAAiB"} {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAEd,mEAA2E;AAAlE,+HAAA,OAAO,OAAyB;AACzC,yDAAiE;AAAxD,qHAAA,OAAO,OAAoB;AACpC,mDAA2D;AAAlD,+GAAA,OAAO,OAAiB;AACjC,uDAA+D;AAAtD,mHAAA,OAAO,OAAmB;AACnC,mDAA2D;AAAlD,+GAAA,OAAO,OAAiB"}
\ No newline at end of file \ No newline at end of file
...@@ -8,7 +8,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi ...@@ -8,7 +8,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
o[k2] = m[k]; o[k2] = m[k];
})); }));
var __exportStar = (this && this.__exportStar) || function(m, exports) { var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./logger"), exports); __exportStar(require("./logger"), exports);
......
...@@ -136,15 +136,20 @@ export default class ActivityConfigService { ...@@ -136,15 +136,20 @@ export default class ActivityConfigService {
} }
// 更新单条数据 // 更新单条数据
async updateOnePrizeById(id, data) { async updateOnePrizeById(id, data: IActivityPrize) {
const { useStock, ...rest } = data;
if(data.switchStock === STOCK_TYPE.NO_LIMIT) {
data.useStock = 0
} else {
delete data.useStock
}
return await this.activityconfigPrizeDao.update( return await this.activityconfigPrizeDao.update(
{ {
_id: id _id: id
}, },
{ {
$set: { $set: {
...rest, data,
updateTime: Date.now(), updateTime: Date.now(),
deleteStatus: DELETE_STATUS.EXIST deleteStatus: DELETE_STATUS.EXIST
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment