<commit_before>'use strict';
/**
 * 消息解析和处理模块
 * @type {[type]}
 */

let moment = require('moment');
let mongodb = require('../libs/mongodb'),
	alias = require('../libs/alias'),
	apis = {
		email: require('../gateway/email'),
		wechat: require('../gateway/wechat'),
		app: require('../gateway/push'),
		sms: require('../gateway/sms')
	},
	events = require('../libs/events');
let _ = require('underscore');
const config = require('config');

module.exports = {
	// 获取用户信息 -todo aggregate wechat
	resolve (event) {

		return new Promise((resolve, reject) => {
			event = event.toObject();
			let param = event.param;

			let queryMessageSetting = {
				mids: [event.type]
			};
			const projectid = param.project || param.projectid;
			if(projectid){
				queryMessageSetting.projectid = projectid;
			}
			else{
				queryMessageSetting.projectid = 'PLT';
			}

			RPC.Message.Config.List(queryMessageSetting).then(
				result=>{
					if(result.code != ErrorCode.OK ){
						return reject(result);
					}

					if(_.isArray(result.result)){
						return reject(ErrorCode.ack(ErrorCode.NOTSUPPORT, result));
					}

					const setting = _.omit(result.result, ['mid', 'projectid']);
					MySQL.Account
						.findOne({
							where: {
								$or: [
									{uid: param.to || param.account || param.uid},
									{user: param.to || param.account || param.uid}
								],
								timedelete: 0<commit_msg>修正RPC调用问题<commit_after>'use strict';
/**
 * 消息解析和处理模块
 * @type {[type]}
 */

let moment = require('moment');
let mongodb = require('../libs/mongodb'),
	alias = require('../libs/alias'),
	apis = {
		email: require('../gateway/email'),
		wechat: require('../gateway/wechat'),
		app: require('../gateway/push'),
		sms: require('../gateway/sms')
	},
	events = require('../libs/events');
let _ = require('underscore');
const config = require('config');

module.exports = {
	// 获取用户信息 -todo aggregate wechat
	resolve (event) {

		return new Promise((resolve, reject) => {
			event = event.toObject();
			let param = event.param;

			let queryMessageSetting = {
				mids: [event.type.toString()]
			};
			const projectid = param.project || param.projectid;
			if(projectid){
				queryMessageSetting.projectid = projectid;
			}
			else{
				queryMessageSetting.projectid = 'PLT';
			}

			RPC.Message.Config.List(queryMessageSetting).then(
				result=>{
					if(result.code != ErrorCode.OK ){
						return reject(result);
					}

					if(_.isArray(result.result)){
						return reject(ErrorCode.ack(ErrorCode.NOTSUPPORT, result));
					}

					const setting = _.omit(result.result, ['mid', 'projectid']);
					MySQL.Account
						.findOne({
							where: {
								$or: [
									{uid: param.to || param.account || param.uid},
									{user: param.to || param.account || param.uid}
								],
								timedelete: 0
{'fraction_non_alphanumeric': 0.1755072979708081, 'fraction_numerical': 0.000711997152011392, 'mean_word_length': 2.89196675900277, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '603350', 'n_tokens_mistral': 1181, 'n_tokens_neox': 936, 'n_words': 175}