/// <summary> /// 构造函数 /// </summary> /// <param name="tempName">模板名称</param> /// <param name="licID">许可ID</param> /// <param name="licForm">许可形式</param> /// <param name="isForever">是否可以永久使用</param> /// <param name="dev">开发商类</param> public template(string tempName, int licID, int licForm, bool isForever, developer dev) { tempID = 0; //模板ID templateName = tempName; //模板名称 licenseId = licID; //产品许可编号 licenseForm = licForm; //许可形式(云,软) this.isForever = isForever; //是否可永久使用 licStartTimeType = ""; //时间限制类型 startTime = 0; //开始时间 endTime = 0; //结束时间 spanTime = 0; //时间跨度 times = 0; //使用次数 licDuration = 0; //许可的使用时长 offlineDays = 0; //软锁离线时长 licBindLimit = 0; //可绑定的设备数 licBindMaxLimit = 0; //可累计绑定的设备数 version = 0; //许可版本 pub = ""; //公开数据区数据(16进制字符串) rom = ""; //只读数据区数据(16进制字符串) raw = ""; //读写数据区数据(16进制字符串) moduleInfo = new Dictionary <uint, string>(); //模块区数据(需转成JSON字符串) canModify = ""; //发许可时,模板的许可限制是否允许临时修改 Dev = dev; //开发商类 API = new openAPI(); //openapi类 }
/// <summary> /// 构造函数,主要用于修改产品,删除产品,查询产品 /// </summary> public product(developer dev) { licenseId = 0; productName = ""; licenseForm = 0; moduleInfo = new Dictionary <uint, string>(); API = new openAPI(); Dev = dev; raw = ""; rom = ""; pub = ""; }
/// <summary> /// 构造函数,主要用于创建产品 /// </summary> /// <param name="licID">设定的许可ID</param> /// <param name="procName">产品名称</param> /// <param name="licForm">许可模式(云,软,云and软)</param> public product(uint licID, string procName, uint licForm, developer dev) { licenseId = licID; productName = procName; licenseForm = licForm; moduleInfo = new Dictionary <uint, string>(); Dev = dev; API = new openAPI(); raw = ""; rom = ""; pub = ""; }
/// <summary> /// 构造函数,用于创建新的普通账户或影子账户 /// </summary> /// <param name="nick">用户昵称</param> /// <param name="name">用户名(邮箱)</param> /// <param name="password">用户密码</param> /// <param name="phone">用户手机号</param> /// <param name="Developer">开发商信息</param> public userInfo(string nick, string name, string password, string phone, developer Developer) { userAccount = name; passwd = password; cellphone = phone; nickname = nick; Dev = Developer; API = new openAPI(); sex = ""; tel = ""; address = ""; desc = ""; shadowAccount = ""; userID = ""; }
/// <summary> /// 构造函数,用于在数据库中取出影子账号修改密码 /// </summary> /// <param name="account">影子账号</param> /// <param name="psd">新密码</param> /// <param name="Devloper">开发商信息</param> public userInfo(string account, string psd, developer Developer) { userAccount = ""; nickname = ""; API = new openAPI(); sex = ""; tel = ""; address = ""; desc = ""; userID = ""; cellphone = ""; shadowAccount = account; passwd = psd; Dev = Developer; }
/// <summary> /// 构造函数,用于创建默认账户,删除账户,查找用户等 /// </summary> /// <param name="dev">开发商类</param> public userInfo(developer dev) { userAccount = ""; passwd = ""; cellphone = ""; nickname = ""; API = new openAPI(); Dev = dev; sex = ""; tel = ""; address = ""; desc = ""; shadowAccount = ""; userID = ""; }
/// <summary> /// 向深思云平台发送请求 /// </summary> /// <returns></returns> public string senseCloudRequest(string url, string JsonInfo, string appid, string secret) { string ttp = getTime(); string uuid = getUUID(); openAPI api = new openAPI(); string addUserFormat = url.Substring(api.HttpsUrl.Length); //将数据转成字节数组形式,在网络上传递使用 byte[] ttpBytes = Encoding.UTF8.GetBytes(ttp); byte[] uuidBytes = Encoding.UTF8.GetBytes(uuid); byte[] resourceURI = Encoding.UTF8.GetBytes(addUserFormat); byte[] JsonInfoBytes = Encoding.UTF8.GetBytes(JsonInfo); byte[] allData = new byte[ttpBytes.Length + uuidBytes.Length + resourceURI.Length + JsonInfoBytes.Length]; //拼接字节数组 ttpBytes.CopyTo(allData, 0); uuidBytes.CopyTo(allData, ttpBytes.Length); resourceURI.CopyTo(allData, ttpBytes.Length + uuidBytes.Length); JsonInfoBytes.CopyTo(allData, ttpBytes.Length + uuidBytes.Length + resourceURI.Length); //签名 String signData = getSignData(allData, secret); //请求数据 return(sendHttpPost(url, appid, ttp, uuid, signData, JsonInfoBytes)); }