master
kira 6 years ago
parent 4948539479
commit 016f5f94b1

@ -124,7 +124,7 @@ public class OpenimClient {
list2.add(obj3); list2.add(obj3);
obj3.setNick("king"); obj3.setNick("king");
obj3.setIconUrl("https://ss0.baidu.com/73t1bjeh1BF3odCf/it/u=1948403834,955109320&fm=85&s=0D06E5134AD145F30C8D6D680300303A"); obj3.setIconUrl("https://ss0.baidu.com/73t1bjeh1BF3odCf/it/u=1948403834,955109320&fm=85&s=0D06E5134AD145F30C8D6D680300303A");
obj3.setUserid("kira2"); obj3.setUserid("kira3_PINE");
obj3.setPassword("xxxxxx"); obj3.setPassword("xxxxxx");
req.setUserinfos(list2); req.setUserinfos(list2);
OpenimUsersAddResponse rsp = null; OpenimUsersAddResponse rsp = null;

@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.BoundListOperations; import org.springframework.data.redis.core.BoundListOperations;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -118,7 +119,11 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
queryParams.put("clientId", client.getIntValue("client_id")); queryParams.put("clientId", client.getIntValue("client_id"));
} }
if (StringUtils.isNotEmpty(userNames)) { if (StringUtils.isNotEmpty(userNames)) {
queryParams.put("userNames", Arrays.asList(userNames.split(","))); List<String> userNams = Arrays.asList(userNames.split(","));
if(CollectionUtils.isEmpty(userNams)){
return Collections.EMPTY_LIST;
}
queryParams.put("userNames",userNams );
} }
if (queryParams.size() < 1) { if (queryParams.size() < 1) {
return Collections.emptyList(); return Collections.emptyList();

@ -99,7 +99,7 @@
<![CDATA[ <![CDATA[
SELECT display_name SELECT display_name
FROM sys_managers FROM sys_managers
WHERE role & #{mask} >0 AND org_id IS NULL AND is_valid = 1 WHERE role & #{mask} >0 AND (org_id IS NULL or org_id=1) AND is_valid = 1
]]> ]]>
</select> </select>

@ -62,8 +62,8 @@
var cnts = data.data.cnts; var cnts = data.data.cnts;
for (var i = cnts.length - 1; i >= 0; i--) { for (var i = cnts.length - 1; i >= 0; i--) {
var unreadmapEle = {msgCount: 0}; var unreadmapEle = {msgCount: 0};
window.sdk.unreadMap[WKIT.Conn.sdk.Base.getNick( window.sdk.unreadMap[getName(WKIT.Conn.sdk.Base.getNick(
cnts[i].from)] = unreadmapEle; cnts[i].from))] = unreadmapEle;
} }
getUnreadMsgCount(); getUnreadMsgCount();
}, },
@ -78,18 +78,20 @@
WKIT.Conn.sdk.Base.getUnreadMsgCount({ WKIT.Conn.sdk.Base.getUnreadMsgCount({
count: 40, count: 40,
success: function (data) { success: function (data) {
console.log(data);
var unreads = data.data; var unreads = data.data;
var uids = ""; var uids = "";
for (var i = unreads.length - 1; i >= 0; i--) { for (var i = unreads.length - 1; i >= 0; i--) {
if(window.sdk.unreadMap[WKIT.Conn.sdk.Base.getNick(unreads[i].contact)]){ window.sdk.unreadMap[getName(WKIT.Conn.sdk.Base.getNick(unreads[i].contact))].msgCount =
unreads[i].msgCount;
var nick = getName(WKIT.Conn.sdk.Base.getNick(unreads[i].contact));
if(nick.length<=6){
uids += nick+",";
}else {
uids += nick.substring(0,uid.length-5) + ",";
} }
window.sdk.unreadMap[WKIT.Conn.sdk.Base.getNick(unreads[i].contact)].msgCount =
unreads[i].msgCount;
var nick = WKIT.Conn.sdk.Base.getNick(unreads[i].contact)
uids += nick.substr(0,nick.length-6) + ",";
} }
console.log("unreadMap",window.sdk.unreadMap);
window.sdk.loadContactList(uids); window.sdk.loadContactList(uids);
}, },
error: function (error) { error: function (error) {
@ -100,7 +102,9 @@
function updateContractList(data) { function updateContractList(data) {
var msg = data.msgs[0]; var msg = data.msgs[0];
var msg_uid = WKIT.Conn.sdk.Base.getNick(msg.from); var msg_uid = getName(WKIT.Conn.sdk.Base.getNick(msg.from))
if (window.sdk.unreadMap[msg_uid]) { if (window.sdk.unreadMap[msg_uid]) {
window.sdk.unreadMap[msg_uid].msgCount = window.sdk.unreadMap[msg_uid].msgCount + 1; window.sdk.unreadMap[msg_uid].msgCount = window.sdk.unreadMap[msg_uid].msgCount + 1;
} else { } else {
@ -116,6 +120,14 @@
$("#J_wkitPluginFrameWrap").css("margin", "0 0 0 0"); $("#J_wkitPluginFrameWrap").css("margin", "0 0 0 0");
} }
function getName(uid) {
if(uid.substring(uid.length-5,uid.length-4)=='_'){
var prefix = uid.substring(0,uid.length-5);
var suffix =uid.substring(uid.length-5,uid.length).toUpperCase();
return prefix+suffix;
}
return uid;
}
function getQueryString(name) { function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg); var r = window.location.search.substr(1).match(reg);

@ -123,11 +123,13 @@
function updateContractList(data) { function updateContractList(data) {
var msg = data.msgs[0]; var msg = data.msgs[0];
var msg_uid = WKIT.Conn.sdk.Base.getNick(msg.from); var msg_uid = WKIT.Conn.sdk.Base.getNick(msg.from).toUpperCase();
if (window.sdk.unreadMap[msg_uid]) { if (window.sdk.unreadMap[msg_uid]) {
window.sdk.unreadMap[msg_uid].msgCount = window.sdk.unreadMap[msg_uid].msgCount + 1; window.sdk.unreadMap[msg_uid].msgCount = window.sdk.unreadMap[msg_uid].msgCount + 1;
window.sdk.unreadMap[msg_uid].lastMsg =msg.msg ;
} else { } else {
var unreadMapEle = {msgCount: 1} var unreadMapEle = {msgCount: 1,msg:msg.msg}
window.sdk.unreadMap[msg_uid] = unreadMapEle; window.sdk.unreadMap[msg_uid] = unreadMapEle;
} }
window.sdk.loadContactList(msg_uid.substr(0, msg_uid - 6)); window.sdk.loadContactList(msg_uid.substr(0, msg_uid - 6));

@ -15,6 +15,7 @@
transition: background-color .1s; transition: background-color .1s;
margin-bottom: 13px; margin-bottom: 13px;
width: 100%; width: 100%;
height: 2rem;
} }
ul { ul {
@ -65,22 +66,26 @@
} }
.avatar { .avatar {
margin-top: 8px; margin-top: 11px;
padding-left: 27px; padding-left: 42px;
}
.msg {
margin-top: 11px;
padding-left: 42px;
} }
.notice { .notice {
width: 15px; width: 1.2rem;
height: 15px; height: 1.2rem;
line-height: 15px; line-height: 1.2rem;
font-size: 10px; font-size: 10px;
color: #fff; color: #fff;
text-align: center; text-align: center;
background-color: #f00; background-color: #f00;
border-radius: 50%; border-radius: 50%;
position: relative; position: relative;
right: -16px; right: -23px;
top: -7px; top: -8px;
} }
.frm_search { .frm_search {
@ -166,31 +171,28 @@
function showContactList(map) { function showContactList(map) {
var contact_list = ''; var contact_list = '';
for (var key in map) { for (var key in map) {
var css = 'hover'; var ele= map[key];
if (key == parent.window.uid) {
css = 'active';
}
var headImUrl = ''; var headImUrl = '';
if (ele.headimg) {
headImUrl = ele.headimg;
if (map[key].headimg) {
headImUrl = map[key].headimg;
} else { } else {
headImUrl = "/static/images/act/encourage_money/default_headimg.png"; headImUrl = "/static/images/act/encourage_money/default_headimg.png";
} }
contact_list += contact_list +=
"<li " + " class=\"" + css + "\" onclick=switchToUser('" + key "<li onclick=switchToUser('" + key
+ "')>" + "')>"
+ "<div class=\"headimg\" style='background-image:url(" + headImUrl + "<div class=\"headimg\" style='background-image:url(" + headImUrl
+ "')>" + "')>"
+ "<div class=\"notice\">" + map[key].msgCount + "</div>" + "<div class=\"notice\">" + ele.msgCount + "</div>"
+ "</div>" + "</div>"
+ "<div class=\"avatar\">" + key + "</div>" + "<div class=\"avatar\">" + key + "</div>";
+ "</li>" if(ele.lastMsg){
contact_list +="<div class=\"msg\">" + ele.lastMsg + "</div>";
}
contact_list+= "</li>";
} }
$("#contact_list").html(contact_list); $("#contact_list").html(contact_list);
} }
function switchToUser(touid) { function switchToUser(touid) {
parent.document.getElementById("subPage").contentWindow.switchTouid(touid); parent.document.getElementById("subPage").contentWindow.switchTouid(touid);
parent.hideList(); parent.hideList();

@ -12,10 +12,10 @@
container: document.getElementById('J_demo'), container: document.getElementById('J_demo'),
width: 700, width: 700,
height: 500, height: 500,
uid: 'kira2', uid: 'kira3_PINE',
appkey: 24980715, appkey: 24980715,
credential: 'xxxxxx', credential: 'xxxxxx',
touid: 'kira', touid: 'kira7',
logo: 'http://img.alicdn.com/tps/i3/TB12LD9IFXXXXb3XpXXSyFWJXXX-82-82.png', logo: 'http://img.alicdn.com/tps/i3/TB12LD9IFXXXXb3XpXXSyFWJXXX-82-82.png',
}); });
} }

Loading…
Cancel
Save