演武场和练兵场
This commit is contained in:
+1
-16
@@ -81,22 +81,7 @@ export default class Item extends BaseModel {
|
||||
return { hasError: false, result }
|
||||
}
|
||||
}
|
||||
// public static async decreaseItems(roleId: string, items: Array<{ id: number, count: number, ratio?: number}>, lean = true) {
|
||||
// const transaction = new Transaction();
|
||||
// let hasError: boolean = false, result = new Array();
|
||||
// try {
|
||||
// for (let { id, count, ratio } of items) {
|
||||
// if (!ratio) ratio = -1;
|
||||
// await transaction.update("Item", { roleId, id, count: { $gte: count } }, { $inc: { count: ratio * count } }, { new: true});
|
||||
// }
|
||||
// await transaction.run();
|
||||
// return {hasError, result};
|
||||
// } catch (error) {
|
||||
// await transaction.rollback().catch(console.error);
|
||||
// transaction.clean();
|
||||
// return {error};
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
public static async deleteAccount(roleId: string) {
|
||||
let result = await ItemModel.deleteMany({ roleId });
|
||||
|
||||
Reference in New Issue
Block a user