|
@@ -7,22 +7,6 @@ const { CrudService } = require('naf-framework-mongoose/lib/service');
|
|
|
const { BusinessError, ErrorCode } = require('naf-core').Error;
|
|
|
const jwt = require('jsonwebtoken');
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-const mongoose = require('mongose')
|
|
|
-
|
|
|
-mongoose.connect('mongodb://localhost/platform')
|
|
|
-
|
|
|
-var Schema = mongoose.Schema;
|
|
|
-
|
|
|
-const goodsSchema = new Schema({
|
|
|
- categoryId: Number,
|
|
|
- characteristic: String,
|
|
|
- dateAdd: String,
|
|
|
-}
|
|
|
-
|
|
|
-const Product = mongoose.model('product',goodsSchema);
|
|
|
-
|
|
|
class UserService extends CrudService {
|
|
|
constructor(ctx) {
|
|
|
super(ctx, 'user');
|
|
@@ -198,10 +182,10 @@ class UserService extends CrudService {
|
|
|
async delete({ id }) {
|
|
|
const res = await this.model.update({ _id: ObjectId(id) }, { isdel: '1' });
|
|
|
if (res) {
|
|
|
- const arr = await Product.update({ userid: id }, { isdel: '1' });
|
|
|
- if (arr) {
|
|
|
- return arr;
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
return res;
|
|
|
}
|