艺人管理修改

This commit is contained in:
JNG 2025-11-10 19:44:44 +08:00
parent 76aa2a98d6
commit b1b9560909
9 changed files with 2592 additions and 5124 deletions

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,7 @@
syntax = "proto3";
package accountFiee;
import "github.com/mwitkow/go-proto-validators@v0.3.2/validator.proto";
import "api/accountFiee/validator.proto";
option go_package = "./;accountFiee";
//protoc -I . -I C:\Users\lenovo\go\src --go_out=. --go-triple_out=. ./accountFiee.proto
@ -179,6 +179,9 @@ message UserListInfo{
string language = 18;
string subscriberNumber = 19;
string nickName = 20;
string idNumber = 21;
string dateOfBirth = 22;
string age = 23;
}
message UserListRequest{
string domain = 1;
@ -230,6 +233,8 @@ message RealNameRequest{
string placeOfResidence = 8;
string groupPhoto = 9;
string attachment = 10;
string idNumber = 11;
string dateOfBirth = 12;
}
message RegisterResponse{
uint64 ID = 1;

View File

@ -5,11 +5,11 @@ package accountFiee
import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
_ "github.com/mwitkow/go-proto-validators"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
math "math"
regexp "regexp"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
)
// Reference imports to suppress errors if they are not otherwise used.

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.8
// - protoc v5.26.1
// - protoc-gen-go-triple v1.0.5
// - protoc v6.32.0
// source: api/accountFiee/accountFiee.proto
package accountFiee

View File

@ -0,0 +1,80 @@
// Copyright 2016 Michal Witkowski. All Rights Reserved.
// See LICENSE for licensing terms.
// Protocol Buffers extensions for defining auto-generateable validators for messages.
// TODO(mwitkow): Add example.
syntax = "proto2";
package validator;
import "google/protobuf/descriptor.proto";
option go_package = "github.com/mwitkow/go-proto-validators;validator";
// TODO(mwitkow): Email protobuf-global-extension-registry@google.com to get an extension ID.
extend google.protobuf.FieldOptions {
optional FieldValidator field = 65020;
}
extend google.protobuf.OneofOptions {
optional OneofValidator oneof = 65021;
}
message FieldValidator {
// Uses a Golang RE2-syntax regex to match the field contents.
optional string regex = 1;
// Field value of integer strictly greater than this value.
optional int64 int_gt = 2;
// Field value of integer strictly smaller than this value.
optional int64 int_lt = 3;
// Used for nested message types, requires that the message type exists.
optional bool msg_exists = 4;
// Human error specifies a user-customizable error that is visible to the user.
optional string human_error = 5;
// Field value of double strictly greater than this value.
// Note that this value can only take on a valid floating point
// value. Use together with float_epsilon if you need something more specific.
optional double float_gt = 6;
// Field value of double strictly smaller than this value.
// Note that this value can only take on a valid floating point
// value. Use together with float_epsilon if you need something more specific.
optional double float_lt = 7;
// Field value of double describing the epsilon within which
// any comparison should be considered to be true. For example,
// when using float_gt = 0.35, using a float_epsilon of 0.05
// would mean that any value above 0.30 is acceptable. It can be
// thought of as a {float_value_condition} +- {float_epsilon}.
// If unset, no correction for floating point inaccuracies in
// comparisons will be attempted.
optional double float_epsilon = 8;
// Floating-point value compared to which the field content should be greater or equal.
optional double float_gte = 9;
// Floating-point value compared to which the field content should be smaller or equal.
optional double float_lte = 10;
// Used for string fields, requires the string to be not empty (i.e different from "").
optional bool string_not_empty = 11;
// Repeated field with at least this number of elements.
optional int64 repeated_count_min = 12;
// Repeated field with at most this number of elements.
optional int64 repeated_count_max = 13;
// Field value of length greater than this value.
optional int64 length_gt = 14;
// Field value of length smaller than this value.
optional int64 length_lt = 15;
// Field value of length strictly equal to this value.
optional int64 length_eq = 16;
// Requires that the value is in the enum.
optional bool is_in_enum = 17;
// Ensures that a string value is in UUID format.
// uuid_ver specifies the valid UUID versions. Valid values are: 0-5.
// If uuid_ver is 0 all UUID versions are accepted.
optional int32 uuid_ver = 18;
}
message OneofValidator {
// Require that one of the oneof fields is set.
optional bool required = 1;
}

View File

@ -29,6 +29,8 @@ func migration() {
AddColumn(&User{}, "nickname")
AddColumn(&User{}, "language")
AddColumn(&User{}, "subscriber_number")
AddColumn(&RealName{}, "id_number")
AddColumn(&RealName{}, "date_of_birth")
}
// 数据迁移

View File

@ -1,8 +1,9 @@
package model
import (
"gorm.io/plugin/soft_delete"
"time"
"gorm.io/plugin/soft_delete"
)
// RealName 实名认证模型
@ -20,4 +21,6 @@ type RealName struct {
PlaceOfResidence string `gorm:"column:place_of_residence;comment:居住地" json:"placeOfResidence"`
GroupPhoto string `gorm:"column:group_photo;comment:证件合影" json:"groupPhoto"`
Attachment string `gorm:"column:attachment;comment:附件" json:"attachment"`
IdNumber string `gorm:"column:id_number;comment:证件号" json:"idNumber"`
DateOfBirth string `gorm:"column:date_of_birth;comment:出生日期" json:"dateOfBirth"`
}

View File

@ -1,6 +1,9 @@
package serializer
import (
"strconv"
"time"
account "github.com/fonchain_enterprise/micro-account/api/accountFiee"
"github.com/fonchain_enterprise/micro-account/pkg/common/utils"
"github.com/fonchain_enterprise/micro-account/pkg/model"
@ -68,6 +71,7 @@ func BuildUserList(user []*model.User) []*account.UserListInfo {
return []*account.UserListInfo{}
}
var userList []*account.UserListInfo
currentYear := time.Now().Year()
for _, i := range user {
realName := i.RealName
if realName == nil {
@ -81,6 +85,8 @@ func BuildUserList(user []*model.User) []*account.UserListInfo {
PlaceOfResidence: "",
GroupPhoto: "",
Attachment: "",
IdNumber: "",
DateOfBirth: "",
}
}
userList = append(userList, &account.UserListInfo{
@ -104,10 +110,41 @@ func BuildUserList(user []*model.User) []*account.UserListInfo {
Language: i.Language,
SubscriberNumber: i.SubscriberNumber,
NickName: i.Nickname,
IdNumber: realName.IdNumber,
DateOfBirth: realName.DateOfBirth,
Age: getAgeString(realName.DateOfBirth, realName.IdNumber, currentYear),
})
}
return userList
}
func getAgeString(dateOfBirth, idNumber string, currentYear int) string {
// 尝试从出生日期获取年份
if dateOfBirth != "" && len(dateOfBirth) >= 4 {
if year, err := strconv.Atoi(dateOfBirth[0:4]); err == nil && year > 1900 && year <= currentYear {
return strconv.Itoa(currentYear - year)
}
}
// 尝试从身份证号获取年份
if idNumber != "" {
var birthYear int
if len(idNumber) == 15 {
if year, err := strconv.Atoi("19" + idNumber[6:8]); err == nil {
birthYear = year
}
} else if len(idNumber) == 18 {
if year, err := strconv.Atoi(idNumber[6:10]); err == nil {
birthYear = year
}
}
if birthYear > 1900 && birthYear <= currentYear {
return strconv.Itoa(currentYear - birthYear)
}
}
return ""
}
func SynInvitationCode(userId uint) (string, error) {
//保存实名信息

View File

@ -3,10 +3,18 @@ package service
import (
"context"
"database/sql"
"dubbo.apache.org/dubbo-go/v3/common/logger"
_ "dubbo.apache.org/dubbo-go/v3/imports"
"errors"
"fmt"
"image"
"log"
"math"
rand2 "math/rand"
"strconv"
"strings"
"time"
"dubbo.apache.org/dubbo-go/v3/common/logger"
_ "dubbo.apache.org/dubbo-go/v3/imports"
account "github.com/fonchain_enterprise/micro-account/api/accountFiee"
"github.com/fonchain_enterprise/micro-account/pkg/application"
"github.com/fonchain_enterprise/micro-account/pkg/cache"
@ -24,13 +32,6 @@ import (
"github.com/go-redis/redis"
uuid2 "github.com/google/uuid"
"gorm.io/gorm"
"image"
"log"
"math"
rand2 "math/rand"
"strconv"
"strings"
"time"
)
type AccountFieeProvider struct {
@ -397,6 +398,8 @@ func (a *AccountFieeProvider) RealName(_ context.Context, in *account.RealNameRe
PlaceOfResidence: in.PlaceOfResidence,
GroupPhoto: in.GroupPhoto,
Attachment: in.Attachment,
IdNumber: in.IdNumber,
DateOfBirth: in.DateOfBirth,
}
// 创建实名信息
if err := model.DB.Create(&newRealName).Error; err != nil {
@ -424,6 +427,8 @@ func (a *AccountFieeProvider) RealName(_ context.Context, in *account.RealNameRe
"place_of_residence": in.PlaceOfResidence,
"group_photo": in.GroupPhoto,
"attachment": in.Attachment,
"id_number": in.IdNumber,
"date_of_birth": in.DateOfBirth,
}
// 更新 RealName 表中的数据
var existingRealName model.RealName