// ============================================================================
// This is auto-generated by gf cli tool only once. Fill this file as you wish.
// ============================================================================

package wf_workinfo

import (
	"database/sql"
	"github.com/gogf/gf/database/gdb"
	"github.com/gogf/gf/errors/gerror"
	"github.com/gogf/gf/frame/g"
	"github.com/gogf/gf/os/gtime"
)

type AddData struct {
	BillInfo string      `p:"bill_info"  json:"bill_info"` // 单据JSON
	Data     string      `p:"data"       json:"data"`      // 处理数据
	Info     string      `p:"info"       json:"info"`      // 处理结果
	Datetime *gtime.Time `p:"datetime"   json:"datetime"`  //
	Type     string      `p:"type"       json:"type"`      // 类型
}

func Add(data *AddData, tx *gdb.TX) (insId int64, err error) {
	var res sql.Result
	res, err = Model.TX(tx).Save(data)
	if err != nil {
		g.Log().Error(err)
		err = gerror.New("写入工作流信息失败")
		return
	}
	insId, err = res.LastInsertId()
	return
}
