public string Active(string strjson) { try { if (string.IsNullOrEmpty(strjson)) { return(Json.Write(-1, "参数JSON格式错误")); } Dictionary <string, string> dic = MyJson.JsonToDictionary(strjson); if (dic.Count == 0) { return(Json.Write(-1, "参数JSON格式错误")); } string equipmentname = string.Empty; string accode = string.Empty; if (dic.TryGetValue("equipmentname", out equipmentname) == false) { return(Json.Write(-1, "设备名称无法识别")); } if (dic.TryGetValue("code", out accode) == false) { return(Json.Write(-1, "激活码无法识别")); } ReturnValue retVal = equLogic.Active(new EquipmentActivationInfo() { ACCode = accode, EIName = equipmentname }); return(Json.Write(retVal.RetCode, retVal.RetMsg)); } catch (Exception ex) { return(Json.Write(-1, Consts.EXP_Info)); } }