示例#1
0
        /// <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);
        }
示例#2
0
        public IActionResult GetAction([FromForm] string actionId)
        {
            Robj <ActionModel> robj = new Robj <ActionModel>();

            try
            {
                if (string.IsNullOrEmpty(actionId))
                {
                    throw new Exception("参数Id不能为空");
                }
                ActionModel action = JcApiHelper.GetAction(actionId);
                robj.Result = action;
            }
            catch (Exception ex)
            {
                robj.Error(ex.Message);
            }
            return(new JsonResult(robj));
        }