From d202628c711fce13714c3c835a93357abb9616ea Mon Sep 17 00:00:00 2001 From: rita <97798661+Love-YeLin@users.noreply.github.com> Date: Mon, 15 Apr 2024 15:25:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=83=8C=E6=99=AF=E5=9B=BE?= =?UTF-8?q?=E7=89=87url=E5=AD=97=E6=AE=B5=20(#100)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- biz/application/service/user.go | 36 +++++++++++++------------ biz/infrastructure/mapper/user/mongo.go | 23 ++++++++-------- go.mod | 2 +- go.sum | 2 ++ 4 files changed, 34 insertions(+), 29 deletions(-) diff --git a/biz/application/service/user.go b/biz/application/service/user.go index eac693d..bbb141f 100644 --- a/biz/application/service/user.go +++ b/biz/application/service/user.go @@ -84,15 +84,16 @@ func (s *UserService) GetUser(ctx context.Context, req *gencontent.GetUserReq) ( return resp, err } return &gencontent.GetUserResp{ - Name: user.Name, - Sex: user.Sex, - FullName: user.FullName, - IdCard: user.IdCard, - Description: user.Description, - Url: user.Url, - CreateTime: user.CreateAt.UnixMilli(), - UpdateTime: user.UpdateAt.UnixMilli(), - Labels: user.Labels, + Name: user.Name, + Sex: user.Sex, + FullName: user.FullName, + IdCard: user.IdCard, + Description: user.Description, + Url: user.Url, + CreateTime: user.CreateAt.UnixMilli(), + UpdateTime: user.UpdateAt.UnixMilli(), + Labels: user.Labels, + BackgroundUrl: user.BackgroundUrl, }, nil } @@ -117,14 +118,15 @@ func (s *UserService) CreateUser(ctx context.Context, req *gencontent.CreateUser func (s *UserService) UpdateUser(ctx context.Context, req *gencontent.UpdateUserReq) (resp *gencontent.UpdateUserResp, err error) { oid, _ := primitive.ObjectIDFromHex(req.UserId) if _, err = s.UserMongoMapper.Update(ctx, &usermapper.User{ - ID: oid, - Name: req.Name, - Sex: req.Sex, - FullName: req.FullName, - IdCard: req.IdCard, - Description: req.Description, - Url: req.Url, - Labels: req.Labels, + ID: oid, + Name: req.Name, + Sex: req.Sex, + FullName: req.FullName, + IdCard: req.IdCard, + Description: req.Description, + Url: req.Url, + Labels: req.Labels, + BackgroundUrl: req.BackgroundUrl, }); err != nil { return resp, err } diff --git a/biz/infrastructure/mapper/user/mongo.go b/biz/infrastructure/mapper/user/mongo.go index 9e00b79..d06f74b 100644 --- a/biz/infrastructure/mapper/user/mongo.go +++ b/biz/infrastructure/mapper/user/mongo.go @@ -32,17 +32,18 @@ type ( FindManyByIds(ctx context.Context, ids []string) ([]*User, error) } User struct { - ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` - Name string `bson:"name,omitempty" json:"name,omitempty"` - Sex int64 `bson:"sex,omitempty" json:"sex,omitempty"` - FullName string `bson:"fullName,omitempty" json:"fullName,omitempty"` - IdCard string `bson:"idCard,omitempty" json:"idCard,omitempty"` - Description string `bson:"description,omitempty" json:"description,omitempty"` - Url string `bson:"url,omitempty" json:"url,omitempty"` - UpdateAt time.Time `bson:"updateAt,omitempty" json:"updateAt,omitempty"` - CreateAt time.Time `bson:"createAt,omitempty" json:"createAt,omitempty"` - Labels []string `bson:"labels,omitempty" json:"labels,omitempty"` - Score_ float64 `bson:"_score,omitempty" json:"_score,omitempty"` + ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` + Name string `bson:"name,omitempty" json:"name,omitempty"` + Sex int64 `bson:"sex,omitempty" json:"sex,omitempty"` + FullName string `bson:"fullName,omitempty" json:"fullName,omitempty"` + IdCard string `bson:"idCard,omitempty" json:"idCard,omitempty"` + Description string `bson:"description,omitempty" json:"description,omitempty"` + Url string `bson:"url,omitempty" json:"url,omitempty"` + BackgroundUrl string `bson:"backgroundUrl,omitempty" json:"backgroundUrl,omitempty"` + UpdateAt time.Time `bson:"updateAt,omitempty" json:"updateAt,omitempty"` + CreateAt time.Time `bson:"createAt,omitempty" json:"createAt,omitempty"` + Labels []string `bson:"labels,omitempty" json:"labels,omitempty"` + Score_ float64 `bson:"_score,omitempty" json:"_score,omitempty"` } MongoMapper struct { diff --git a/go.mod b/go.mod index a7a0c15..0760953 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/CloudStriver/cloudmind-mq v1.0.12-0.20240411042341-53be6a32a1ac github.com/CloudStriver/go-pkg v0.0.0-20240329084540-20ca37a52fea - github.com/CloudStriver/service-idl-gen-go v0.0.0-20240412035535-b11df688dcda + github.com/CloudStriver/service-idl-gen-go v0.0.0-20240415063135-d3955d0682e0 github.com/bytedance/sonic v1.10.2 github.com/cloudwego/kitex v0.8.0 github.com/elastic/go-elasticsearch/v8 v8.11.1 diff --git a/go.sum b/go.sum index 0053da9..67ffaa7 100644 --- a/go.sum +++ b/go.sum @@ -395,6 +395,8 @@ github.com/CloudStriver/service-idl-gen-go v0.0.0-20240412033032-028d45340c2f h1 github.com/CloudStriver/service-idl-gen-go v0.0.0-20240412033032-028d45340c2f/go.mod h1:chtR82RvfrjUujTGWROSCNAwF9Lh/U959k34bXIDvBI= github.com/CloudStriver/service-idl-gen-go v0.0.0-20240412035535-b11df688dcda h1:iHiWtcp1r3bOilaaK2rbARfxPtujVWcDo+UHdkpWB3Q= github.com/CloudStriver/service-idl-gen-go v0.0.0-20240412035535-b11df688dcda/go.mod h1:chtR82RvfrjUujTGWROSCNAwF9Lh/U959k34bXIDvBI= +github.com/CloudStriver/service-idl-gen-go v0.0.0-20240415063135-d3955d0682e0 h1:daaQ68hELBrjQW++Sw2ztgqr61FVhtJBjT0UI74CAhk= +github.com/CloudStriver/service-idl-gen-go v0.0.0-20240415063135-d3955d0682e0/go.mod h1:chtR82RvfrjUujTGWROSCNAwF9Lh/U959k34bXIDvBI= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=