文章标题

来源:互联网 发布:免费的视频会议软件 编辑:程序博客网 时间:2024/06/16 02:02

Web即时通讯前端组建:LayIM,前端组建配合后台完成即使聊天功能。用到的技术ASP.NET SingalR框架
数据有frend.json,数据格式如图
{
“status”: 1,
“msg”: “ok”,
“data”: [
{
“name”: “销售部”,
“nums”: 36,
“id”: 1,
“item”: [
{
“id”: “100001”,
“name”: “郭敬明”,
“face”: “/images/default.jpg”
},
{
“id”: “100002”,
“name”: “作家崔成浩”,
“face”: “/images/default.jpg”
},
{
“id”: “1000022”,
“name”: “韩寒”,
“face”: “/images/default.jpg”
},
{
“id”: “10000222”,
“name”: “范爷”,
“face”: “/images/default.jpg”
},
{
“id”: “100002222”,
“name”: “小马哥”,
“face”: “/images/default.jpg”
}
]
},
{
“name”: “大学同窗”,
“nums”: 16,
“id”: 2,
“item”: [
{
“id”: “1000033”,
“name”: “苏醒”,
“face”: “/images/default.jpg”
},
{
“id”: “10000333”,
“name”: “马云”,
“face”: “/images/default.jpg”
},
{
“id”: “100003”,
“name”: “鬼脚七”,
“face”: “/images/default.jpg”
},
{
“id”: “100004”,
“name”: “谢楠”,
“face”: “/images/default.jpg”
},
{
“id”: “100005”,
“name”: “徐峥”,
“face”: “/images/default.jpg”
}
]
},
{
“name”: “H+后台主题”,
“nums”: 38,
“id”: 3,
“item”: [
{
“id”: “100006”,
“name”: “柏雪近在它香”,
“face”: “/images/default.jpg”
},
{
“id”: “100007”,
“name”: “罗昌平”,
“face”: “/images/default.jpg”
},
{
“id”: “100008”,
“name”: “Crystal影子”,
“face”: “/images/default.jpg”
},
{
“id”: “100009”,
“name”: “艺小想”,
“face”: “/images/default.jpg”
},
{
“id”: “100010”,
“name”: “天猫”,
“face”: “/images/default.jpg”
},
{
“id”: “100011”,
“name”: “张泉灵”,
“face”: “/images/default.jpg”
}
]
}
]
}

建立简单的Model
public class CSGroupResult
{

public int id {get;set;}
public string name {get;set;}
public int nums {get{return item == nil?0:item.count}}
public Listitem{get;set;}
}

public class CSResult
{
public int status {get;set;}
public string msg {get;set;}
public object data {get;set;}
}
public class CSBaseModel
{
public int id {get;set;}
public string name {get;set;}
public string face{get;set;}
}

public class CSFriend:CSBaseModel{}
public class CSGroup:CSBaseModel{}
public class CSGroups:CSBaseModel{}

public class DBHelper
{

// 获取好友列表
public static CSResult GetFriend()
{
var friends = new List();
for (int i = 0;i < 9;i++){
friends.Add(new CSFriend {id = i, name = “好友” + i, face = “/photos/00” + i + “.jpg”});
}
var friendGroup = new List();
fr
}
}

0 0
原创粉丝点击