freeze op
This commit is contained in:
parent
2bc8ce98bd
commit
cbf4cc764c
|
@ -1,6 +1,9 @@
|
|||
package proto
|
||||
|
||||
import "service/dbstruct"
|
||||
import (
|
||||
"service/api/base"
|
||||
"service/dbstruct"
|
||||
)
|
||||
|
||||
// op创建订单
|
||||
type OpCreateOrderReq struct {
|
||||
|
@ -131,3 +134,26 @@ type WxpayCallbackManualParam struct {
|
|||
OutOrderId string `json:"out_order_id"` // 外部订单id,比如支付宝、微信
|
||||
CallbackPayType string `json:"callback_pay_type"` // 支付类型
|
||||
}
|
||||
|
||||
// op冻结提现权限
|
||||
type OpAddWithdrawFreezeReq struct {
|
||||
base.BaseRequest
|
||||
UserId int64 `json:"user_id"` // 要冻结的主播user_id
|
||||
}
|
||||
|
||||
type OpAddWithdrawFreezeData struct{}
|
||||
|
||||
type OpDelWithdrawFreezeReq struct {
|
||||
base.BaseRequest
|
||||
UserId int64 `json:"user_id"` // 要冻结的主播user_id
|
||||
}
|
||||
|
||||
type OpDelWithdrawFreezeData struct{}
|
||||
|
||||
type OpGetWithdrawFreezeListReq struct {
|
||||
base.BaseRequest
|
||||
}
|
||||
|
||||
type OpGetWithdrawFreezeListData struct {
|
||||
List []*dbstruct.WithdrawFreeze `json:"list"`
|
||||
}
|
||||
|
|
|
@ -350,6 +350,9 @@ func Init(r *gin.Engine) {
|
|||
opVasPayGroup.POST("manual_unlock_wechat", middleware.JSONParamValidator(zoneproto.OpManualUnlockWechatParam{}), OpManualUnlockWechat)
|
||||
opVasPayGroup.POST("rollback_zone_exit_status", middleware.JSONParamValidator(zoneproto.OpRollbackZoneExitStatusParam{}), OpRollbackZoneAdmissionExitStatus)
|
||||
opVasPayGroup.POST("rollback_zone_refund_status", middleware.JSONParamValidator(zoneproto.OpRollbackZoneRefundStatusParam{}), OpRollbackZoneRefundStatus)
|
||||
opVasPayGroup.POST("add_withdraw_freeze", middleware.JSONParamValidator(vasproto.OpAddWithdrawFreezeReq{}), OpAddWithdrawFreeze)
|
||||
opVasPayGroup.POST("del_withdraw_freeze", middleware.JSONParamValidator(vasproto.OpDelWithdrawFreezeReq{}), OpDelWithdrawFreeze)
|
||||
opVasPayGroup.POST("get_withdraw_freeze_list", middleware.JSONParamValidator(vasproto.OpGetWithdrawFreezeListReq{}), OpGetWithdrawFreezeList)
|
||||
|
||||
// 慧用工
|
||||
extHvyogoGroup := r.Group("/ext/hvyogo")
|
||||
|
|
|
@ -469,3 +469,52 @@ func PayMeans(ctx *gin.Context) {
|
|||
}
|
||||
ReplyOk(ctx, data)
|
||||
}
|
||||
|
||||
// 提现冻结
|
||||
func OpAddWithdrawFreeze(ctx *gin.Context) {
|
||||
req := ctx.MustGet("client_req").(*vasproto.OpAddWithdrawFreezeReq)
|
||||
ec, err := service.DefaultService.OpAddWithdrawFreeze(ctx, req)
|
||||
if ec != errcode.ErrCodeVasSrvOk {
|
||||
logger.Error("OpAddWithdrawFreeze fail, req: %v, ec: %v", util.ToJson(req), ec)
|
||||
if err != nil {
|
||||
ReplyErrorMsg(ctx, err.Error())
|
||||
return
|
||||
}
|
||||
ReplyErrCodeMsg(ctx, ec)
|
||||
return
|
||||
}
|
||||
ReplyOk(ctx, nil)
|
||||
}
|
||||
|
||||
func OpDelWithdrawFreeze(ctx *gin.Context) {
|
||||
req := ctx.MustGet("client_req").(*vasproto.OpDelWithdrawFreezeReq)
|
||||
ec, err := service.DefaultService.OpDelWithdrawFreeze(ctx, req)
|
||||
if ec != errcode.ErrCodeVasSrvOk {
|
||||
logger.Error("OpDelWithdrawFreeze fail, req: %v, ec: %v", util.ToJson(req), ec)
|
||||
if err != nil {
|
||||
ReplyErrorMsg(ctx, err.Error())
|
||||
return
|
||||
}
|
||||
ReplyErrCodeMsg(ctx, ec)
|
||||
return
|
||||
}
|
||||
ReplyOk(ctx, nil)
|
||||
}
|
||||
|
||||
func OpGetWithdrawFreezeList(ctx *gin.Context) {
|
||||
req := ctx.MustGet("client_req").(*vasproto.OpGetWithdrawFreezeListReq)
|
||||
list, ec, err := service.DefaultService.OpGetWithdrawFreezeList(ctx, req)
|
||||
if ec != errcode.ErrCodeVasSrvOk {
|
||||
logger.Error("OpGetWithdrawFreezeList fail, req: %v, ec: %v", util.ToJson(req), ec)
|
||||
if err != nil {
|
||||
ReplyErrorMsg(ctx, err.Error())
|
||||
return
|
||||
}
|
||||
ReplyErrCodeMsg(ctx, ec)
|
||||
return
|
||||
}
|
||||
data := &vasproto.OpGetWithdrawFreezeListData{
|
||||
List: list,
|
||||
}
|
||||
ReplyOk(ctx, data)
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ const (
|
|||
COLZoneMomentStat = "zone_moment_stat"
|
||||
COLUserIncome = "user_income"
|
||||
COLWithdrawHis = "withdraw_his"
|
||||
COLWithdrawFreeze = "withdraw_freeze"
|
||||
|
||||
DBCatalog = "catalog"
|
||||
COLCatalog = "catalog"
|
||||
|
@ -294,6 +295,11 @@ func (m *Mongo) getColWithdrawHis() *qmgo.Collection {
|
|||
return m.clientMix.Database(DBVas).Collection(COLWithdrawHis)
|
||||
}
|
||||
|
||||
// 提现冻结
|
||||
func (m *Mongo) getColWithdrawFreeze() *qmgo.Collection {
|
||||
return m.clientMix.Database(DBVas).Collection(COLWithdrawFreeze)
|
||||
}
|
||||
|
||||
// 分类表
|
||||
func (m *Mongo) getColCatalog() *qmgo.Collection {
|
||||
return m.clientMix.Database(DBCatalog).Collection(COLCatalog)
|
||||
|
|
|
@ -289,3 +289,48 @@ func (m *Mongo) AddWithdrawHis(ctx *gin.Context, doc *dbstruct.WithdrawHis) erro
|
|||
_, err := col.InsertOne(ctx, doc)
|
||||
return err
|
||||
}
|
||||
|
||||
// 提现冻结
|
||||
func (m *Mongo) AddWithdrawFreeze(ctx *gin.Context, doc *dbstruct.WithdrawFreeze) error {
|
||||
col := m.getColWithdrawFreeze()
|
||||
_, err := col.InsertOne(ctx, doc)
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *Mongo) DelWithdrawFreeze(ctx *gin.Context, userId int64) error {
|
||||
col := m.getColWithdrawFreeze()
|
||||
err := col.RemoveId(ctx, userId)
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *Mongo) GetWithdrawFreezeList(ctx *gin.Context) ([]*dbstruct.WithdrawFreeze, error) {
|
||||
list := make([]*dbstruct.WithdrawFreeze, 0)
|
||||
col := m.getColWithdrawFreeze()
|
||||
query := qmgo.M{}
|
||||
err := col.Find(ctx, query).All(&list)
|
||||
if err == qmgo.ErrNoSuchDocuments {
|
||||
err = nil
|
||||
return make([]*dbstruct.WithdrawFreeze, 0), nil
|
||||
}
|
||||
if err != nil {
|
||||
return make([]*dbstruct.WithdrawFreeze, 0), err
|
||||
}
|
||||
return list, nil
|
||||
}
|
||||
|
||||
func (m *Mongo) GetWithdrawFreezeByUserId(ctx *gin.Context, userId int64) (*dbstruct.WithdrawFreeze, error) {
|
||||
doc := new(dbstruct.WithdrawFreeze)
|
||||
col := m.getColWithdrawFreeze()
|
||||
query := qmgo.M{
|
||||
"_id": userId,
|
||||
}
|
||||
err := col.Find(ctx, query).One(&doc)
|
||||
if err == qmgo.ErrNoSuchDocuments {
|
||||
err = nil
|
||||
return nil, nil
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return doc, nil
|
||||
}
|
||||
|
|
|
@ -4267,3 +4267,26 @@ func (v *Vas) UnilaterallyWithdrawAccomplish(ctx *gin.Context, orderId string) (
|
|||
|
||||
return
|
||||
}
|
||||
|
||||
// 提现冻结
|
||||
func (v *Vas) AddWithdrawFreeze(ctx *gin.Context, userId, mid, opMid int64) error {
|
||||
wf := &dbstruct.WithdrawFreeze{
|
||||
UserId: userId,
|
||||
Mid: mid,
|
||||
Ct: time.Now().Unix(),
|
||||
OperatorMid: opMid,
|
||||
}
|
||||
return v.store.AddWithdrawFreeze(ctx, wf)
|
||||
}
|
||||
|
||||
func (v *Vas) DelWithdrawFreeze(ctx *gin.Context, userId int64) error {
|
||||
return v.store.DelWithdrawFreeze(ctx, userId)
|
||||
}
|
||||
|
||||
func (v *Vas) GetWithdrawFreezeByUserId(ctx *gin.Context, userId int64) (*dbstruct.WithdrawFreeze, error) {
|
||||
return v.store.GetWithdrawFreezeByUserId(ctx, userId)
|
||||
}
|
||||
|
||||
func (v *Vas) GetWithdrawFreezeList(ctx *gin.Context) ([]*dbstruct.WithdrawFreeze, error) {
|
||||
return v.store.GetWithdrawFreezeList(ctx)
|
||||
}
|
||||
|
|
|
@ -1429,3 +1429,52 @@ func (s *Service) SearchZoneMember(ctx *gin.Context, req *vasproto.SearchMemberR
|
|||
list = append(list, item)
|
||||
return
|
||||
}
|
||||
|
||||
func (s *Service) OpAddWithdrawFreeze(ctx *gin.Context, req *vasproto.OpAddWithdrawFreezeReq) (ec errcode.ErrCode, err error) {
|
||||
defer func() {
|
||||
ec, err = errs.DealVasErr(err)
|
||||
}()
|
||||
|
||||
// 检查重复添加
|
||||
doc, _ := _DefaultVas.GetWithdrawFreezeByUserId(ctx, req.UserId)
|
||||
if doc != nil {
|
||||
err = fmt.Errorf("该主播权限已冻结,请勿重复添加")
|
||||
return
|
||||
}
|
||||
|
||||
// 获取mid
|
||||
userAcnt, _ := _DefaultAccount.OpListByUserId(ctx, &accountproto.OpListByUserIdReq{UserId: goproto.Int64(req.UserId)})
|
||||
|
||||
err = _DefaultVas.AddWithdrawFreeze(ctx, req.UserId, userAcnt.GetMid(), req.Mid)
|
||||
if err != nil {
|
||||
logger.Error("AddWithdrawFreeze fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (s *Service) OpDelWithdrawFreeze(ctx *gin.Context, req *vasproto.OpDelWithdrawFreezeReq) (ec errcode.ErrCode, err error) {
|
||||
defer func() {
|
||||
ec, err = errs.DealVasErr(err)
|
||||
}()
|
||||
|
||||
err = _DefaultVas.DelWithdrawFreeze(ctx, req.UserId)
|
||||
if err != nil {
|
||||
logger.Error("DelWithdrawFreeze fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (s *Service) OpGetWithdrawFreezeList(ctx *gin.Context, req *vasproto.OpGetWithdrawFreezeListReq) (list []*dbstruct.WithdrawFreeze, ec errcode.ErrCode, err error) {
|
||||
defer func() {
|
||||
ec, err = errs.DealVasErr(err)
|
||||
}()
|
||||
|
||||
list, err = _DefaultVas.GetWithdrawFreezeList(ctx)
|
||||
if err != nil {
|
||||
logger.Error("GetWithdrawFreezeList fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
@ -195,3 +195,11 @@ type WithdrawHis struct {
|
|||
Err string `json:"err" bson:"err"`
|
||||
Ct int64 `json:"ct" bson:"ct"`
|
||||
}
|
||||
|
||||
// 提现冻结
|
||||
type WithdrawFreeze struct {
|
||||
UserId int64 `json:"user_id" bson:"_id"`
|
||||
Mid int64 `json:"mid" bson:"mid"`
|
||||
Ct int64 `json:"ct" bson:"ct"`
|
||||
OperatorMid int64 `json:"operator_mid" bson:"operator_mid"`
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue