package cygx import ( "github.com/beego/beego/v2/client/orm" "github.com/rdlucklib/rdluck_tools/paging" "time" ) type CygxOrder struct { OrderId int `orm:"column(order_id);pk";comment:"订单id"` OrderCode string `comment:"订单编号"` OutTradeCode string `comment:"外部交易号"` PaymentType int `comment:"支付类型。支付类型。取值范围:1微信小程序,2微信扫码支付,3微信H5支付。"` GoodsName string `comment:"商品名称"` GoodsId int `comment:"商品ID"` BuyerInvoice string `comment:"买家发票信息"` GoodsMoney float64 `comment:"商品总价"` OrderMoney float64 `comment:"订单总价"` Point int `comment:"订单消耗积分"` PointMoney float64 `comment:"订单消耗积分抵多少钱"` PayMoney float64 `comment:"订单实付金额"` RefundMoney float64 `comment:"订单退款金额"` RefundTime time.Time `description:"退款时间"` RefundRemark string `description:"退款原因说明"` OrderStatus int `comment:"订单状态,0:已取消、1:待支付、2:已支付、3:退款成功、4:退款处理中、5:退款异常、6:退款关闭"` PayTime time.Time `comment:"订单付款时间"` SourceId int `comment:"来源ID"` Source string `comment:"来源\n报告 :article\n活动 :activity"` SourceTitle string `comment:"来源名称,活动或者报告标题"` UserId int `comment:"用户ID"` Mobile string `comment:"手机号"` Email string `comment:"邮箱"` CompanyId int `comment:"公司ID"` CompanyName string `comment:"公司名称"` RealName string `comment:"用户实际名称"` SellerName string `comment:"所属销售"` CreateTime time.Time `comment:"创建时间"` ModifyTime time.Time `comment:"修改时间"` RegisterPlatform int `comment:"来源 1小程序,2:网页"` } type CygxOrderResp struct { OrderId int `orm:"column(order_id);pk";comment:"订单id"` OrderCode string `comment:"订单编号"` OutTradeNo string `comment:"【商户订单号】 商户系统内部订单号"` OutTradeCode string `comment:"外部交易号"` PaymentType int `comment:"支付类型。取值范围:1微信支付,2支付宝支付。"` TradeType string `comment:"交易类型,枚举值:JSAPI:公众号支付 、 NATIVE:扫码支付 、 App:App支付 、 MICROPAY:付款码支付 、 MWEB:H5支付 、 FACEPAY:刷脸支付"` GoodsName string `comment:"商品名称"` GoodsId int `comment:"商品ID"` BuyerInvoice string `comment:"买家发票信息"` GoodsMoney float64 `comment:"商品总价"` OrderMoney float64 `comment:"订单总价"` Point int `comment:"订单消耗积分"` PointMoney float64 `comment:"订单消耗积分抵多少钱"` PayMoney float64 `comment:"订单实付金额"` RefundMoney float64 `comment:"订单退款金额"` RefundTime time.Time `comment:"退款时间"` RefundRemark string `comment:"退款原因说明"` OrderStatus int `comment:"订单状态,0:已取消、1:待支付、2:已支付、3:退款成功、4:退款处理中、5:退款异常、6:退款关闭"` PayTime time.Time `comment:"订单付款时间"` SourceId int `comment:"来源ID"` Source string `comment:"来源\n报告 :article\n活动 :activity"` SourceTitle string `comment:"来源名称,活动或者报告标题"` UserId int `comment:"用户ID"` Mobile string `comment:"手机号"` Email string `comment:"邮箱"` CompanyId int `comment:"公司ID"` CompanyName string `comment:"公司名称"` RealName string `comment:"用户实际名称"` SellerName string `comment:"所属销售"` StartDate time.Time `comment:"开始日期"` EndDate time.Time `comment:"结束日期"` CreateTime time.Time `comment:"创建时间"` ModifyTime time.Time `comment:"修改时间"` RegisterPlatform int `comment:"来源 1小程序,2:网页"` ShareId int `comment:"分享人ID"` ShareName string `comment:"分享人姓名"` } func GetCygxOrderList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxOrderResp, err error) { o := orm.NewOrmUsingDB("hz_cygx") sql := `SELECT * FROM cygx_order WHERE 1 = 1 ` + condition sql += ` LIMIT ?,? ` _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items) return } // 获取数量 func GetCygxOrderCount(condition string, pars []interface{}) (count int, err error) { o := orm.NewOrmUsingDB("hz_cygx") sqlCount := ` SELECT COUNT(1) AS count FROM cygx_order WHERE 1= 1 ` + condition err = o.Raw(sqlCount, pars).QueryRow(&count) return } // 根据订单编号获取订单详情 func GetCygxOrderDetailByOrderCode(orderCode string) (item *CygxOrderResp, err error) { o := orm.NewOrmUsingDB("hz_cygx") sql := `SELECT * FROM cygx_order WHERE order_code = ? ` err = o.Raw(sql, orderCode).QueryRow(&item) return } type OrderListResp struct { OrderCode string `comment:"订单编号"` UserId int `comment:"用户ID"` Mobile string `comment:"手机号"` Email string `comment:"邮箱"` CompanyId int `comment:"公司ID"` CompanyName string `comment:"公司名称"` RealName string `comment:"用户实际名称"` SellerName string `comment:"所属销售"` OrderMoney float64 `comment:"订单总价"` CreateTime string `comment:"创建时间"` SourceId int `comment:"来源ID"` Source string `comment:"来源\n报告 :article\n活动 :activity"` SourceTitle string `comment:"来源名称,活动或者报告标题"` OrderStatus int `comment:"订单状态码"` OrderStatusText string `comment:"订单状态描述"` PaymentTypeText string `comment:"支付类型。取值范围:1微信小程序,2微信扫码支付,3微信H5支付。"` StartDate string `comment:"开始日期"` EndDate string `comment:"结束日期"` InviteName string `description:"邀请人"` PayTime string `comment:"订单付款时间"` RefundTime string `comment:"订单退款时间"` RefundRemark string `description:"退款原因说明"` PaymentProject string `comment:"付款项目"` HttpUrl string `description:"跳转地址"` } type UserOrderListResp struct { Paging *paging.PagingItem `description:"分页数据"` List []*OrderListResp }