Compare commits
	
		
			No commits in common. "920e686c5b095215daa9d6076c992b13c9f6f113" and "545916ec454ba29f29d21b9d9e06df5cb6865272" have entirely different histories.
		
	
	
		
			920e686c5b
			...
			545916ec45
		
	
		
| @ -1,4 +1,4 @@ | |||||||
| FROM testhub.szjixun.cn:9043/public/golang:1.20-alpine AS builder | FROM testhub.szjixun.cn:9043/public/golang:1.18-alpine AS builder | ||||||
| 
 | 
 | ||||||
| LABEL stage=gobuilder | LABEL stage=gobuilder | ||||||
| ENV CGO_ENABLED 0 | ENV CGO_ENABLED 0 | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| FROM testhub.szjixun.cn:9043/public/golang:1.20-alpine AS builder | FROM testhub.szjixun.cn:9043/public/golang:1.18-alpine AS builder | ||||||
| 
 | 
 | ||||||
| LABEL stage=gobuilder | LABEL stage=gobuilder | ||||||
| ENV CGO_ENABLED 0 | ENV CGO_ENABLED 0 | ||||||
|  | |||||||
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
									
									
									
									
								
							| @ -1,6 +1,6 @@ | |||||||
| module exhibition-register | module exhibition-register | ||||||
| 
 | 
 | ||||||
| go 1.20 | go 1.18 | ||||||
| 
 | 
 | ||||||
