This commit is contained in:
Leufolium 2024-07-09 21:54:04 +08:00
parent 8990758254
commit 883db65ea4
4 changed files with 52 additions and 24 deletions

View File

@ -2683,7 +2683,7 @@ func (m *Mongo) GetStreamerAuthApprovalDetailsHisList(ctx *gin.Context, req *str
list := make([]*dbstruct.StreamerAuthApprovalDetails, 0) list := make([]*dbstruct.StreamerAuthApprovalDetails, 0)
col := m.getColStreamerAuthApprovalDetailsHis() col := m.getColStreamerAuthApprovalDetailsHis()
query := qmgo.M{ query := qmgo.M{
"del_flag": 0, "del_flag": consts.Deleted,
} }
if req.Status != nil { if req.Status != nil {
query["status"] = util.DerefInt64(req.Status) query["status"] = util.DerefInt64(req.Status)
@ -2703,7 +2703,7 @@ func (m *Mongo) GetStreamerAuthApprovalDetailsHisListByMid(ctx *gin.Context, req
list := make([]*dbstruct.StreamerAuthApprovalDetails, 0) list := make([]*dbstruct.StreamerAuthApprovalDetails, 0)
col := m.getColStreamerAuthApprovalDetailsHis() col := m.getColStreamerAuthApprovalDetailsHis()
query := qmgo.M{ query := qmgo.M{
"del_flag": 0, "del_flag": consts.Deleted,
} }
if req.Status != nil { if req.Status != nil {
query["status"] = util.DerefInt64(req.Status) query["status"] = util.DerefInt64(req.Status)

View File

@ -1288,7 +1288,21 @@ func (s *Service) GetStreamerAuthApprovalStatuses(ctx *gin.Context, req *streame
return return
} }
if streamerauthapprovalbasic == nil { if streamerauthapprovalbasic == nil {
basicStatus = consts.StreamerAuthApprovalBasicApprove_NotFound list, err := _DefaultStreamerAuthApprovalBasicHis.OpListByMid(ctx, &streamerauthapprovalbasichisproto.OpListByMidReq{
Uid: goproto.Int64(req.BaseRequest.Mid),
Offset: 0,
Limit: 1,
})
if err != nil {
logger.Error("_DefaultStreamerAuthApprovalBasicHis OpListByMid fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeStreamerAuthApprovalBasicSrvFail
return
}
if len(list) == 0 {
basicStatus = consts.StreamerAuthApprovalBasicApprove_NotFound
} else {
basicStatus = list[0].GetApproveStatus()
}
} else { } else {
basicStatus = streamerauthapprovalbasic.GetApproveStatus() basicStatus = streamerauthapprovalbasic.GetApproveStatus()
} }
@ -1302,7 +1316,21 @@ func (s *Service) GetStreamerAuthApprovalStatuses(ctx *gin.Context, req *streame
return return
} }
if streamerauthapprovaldetails == nil { if streamerauthapprovaldetails == nil {
detailsStatus = consts.StreamerAuthApprovalDetailsApprove_NotFound list, err := _DefaultStreamerAuthApprovalDetailsHis.OpListByMid(ctx, &streamerauthapprovaldetailshisproto.OpListByMidReq{
Uid: goproto.Int64(req.BaseRequest.Mid),
Offset: 0,
Limit: 1,
})
if err != nil {
logger.Error("_DefaultStreamerAuthApprovalDetailsHis OpListByMid fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeStreamerAuthApprovalDetailsSrvFail
return
}
if len(list) == 0 {
detailsStatus = consts.StreamerAuthApprovalDetailsApprove_NotFound
} else {
detailsStatus = list[0].GetApproveStatus()
}
} else { } else {
detailsStatus = streamerauthapprovaldetails.GetApproveStatus() detailsStatus = streamerauthapprovaldetails.GetApproveStatus()
} }

View File

@ -1964,8 +1964,7 @@ func (s *Service) OpApproveStreamerAuthApprovalBasic(ctx *gin.Context, req *stre
ApproveStatus: req.ApproveStatus, ApproveStatus: req.ApproveStatus,
Remarks: req.Remarks, Remarks: req.Remarks,
}, },
Ids: req.Ids, Ids: req.Ids,
ApproveStatus: consts.StreamerAuthApprovalBasicApprove_Waiting,
}) })
if err == qmgo.ErrNoSuchDocuments { if err == qmgo.ErrNoSuchDocuments {
ec = errcode.ErrCodeStreamerAuthApprovalBasicNotExist ec = errcode.ErrCodeStreamerAuthApprovalBasicNotExist
@ -2165,8 +2164,7 @@ func (s *Service) OpApproveStreamerAuthApprovalDetails(ctx *gin.Context, req *st
ApproveStatus: req.ApproveStatus, ApproveStatus: req.ApproveStatus,
Remarks: req.Remarks, Remarks: req.Remarks,
}, },
Ids: req.Ids, Ids: req.Ids,
ApproveStatus: consts.StreamerAuthApprovalDetailsApprove_Waiting,
}) })
if err == qmgo.ErrNoSuchDocuments { if err == qmgo.ErrNoSuchDocuments {
ec = errcode.ErrCodeStreamerAuthApprovalDetailsNotExist ec = errcode.ErrCodeStreamerAuthApprovalDetailsNotExist

View File

@ -1,6 +1,7 @@
package interceptor package interceptor
import ( import (
"encoding/base64"
"fmt" "fmt"
"service/api/consts" "service/api/consts"
"service/app/mix/conf" "service/app/mix/conf"
@ -8,6 +9,7 @@ import (
"service/library/logger" "service/library/logger"
"service/library/mycrypto" "service/library/mycrypto"
"testing" "testing"
"time"
) )
func Test(t *testing.T) { func Test(t *testing.T) {
@ -30,23 +32,23 @@ func Test(t *testing.T) {
// fmt.Println(string(phone)) // fmt.Println(string(phone))
// hash := mycrypto.CryptoServiceInstance().SHA256.Encrypt(phone) // hash := mycrypto.CryptoServiceInstance().SHA256.Encrypt(phone)
// fmt.Println(string(hash)) // fmt.Println(string(hash))
// mobilePhone := "18282063182" mobilePhone := "13728423678"
// rsaBytes, _ := mycrypto.CryptoServiceInstance().RSA.Encrypt([]byte(mobilePhone)) rsaBytes, _ := mycrypto.CryptoServiceInstance().AES.Encrypt([]byte(mobilePhone))
// base64EncryptedBytes := make([]byte, base64.StdEncoding.EncodedLen(len(rsaBytes))) base64EncryptedBytes := make([]byte, base64.StdEncoding.EncodedLen(len(rsaBytes)))
// base64.StdEncoding.Encode(base64EncryptedBytes, rsaBytes) base64.StdEncoding.Encode(base64EncryptedBytes, rsaBytes)
// phoneHash := mycrypto.CryptoServiceInstance().SHA256.Encrypt([]byte(mobilePhone)) phoneHash := mycrypto.CryptoServiceInstance().SHA256.Encrypt([]byte(mobilePhone))
// fmt.Printf("Time:%v\n", time.Now().Unix()) fmt.Printf("Time:%v\n", time.Now().Unix())
// fmt.Printf("RSA:%v\n", string(base64EncryptedBytes)) fmt.Printf("RSA:%v\n", string(base64EncryptedBytes))
// fmt.Printf("PhoneHash:%v\n", phoneHash) fmt.Printf("PhoneHash:%v\n", phoneHash)
data := "FortuneFavorsTheBold2@" // data := "FortuneFavorsTheBold2@"
sign := "G7I7Z+RGNqbGOecP3aBmki3Y9omqs0AICwFRLkZ1CRhRh/3BFN1kBcZrmFeoUibzeM3t2D8AsdF8cSankmfLjOR6rN2xx49mQRawy7Zat7DLRj6j+eDJZ2jhIFXcLl72Ap7KSxzk0UyiFS7FVnK3esmqQtQpDfE8UPgPW9IOzYo=" // sign := "G7I7Z+RGNqbGOecP3aBmki3Y9omqs0AICwFRLkZ1CRhRh/3BFN1kBcZrmFeoUibzeM3t2D8AsdF8cSankmfLjOR6rN2xx49mQRawy7Zat7DLRj6j+eDJZ2jhIFXcLl72Ap7KSxzk0UyiFS7FVnK3esmqQtQpDfE8UPgPW9IOzYo="
err = mycrypto.CryptoServiceInstance().HygSHA1WithRSA.Verify([]byte(data), sign) // err = mycrypto.CryptoServiceInstance().HygSHA1WithRSA.Verify([]byte(data), sign)
if err != nil { // if err != nil {
logger.Error("err : %v", err) // logger.Error("err : %v", err)
} else { // } else {
logger.Info("Verify success") // logger.Info("Verify success")
} // }
} }