|
@@ -180,11 +180,14 @@ class UserService extends CrudService {
|
|
|
* @param {Object} {id} 只接收id,不过需要解构,因为是object形式过来的
|
|
|
*/
|
|
|
async delete({ id }) {
|
|
|
- const data = await this.model.findById(id);
|
|
|
- if (!data) {
|
|
|
- throw new BusinessError(ErrorCode.DATA_NOT_EXIST);
|
|
|
+ const res = await this.model.update({ _id: ObjectId(id) }, { isdel: '1' });
|
|
|
+ if (res) {
|
|
|
+ const url = this.ctx.app.config.axios.product;
|
|
|
+ const arr = await url.model.updateMany({ userid: ObjectId(id) }, { isdel: '1' });
|
|
|
+ if (arr) {
|
|
|
+ return arr;
|
|
|
+ }
|
|
|
}
|
|
|
- const res = await data.update({ isdel: '1' });
|
|
|
return res;
|
|
|
}
|
|
|
}
|