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

View File

@ -1288,7 +1288,21 @@ func (s *Service) GetStreamerAuthApprovalStatuses(ctx *gin.Context, req *streame
return
}
if streamerauthapprovalbasic == nil {
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 {
basicStatus = streamerauthapprovalbasic.GetApproveStatus()
}
@ -1302,7 +1316,21 @@ func (s *Service) GetStreamerAuthApprovalStatuses(ctx *gin.Context, req *streame
return
}
if streamerauthapprovaldetails == nil {
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 {
detailsStatus = streamerauthapprovaldetails.GetApproveStatus()
}

View File

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

View File

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