@@ -0,0 +1,77 @@
|
||||
package integralexcangemod
|
||||
|
||||
import (
|
||||
"91porn-server/models/commod"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
)
|
||||
|
||||
// RechargeUpdateReq 修改参数
|
||||
type RechargeUpdateReq struct {
|
||||
StatusDesc *string `json:"statusDesc" bson:"statusDesc"` // 状态描述
|
||||
UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` // 更新时间
|
||||
}
|
||||
|
||||
type RchgQueryReq struct {
|
||||
ID *string `form:"id" json:"_id,omitempty" bson:"_id"` // 流水id
|
||||
UID *uint64 `form:"uid" json:"uid,omitempty" bson:"uid"` // 用户id
|
||||
Status *int `form:"status" json:"status,omitempty" bson:"status"` // 1、进行中 2、生成成功 3、生成失败 4、已经退款
|
||||
}
|
||||
|
||||
type WebListRequest struct {
|
||||
Status *int `form:"status" json:"status" bson:"status"` // 1、待发货 2、发货中 3、已发货 4、拒绝发货
|
||||
UID *uint64 `form:"uid" json:"uid,omitempty" bson:"uid"` // 用户id
|
||||
ID *string `form:"id" json:"_id,omitempty" bson:"_id"` // 流水id
|
||||
commod.Page
|
||||
}
|
||||
|
||||
type QueryAllRes struct {
|
||||
List []*IntegralExchange `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
}
|
||||
|
||||
func (receiver *WebListRequest) Filter() primitive.M {
|
||||
filter := bson.M{}
|
||||
if receiver.Status != nil {
|
||||
filter["status"] = receiver.Status
|
||||
}
|
||||
if receiver.UID != nil {
|
||||
filter["uid"] = receiver.UID
|
||||
}
|
||||
if receiver.ID != nil {
|
||||
id, _ := primitive.ObjectIDFromHex(*receiver.ID)
|
||||
filter["_id"] = id
|
||||
}
|
||||
return filter
|
||||
}
|
||||
|
||||
func (receiver *WebListRequest) Options() *options.FindOptions {
|
||||
return options.Find().SetSkip(int64(receiver.Skip())).SetLimit(int64(receiver.Limit() + 1)).SetSort(bson.M{"createTime": -1})
|
||||
}
|
||||
|
||||
type EditCond struct {
|
||||
ID string `json:"id" binding:"required"` // 文档
|
||||
Status *int `json:"status" bson:"status"` // 状态 2、发货中 3、已发货 4、拒绝发货
|
||||
Remark *string `json:"remark" bson:"remark"` // 拒绝理由
|
||||
}
|
||||
|
||||
func (receiver *EditCond) Filter() bson.M {
|
||||
objID, _ := primitive.ObjectIDFromHex(receiver.ID)
|
||||
return bson.M{"_id": objID}
|
||||
}
|
||||
|
||||
func (receiver *EditCond) Update(updateAct string) bson.M {
|
||||
var update = bson.M{}
|
||||
if receiver.Status != nil {
|
||||
update["status"] = receiver.Status
|
||||
}
|
||||
if receiver.Remark != nil {
|
||||
update["remark"] = receiver.Remark
|
||||
}
|
||||
update["updateAct"] = updateAct
|
||||
update["updateTime"] = time.Now()
|
||||
return bson.M{"$set": update}
|
||||
}
|
||||
Reference in New Issue
Block a user