|
@@ -176,6 +176,27 @@ class RoomService extends CrudService {
|
|
|
}
|
|
|
return resmodel;
|
|
|
}
|
|
|
+
|
|
|
+ async switchzb({ id }) {
|
|
|
+ const resmodel = await this.model.findById(id);
|
|
|
+ if (resmodel) {
|
|
|
+ resmodel.switchzjr = '';
|
|
|
+ const result = await resmodel.save();
|
|
|
+ if (result) {
|
|
|
+ const { mq } = this.ctx;
|
|
|
+ if (mq) {
|
|
|
+ const exchange = 'switch_zb_' + id;
|
|
|
+ const parm = {
|
|
|
+ durable: true,
|
|
|
+ headers: {
|
|
|
+ userid: result.id,
|
|
|
+ } };
|
|
|
+ await mq.fanout(exchange, result.id, JSON.stringify(result), parm);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return resmodel;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
module.exports = RoomService;
|