|
@@ -7,9 +7,9 @@ import (
|
|
|
)
|
|
|
|
|
|
type CygxOrderAddReq struct {
|
|
|
- GoodsId int `description:"商品ID"`
|
|
|
- Source string `description:"资源(文章、活动)"`
|
|
|
- SourceId int `description:"资源ID"`
|
|
|
+ GoodsId int `description:"商品ID"`
|
|
|
+ //Source string `description:"资源(文章、活动)"`
|
|
|
+ SourceId int `description:"资源ID"`
|
|
|
}
|
|
|
|
|
|
type CygxOrder struct {
|
|
@@ -43,6 +43,37 @@ type CygxOrder struct {
|
|
|
RegisterPlatform int `comment:"来源 1小程序,2:网页"`
|
|
|
}
|
|
|
|
|
|
+type CygxOrderResp struct {
|
|
|
+ OrderId int `orm:"column(order_id);pk";comment:"订单id"`
|
|
|
+ OrderCode string `comment:"订单编号"`
|
|
|
+ OutTradeCode string `comment:"外部交易号"`
|
|
|
+ PaymentType int `comment:"支付类型。取值范围:1微信支付,2支付宝支付。"`
|
|
|
+ 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:"订单退款金额"`
|
|
|
+ OrderStatus int `comment:"订单状态,0:已取消、1:待支付、2:已支付、3:已退款"`
|
|
|
+ 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 CygxOrderAction struct {
|
|
|
ActionId int64 `orm:"column(action_id);pk"` // 动作id
|
|
|
Action string // 动作内容
|
|
@@ -105,3 +136,42 @@ func AddCygxOrder(item *CygxOrder) (err error) {
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// 根据订单编号修改
|
|
|
+func UpdateCygxOrder(item *CygxOrder, oldOrderCode string) (err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ updateParams := make(map[string]interface{})
|
|
|
+ updateParams["SourceId"] = item.SourceId
|
|
|
+ updateParams["Source"] = item.Source
|
|
|
+ updateParams["SourceTitle"] = item.SourceTitle
|
|
|
+ updateParams["ModifyTime"] = item.ModifyTime
|
|
|
+ ptrStructOrTableName := "cygx_order"
|
|
|
+ whereParam := map[string]interface{}{"order_code": oldOrderCode}
|
|
|
+ qs := o.QueryTable(ptrStructOrTableName)
|
|
|
+ for expr, exprV := range whereParam {
|
|
|
+ qs = qs.Filter(expr, exprV)
|
|
|
+ }
|
|
|
+ _, err = qs.Update(updateParams)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func GetCygxOrderList(condition string, pars []interface{}) (item []*CygxOrderResp, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT *
|
|
|
+ FROM
|
|
|
+ cygx_order
|
|
|
+ WHERE 1 = 1 ` + condition
|
|
|
+ _, err = o.Raw(sql, pars).QueryRows(&item)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// 获取数量
|
|
|
+func GetCygxOrderCount(condition string, pars []interface{}) (count int, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sqlCount := ` SELECT COUNT(1) AS count FROM cygx_order WHERE 1= 1 ` + condition
|
|
|
+ err = o.Raw(sqlCount, pars).QueryRow(&count)
|
|
|
+ return
|
|
|
+}
|