• 上篇博客介绍了聊天功能,这里介绍通讯录是如何实现的。首先要加载公司的所有部门,树形结构,然后点击进入部门的人员列表,点击人员能查看详细信息。 一、界面 二、代码实现 1.controller /** * 加载部门列表 ...

              上篇博客介绍了聊天功能,这里介绍通讯录是如何实现的。首先要加载公司的所有部门,树形结构,然后点击进入部门的人员列表,点击人员能查看详细信息。

    一、界面

             公司部门的树形结构

        部门成员列表:


            个人详细信息:


    二、代码实现

    1.controller

            /**
    	 * 加载部门列表
    	 */
    	@RequestMapping("/addressListDepartmentjsp.do")
    	public void  addressListDepartment(HttpServletRequest request, HttpServletResponse response) throws IOException{
    		request.setCharacterEncoding("utf-8");
    		response.setCharacterEncoding("utf-8");
    		
    	    List<JsonTree> jsList = addressListService.getTree();
    	    JSONArray jsonArray = JSONArray.fromObject(jsList);
    	    PrintWriter out = response.getWriter();
    	    out.print(jsonArray);
    	}
    	
    	
    	/**
    	 * 加载部门成员列表
    	 */
    	@RequestMapping("/addressListUserList.do")
    	public String addressListuserList(HttpServletRequest request,HttpServletResponse response) throws UnsupportedEncodingException{
    		 request.setCharacterEncoding("utf-8");
    		 response.setCharacterEncoding("utf-8");
    		 String deptId=request.getParameter("Departmentid");
    		 String d=request.getParameter("departmentName");
    		 String departmentName = new String(d.getBytes("ISO-8859-1"),"utf-8");
    		 List<UserDetail> userDetail = addressListService.getUserDetail(deptId);
    		 
    		 request.setAttribute("userDetail", userDetail);
    		 request.setAttribute("departmentName", departmentName);
    		 return "addressListUserList";
    	}
    	
    	
    	/**
    	 * 查看员工详细信息
    	 */
    	@RequestMapping("/addressListUserInfo.do")
    	public String addressListuserInfo(HttpServletRequest request,HttpServletResponse response) throws UnsupportedEncodingException{
    		request.setCharacterEncoding("utf-8");
    		response.setCharacterEncoding("utf-8");
    		
    		String n=request.getParameter("name");
    		String name = new String(n.getBytes("ISO-8859-1"),"utf-8");
    		String mobile=request.getParameter("mobile");
    		String email=request.getParameter("email");
    		String weixinid=request.getParameter("weixinid");
    		String avatar=request.getParameter("avatar");
    		String d=request.getParameter("departmentName");
    		String departmentName = new String(d.getBytes("ISO-8859-1"),"utf-8");
    		request.setAttribute("name", name);
    		request.setAttribute("mobile", mobile);
    		request.setAttribute("email",email);
    		request.setAttribute("weixinid", weixinid);
    		request.setAttribute("avatar", avatar);
    		request.setAttribute("departmentName", departmentName);
    		
    		return "addressListUserInfo";
    	}


    2.serviceImpl

    	/**
    	 * 加载部门列表
    	 */
    	public List<JsonTree> getTree(){
    		//1.先获取token
    		String accessToken = CommonUtil.getAccessToken("wxe510946434680dab", "eWTaho766INvp4e1MCsz1mHYuT2DAleb62REQ3vsFizhY4vtmwZpKweuxUVh33G0").getAccessToken();
    		//2.获取部门列表
    		List<Department> departmentList = AdvancedUtil.getDepartment(accessToken);
    		//根据部门列表转换为页面需要的格式
    		List<JsonTree> jsList = this.convertList(departmentList);
    		return jsList;
    	}
    	
    	/**
    	 * 转为ZTree的格式
    	 */
    	public List<JsonTree> convertList( List<Department> departmentList)
        {
            List<JsonTree> rootNode = new ArrayList<JsonTree>();
           
            for (int i = 0; i < departmentList.size(); i++) {
            	for (int j = i+1; j <departmentList.size(); j++) {
            		if (departmentList.get(i).getId()==departmentList.get(j).getParentid()) {
    					JsonTree jt = new JsonTree();
    					jt.setId(departmentList.get(i).getId());
    					jt.setName(departmentList.get(i).getName());
    					jt.setpId(departmentList.get(i).getParentid());
    					jt.setOpen(false);
    					jt.setUrl("");
    					rootNode.add(jt);
    					break;
    				}else {
    					JsonTree jt = new JsonTree();
    					jt.setId(departmentList.get(i).getId());
    					jt.setName(departmentList.get(i).getName());
    					jt.setpId(departmentList.get(i).getParentid());
    					jt.setOpen(false);
    					jt.setUrl("addressListUserList.do?Departmentid="+departmentList.get(i).getId()+"&departmentName="+departmentList.get(i).getName());
    					
    					rootNode.add(jt);
    					break;
    				}
    			}
    
    		}
            return rootNode;
        }
    	
    	/**
    	 * 加载部门成员列表
    	 */
    	public List<UserDetail> getUserDetail(String deptId){
    		//1.先获取token
    		String accessToken = CommonUtil.getAccessToken("wxe510946434680dab", "eWTaho766INvp4e1MCsz1mHYuT2DAleb62REQ3vsFizhY4vtmwZpKweuxUVh33G0").getAccessToken();
    		
    		//2.根据部门id和token的值获取部门成员列表
    		List<UserDetail> userDetail = AdvancedUtil.getUserDetail(accessToken, deptId);
    		
    		return userDetail;
    	}


    3.工具类

    //获取部门列表
    public static List<Department> getDepartment(String accessToken) {
    		List<Department> departmentList = null;
    		//  https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token=ACCESS_TOKEN
    		String requestUrl = "https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token=ACCESS_TOKEN";
    		requestUrl = requestUrl.replace("ACCESS_TOKEN", accessToken);
    	
    		JSONObject jsonObject = CommonUtil.httpsRequest(requestUrl, "GET", null);
    
    		if (null != jsonObject) {
    			try {
    				departmentList = JSONArray.toList(jsonObject.getJSONArray("department"), Department.class);
    			} catch (JSONException e) {
    				departmentList = null;
    				int errorCode = jsonObject.getInt("errcode");
    				String errorMsg = jsonObject.getString("errmsg");
    				
    			}
    		}
    		return departmentList;
    	}
    //获取部门成员详情
    public static List<UserDetail> getUserDetail(String accessToken,String departmentId){
    		List<UserDetail> userDetail = null;
    		String requestUrl = "https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token=ACCESS_TOKEN&department_id=DEPARTMENT_ID&fetch_child=1&status=0";
    		requestUrl = requestUrl.replace("ACCESS_TOKEN", accessToken).replace("DEPARTMENT_ID", departmentId);
    		
    		JSONObject jsonObject = CommonUtil.httpsRequest(requestUrl, "GET", null);
    
    		if (null != jsonObject) {
    			try {
    				userDetail = JSONArray.toList(jsonObject.getJSONArray("userlist"),UserDetail.class);
    			} catch (JSONException e) {
    				userDetail = null;
    				int errorCode = jsonObject.getInt("errcode");
    				String errorMsg = jsonObject.getString("errmsg");
    				
    			}
    		}
    		return userDetail;
    	}



    4.js

    <script type="text/javascript">
    		var curMenu = null, zTree_Menu = null;
    		var setting = {
    			view: {
    				showLine: false,
    				showIcon: false,
    				selectedMulti: false,
    				dblClickExpand: false,
     				addDiyDom: addDiyDom
    			},
    			data: {
    				simpleData: {
    					enable: true
    				}
    			},
    			callback: {
    				beforeClick: beforeClick
    			}
    		};
    		var zNodes = null;
    		$.ajax({
    				type : "post",
     				async: false,
    				url :"addressListDepartmentjsp.do",
    				success : function(data) {
    				zNodes = eval('(' + data + ')');
    				},
    				error : function(data) {				
    					
    				}
    			});
    		 
    		function addDiyDom(treeId, treeNode) {
    			var spaceWidth = 5;
    			var switchObj = $("#" + treeNode.tId + "_switch"),
    			icoObj = $("#" + treeNode.tId + "_ico");
    			switchObj.remove();
    			icoObj.before(switchObj);
    
    			if (treeNode.level > 1) {
    				var spaceStr = "<span style='display: inline-block;width:" + (spaceWidth * treeNode.level)+ "px'></span>";
    				switchObj.before(spaceStr);
    			}
    		}
    
    		function beforeClick(treeId, treeNode) {
    		   var str ='' ;
    			str = getAllChildrenNodes(treeNode,str);
    			if (str.substr(0,1)==',') str=str.substr(1);
    			if(str!=""){
    				treeNode.url="";
    				var zTree = $.fn.zTree.getZTreeObj("treeDemo");
    				zTree.expandNode(treeNode);
    				return false;
    			}
    			if(str==""){
    			
    			}
    			return true;
    		}
    		
    // 		张晓   朱丹
    		function getAllChildrenNodes(treeNode,result){
    			//var strResult=result;
    	 		if (treeNode.isParent) {
    				var childrenNodes = treeNode.children;
    				if (childrenNodes) {
    					for (var i = 0; i < childrenNodes.length; i++) {
    						result += ',' + childrenNodes[i].id;
    					}
    				}
    			}
    		return result;
    		}
     		 $(document).ready(function(){
    			var treeObj = $("#treeDemo");
    			$.fn.zTree.init(treeObj, setting, zNodes);
    			zTree_Menu = $.fn.zTree.getZTreeObj("treeDemo");
    			curMenu = zTree_Menu.getNodes()[0].children[0].children[0];
    			zTree_Menu.selectNode(curMenu);
    
    			treeObj.hover(function () {
    				if (!treeObj.hasClass("showIcon")) {
    					treeObj.addClass("showIcon");
    				}
    			}, function() {
    				treeObj.removeClass("showIcon");
    			});
    		});
    	</script>
    	<style type="text/css">
    		.ztree * {font-size: 13pt;font-family:"Microsoft Yahei",Verdana,Simsun,"Segoe UI Web Light","Segoe UI Light","Segoe UI Web Regular","Segoe UI","Segoe UI Symbol","Helvetica Neue",Arial}
    		.ztree li ul{ margin:0; padding:0}
    		.ztree li {line-height:30px;}
    		.ztree li a {width:100%;height:30px;padding-top: 0px;border-bottom:1px #EEEEEE solid}
    		.ztree li a:hover {text-decoration:none; background-color: #E7E7E7;}
    /* 		.ztree li a span.button.switch {visibility:hidden} */
    		.ztree.showIcon li a span.button.switch {visibility:visible}
    		.ztree li a.curSelectedNode {background-color:#D4D4D4;border:0;height:30px;}
    		.ztree li span {line-height:30px;}
    		.ztree li span.button {margin-top: -7px;}
    		.ztree li span.button.switch {width: 16px;height: 16px;}
    		
    		.ztree li a.level0 span {font-size: 150%;font-weight: bold;}
    		.ztree li span.button {background-image:url("images/left_menuForOutLook.png"); *background-image:url("./left_menuForOutLook.gif")}
    		.ztree li span.button.switch.level0 {width: 20px; height:20px}
    		.ztree li span.button.switch.level1 {width: 20px; height:20px}
    		.ztree li span.button.noline_open {background-position: 0 0;}
    		.ztree li span.button.noline_close {background-position: -18px 0;}
    		.ztree li span.button.noline_open.level0 {background-position: 0 -18px;}
    		.ztree li span.button.noline_close.level0 {background-position: -18px -18px;}
    	</style>
     </head>
    
    	<body>
    	 <div data-role="page" id="UserMain">
    		<div class="content_wrap" style="width:96%;height:98%;margin-left: auto;margin-right: auto;" >
    			<div class="zTreeDemoBackground left" style="width:100%;height:98%;" >
    				<ul id="treeDemo" class="ztree" style="width:98%;height:98%;" ></ul>
    			</div>
    		</div>
    		<span id="zNodes"></span>
    		</div>
    	</body>


    三、总结

                通讯录功能并没有想象中的难,树结构采用ztree框架,后台查到的数据必须转换为ztree定义的名称,然后部门成员列表的显示和查询用到jquery mobile,在以后的博客中再介绍这种js的使用,从名字上就知道它是专门为手机页面开发的。

    展开全文
  • 通讯录  复选列表项                    
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="viewport" content="initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script src="Scripts/jquery-1.8.2.min.js"></script>
        <link href="weui-0.4.2/dist/style/weui.css" rel="stylesheet" />
        <script src="Scripts/jquery-ui-1.8.24.min.js"></script>
        <script src="WXJS/Wxjs.js"></script>


        <title>通讯录</title>
    </head>
    <body>
        <!--<div class="weui_cells_title">复选列表项</div>
            <div class="weui_cells weui_cells_checkbox">
                <label class="weui_cell weui_check_label" for="s0">
                    <div class="weui_cell_hd">
                        <input type="checkbox" class="weui_check" name="checkbox1" id="s0" checked="checked">
                        <i class="weui_icon_checked"></i>
                    </div>
                    <div class="weui_cell_bd weui_cell_primary">

                        <img src="#" alt="图片" id="showImg"/>
                        <label id="showName"></label>
                    </div>
                </label>
                <label class="weui_cell weui_check_label" for="s12">
                    <div class="weui_cell_hd">
                        <input type="checkbox" name="checkbox1" class="weui_check" id="s12">
                        <i class="weui_icon_checked"></i>
                    </div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <p>standard is dealicient for u.</p>
                    </div>
                </label>


            </div>-->

        <div id="deptContainer">
            <!--<div>
                <div id="empContainer">开发部</div>
                <div id="dept_1">
                    <div id="emp_1">张三</div>
                    <div id="emp_2">李四</div>
                    <div id="emp_3">王五</div>
                </div>
            </div>

            <div>
                <div>开发部</div>
                <div id="dept_2">
                    <div id="emp_4">张三</div>
                    <div id="emp_5">李四</div>
                    <div id="emp_6">王五</div>
                </div>
            </div>-->
        </div>
        <input type="button" name="name" value="获取部门id" id="getDepartmentId" />

        <input type="button" name="name" value="提交(获取选中人员信息)" id="getMemberInfo" />
        <br />
        <div id="test">测试是否会消失</div>
        <br />


        <script>
            //获取用户列表---头像,名称……

            //1.先获得所有的部门  2.根据获得所有的员工 3.根据id 将成员分组 4.将成员放在不同的div中
            $(function () {
                var deptId;
                $("#getDepartmentId").click(function () {
                    //  GetDepartmentId("Wechat/Department", "Wechat/DepartmentMemberInfo");

                    GetDepartmentList(function (data) {
                        GetEmployees(data.department[0].id, function (emps) {
                            var depts = data.department;

                            var deptContainer = $("#deptContainer");

                            deptContainer.empty();

                            for (var i = 0; i < depts.length; i++) {
                                deptId = depts[i].id; //获取部门id
                                var deptName = depts[i].name; //获取部门名称
                                //根据部门id获得成员信息列表
                                var str = '<div id="' + deptId + '"><span>' + '<strong>' + deptName + '</strong>' + '&nbsp' + '&nbsp' + '&nbsp' + '&nbsp' + '&nbsp' + '&nbsp' + '&nbsp' + '>' + '</span></div>';
                           
                                deptContainer.append(str);

                               
                                var userList = emps.userlist;
                                for (var j = 0; j < userList.length; j++) {
                                    var memberDept = userList[j].department;

                                    if (memberDept.indexOf(deptId) != -1) {
                                        var userid = userList[j].userid;
                                        var img = userList[j].avatar;
                                        var name = userList[j].name;
                                        var department = userList[j].department;
                                        var position = userList[j].position;
                                        var mobile = userList[j].mobile;
                                        var gender = userList[j].gender;
                                        var email = userList[j].email;
                                        var extattr = userList[j].extattr;

                                        if (img != null) {
                                            img += '64';
                                        } //将最后的/0 改成/64


                                        //页面中带有成员信息,在提交用户信息时可以使用

                                        var userHtml = '<div class="weui_cells weui_cells_checkbox" id="' + userid + '"><label class="weui_cell weui_check_label" for="u' + deptId + userid + '"><div class="weui_cell_hd"><input type="checkbox" class="weui_check" id="u' + deptId + userid + '"><i class="weui_icon_checked"></i></div><div class="weui_cell_bd weui_cell_primary"><img src="' + img + '" alt="图片" id="showImg" /><label id="showName">' + name + '</label><div value="' + userid + '" id="userid"></div><div value="' + department + '" id="department">' +
                                            '</div><div value="' + position + '" id="position"></div><div value="' + mobile + '" id="mobile"></div>' +
                                            '<div value="' + gender + '" id="gender"></div><div value="' + email + '" id="email"></div><div value="' + extattr + '" id="extattr"></div></div></label></div>';

                                        //  empContainer.append(userHtml);
                                       
                                        $("#"+deptId).append(userHtml);
                                    }
                                }

                            }

                        });

                    });
                });
                //这里的selector必须是唯一的,不然它会触发多次事件


                $('#deptContainer').on("click", "span", function () {
                  
                    $(this).siblings('.weui_cells').slideToggle();
                });
            });

           


            var img;
            var name;
            var userid;
            var department;

            var position;
            var mobile;
            var gender;
            var email;
            var extattr;

            $('#getMemberInfo').click(function () {
                var check = $('.weui_check');


                var array = new Array;

                for (var i = 0; i < check.length; i++) {
                    if (check[i].checked) {
                        var c = check[i];
                        //选中input checkbox的父元素
                        var p = c.parentNode;
                        //下一个兄弟元素
                        var nextBrother = p.nextElementSibling;
                        //获取图片
                        img = nextBrother.firstChild.attributes.src.value;
                        //姓名
                        name = nextBrother.innerText;
                        //递归向下一个兄弟元素,取得需要的值
                        var userName = nextBrother.firstChild.nextElementSibling; // 成员姓名
                        var userId;
                        userId = userName.nextElementSibling; //成员userid
                        userid = userId.attributes.value.value;

                        var departmentS = userId.nextElementSibling; //成员department
                        department = departmentS.attributes.value.value;

                        var positionS = departmentS.nextElementSibling;  //成员职位
                        position = positionS.attributes.value.value;

                        var mobileS = positionS.nextElementSibling; //成员mobile
                        mobile = mobileS.attributes.value.value;


                        var genderS = mobileS.nextElementSibling; //成员gender
                        gender = genderS.attributes.value.value;

                        var emailS = genderS.nextElementSibling; //成员email
                        email = emailS.attributes.value.value;

                        var extattrS = emailS.nextElementSibling; //成员extattr
                        extattr = extattrS.attributes.value.value;
                        //传到另一个页面
                        //var info = new JSON;
                        //info.key = "name";
                        var info = {
                            "name": name,
                            "image": img,
                            "userId": userid,
                            "department": department,
                            "position": position,
                            "mobile": mobile,
                            "gender": gender,
                            "email": email,
                            "extattr": extattr
                        };
                        var infos = JSON.stringify(info);
                        array.push(infos);

                    }
                }

                var storage = window.localStorage;
                var hel = JSON.stringify(array);
                storage.setItem("memberInfo", hel);
                var result = storage.getItem("memberInfo");
                var value = JSON.parse(result);
                var v = value[0];
                var k = JSON.parse(v);
                var r = k.name;

                alert(r);

            });
          
        </script>
    </body>
    </html>
    '
    展开全文
  • 微信企业号升级后,使用之前的方法添加部门和人员就会有问题。是因为AccessToken的获取修改了,现在获取AccessToken的方法有一些改变,现在每一个应用都有自己的...但获取通讯录的信息,任何一个应用的Access

    微信企业号升级后,使用之前的方法添加部门和人员就会有问题。是因为AccessToken的获取修改了,现在获取AccessToken的方法有一些改变,现在每一个应用都有自己的AccessToken,而不是原来的只有一个AccessToken,因此获取AccessToken是需要根据应用获取对应的AccessToken,而不是原来的AccessToken。但获取通讯录的信息,任何一个应用的AccessToken都可以使用,但修改删除和添加只能使用通讯录同步的AccessToken,并且需要在管理界面进行相应的设置。如下:




    设置成功后可以看到:


    已经不能再通讯录后台管理通讯录了。


    然后就可以根据之前的通讯录API管理通讯录了。

    需要注意的是使用其他应用的AccessToken能获取到的通讯录信息是和这个应用的可见范围相关的,不在可见范围的人员部门是不能获取的。
    如下的应用只能获取通讯录下分公司下边的人员部门等信息,并且不能修改相关信息。


    展开全文
  • 江南鹤微信hook二次开发获取通讯录 【江南鹤微信hook二次开发c#源代码】中包含比较全面的功能。以后的日子里,我会逐一为大家详细讲解! 今天讲解的是用【江南鹤微信hook二次开发c#源代码】获取通讯录 用【江南...

    最新微信hook二次开发之获取通讯录

    【最新微信hook二次开发c#源代码】中包含比较全面的功能。以后的日子里,我会逐一为大家详细讲解! 今天讲解的是用【江南鹤微信hook二次开发c#源代码】获取通讯录

    用【江南鹤微信hook二次开发c#源代码】获取通讯录分以下几步:

    1 发送获取通讯录的请求

    private void btn_GetContact_Click(object sender, EventArgs e)
        {
            if(nmHeler.Socket_ConnId == 0)
               { MessageBox.Show("请选择一个操作账号!"); return; }
            nmCore.NM_GetContactList(nmHeler.Socket_ConnId);
        }
      /// <summary>
        /// 功能_读取通讯录列表
        /// </summary>
        /// <param name="ConnID"></param>
        public void NM_GetContactList(int ConnID)
        {
            JObject sendJson = new JObject {["PackType"] = NMHelper.NM_GetContactList};
            SendPacket(ConnID, sendJson.ToString());
        }

    2 hook程序截获 微信服务器发来的请求结果

        HandleResult OnReceive(IServer sender, IntPtr connId, byte[] bytes)
        {
            string s_Recv = Encoding.Default.GetString(bytes);
            JObject RecvJson = JObject.Parse(s_Recv);
            int RecvType;
            if(nmHeler.Json_GetInt(RecvJson, "PackType",out RecvType) == true)
            {
                if (RecvType == NMHelper.NM_GetContactList)
                {
                    Event_RecvContactList((int)connId, RecvJson);
                }
            }
            return HandleResult.Ok;
        }

    3 对结果进行分析处理

     NMHelper.nmWxidInfo MemberInfo = new NMHelper.nmWxidInfo
      {
       Type = nmHeler.Json_GetIntEx((JObject) JtMember, "Type"),
       List = nmHeler.Json_GetIntEx((JObject) JtMember, "List"),
       Wxid = nmHeler.Json_GetString((JObject) JtMember, "Wxid", true),
       WxNo = nmHeler.Json_GetString((JObject) JtMember, "WxNo", true),
       Nick = nmHeler.Json_GetString((JObject) JtMember, "Nick", true),
       Mark = nmHeler.Json_GetString((JObject) JtMember, "Mark", true),
        HeadIMG = nmHeler.Json_GetString((JObject) JtMember, "HeadIMG", true)
    };

    4 分类列出通讯录列表

        void Event_RecvContactList(int ConnID, JObject RecvJson)
        {
            string outLog = "[通讯录列表]" + nmHeler.Json_GetString(RecvJson, "RecvWxid", true) + NewLine;
            int dwState = nmHeler.Json_GetIntEx(RecvJson, "State");
            if(dwState == 0)
            {
                outLog += "通讯录列表读取失败!";
                WriteLog(outLog);
                return;
            }
            JArray m_List = RecvJson.Value<JArray>("List");
            if(m_List != null)
            {
                list_Friend.BeginUpdate(); list_Group.BeginUpdate(); list_GHFriend.BeginUpdate();
                list_Friend.Items.Clear(); list_Group.Items.Clear(); list_GHFriend.Items.Clear();
                for (int i = 0; i < m_List.Count; i++) 
                {
                    JToken JtMember = m_List.ElementAt(i);
                    if(JtMember != null)
                    {
                        NMHelper.nmWxidInfo MemberInfo = new NMHelper.nmWxidInfo
                        {
                            Type = nmHeler.Json_GetIntEx((JObject) JtMember, "Type"),
                            List = nmHeler.Json_GetIntEx((JObject) JtMember, "List"),
                            Wxid = nmHeler.Json_GetString((JObject) JtMember, "Wxid", true),
                            WxNo = nmHeler.Json_GetString((JObject) JtMember, "WxNo", true),
                            Nick = nmHeler.Json_GetString((JObject) JtMember, "Nick", true),
                            Mark = nmHeler.Json_GetString((JObject) JtMember, "Mark", true),
                            HeadIMG = nmHeler.Json_GetString((JObject) JtMember, "HeadIMG", true)
                        };
                        ListViewItem UserItem = new ListViewItem();
    
                        if (MemberInfo.Type == 8 || MemberInfo.Type == 24 || MemberInfo.Type == 29)
                        {
                            UserItem.Text = MemberInfo.Nick;
                            UserItem.SubItems.Add(MemberInfo.Wxid);
                            UserItem.SubItems.Add(MemberInfo.WxNo);
                            UserItem.SubItems.Add(MemberInfo.HeadIMG);
                            list_GHFriend.Items.Add(UserItem);
                        }
                        else if (MemberInfo.Wxid.LastIndexOf("@chatroom") != -1)
                        {
                            UserItem.Text = MemberInfo.Nick == string.Empty ? "群聊" : MemberInfo.Nick;
                            UserItem.SubItems.Add(MemberInfo.Wxid);
                            UserItem.SubItems.Add(MemberInfo.WxNo);
                            UserItem.SubItems.Add(MemberInfo.List.ToString());
                            UserItem.SubItems.Add(MemberInfo.HeadIMG);
                            list_Group.Items.Add(UserItem);
                        }
                        else if (MemberInfo.List != 2)
                        {
                            UserItem.Text = MemberInfo.Nick;
                            UserItem.SubItems.Add(MemberInfo.Mark);
                            UserItem.SubItems.Add(MemberInfo.Wxid);
                            UserItem.SubItems.Add(MemberInfo.WxNo);
                            UserItem.SubItems.Add(MemberInfo.HeadIMG);
                            list_Friend.Items.Add(UserItem);
                        }
                    }
                }
                list_Friend.EndUpdate();
                list_Group.EndUpdate();
                list_GHFriend.EndUpdate();
                outLog += "通讯录列表读取成功";
                outLog += ",好友:" + list_Friend.Items.Count.ToString();
                outLog += ",群聊:" + list_Group.Items.Count.ToString();
                outLog += ",好友:" + list_GHFriend.Items.Count.ToString();
                WriteLog(outLog);
            }
        }

    15866555201-2-1024x642.png

    交流请+vx weixinhook

    展开全文
  • wx.addPhoneContact({  success:function(e){  } }) 参数: photoFilePath // 头像本地文件路径 lastName //姓氏 nickName //昵称 middleName //中间名 firstName //名字 remark //备注 ......

    wx.addPhoneContact({

          success:function(e){

           }

    })

    参数:

    photoFilePath // 头像本地文件路径

    lastName  //姓氏

    nickName  //昵称

    middleName //中间名

    firstName  //名字

    remark //备注

    mobilePhoneNumber //手机号

     

    回调结果

    success  //添加成功

    fail //用户取消操作

     

    调用成功参数请看官方文档,下面是地址

    https://developers.weixin.qq.com/miniprogram/dev/api/phone-contact.html#wxaddphonecontactobject

    展开全文
  • 获取通讯录员工的信息并保存到数据库,获取部分已经明白。 获取到的是个JSONObject,json是小白,怎么将JSONObject解析出来并将结果存储到数据库?最好有代码和注释,小白求教!
  • 第一步: 后台管理界面开启通讯录同步 第二步. 后面要设置接收事件服务器,目前我还没做,可以参考: https://www.cnblogs.com/shirui/p/7365538.html#commentform 第三步. AccessTokenController中,直接在...
  • 最近已经是第四次开发微信公众号,这一次的开发任务是完成一个微信企业号的开发, 主要是利用微信企业号进行办公管理。而其中很重要的一个功能即为本地通讯录微信服务器上的通讯录保持同步。  而基本的实现逻辑...
  • 微信小程序通讯录demo

    2019-04-01 11:38:20
    前言 帮别人做的一个展示用的demo,最开始只需要一些假数据展示看看效果。不过到最后也没用上,所以就拿出来分享一下吧。我自己把后台接口部分给简单补齐了,做了一些假数据,样式也做了...如果是初学微信小程序的...
  • 参考文档 开发API:https://work.weixin.qq.com/api/doc/90000/90135/90194 ...1、先获取token(每一步操作都需要用到token) 获取token需要用corpid和secret “我的企业”中可以查看企业ID(corpi...
  • 还没吃饭呢,刚写了下企业号通讯录接口,拿出来,有需要的可以找我要源码,转载请标明出处,尊重他人劳动成果,好吧,上代码图和思想先。 企业号通讯录具备完全开放的接口,你的应用可以调用这些接口管理部门...
  • 原文:C#开发微信门户及应用(18)-微信企业号的通讯录管理开发之成员管理在上篇随笔《C#开发微信门户及应用(17)-微信企业号的通讯录管理开发之部门管理》介绍了通讯录的部门的相关操作管理,通讯录管理包括部门管理...
  • 参考腾讯提供的企业微信api,得知企业微信在同步通讯录时需要先将部门和人员按照规定格式上传,然后再根据上传后返回的media_id执行部门或者人员的覆盖操作。 话不多说,直接上菜。 同步程序 public string ...
  • 1.获取通讯录密钥 获取方式: 登录企业微信—>管理工具—>通讯录同步助手—>开启“API接口同步” ; 开启后,即可看到通讯录密钥,也可设置通讯录API的权限:读取或者编辑通讯录。 获取通讯录密钥的目的: ...
  • 一、前台 1、communication.wxml&lt;view class="wa-list"&gt; &lt;view wx:for="{{communications}}" wx:key="item.id" class="wa-item wa-item-ava&...item-img-r
  • 微信小程序实现通讯录功能wxSortPickerView.zip
  • 企业号所需信息及详细设置看官方文档,如题所示,这里涉及通讯录管理和消息发送,详情如下:基础设置部分 先测试是否可以正常获取ACCESS_TOKEN //获取token String corpid = ""; String corpsecret = ...
  • 本篇主要还是继续介绍企业号的开发工作的开展,介绍微信企业号通讯录管理开发功能,介绍其中组织机构里面如何获取和管理部门的信息等内容。 %26nbsp;1、企业组织的创建和配置 首先我们可以在企业号的管理后台里面...
  • 微信小程序模仿通讯录功能需要用到scroll-view标签 思路:首先需要获取到你所需要展示的数据样式的高度(这就需要用到微信给我们提供的一个API来完成了,因为小程序是没有DOM树结构的,这个可以去看我的前一篇里面有...
  • 首先获取access_token,这边只是简单的获取一下,真的做项目的时候,需要定时获取,可以在监听器或servlet中完成获取,并发到缓存中,之后单独开一篇文章。这边先入门import com.google.gson.Gson; import ...
1 2 3 4 5 ... 20
收藏数 4,198
精华内容 1,679