1
This commit is contained in:
@@ -686,3 +686,64 @@ func SetOrderStatus(tx orm.TxOrmer, payPrice, payMethod, status int, orderID str
|
||||
}
|
||||
return "更新Order状态成功", nil
|
||||
}
|
||||
|
||||
// QueryRechargeRecommend 电话充值记录查询
|
||||
func QueryRechargeRecommend(userId []string, mobile, orderId string, page, pageSize int, start, end time.Time, rechargeStatus int) ([]*model.RechargeUserModelData, int, error) {
|
||||
result := make([]*model.RechargeUserModelData, 0, 0)
|
||||
sql := `SELECT SQL_CALC_FOUND_ROWS o.*,u.name FROM order o `
|
||||
sqlParams := make([]interface{}, 0, 0)
|
||||
|
||||
sql += ` JOIN user u ON o.user_id = u.user_id WHERE 1=1 `
|
||||
|
||||
if orderId != "" {
|
||||
sql += ` AND o.order_id = ? `
|
||||
sqlParams = append(sqlParams, orderId)
|
||||
if err := GetRows(GetDB(), &result, sql, sqlParams...); err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
return result, 1, nil
|
||||
}
|
||||
|
||||
if userId != nil {
|
||||
sql += ` AND o.user_id IN (` + GenQuestionMarks(len(userId)) + `)`
|
||||
sqlParams = append(sqlParams, userId)
|
||||
}
|
||||
|
||||
if !utils.IsTimeZero(start) {
|
||||
sql += ` AND o.created_at > ?`
|
||||
sqlParams = append(sqlParams, start)
|
||||
}
|
||||
if !utils.IsTimeZero(end) {
|
||||
sql += ` AND o.created_at < ?`
|
||||
sqlParams = append(sqlParams, end)
|
||||
}
|
||||
|
||||
if mobile != "" {
|
||||
sql += ` AND o.mobile = ? `
|
||||
sqlParams = append(sqlParams, mobile)
|
||||
}
|
||||
|
||||
if rechargeStatus != 0 {
|
||||
sql += ` AND o.recharge_status = ? `
|
||||
sqlParams = append(sqlParams, rechargeStatus)
|
||||
}
|
||||
|
||||
sql += " ORDER BY o.created_at DESC LIMIT ? OFFSET ?"
|
||||
sqlParams = append(sqlParams, jxutils.FormalizePageSize(pageSize), (page-1)*pageSize)
|
||||
|
||||
db := GetDB()
|
||||
tx, _ := Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
Rollback(db, tx)
|
||||
}
|
||||
}()
|
||||
|
||||
if err := GetRowsTx(tx, &result, sql, sqlParams...); err != nil {
|
||||
Rollback(db, tx)
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
count := GetLastTotalRowCountTx(tx)
|
||||
return result, count, nil
|
||||
}
|
||||
|
||||
@@ -67,24 +67,27 @@ var (
|
||||
type Order struct {
|
||||
ModelIDCUL
|
||||
|
||||
OrderID string `orm:"column(order_id)" json:"orderID"` // 订单号
|
||||
UserID string `orm:"column(user_id);size(48)" json:"userID"` // 用户ID
|
||||
Type int `json:"type"` // 支付还是提现 1-支付,2-提现
|
||||
OrderType int `json:"orderType"` // 订单类型,1-发任务,2-会员月卡,3-发快递,4-提现,5-会员年卡,6-使用充值到余额方式的订单
|
||||
Way string `json:"way"` // weixinapp ,weixinmini
|
||||
Status int `json:"status"` // 订单状态,待支付2,已支付5,支付成功110,支付失败115,150取消
|
||||
PayPrice int `json:"payPrice"` // 支付金额
|
||||
TransactionID string `orm:"column(transaction_id);size(48)" json:"transactionID"` // 支付成功后,支付方生成的事务ID
|
||||
PayFinishedAt time.Time `orm:"type(datetime);null" json:"payFinishedAt"` // 支付完成时间
|
||||
PrepayID string `orm:"column(prepay_id);size(48)" json:"prepayID"` // 下单后,支付前,支付方生成的事务ID
|
||||
OriginalData string `orm:"type(text)" json:"-"` //
|
||||
Comment string `orm:"size(255)" json:"comment"` // 备注
|
||||
Lng float64 `json:"lng"` // 坐标
|
||||
Lat float64 `json:"lat"` // 坐标
|
||||
CityCode int `orm:"default(0)" json:"cityCode"` // 提交订单时用户所在城市
|
||||
DistrictCode int `orm:"default(0)" json:"districtCode"` // 城市code
|
||||
Address string `orm:"size(255)" json:"address"` // 地址
|
||||
PayMethod int `orm:"size(255)" json:"address"` // 支付方式1-余额支付,2-微信支付,3-微信提现,4-支付宝提现 5-余额+微信混合支付
|
||||
OrderID string `orm:"column(order_id)" json:"orderID"` // 订单号
|
||||
UserID string `orm:"column(user_id);size(48)" json:"userID"` // 用户ID
|
||||
Type int `json:"type"` // 支付还是提现 1-支付,2-提现
|
||||
OrderType int `json:"orderType"` // 订单类型,1-发任务,2-会员月卡,3-发快递,4-提现,5-会员年卡,6-使用充值到余额方式的订单,7-话费
|
||||
Way string `json:"way"` // weixinapp ,weixinmini
|
||||
Status int `json:"status"` // 订单状态,待支付2,已支付5,支付成功110,支付失败115,150取消
|
||||
PayPrice int `json:"payPrice"` // 支付金额
|
||||
TransactionID string `orm:"column(transaction_id);size(48)" json:"transactionID"` // 支付成功后,支付方生成的事务ID
|
||||
PayFinishedAt time.Time `orm:"type(datetime);null" json:"payFinishedAt"` // 支付完成时间
|
||||
PrepayID string `orm:"column(prepay_id);size(48)" json:"prepayID"` // 下单后,支付前,支付方生成的事务ID
|
||||
OriginalData string `orm:"type(text)" json:"-"` //
|
||||
Comment string `orm:"size(255)" json:"comment"` // 备注
|
||||
Lng float64 `json:"lng"` // 坐标
|
||||
Lat float64 `json:"lat"` // 坐标
|
||||
CityCode int `orm:"default(0)" json:"cityCode"` // 提交订单时用户所在城市
|
||||
DistrictCode int `orm:"default(0)" json:"districtCode"` // 城市code
|
||||
Address string `orm:"size(255)" json:"address"` // 地址
|
||||
PayMethod int `orm:"size(255)" json:"payMethod"` // 支付方式1-余额支付,2-微信支付,3-微信提现,4-支付宝提现 5-余额+微信混合支付
|
||||
Mobile string `orm:"size(15)" json:"mobile"` // 电话话费充值时使用
|
||||
FlowCode string `orm:"size(15)" json:"flowCode"` // 电话话费充值时使用
|
||||
RechargeStatus int `orm:"size(2)" json:"rechargeStatus"` // 充值状态 0-未提交,3-等待待充值(本地) 1:充值中(三方),2:已充值,-1:失败(三方)
|
||||
}
|
||||
|
||||
func (v *Order) TableUnique() [][]string {
|
||||
@@ -200,3 +203,9 @@ type UnionOrderStatus struct {
|
||||
OrderStatusAt time.Time `json:"orderStatusAt"` //更新时间
|
||||
Comment string `orm:"size(255)" json:"comment"` //备注
|
||||
}
|
||||
|
||||
// RechargeUserModelData 充值列表
|
||||
type RechargeUserModelData struct {
|
||||
Order
|
||||
Name string `json:"name" db:"name"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user