寻宝:抽象队长匹配队友的逻辑;抽象 channel 中的用户
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { ChannelUser } from './../domain/ChannelUser';
|
||||
import { Channel } from 'pinus';
|
||||
import { getRandNum, getRandomArr } from '../pubUtils/util';
|
||||
import { TERAPH_RANDOM } from "../consts/consts";
|
||||
import { indexOf } from 'underscore';
|
||||
@@ -57,4 +59,12 @@ export function checkMaterialEnough(count: number, attrs:Array<any>, teraphInfo:
|
||||
consumes.push({ id, count: count*times});
|
||||
}
|
||||
return {attr: res, consumes};
|
||||
}
|
||||
|
||||
export function addUserToChannel(channel: Channel, user: ChannelUser) {
|
||||
const users = channel.getMembers();
|
||||
const { uid, sid } = user;
|
||||
if (users.indexOf(uid) === -1) {
|
||||
channel.add(uid, sid);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user