public async Task Item() { var para = this.ParaForm <AssetM>(); AssetM data = AssetBll.GetById(para); if (data == null) { await this.Json(new { errmsg = para.ErrorMsg, errcode = para.ErrorCode }); return; } // 返回字段 var redata = new { data.Id, data.Title, data.Code, data.Amount, data.Value, data.Positions, data.Price, data.Remark, data.Profit, data.ExcOrg, data.Kind, data.Risk, ValueDate = data.ValueDate.ToString("yyyy/MM/dd HH:mm"), ExpDate = data.ExpDate.ToString("yyyy/MM/dd HH:mm"), data.Rate, data.Action, Ctime = data.Ctime.ToString("yyyy/MM/dd HH:mm"), data.ItemCode }; // 按需字段列表 if (!string.IsNullOrWhiteSpace(para.Fields) && para.Fields.Split(',').Length > 0) { var list = SerializeHelp.ObjectToDict(redata, para.Fields.Split(',')); await this.Json(new { list, errcode = ErrCode.Success }); return; } await this.Json(new { item = redata, errcode = ErrCode.Success }); }