...
|
...
|
@@ -7,6 +7,7 @@ |
|
|
|
|
|
'use strict';
|
|
|
const aes = require('./aes-pwd');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const common = require('../../../config/common');
|
|
|
const clientApi = require('../models/client-api');
|
|
|
const clientService = require('../models/client-service');
|
...
|
...
|
@@ -16,10 +17,11 @@ const clientService = require('../models/client-service'); |
|
|
*/
|
|
|
const index = (req, res, next) => {
|
|
|
let type = 2;
|
|
|
let uid = req.user.uid;
|
|
|
let reg = /MSIE\s?[987]\.0/i;
|
|
|
let userAgent = req.headers['user-agent'];
|
|
|
let unSupport = reg.test(userAgent);
|
|
|
let encryptedUid = aes.encryptionUid(req.user.uid);
|
|
|
let encryptedUid = aes.encryptionUid(uid);
|
|
|
let domains = common.domains;
|
|
|
let imCs = domains.imCs;
|
|
|
let imSocket = domains.imSocket;
|
...
|
...
|
@@ -36,8 +38,11 @@ const index = (req, res, next) => { |
|
|
layout: false
|
|
|
});
|
|
|
} else {
|
|
|
clientService.getClientData(type, encryptedUid)
|
|
|
clientService.getClientData(uid, type, encryptedUid)
|
|
|
.then(result => {
|
|
|
if (result.code === 401) {
|
|
|
return res.redirect(helpers.urlFormat('/signin.html'));
|
|
|
}
|
|
|
res.render('client', Object.assign(data, result));
|
|
|
}).catch(next);
|
|
|
}
|
...
|
...
|
@@ -58,10 +63,11 @@ const domains = (req, res) => { |
|
|
* @param next
|
|
|
*/
|
|
|
const history = (req, res, next) => {
|
|
|
const encId = aes.encryptionUid(req.user.uid);
|
|
|
const uid = req.user.uid;
|
|
|
const encId = aes.encryptionUid(uid);
|
|
|
const endTime = req.body.endTime;
|
|
|
|
|
|
clientApi.getMsgHistory(encId, endTime)
|
|
|
clientApi.getMsgHistory(uid, encId, endTime)
|
|
|
.then(result => {
|
|
|
res.json(result);
|
|
|
}).catch(next);
|
...
|
...
|
@@ -74,7 +80,10 @@ const history = (req, res, next) => { |
|
|
* @param next
|
|
|
*/
|
|
|
const saveEval = (req, res, next) => {
|
|
|
const params = {};
|
|
|
const uid = req.user.uid;
|
|
|
const params = {
|
|
|
uid
|
|
|
};
|
|
|
|
|
|
params.stars = req.body.stars;
|
|
|
params.promoter = req.body.promoter;
|
...
|
...
|
@@ -102,9 +111,12 @@ const saveEval = (req, res, next) => { |
|
|
* @param next
|
|
|
*/
|
|
|
const queryReason = (req, res, next) => {
|
|
|
const uid = req.user.uid;
|
|
|
const type = req.body.type;
|
|
|
const encryptedUid = aes.encryptionUid(uid);
|
|
|
|
|
|
|
|
|
clientApi.queryReason(type)
|
|
|
clientApi.queryReason(uid, encryptedUid, type)
|
|
|
.then(result => {
|
|
|
res.json(result);
|
|
|
}).catch(next);
|
...
|
...
|
@@ -117,11 +129,12 @@ const queryReason = (req, res, next) => { |
|
|
* @param next
|
|
|
*/
|
|
|
const saveMessage = (req, res, next) => {
|
|
|
const uid = req.user.uid;
|
|
|
const content = req.body.content;
|
|
|
const encId = req.body.encryptedUid;
|
|
|
const cvId = req.body.conversationId;
|
|
|
|
|
|
clientApi.saveMessage(content, encId, cvId)
|
|
|
clientApi.saveMessage(content, encId, cvId, uid)
|
|
|
.then(result => {
|
|
|
res.json(result);
|
|
|
}).catch(next);
|
...
|
...
|
|