123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- package cygx
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- // /订单操作表
- type CygxOrderAction struct {
- ActionId int `orm:"column(action_id);pk";comment:"动作id"`
- Action string `comment:"动作内容"`
- OrderStatus int `comment:"订单状态,0:已取消、1:待支付、2:已支付、3:已退款"`
- OrderStatusText string `comment:"订单状态名称"`
- 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:"所属销售"`
- CreateTime time.Time `comment:"创建时间"`
- ModifyTime time.Time `comment:"修改时间"`
- RegisterPlatform int `comment:"来源 1小程序,2:网页"`
- AdminId int `comment:"管理员ID"`
- AdminName string `comment:"管理员姓名"`
- }
- func AddCygxOrderRefundRevoke(item *CygxOrderAction) (err error) {
- to := orm.NewOrmUsingDB("hz_cygx")
- o, err := to.Begin()
- if err != nil {
- return
- }
- defer func() {
- if err != nil {
- _ = o.Rollback()
- } else {
- _ = o.Commit()
- }
- }()
- updateParams := make(map[string]interface{})
- updateParams["OrderStatus"] = 6 //退款关闭
- ptrStructOrTableName := "cygx_order"
- whereParam := map[string]interface{}{"order_code": item.OrderCode}
- qs := o.QueryTable(ptrStructOrTableName)
- for expr, exprV := range whereParam {
- qs = qs.Filter(expr, exprV)
- }
- _, err = qs.Update(updateParams)
- if err != nil {
- return
- }
- _, err = o.Insert(item)
- return
- }
- //// 添加CygxOrderRefund
- //func AddCygxOrderRefundRevoke(item *CygxOrderRefund) (err error) {
- // to := orm.NewOrmUsingDB("hz_cygx")
- // o, err := to.Begin()
- // if err != nil {
- // return
- // }
- // defer func() {
- // if err != nil {
- // _ = o.Rollback()
- // } else {
- // _ = o.Commit()
- // }
- // }()
- // updateParams := make(map[string]interface{})
- // updateParams["OrderStatus"] = 3
- // updateParams["RefundMoney"] = item.RefundMoney
- // updateParams["RefundRemark"] = item.Remark
- // updateParams["RefundTime"] = time.Now()
- // ptrStructOrTableName := "cygx_order"
- // whereParam := map[string]interface{}{"order_code": item.OrderCode}
- // qs := o.QueryTable(ptrStructOrTableName)
- // for expr, exprV := range whereParam {
- // qs = qs.Filter(expr, exprV)
- // }
- // _, err = qs.Update(updateParams)
- // if err != nil {
- // return
- // }
- // _, err = o.Insert(item)
- // return
- //}
|