|
@@ -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') //第一步,建立与shop数据库的连接
|
|
|
-
|
|
|
-var Schema = mongoose.Schema;//第二步,通过mongoose的Schema实例化一个集合对象
|
|
|
-
|
|
|
-const goodsSchema = new Schema({
|
|
|
- categoryId: Number,//种类
|
|
|
- characteristic: String,//描述
|
|
|
- dateAdd: String,//上架时间
|
|
|
-}
|
|
|
-
|
|
|
-const Product = mongoose.model('product',goodsSchema);//第三步,返回数据库模型,会自动对应数据库中名字为 product 的表
|
|
|
-
|
|
|
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;
|
|
|
- }
|
|
|
+ // const arr = await Product.update({ userid: id }, { isdel: '1' });
|
|
|
+ // if (arr) {
|
|
|
+ // return arr;
|
|
|
+ // }
|
|
|
}
|
|
|
return res;
|
|
|
}
|