结构体

//输入参数
type AjaxRequestData struct {
    Handsontabledata []*HandsontableDataArr
    SysCode         string
    TableCode          string
    Lsh              string
}

type  HandsontableDataArr struct {
    ReportCode        string
    ReportName        string
    AccCode            string
    AccName            string
    Jie                float64
    Dai                float64
}

控制器

//控制器
func (this *AdjustmentVouchersController) Addfl() {
    var ob models.AjaxRequestData
    var err error
    if err = json.Unmarshal(this.Ctx.Input.RequestBody, &ob); err == nil {
        this.Data["json"] = ob
    } else {
        this.Data["json"] = err.Error()
    }
    this.ServeJSON()
}

前端提交的json数据

{
    "Handsontabledata":[
        {
            "ReportCode":"77101",
            "ReportName":"流动资产:",
            "AccCode":"1001",
            "AccName":"现金",
            "Jie":1000,
            "Dai":0
        },
        {
            "ReportCode":"77101",
            "ReportName":"流动资产:",
            "AccCode":"1002",
            "AccName":"银行存款",
            "Jie":0,
            "Dai":1000
        }
    ],
    "SysCode":"3201711110000000010",
    "TableCode":"",
    "Lsh":""
}: 

后端返回的的json数据

{
  "Handsontabledata": [
    {
      "ReportCode": "77101",
      "ReportName": "流动资产:",
      "AccCode": "1001",
      "AccName": "现金",
      "Jie": 1000,
      "Dai": 0
    },
    {
      "ReportCode": "77101",
      "ReportName": "流动资产:",
      "AccCode": "1002",
      "AccName": "银行存款",
      "Jie": 0,
      "Dai": 1000
    }
  ],
  "SysCode": "3201711110000000010",
  "TableCode": "",
  "Lsh": ""
} 

本文由 吾爱 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。

2 条评论

  1. 刘平
    刘平

    666

  2. 刘总
    刘总

    666

添加新评论