/// <summary> /// 生成TsCode /// </summary> public TsResultModel GetTsResultModel(string itemId, string itemType = "") { TsResultModel result = null; if (itemType.ToLower() == TsCreateType.Controller.ToString().ToLower()) { ControllerModel controller = JcApiHelper.GetController(itemId); if (controller == null) { throw new Exception("无效的ItemId."); } result = GetTsResultModel(controller); } else if (itemType.ToLower() == TsCreateType.Action.ToString().ToLower()) { ActionModel action = JcApiHelper.GetAction(itemId); if (action == null) { throw new Exception("无效的ItemId."); } result = GetTsResultModel(action); } else { PTypeModel ptype = JcApiHelper.GetPTypeModel(itemId); if (ptype == null) { throw new Exception("无效的ItemId."); } result = GetTsResultModel(ptype); } return(result); }
public IActionResult GetController([FromForm] string controllerId) { Robj <ControllerModel> robj = new Robj <ControllerModel>(); try { if (string.IsNullOrEmpty(controllerId)) { throw new Exception("参数controllerId不能为空"); } ControllerModel controller = JcApiHelper.GetController(controllerId); robj.Result = controller; } catch (Exception ex) { robj.Error(ex.Message); } return(new JsonResult(robj)); }
public IActionResult GetControllerListByIds([FromBody] List <string> ids) { Robj <List <ControllerModel> > robj = new Robj <List <ControllerModel> >(); try { // List<string> ids = idsStr.Split(',').ToList(); List <ControllerModel> list = new List <ControllerModel>(); for (int i = 0; i < ids.Count; i++) { list.Add(JcApiHelper.GetController(ids[i])); } robj.Result = list; } catch (Exception ex) { robj.Error(ex.Message); } return(new JsonResult(robj)); }