Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function User( option ) {
option = option || {};
this.ss = new Session( option );
this.host = option['https'] || option['host'];
this.api = 'https://' + this.host + '/_a/baas/user';
// 1.5.1 + 废弃
this.prefix= option['table.prefix'] || '';
// 1.5.1 + 废弃
this.table_name = option['user.table'] || 'user';
// 1.5.1 + 废弃
this.tab = new Table( option, this.table_name );
// 1.5.1 + 废弃
this.cid = option.app || '';
// 1.5.1 新增: 用户数据处理云端应用
this.handler = option['user'] || '';
this.appid = option['appid']; // 小程序ID,可不填写
this.secret = option['secret']; // 云端鉴权 secret 格式为 appid|secret
// 用户退出
this.logout = function() {
var that = this;
return new _P(function (resolve, reject) {
function Wss( option ) {
this.isOpen = false;
this.events = {};
this.conn_events = {};
this.host = option['wss'] || option['host'];
this.ss = new Session( option );
this.ss.start();
this.cid = option.app || '';
this.prefix= option['table.prefix'] || '';
this.table_name = option['ws.table'] || 'message';
this.user_table = option['user.table'] || 'user';
this.tab = new Table( option, this.table_name );
/**
* 读取当前线上用户
* @return Promise
*/
this.liveUsers = function() {
var that = this;
return new _P(function (resolve, reject) {
var eventBack = null;
if ( typeof that.events['getConnections'] == 'function' ) {
eventBack = that.events['getConnections'];
}