NPOI文件导入操作
using EntMSM.SmsDbContext;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Web.Mvc; namespace EntMSM.Controllers
{
public class ContactsController : BaseController
{
EntSmsDbContext esd = new EntSmsDbContext(); /// <summary>
/// iqueryable转datatable
/// </summary>
/// <param name="enumerable"></param>
/// <returns></returns>
public static DataTable ConvertToDataTable(IQueryable<EntMSM.Models.ContactList> database)
{
DataTable table = new DataTable();
table.Columns.Add("编号", typeof(long));
table.Columns.Add("姓名", typeof(string));
table.Columns.Add("电话", typeof(string));
table.Columns.Add("邮箱", typeof(string));
table.Columns.Add("公司", typeof(string));
foreach (EntMSM.Models.ContactList info in database)
{
DataRow row = table.NewRow();
row["编号"] = info.Id;
row["姓名"] = info.LinkName;
row["电话"] = info.LinkMobile;
row["邮箱"] = info.LinkEmails;
row["公司"] = info.LinkCompany;
table.Rows.Add(row);
}
return table;
}
/// <summary>
/// ASP.NET MVC导出CSV文件
/// </summary>
/// <returns></returns>
public ActionResult DataSetToCsv()
{ //定义模版(标题、内容字段、格式化参数)
string[] template = new string[] { "编号,", "姓名,", "电话,", "邮箱,", "公司,","分组名" };
string contactsfileName = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString();
System.IO.MemoryStream output = new System.IO.MemoryStream();
System.IO.StreamWriter writer = new System.IO.StreamWriter(output, System.Text.Encoding.Default);
//输出标题
int lenght = template.GetLength();
for (int i = ; i < lenght; i++)
writer.Write(template[i]);
writer.WriteLine();
//输出内容
EntMSM.Models.Users curr = Session["LoginUser"] as EntMSM.Models.Users; //通过lambda表达式实现多表连接查询 显示对应的 短信账户名称 和角色权限对应名称
var contactsList = esd.ContactLists.AsEnumerable().Join(esd.Groupss, a => a.Groups_Id, b => b.Id,
(a, b) => new { a.Id, a.LinkCompany, a.LinkEmails, a.LinkMobile, a.LinkName, a.Uses_Id, b.Name }).Where(a => a.Uses_Id == curr.Id).DefaultIfEmpty();
//var contactsList = esd.ContactLists.Where(u => u.Uses_Id == curr.Id);
//List<EntMSM.Models.ContactList> lstUser = contactsList.Where(a=>a.Uses_Id==curr.Id).ToList();
if (contactsList != null)
{
foreach (var user in contactsList)
{
writer.Write(user.Id + ",");
writer.Write("\"" + System.Web.HttpUtility.HtmlDecode(user.LinkName) + "\",");
writer.Write(System.Web.HttpUtility.HtmlDecode(user.LinkMobile) + ",");
writer.Write("\"" + System.Web.HttpUtility.HtmlDecode(user.LinkEmails) + "\",");
writer.Write("\"" + System.Web.HttpUtility.HtmlDecode(user.LinkCompany) + "\",");
writer.Write(user.Name);
writer.WriteLine();
}
}
writer.Flush();
output.Position = ;
return File(output, "text/comma-separated-values", contactsfileName + ".csv"); } #region Oledb方式读取EXCEL 导入通讯录
/// <summary>
/// Oledb方式读取EXCEL
/// </summary>
/// <param name="fileNamePath">文件路径</param>
/// <returns>DataTable</returns>
private DataTable ReadExcelByOledb(string fileNamePath, EntMSM.Models.Users currentUser)
{
string connStr = "Provider=Microsoft.Ace.OleDb.12.0;" + "data source=" + fileNamePath + ";Extended Properties='Excel 12.0; HDR=Yes; IMEX=1'";
OleDbConnection oledbconn1 = new OleDbConnection(connStr);
oledbconn1.Open();
DataTable _table = oledbconn1.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" }); string strTableName = string.Empty;
if (_table.Rows.Count > )
{
strTableName = _table.Rows[]["TABLE_NAME"].ToString().Trim();
string sql = string.Format("SELECT * FROM [{0}]", strTableName);
_table = new DataTable();
OleDbDataAdapter da = new OleDbDataAdapter(sql, oledbconn1);
_table.Columns.Add(new DataColumn("Uses_Id", typeof(int)));
_table.Columns["Uses_Id"].DefaultValue = currentUser.Id;//设置该列默认值
da.Fill(_table);
}
oledbconn1.Close();
return _table;
}
/// <summary>
/// 利用NPOI读取Excel
/// </summary>
IWorkbook hssfworkbook;
public DataTable ImportExcelFile(string fileNamePath, string groupsId, EntMSM.Models.Users currentUser)
{
#region//初始化信息
string fileType = fileNamePath.Split('.')[].Trim();
try
{
using (FileStream file = new FileStream(fileNamePath, FileMode.Open, FileAccess.Read))
{
if (fileType == "xlsx")
{
hssfworkbook = new XSSFWorkbook(file);
}
else
{
hssfworkbook = new HSSFWorkbook(file);
}
}
}
catch (Exception e)
{
throw e;
}
#endregion ISheet sheet = hssfworkbook.GetSheetAt();
System.Collections.IEnumerator rows = sheet.GetRowEnumerator(); DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(Int32));
dt.Columns.Add("Uses_Id", typeof(Int32));
dt.Columns.Add("LinkName", typeof(string));
dt.Columns.Add("LinkMobile", typeof(string));
dt.Columns.Add("LinkEmails", typeof(string));
dt.Columns.Add("LinkCompany", typeof(string));
dt.Columns.Add("Groups_Id", typeof(Int32));
rows.MoveNext();
while (rows.MoveNext())
{
IRow row = null;
if (fileType == "xlsx")
{
row = (XSSFRow)rows.Current;
}
else
{
row = (HSSFRow)rows.Current;
} DataRow dr = dt.NewRow();
for (int i = ; i < ; i++)
{
ICell cell = row.GetCell(i);
if (i == )
{
if (cell == null)
{
dr[i] = null;
}
else
{
dr[i] = cell.ToString();
}
}
else if (i == )
{
dr[i] = currentUser.Id;
dr[i + ] = cell.ToString();
}
else if (i == )
{
dr[i+] =int.Parse(groupsId);
}
else
{
if (cell == null)
{
dr[i + ] = null;
}
else
{
dr[i + ] = cell.ToString();
}
}
}
dt.Rows.Add(dr);
}
return dt;
} /// <summary>
/// 读取csv
/// </summary>
/// <param name="filepath"></param>
/// <returns></returns>
private DataTable ReadCsv(string filepath,string groupsId ,EntMSM.Models.Users currentUser)
{
base.IsLogin();
StreamReader sr;
string strTol = string.Empty;
string strTemp = string.Empty;
DataTable dt = new DataTable();
EntMSM.Models.Users curr = Session["LoginUser"] as EntMSM.Models.Users;
int count = ;//导入成功的计数
try
{
sr = new StreamReader(filepath, Encoding.Default);
dt.Columns.Add("Id", typeof(Int32));
dt.Columns.Add("Uses_Id", typeof(Int32));
dt.Columns.Add("LinkName", typeof(string));
dt.Columns.Add("LinkMobile", typeof(string));
dt.Columns.Add("LinkEmails", typeof(string));
dt.Columns.Add("LinkCompany", typeof(string));
dt.Columns.Add("Groups_Id",typeof(Int32));
strTemp = sr.ReadLine();//跳过头部
strTemp = sr.ReadLine();//跳过模板号码 if (strTemp.Split(',').Length > )
{
//针对360手机助手导出的通讯录导入
while (!string.IsNullOrEmpty(strTemp))//如果还有数据,继续读数据
{
count++;
DataRow row = dt.NewRow();
string tel = strTemp.Split(',')[].Trim('"').Trim(' ');
row["Id"] = ;
row["Uses_Id"] = currentUser.Id;
row["LinkName"] = strTemp.Split(',')[].Trim('"').Trim(' ');
row["LinkMobile"] = tel;
row["LinkEmails"] = strTemp.Split(',')[].Trim('"').Trim(' ');
row["LinkCompany"] = strTemp.Split(',')[].Trim('"').Trim(' ');
row["Groups_Id"] =int.Parse(groupsId);
dt.Rows.Add(row);
strTemp = sr.ReadLine();//读取下一行 }
}
else
{
//普通格式的文档导入
while (!string.IsNullOrEmpty(strTemp))//如果还有数据,继续读数据
{
count++;
DataRow row = dt.NewRow();
string tel = strTemp.Split(',')[].Trim('"').Trim(' ');
row["Id"] = ;
row["Uses_Id"] = currentUser.Id;
row["LinkName"] = strTemp.Split(',')[].Trim('"').Trim(' ');
row["LinkMobile"] = tel;
row["LinkEmails"] = strTemp.Split(',')[].Trim('"').Trim(' ');
row["LinkCompany"] = strTemp.Split(',')[].Trim('"').Trim(' ');
row["Groups_Id"] =int.Parse(groupsId);
dt.Rows.Add(row);
strTemp = sr.ReadLine();//读取下一行 }
}
}
catch (Exception)
{
dt = null;
throw;
}
sr.Close();//关闭流
return dt; }
/// <summary>
/// 判断两个DataTable中,第一个dataTable中在第二个dataTable中不存在的记录集
/// </summary>
/// <param name="returnTable">返回的不重复的结果集</param>
/// <param name="table1">即将导入的数据集</param>
/// <param name="table2">数据库中的数据集</param>
/// <param name="fieldsStr">字段名</param>
/// <returns></returns>
public static DataTable ComPare2DataTable(DataTable table1, DataTable table2, string fieldsStr)
{
try
{
DataTable returnTable = new DataTable();
returnTable = table1.Clone(); //for循环将数据库中的table2的每行数据转换为一个字符串,保存的HashTable中
Hashtable hashtable = new Hashtable();
DataRow[] dataRows = table2.Select(""); string[] fieldArr = fieldsStr.Split(','); foreach (DataRow row in dataRows)
{
string rowStr = "";
for (int i = ; i < fieldArr.Length; i++)
{
Object obj = row[fieldArr[i]];
if (!String.IsNullOrEmpty(obj.ToString()))
{
rowStr += obj.ToString();
}
}
hashtable.Add(rowStr, "");
} //将要导入的DataTable,将每一行数据转换为字符串之后,在hashTable中找是否存在这个key,存在的加入返回的DataTable中,反之不加入。
DataRow[] dataRows1 = table1.Select();
foreach (DataRow row in dataRows1)
{
string rowStr1 = "";
for (int i = ; i < fieldArr.Length; i++)
{
Object obj = row[fieldArr[i]];
if (!String.IsNullOrEmpty(obj.ToString()))
{
rowStr1 += obj.ToString();
}
}
if (!hashtable.ContainsKey(rowStr1))
{
returnTable.Rows.Add(row.ItemArray);
}
}
return returnTable;
}
catch (Exception ex)
{
throw ex;
}
} /// <summary>
/// 文档上传 读取文档内容并保存到 数据库
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public string UploadFile()
{
string result = "导入失败!";
try
{
base.IsLogin();
int sucCount = ;
int allCount = ;
string reqs = Request.Form["fileName"];
string groupsId=Request.Form["groupsId"];
string strPath = Server.MapPath("/UpLoadFile/" + reqs);
EntMSM.Models.Users curr = Session["LoginUser"] as EntMSM.Models.Users;
DataTable dt = null;
DataTable dt1 = ConvertToDataTable(esd.ContactLists.Where(a => a.Uses_Id == curr.Id));
dt1.Columns["电话"].ColumnName = "LinkMobile";
if (reqs.Split('.')[].ToUpper() == "CSV")
{
dt = ReadCsv(strPath, groupsId, curr);//csv
}
else
{
dt = ImportExcelFile(strPath, groupsId, curr);
//ReadExcelByOledb(strPath, curr);//xls
// dt.Columns["电话"].ColumnName = "LinkMobile";
}
allCount = dt.Rows.Count;
//去掉重复行 ,重复数据过滤
DataTable dd = DeleteSameRow(dt, "LinkMobile");//去除上传文件中重复的数据
DataTable ddt = ComPare2DataTable(dd, dt1, "LinkMobile");//出去已经存在数据库中的重复数据 int currCount = ddt.Rows.Count;
for (int i = ; i < ddt.Rows.Count; )
{
//ddt.Rows[i][2] = System.Web.HttpUtility.HtmlEncode(ddt.Rows[i][2].ToString());
//ddt.Rows[i][3] = System.Web.HttpUtility.HtmlEncode(ddt.Rows[i][3].ToString());
//ddt.Rows[i][4] = System.Web.HttpUtility.HtmlEncode(ddt.Rows[i][4].ToString());
//ddt.Rows[i][5] = System.Web.HttpUtility.HtmlEncode(ddt.Rows[i][5].ToString());
if (ddt.Rows[i][].ToString().Trim() == "" || ddt.Rows[i][] == null || ddt.Rows[i][].ToString().Trim() == "" || ddt.Rows[i][] == null || ddt.Rows[i][].ToString().Trim() == "" || ddt.Rows[i][] == null)
{
ddt.Rows[i].Delete();
}
else
{
if (!IsChiOrEng(ddt.Rows[i][].ToString()))
{
ddt.Rows[i].Delete();
}
else if (!IsPhone(ddt.Rows[i][].ToString()))
{
ddt.Rows[i].Delete();
}
else if (!IsEmail(ddt.Rows[i][].ToString()))
{
ddt.Rows[i].Delete();
}
else if (StrLenth(ddt.Rows[i][].ToString()))
{
ddt.Rows[i].Delete();
}
else if (StrLenth(ddt.Rows[i][].ToString()))
{
ddt.Rows[i].Delete();
}
else if (StrLenth(ddt.Rows[i][].ToString()))
{
ddt.Rows[i].Delete();
}
else
{
i++;
}
}
} int twoCount = ddt.Rows.Count;
if (currCount > )
{
sucCount = addTable(ddt);
if (sucCount > )
{
result = "导入通讯录共计:" + allCount + "条\n\t导入成功:" + sucCount + "条\n\t过滤重复联系人:" + (allCount - currCount) + "条\n\t过滤错误数据:" + (currCount - twoCount) + "条";
}
else
{
result = "导入通讯录共计:" + allCount + "条\n\t导入成功:" + sucCount + "条\n\t过滤重复联系人:" + (allCount - currCount) + "条\n\t过滤错误数据:" + (currCount - twoCount) + "条";
}
}
else
{
result = "导入通讯录共计:" + allCount + "条\n\t导入成功:" + sucCount + "条\n\t过滤重复联系人:" + (allCount - currCount) + "条\n\t过滤错误数据:" + (currCount - twoCount) + "条";
}
if (System.IO.File.Exists(strPath)) //存在文件
{
System.IO.File.Delete(strPath);//删除文件
}
}
catch
{
result = "文档内容格式有误,导入失败!";
}
return result;
}
/// <summary>
/// 替换html中的特殊字符
/// </summary>
/// <param name="theString">需要进行替换的文本。</param>
/// <returns>替换完的文本。</returns>
public string HtmlEncode(string theString)
{
theString = theString.Replace(">", ">");
theString = theString.Replace("<", "<");
theString = theString.Replace("\"", """);
theString = theString.Replace("\'", "'");
theString = theString.Replace("\n", "<br/> ");
return theString;
}
#region 删除DataTable重复列,类似distinct
/// <summary>
/// 删除DataTable重复列,类似distinct
/// </summary>
/// <param name="dt">DataTable</param>
/// <param name="Field">字段名</param>
/// <returns></returns>
public static DataTable DeleteSameRow(DataTable dt, string Field)
{
ArrayList indexList = new ArrayList();
// 找出待删除的行索引
for (int i = ; i < dt.Rows.Count - ; i++)
{
if (!IsContain(indexList, i))
{
for (int j = i + ; j < dt.Rows.Count; j++)
{
if (dt.Rows[i][Field].ToString() == dt.Rows[j][Field].ToString())
{
indexList.Add(j);
}
}
}
}
indexList.Sort();
// 排序
for (int i = indexList.Count - ; i >= ; i--)// 根据待删除索引列表删除行
{
int index = Convert.ToInt32(indexList[i]);
dt.Rows.RemoveAt(index);
}
return dt;
} /// <summary>
/// 判断数组中是否存在
/// </summary>
/// <param name="indexList">数组</param>
/// <param name="index">索引</param>
/// <returns></returns>
public static bool IsContain(ArrayList indexList, int index)
{
for (int i = ; i < indexList.Count; i++)
{
int tempIndex = Convert.ToInt32(indexList[i]);
if (tempIndex == index)
{
return true;
}
}
return false;
}
#endregion
/// <summary>
/// 添加table
/// </summary>
/// <param name="dtt"></param>
/// <returns></returns>
public int addTable(DataTable dtt)
{
string a = ConfigurationManager.ConnectionStrings["EntSmsDbContext"].ToString();
SqlConnection con = new SqlConnection(a);
SqlCommand cmd = new SqlCommand("select * from ContactList", con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
SqlCommandBuilder Builder = new SqlCommandBuilder(sda);
sda.Fill(dtt);
int states = sda.Update(dtt);
return states;
}
/// <summary>
/// 字符串长度
/// </summary>
/// <param name="len"></param>
/// <returns></returns>
public bool StrLenth(string len)
{ if (IsChinese(len))
{
if (len.ToString().Length > )
{
return true;
}
}
else
{
if (len.ToString().Length > )
{
return true;
}
}
return false;
}
/// <summary>
/// 判断是否为Email
/// </summary>
/// <param name="s">字符串</param>
/// <returns></returns>
public static bool IsEmail(string s)
{
return Regex.IsMatch(s, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");
}
/// <summary>
/// 判断是否为手机号码格式
/// </summary>
/// <param name="s">字符串</param>
/// <returns></returns>
public static bool IsPhone(string s)
{
return Regex.IsMatch(s, @"^(((13[0-9]{1})|14[0-9]{1}|15[0-9]{1}|18[0-9]{1})+\d{8})$");
}
/// <summary>
/// 判断是否为中文字符
/// </summary>
/// <param name="s">字符串</param>
/// <returns></returns>
public static bool IsChinese(string s)
{
return Regex.IsMatch(s, @"[\u4e00-\u9fa5]");
}
/// <summary>
/// 验证用户名为中、英文
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static bool IsChiOrEng(string val)
{
string strRegex = @"[\u4e00-\u9fa5_a-zA-Z]";
return Regex.IsMatch(val, strRegex);
}
/// <summary>
/// 判断是否为正整数
/// </summary>
/// <param name="s">字符串</param>
/// <returns></returns>
public static bool IsInt(string s)
{
return Regex.IsMatch(s, @"^\d+$");
}
#endregion /// <summary>
/// 非法字符转换
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public string ReplaceStr(string str)
{
//str=str.Replace(",","");
str = str.Replace("'", "");
str = str.Replace(";", "");
str = str.Replace(":", "");
str = str.Replace("/", "");
str = str.Replace("?", "");
str = str.Replace("<", "");
str = str.Replace(">", "");
str = str.Replace(".", "");
str = str.Replace("#", "");
str = str.Replace("%", "");
str = str.Replace("%", "");
str = str.Replace("^", "");
str = str.Replace("//", "");
str = str.Replace("@", "");
str = str.Replace("(", "");
str = str.Replace(")", "");
str = str.Replace("*", "");
str = str.Replace("~", "");
str = str.Replace("`", "");
str = str.Replace("$", "");
str = str.Replace("&", "");
str = str.Replace("\n", "");
return str;
} }
}
NPOI文件导入操作的更多相关文章
- C# Excel文件导入操作
Excel文件导出的操作我们经经常使用到,可是讲一个Excel文档导入并显示到界面还是第一次用到. 以下简介下在C#下怎样进行Excel文件的导入操作. 首先加入两个引用 using System.I ...
- ajax模拟表单提交,后台使用npoi实现导入操作 方式一
页面代码: <form id="form1" enctype="multipart/form-data"> <div style=" ...
- ajax模拟表单提交,后台使用npoi实现导入操作 方式二
页面代码: <form id="form1" enctype="multipart/form-data"> <div style=" ...
- 3.数据库操作相关术语,Oracle认证,insert into,批量插入,update tablename set,delete和truncate的差别,sql文件导入
1相关术语 语句 含义 操作 DML语句 (Data Manipulation Language) 数据库操作语言 insert update delete select DDL语言 (Date ...
- asp.net mvc4 easyui datagrid 增删改查分页 导出 先上传后导入 NPOI批量导入 导出EXCEL
效果图 数据库代码 create database CardManage use CardManage create table CardManage ( ID ,) primary key, use ...
- 用NPOI实现导入导出csv、xls、xlsx数据功能
用NPOI实现导入导出csv.xls.xlsx数据功能 直接上代码 首先定义一个接口 如果需要直接操作文件的话,就自己在封装一次 然后定义csv类的具体实现 这个需要引入命名空间LumenWo ...
- 使用NPOI进行Excel操作
一.NPOI组件导入 右键项目菜单,“管理NuGet程序包” 直接搜索“NPOI”即会出现列表,下载第一个进行安装即可 安装完成后项目引用会出现以下几项 二.基础使用 添加引用 using NPOI. ...
- unity3d教程游戏包含的一切文件导入资源
http://www.58player.com/blog-2327-954.html 导入资源 将文件增加至工程文件夹的资源 (Assets) 文件夹后,Unity 将自动检测文件.将任何资源 (As ...
- 用SQLSERVER里的bcp命令或者bulkinsert命令也可以把dat文件导入数据表
用SQLSERVER里的bcp命令或者bulkinsert命令也可以把dat文件导入数据表 下面的内容的实验环境我是在SQLSERVER2005上面做的 之前在园子里看到两篇文章<C# 读取纯真 ...
随机推荐
- JQuery 一些特殊符号的使用
前言:我写博客的频率与我的清闲程度成正比.. 太闲了所以想记录一下JQuery里的特殊符号,级别:入门级.用到哪里写到哪里,不全面是肯定的. 其实只要接触前端就肯定少不了用jquery,但是以前太 ...
- SQLCE本地数据库
SQLCE是一个标准得关系数据库,可以使用 LINQ 和DateContext来处理本地数据库数据库. 使用SQLCE 要在代码中使用本地数据库功能,需要添加以下命名空间 : using System ...
- 从Hive1.0升级到Hive2.0(删除hive1.x中的元数据, 并不是数据迁移)
软件环境: linux系统: CentOS6.7 Hadoop版本: 2.6.5 zookeeper版本: 3.4.8 主机配置: 一共m1, m2, m3这五部机, 每部主机的用户名都为centos ...
- AO如何获取SDE数据库中的数据
/// <summary> /// 获取Table类型表的记录 /// </summary> /// <param name="relationCheckCla ...
- REST、RESTful、SOA
1.http://www.imooc.com/article/17650 2.SOA面向服务架构
- 【VB】api实现窗口最小化
Const WM_SYSCOMMAND = &H112 Const SC_MINIMIZE = &HF020& SendMessage hWnd, WM_SYSCOMMAND, ...
- AdaBoost--从原理到实现(Code:Python)
本文对原文有修改,若有疑虑,请移步原作者. 原文链接:blog.csdn.net/dark_scope/article/details/14103983 集成方法在函数模型上等价于一个多层神经网络, ...
- OpenCV: 图像连通域检测的递归算法
序言:清除链接边缘,可以使用数组进行递归运算; 连通域检测的递归算法是定义级别的检测算法,且是无优化和无语义失误的. 同样可用于寻找连通域 void ClearEdge(CvMat* MM,CvPoi ...
- java rsa加密解密
- Jmeter JSON断言和响应断言的区别是什么?
假设响应数据是{"code":0,"datas":{"informationStatus":1}} 响应断言:"code" ...