| require ( | require ( | ||||||
| 	dubbo.apache.org/dubbo-go/v3 v3.0.5 | 	dubbo.apache.org/dubbo-go/v3 v3.0.5 | ||||||
|  | |||||||
| @ -6,6 +6,6 @@ import ( | |||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| type ExhibitionProvider struct { | type ExhibitionProvider struct { | ||||||
| 	exhibition.UnimplementedExhibitionServer | 	exhibition.UnsafeExhibitionServer | ||||||
| 	registerLogic logic.Register | 	registerLogic logic.Register | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,16 +1 @@ | |||||||
| package controller | package controller | ||||||
| 
 |  | ||||||
| import ( |  | ||||||
| 	"context" |  | ||||||
| 	"exhibition-register/pb/exhibition" |  | ||||||
| 	"exhibition-register/pkg/msg" |  | ||||||
| ) |  | ||||||
| 
 |  | ||||||
| func (e *ExhibitionProvider) CheckPhone(_ context.Context, req *exhibition.RegisterInfo) (res *exhibition.CheckPhoneResp, err error) { |  | ||||||
| 	res = new(exhibition.CheckPhoneResp) |  | ||||||
| 	if res, err = e.registerLogic.CheckByPhone(req); err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
| 	res.Msg = msg.Success |  | ||||||
| 	return |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -1,23 +0,0 @@ | |||||||
| package dao |  | ||||||
| 
 |  | ||||||
| import ( |  | ||||||
| 	"errors" |  | ||||||
| 	"exhibition-register/internal/model" |  | ||||||
| 	"exhibition-register/pkg/app" |  | ||||||
| 	"exhibition-register/pkg/msg" |  | ||||||
| 	"go.uber.org/zap" |  | ||||||
| 	"gorm.io/gorm" |  | ||||||
| ) |  | ||||||
| 
 |  | ||||||
| func CheckByPhone(phone string) (record *model.RegisterRecord, err error) { |  | ||||||
| 	res := app.ModuleClients.ExhibitionRegister.Where("phone_num=?", phone).First(record) |  | ||||||
| 	if res.Error != nil { |  | ||||||
| 		if errors.Is(err, gorm.ErrRecordNotFound) { |  | ||||||
| 			return nil, nil |  | ||||||
| 		} |  | ||||||
| 		zap.L().Error("Register err CheckByPhone", zap.Error(err)) |  | ||||||
| 		err = errors.New(msg.ErrorSelect) |  | ||||||
| 		return |  | ||||||
| 	} |  | ||||||
| 	return |  | ||||||
| } |  | ||||||
| @ -1,47 +1,7 @@ | |||||||
| package logic | package logic | ||||||
| 
 | 
 | ||||||
| import ( |  | ||||||
| 	"exhibition-register/internal/dao" |  | ||||||
| 	"exhibition-register/pb/exhibition" |  | ||||||
| ) |  | ||||||
| 
 |  | ||||||
| type IRegister interface { | type IRegister interface { | ||||||
| 	CheckByPhone(in *exhibition.RegisterInfo) (out *exhibition.CheckPhoneResp, err error) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func NewRegister() IRegister { |  | ||||||
| 	return &Register{} |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type Register struct { | type Register struct { | ||||||
| } | } | ||||||
| 
 |  | ||||||
| // CheckPhone 通过手机号检索 存在的就返回数据
 |  | ||||||
| func (r *Register) CheckByPhone(in *exhibition.RegisterInfo) (out *exhibition.CheckPhoneResp, err error) { |  | ||||||
| 	out = &exhibition.CheckPhoneResp{} |  | ||||||
| 	record, err := dao.CheckByPhone(in.PhoneNum) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
| 	if record == nil { |  | ||||||
| 		out.IsExist = false |  | ||||||
| 		return out, nil |  | ||||||
| 	} |  | ||||||
| 	data := &exhibition.RegisterInfo{ |  | ||||||
| 		Id:          int32(record.ID), |  | ||||||
| 		Uuid:        record.UUID, |  | ||||||
| 		ArtistName:  record.ArtistName, |  | ||||||
| 		Gender:      record.Gender, |  | ||||||
| 		PhoneNum:    record.PhoneNum, |  | ||||||
| 		IdCard:      record.IdCard, |  | ||||||
| 		Address:     record.Address, |  | ||||||
| 		IdCardPhoto: record.IdCardPhoto, |  | ||||||
| 		ArtistPhoto: record.ArtistPhoto, |  | ||||||
| 		CreatedAt:   record.CreatedAt.String(), |  | ||||||
| 		UpdatedAt:   record.UpdatedAt.String(), |  | ||||||
| 	} |  | ||||||
| 	out.Data = data |  | ||||||
| 	out.IsExist = true |  | ||||||
| 
 |  | ||||||
| 	return out, nil |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -71,4 +71,52 @@ const ( | |||||||
| 
 | 
 | ||||||
| const ( | const ( | ||||||
| 	ErrOperate = "操作错误" | 	ErrOperate = "操作错误" | ||||||
|  | 
 | ||||||
|  | 	ErrCreateUser      = "创建用户失败" | ||||||
|  | 	ErrUpdateUser      = "更新用户失败" | ||||||
|  | 	ErrGetUserInfo     = "查询用户信息失败" | ||||||
|  | 	ErrGetUserInfoExam = "查询答题用户信息失败" | ||||||
|  | 	ErrUserNotRegister = "用户未注册" | ||||||
|  | 	ErrVerifyUser      = "校验用户信息失败" | ||||||
|  | 	ErrUserHad         = "当前用户信息已存在" | ||||||
|  | 
 | ||||||
|  | 	ErrCreateExam          = "创建考试失败" | ||||||
|  | 	ErrUpdateExam          = "更新考试失败" | ||||||
|  | 	ErrGetExamInfoData     = "查询考试信息失败" | ||||||
|  | 	ErrGetExamInfoCount    = "查询考试信息失败" | ||||||
|  | 	ErrGetExamInfoNoParams = "查询考试信息条件错误" | ||||||
|  | 	ErUpdateExamStatus     = "更新考试状态错误" | ||||||
|  | 
 | ||||||
|  | 	ErrCreateTrain          = "创建培训失败" | ||||||
|  | 	ErrUpdateTrain          = "更新培训失败" | ||||||
|  | 	ErrGetTrainInfoData     = "查询培训信息失败" | ||||||
|  | 	ErrGetTrainInfoCount    = "查询培训信息失败" | ||||||
|  | 	ErrGetTrainInfoNoParams = "查询培训信息条件错误" | ||||||
|  | 
 | ||||||
|  | 	ErrCreateQuestion       = "创建题目失败" | ||||||
|  | 	ErrUpdateQuestion       = "更新题目失败" | ||||||
|  | 	ErrQuestionInUse        = "题目正在被使用,无法修改" | ||||||
|  | 	ErrGetQuestionInfoData  = "查询题目信息失败" | ||||||
|  | 	ErrGetQuestionInfoCount = "查询题目信息失败" | ||||||
|  | 
 | ||||||
|  | 	ErrCreateGift       = "创建礼品失败" | ||||||
|  | 	ErrUpdateGift       = "更新礼品失败" | ||||||
|  | 	ErrGetGiftInfoData  = "查询礼品信息失败" | ||||||
|  | 	ErrGetGiftInfoCount = "查询礼品信息失败" | ||||||
|  | 
 | ||||||
|  | 	ErrCreateUserHis            = "创建考试成绩失败" | ||||||
|  | 	ErrQueryUserHis             = "查询考试成绩失败" | ||||||
|  | 	ErrQueryAnswerScore         = "查询答案分值失败" | ||||||
|  | 	ErrQueryAnswer              = "查询答案失败" | ||||||
|  | 	ErrCreateUserAnswerHis      = "创建作答记录失败" | ||||||
|  | 	ErrCreateUserTrainHis       = "创建培训记录失败" | ||||||
|  | 	ErrUpdateUserTrainHis       = "更新培训记录失败" | ||||||
|  | 	ErrCreateUserGiftHis        = "创建礼品记录失败" | ||||||
|  | 	ErrUpdateUserGiftHis        = "更新礼品状态失败" | ||||||
|  | 	ErrCheckAnswer              = "答案核对失败" | ||||||
|  | 	ErrUpdateUserHis            = "更新考试成绩失败" | ||||||
|  | 	ErrUpdateParticipantNum     = "更新参与人数失败" | ||||||
|  | 	ErrUpdateParticipantPassNum = "更新通过人数失败" | ||||||
|  | 	ErrQueryVideo               = "查询视频信息失败" | ||||||
|  | 	ErrQueryUserAnswerHis       = "查询答题记录失败" | ||||||
| ) | ) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user