The blog has not been updated recently. The project uses a small function of chatting with customer service and showing whether it is online or not. Record it:
If you want to check the online status of qq and initiate a real-time chat (refer to the previous blog), you must go to this website to open qq promotion (http://shang.qq.com/v3/widget.html)
http://webpresence.qq.com/getonline?Type=1&123456:1111:Concatenate request URL. Return online array
java code
StringBuffer sb = new StringBuffer(); sb.append("http://webpresence.qq.com/getonline?Type=1&"); for (CustomerServiceDTO customerServiceDTO : customerList) { sb.append(customerServiceDTO.getCustomerServiceQQ()+":"); } model.addAttribute ("qqList", sb);
<!--Customer Service--> <div class="kefu_wrap"> <img class="kefu_img" src="<%=basePath%>web/base/images/static/kefu.png"/> <p class="link_icon"> <c:forEach items="${customerList}" var="customer"> <a class="shouhou0 shouhou1" href="tencent://Message/?Uin=${customer.customerServiceQQ}&site=qq&menu=yes" target="_Blank"><input class="active" type="text" value="${customer.customerServiceName}" style="border:none;" onclick="window,location=this.parentNode.href;" readonly="readonly"/></a> <!--.shouhou0为离线状态,.shouhou1为在线状态 --> </c:forEach> </p> <p class="kefu_phone">Customer Service Phone<br />400-</p> <img class="kefu_erweima" src="kefu.png"/> </div> <script type="text/javascript"> var online = new Array(); </script> <script type="text/javascript" src="${qqList}"></script> <script type="text/javascript"> for (var i = 0; i < online.length; i++) { if (online[i] == 0) { //Here are different css displayed offline and online, which can be modified according to your own situation $(".link_icon a").eq(i).find("INPUT").removeClass("active"); $(".link_icon a").eq(i).removeClass("shouhou1"); } } </script>