From c15ae5604ff8c17e2896cade7f38979363828aca Mon Sep 17 00:00:00 2001 From: shenjiachi <shenjiachi@fnuoos.com> Date: Tue, 10 Dec 2024 14:12:20 +0800 Subject: [PATCH 1/7] update --- app/hdl/friend_circle/hdl_friend_circle.go | 2 ++ app/router/router.go | 2 +- app/svc/friend_circle/svc_firend_circle.go | 11 +++++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/hdl/friend_circle/hdl_friend_circle.go b/app/hdl/friend_circle/hdl_friend_circle.go index 5f8ef75..fce2a06 100644 --- a/app/hdl/friend_circle/hdl_friend_circle.go +++ b/app/hdl/friend_circle/hdl_friend_circle.go @@ -44,6 +44,8 @@ func MySelfList(c *gin.Context) { e.OutErr(c, e.ERR, err.Error()) return } + resp.Page = args.Page + resp.PageSize = args.PageSize e.OutSuc(c, resp, nil) } diff --git a/app/router/router.go b/app/router/router.go index 5196b3b..e1867e4 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -199,7 +199,7 @@ func route(r *gin.RouterGroup) { func rCircleFriends(r *gin.RouterGroup) { r.POST("/mySelfList", friend_circle.MySelfList) // 我的朋友圈列表 - r.GET("/recommendList", friend_circle.RecommendList) // 推荐列表 + r.POST("/recommendList", friend_circle.RecommendList) // 推荐列表 r.POST("/commentList", friend_circle.CommentList) // 评论列表 r.POST("/commentDetail", friend_circle.CommentDetail) // 评论详情 r.POST("/publish", friend_circle.Publish) // 发送朋友圈 diff --git a/app/svc/friend_circle/svc_firend_circle.go b/app/svc/friend_circle/svc_firend_circle.go index 6357c5c..26f9b9a 100644 --- a/app/svc/friend_circle/svc_firend_circle.go +++ b/app/svc/friend_circle/svc_firend_circle.go @@ -72,7 +72,7 @@ func MySelfList(c *gin.Context, req friend_circles.MySelfListReq) (resp friend_c //获取当前用户在im中的user_id var friends []*model.Friend - err = db.DbIm.Where("`phone_number`=?", user.Phone).Limit(5000).Find(&friends) + err = db.DbIm.Where("`user_id`=?", user.Id).Limit(5000).Find(&friends) if err != nil { return } @@ -127,18 +127,17 @@ func GetRecommendList(c *gin.Context, req friend_circles.RecommendListReq) (resp // 构建查询 query := elastic.NewBoolQuery() - query.Must(elastic.NewTermQuery("state", "1")) - query.Should(elastic.NewTermQuery("is_top_up", "1")) + query.Must(elastic.NewTermQuery("state", 1)) + query.Should(elastic.NewTermQuery("is_top_up", 1)) searchResult, err := es.EsClient.Search(). - Index(md.EggFriendCircleEsIndex). // 替换为你的索引名称 + Index(md.EggFriendCircleEsAlias). // 替换为你的索引名称 Query(query). - Sort("create_at", false). // 按时间倒排 + //Sort("create_at", false). // 按时间倒排 From(from). Size(req.PageSize). Pretty(true). Do(context.Background()) if err != nil { - logx.Fatalf("Error searching for documents: %v", err) return } From 320cfaeb68f3a636a8cacb0c1d8583844c7333fb Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 10 Dec 2024 14:37:26 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=B9=BF=E5=91=8A=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E5=80=BC=20=E7=94=A8=E6=88=B7=E6=B3=A8?= =?UTF-8?q?=E9=94=80=E6=93=8D=E4=BD=9C=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/hdl/hdl_user.go | 59 ++++++++++++ app/md/md_advertising.go | 1 + app/md/md_login.go | 3 + app/md/md_mq.go | 6 +- app/router/router.go | 1 + app/svc/svc_advertising.go | 16 +++- docs/docs.go | 187 ++++++++++++++++++++++++------------- docs/swagger.json | 182 +++++++++++++++++++++++------------- docs/swagger.yaml | 121 +++++++++++++++--------- go.mod | 2 +- 10 files changed, 399 insertions(+), 179 deletions(-) diff --git a/app/hdl/hdl_user.go b/app/hdl/hdl_user.go index 97e9277..26b10cf 100644 --- a/app/hdl/hdl_user.go +++ b/app/hdl/hdl_user.go @@ -5,21 +5,26 @@ import ( "applet/app/e" "applet/app/es/hdl" md2 "applet/app/es/md" + "applet/app/lib/auth" "applet/app/md" "applet/app/svc" "applet/app/utils" + "applet/app/utils/cache" "applet/app/utils/qrcode" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "code.fnuoos.com/EggPlanet/egg_models.git/src/model" "code.fnuoos.com/EggPlanet/egg_system_rules.git/aliyun" "code.fnuoos.com/EggPlanet/egg_system_rules.git/kuaizhan" "code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es" + "code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" "context" + "fmt" "github.com/gin-gonic/gin" "github.com/olivere/elastic/v7" "github.com/syyongx/php2go" "github.com/tidwall/gjson" "strings" + "time" ) // UserInfo @@ -314,3 +319,57 @@ func InviteUrl(c *gin.Context) { e.OutSuc(c, res, nil) return } + +// Delete +// @Summary 注销账号 +// @Tags 账号与安全 +// @Description 注销账号 +// @Accept json +// @Produce json +// @Param req body md.DeleteUserReq true "注册参数" +// @Success 200 string "登录成功返回" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/v1/memberCenter/delete [post] +func Delete(c *gin.Context) { + var req md.DeleteUserReq + err := c.ShouldBindJSON(&req) + if err != nil { + err = svc.HandleValidateErr(err) + err1 := err.(e.E) + e.OutErr(c, err1.Code, err1.Error()) + return + } + user := svc.GetUser(c) + //data := svc.AliyunSmsBase(c, "") + ////校验短信 + //err = aliyun.AliyunCheckSms(data["aliyun_sms_id"], data["aliyun_sms_secret"], user.Phone, req.Code) + //if err != nil { + // e.OutErr(c, 400, e.NewErr(400, "验证码错误,请重试")) + // return + //} + user.State = 3 + db.Db.Where("id=?", user.Id).Cols("state").Update(user) + tmp := model.UserDeleteInfo{ + Uid: int(user.Id), + Phone: user.Phone, + CreateAt: time.Now(), + } + db.Db.Insert(&tmp) + ch, err := rabbit.Cfg.Pool.GetChannel() + if err == nil { + defer ch.Release() + err = ch.PublishV2(md.EggUserExchange, md.CommUserId{ + Uid: utils.Int64ToStr(user.Id), + }, md.EggUserDelete) + if err != nil { + ch.PublishV2(md.EggUserExchange, md.CommUserId{ + Uid: utils.Int64ToStr(user.Id), + }, md.EggUserDelete) + } + } + // 清掉token + cacheKey := fmt.Sprintf(auth.TokenKey, user.Id) + _, err = cache.SetEx(cacheKey, "", 1) + e.OutSuc(c, "success", nil) + return +} diff --git a/app/md/md_advertising.go b/app/md/md_advertising.go index 69e372c..21e3250 100644 --- a/app/md/md_advertising.go +++ b/app/md/md_advertising.go @@ -29,6 +29,7 @@ type AdvertisingCheck struct { } type AdvertisingState struct { IsSuccess string `json:"is_success"` + Integral string `json:"integral"` } type AdvertisingFunction struct { Name string `json:"name" example:"名称"` diff --git a/app/md/md_login.go b/app/md/md_login.go index e124d07..f8ddf0a 100644 --- a/app/md/md_login.go +++ b/app/md/md_login.go @@ -34,6 +34,9 @@ type UpdatePasscodeReq struct { Code string `json:"code" example:"验证码"` PassCode string `json:"passcode" example:"密码 如 123"` } +type DeleteUserReq struct { + Code string `json:"code" example:"验证码"` +} type WechatLoginReq struct { OpenID string `json:"open_id" example:"微信openId"` UnionId string `json:"union_id" example:"微信UnionId"` diff --git a/app/md/md_mq.go b/app/md/md_mq.go index 3f054f9..8292fea 100644 --- a/app/md/md_mq.go +++ b/app/md/md_mq.go @@ -11,6 +11,8 @@ const ( EggVideoPlayletExchange = "egg.video_playlet" EggVideoReward = "video" EggPlayletReward = "playlet" + EggUserExchange = "egg.user" + EggUserDelete = "user_delete" ) type VideoReward struct { @@ -19,7 +21,9 @@ type VideoReward struct { type PlayletReward struct { Uid string `json:"uid"` } - +type CommUserId struct { + Uid string `json:"uid"` +} type JpushRecordFundData struct { Id string `json:"id"` UserId string `json:"user_id"` diff --git a/app/router/router.go b/app/router/router.go index e1867e4..3fbb454 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -121,6 +121,7 @@ func route(r *gin.RouterGroup) { rMemberCenter.POST("/updatePassword", hdl.UpdatePassword) //修改密码 rMemberCenter.POST("/updatePasscode", hdl.UpdatePasscode) //修改支付密码 rMemberCenter.GET("/inviteUrl", hdl.InviteUrl) //邀请链接 + rMemberCenter.POST("/delete", hdl.Delete) //注销账号 } rPointsCenter := r.Group("/pointsCenter") // 积分中心 { diff --git a/app/svc/svc_advertising.go b/app/svc/svc_advertising.go index f7f2bf6..2d63c0f 100644 --- a/app/svc/svc_advertising.go +++ b/app/svc/svc_advertising.go @@ -5,6 +5,7 @@ import ( "applet/app/e" "applet/app/md" "applet/app/utils" + "applet/app/utils/cache" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "code.fnuoos.com/EggPlanet/egg_models.git/src/model" "encoding/json" @@ -126,13 +127,22 @@ func AdvertisingState(c *gin.Context) { return } isSuccess := "0" - var data model.AdvertisingCallback - db.Db.Where("uniq_id=? ", req.Id).Get(&data) - if data.Id > 0 { + getString, _ := cache.GetString(req.Id) + integral := "0" + if getString == "" { + var data model.AdvertisingCallback + db.Db.Where("uniq_id=? ", req.Id).Get(&data) + if data.Id > 0 { + isSuccess = "1" + integral = data.Integral + } + } else { isSuccess = "1" + integral = getString } res := md.AdvertisingState{ IsSuccess: isSuccess, + Integral: integral, } e.OutSuc(c, res, nil) return diff --git a/docs/docs.go b/docs/docs.go index 95b03b8..cba0e2f 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1,4 +1,5 @@ -// Package docs Code generated by swaggo/swag. DO NOT EDIT +// Code generated by swaggo/swag. DO NOT EDIT. + package docs import "github.com/swaggo/swag" @@ -2266,6 +2267,46 @@ const docTemplate = `{ } } }, + "/api/v1/memberCenter/delete": { + "post": { + "description": "注销账号", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "账号与安全" + ], + "summary": "注销账号", + "parameters": [ + { + "description": "注册参数", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.DeleteUserReq" + } + } + ], + "responses": { + "200": { + "description": "登录成功返回", + "schema": { + "type": "string" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/v1/memberCenter/getBasic": { "get": { "description": "基础数据(获取)", @@ -3090,7 +3131,9 @@ const docTemplate = `{ "name": "req", "in": "body", "required": true, - "schema": {} + "schema": { + "type": "object" + } } ], "responses": { @@ -3881,6 +3924,68 @@ const docTemplate = `{ } } }, + "code_fnuoos_com_EggPlanet_egg_models_git_src_model.ImSendRedPackageOrd": { + "type": "object", + "properties": { + "amount": { + "type": "string" + }, + "create_time": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "im_data": { + "type": "string" + }, + "im_uid": { + "type": "integer" + }, + "ord_no": { + "type": "string" + }, + "received_im_user_ids": { + "type": "string" + }, + "received_times": { + "type": "string" + }, + "received_user_amount": { + "type": "string" + }, + "received_user_ids": { + "type": "string" + }, + "red_packet_balance_amount": { + "type": "string" + }, + "red_packet_balance_nums": { + "type": "integer" + }, + "red_packet_nums": { + "type": "integer" + }, + "red_packet_type": { + "type": "integer" + }, + "state": { + "type": "integer" + }, + "uid": { + "type": "integer" + }, + "update_time": { + "type": "string" + }, + "wait_draw_im_user_ids": { + "type": "string" + }, + "wait_draw_user_ids": { + "type": "string" + } + } + }, "comm.AccessRecordsReq": { "type": "object", "properties": { @@ -4240,6 +4345,9 @@ const docTemplate = `{ "md.AdvertisingState": { "type": "object", "properties": { + "integral": { + "type": "string" + }, "is_success": { "type": "string" } @@ -4476,6 +4584,15 @@ const docTemplate = `{ } } }, + "md.DeleteUserReq": { + "type": "object", + "properties": { + "code": { + "type": "string", + "example": "验证码" + } + } + }, "md.DynamicDataResp": { "type": "object", "properties": { @@ -5476,7 +5593,7 @@ const docTemplate = `{ "description": "红包详情信息", "allOf": [ { - "$ref": "#/definitions/model.ImSendRedPackageOrd" + "$ref": "#/definitions/code_fnuoos_com_EggPlanet_egg_models_git_src_model.ImSendRedPackageOrd" } ] }, @@ -6158,68 +6275,6 @@ const docTemplate = `{ } } }, - "model.ImSendRedPackageOrd": { - "type": "object", - "properties": { - "amount": { - "type": "string" - }, - "create_time": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "im_data": { - "type": "string" - }, - "im_uid": { - "type": "integer" - }, - "ord_no": { - "type": "string" - }, - "received_im_user_ids": { - "type": "string" - }, - "received_times": { - "type": "string" - }, - "received_user_amount": { - "type": "string" - }, - "received_user_ids": { - "type": "string" - }, - "red_packet_balance_amount": { - "type": "string" - }, - "red_packet_balance_nums": { - "type": "integer" - }, - "red_packet_nums": { - "type": "integer" - }, - "red_packet_type": { - "type": "integer" - }, - "state": { - "type": "integer" - }, - "uid": { - "type": "integer" - }, - "update_time": { - "type": "string" - }, - "wait_draw_im_user_ids": { - "type": "string" - }, - "wait_draw_user_ids": { - "type": "string" - } - } - }, "pb.SendRedPacketResp": { "type": "object", "properties": { @@ -6242,8 +6297,6 @@ var SwaggerInfo = &swag.Spec{ Description: "APP客户端-Api接口", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, - LeftDelim: "{{", - RightDelim: "}}", } func init() { diff --git a/docs/swagger.json b/docs/swagger.json index 01b7f57..6baec14 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -2260,6 +2260,46 @@ } } }, + "/api/v1/memberCenter/delete": { + "post": { + "description": "注销账号", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "账号与安全" + ], + "summary": "注销账号", + "parameters": [ + { + "description": "注册参数", + "name": "req", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.DeleteUserReq" + } + } + ], + "responses": { + "200": { + "description": "登录成功返回", + "schema": { + "type": "string" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/v1/memberCenter/getBasic": { "get": { "description": "基础数据(获取)", @@ -3084,7 +3124,9 @@ "name": "req", "in": "body", "required": true, - "schema": {} + "schema": { + "type": "object" + } } ], "responses": { @@ -3875,6 +3917,68 @@ } } }, + "code_fnuoos_com_EggPlanet_egg_models_git_src_model.ImSendRedPackageOrd": { + "type": "object", + "properties": { + "amount": { + "type": "string" + }, + "create_time": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "im_data": { + "type": "string" + }, + "im_uid": { + "type": "integer" + }, + "ord_no": { + "type": "string" + }, + "received_im_user_ids": { + "type": "string" + }, + "received_times": { + "type": "string" + }, + "received_user_amount": { + "type": "string" + }, + "received_user_ids": { + "type": "string" + }, + "red_packet_balance_amount": { + "type": "string" + }, + "red_packet_balance_nums": { + "type": "integer" + }, + "red_packet_nums": { + "type": "integer" + }, + "red_packet_type": { + "type": "integer" + }, + "state": { + "type": "integer" + }, + "uid": { + "type": "integer" + }, + "update_time": { + "type": "string" + }, + "wait_draw_im_user_ids": { + "type": "string" + }, + "wait_draw_user_ids": { + "type": "string" + } + } + }, "comm.AccessRecordsReq": { "type": "object", "properties": { @@ -4234,6 +4338,9 @@ "md.AdvertisingState": { "type": "object", "properties": { + "integral": { + "type": "string" + }, "is_success": { "type": "string" } @@ -4470,6 +4577,15 @@ } } }, + "md.DeleteUserReq": { + "type": "object", + "properties": { + "code": { + "type": "string", + "example": "验证码" + } + } + }, "md.DynamicDataResp": { "type": "object", "properties": { @@ -5470,7 +5586,7 @@ "description": "红包详情信息", "allOf": [ { - "$ref": "#/definitions/model.ImSendRedPackageOrd" + "$ref": "#/definitions/code_fnuoos_com_EggPlanet_egg_models_git_src_model.ImSendRedPackageOrd" } ] }, @@ -6152,68 +6268,6 @@ } } }, - "model.ImSendRedPackageOrd": { - "type": "object", - "properties": { - "amount": { - "type": "string" - }, - "create_time": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "im_data": { - "type": "string" - }, - "im_uid": { - "type": "integer" - }, - "ord_no": { - "type": "string" - }, - "received_im_user_ids": { - "type": "string" - }, - "received_times": { - "type": "string" - }, - "received_user_amount": { - "type": "string" - }, - "received_user_ids": { - "type": "string" - }, - "red_packet_balance_amount": { - "type": "string" - }, - "red_packet_balance_nums": { - "type": "integer" - }, - "red_packet_nums": { - "type": "integer" - }, - "red_packet_type": { - "type": "integer" - }, - "state": { - "type": "integer" - }, - "uid": { - "type": "integer" - }, - "update_time": { - "type": "string" - }, - "wait_draw_im_user_ids": { - "type": "string" - }, - "wait_draw_user_ids": { - "type": "string" - } - } - }, "pb.SendRedPacketResp": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index bef0bf8..1aeba9c 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -12,6 +12,47 @@ definitions: description: 总数据量 type: integer type: object + code_fnuoos_com_EggPlanet_egg_models_git_src_model.ImSendRedPackageOrd: + properties: + amount: + type: string + create_time: + type: string + id: + type: integer + im_data: + type: string + im_uid: + type: integer + ord_no: + type: string + received_im_user_ids: + type: string + received_times: + type: string + received_user_amount: + type: string + received_user_ids: + type: string + red_packet_balance_amount: + type: string + red_packet_balance_nums: + type: integer + red_packet_nums: + type: integer + red_packet_type: + type: integer + state: + type: integer + uid: + type: integer + update_time: + type: string + wait_draw_im_user_ids: + type: string + wait_draw_user_ids: + type: string + type: object comm.AccessRecordsReq: properties: index: @@ -265,6 +306,8 @@ definitions: type: object md.AdvertisingState: properties: + integral: + type: string is_success: type: string type: object @@ -430,6 +473,12 @@ definitions: description: 标题 type: string type: object + md.DeleteUserReq: + properties: + code: + example: 验证码 + type: string + type: object md.DynamicDataResp: properties: development_committee: @@ -1123,7 +1172,7 @@ definitions: properties: detail: allOf: - - $ref: '#/definitions/model.ImSendRedPackageOrd' + - $ref: '#/definitions/code_fnuoos_com_EggPlanet_egg_models_git_src_model.ImSendRedPackageOrd' description: 红包详情信息 list: description: 领取红包用户列表 @@ -1593,47 +1642,6 @@ definitions: description: 余额 type: string type: object - model.ImSendRedPackageOrd: - properties: - amount: - type: string - create_time: - type: string - id: - type: integer - im_data: - type: string - im_uid: - type: integer - ord_no: - type: string - received_im_user_ids: - type: string - received_times: - type: string - received_user_amount: - type: string - received_user_ids: - type: string - red_packet_balance_amount: - type: string - red_packet_balance_nums: - type: integer - red_packet_nums: - type: integer - red_packet_type: - type: integer - state: - type: integer - uid: - type: integer - update_time: - type: string - wait_draw_im_user_ids: - type: string - wait_draw_user_ids: - type: string - type: object pb.SendRedPacketResp: properties: seq: @@ -3133,6 +3141,32 @@ paths: summary: 绑定上级-要登陆的 tags: - 登录注册 + /api/v1/memberCenter/delete: + post: + consumes: + - application/json + description: 注销账号 + parameters: + - description: 注册参数 + in: body + name: req + required: true + schema: + $ref: '#/definitions/md.DeleteUserReq' + produces: + - application/json + responses: + "200": + description: 登录成功返回 + schema: + type: string + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 注销账号 + tags: + - 账号与安全 /api/v1/memberCenter/getBasic: get: consumes: @@ -3674,7 +3708,8 @@ paths: in: body name: req required: true - schema: {} + schema: + type: object produces: - application/json responses: diff --git a/go.mod b/go.mod index 1791791..45903e8 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( ) require ( - code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241206115326-8cbc93c7c64d + code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241210053355-df51eb14c56e code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241207095445-64c8aa0b486e code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 From daa3c34356d4a70750aa7e7eb5fd5debc988791b Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 10 Dec 2024 15:35:40 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=B3=A8=E9=94=80?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/hdl/hdl_user.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/hdl/hdl_user.go b/app/hdl/hdl_user.go index 26b10cf..1d0003d 100644 --- a/app/hdl/hdl_user.go +++ b/app/hdl/hdl_user.go @@ -5,11 +5,9 @@ import ( "applet/app/e" "applet/app/es/hdl" md2 "applet/app/es/md" - "applet/app/lib/auth" "applet/app/md" "applet/app/svc" "applet/app/utils" - "applet/app/utils/cache" "applet/app/utils/qrcode" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "code.fnuoos.com/EggPlanet/egg_models.git/src/model" @@ -18,7 +16,6 @@ import ( "code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es" "code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" "context" - "fmt" "github.com/gin-gonic/gin" "github.com/olivere/elastic/v7" "github.com/syyongx/php2go" @@ -368,8 +365,8 @@ func Delete(c *gin.Context) { } } // 清掉token - cacheKey := fmt.Sprintf(auth.TokenKey, user.Id) - _, err = cache.SetEx(cacheKey, "", 1) + //cacheKey := fmt.Sprintf(auth.TokenKey, user.Id) + //_, err = cache.SetEx(cacheKey, "", 1) e.OutSuc(c, "success", nil) return } From 2958e942a18161b3c81db388e7cb144dc66e28db Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 10 Dec 2024 15:38:08 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=B3=A8=E9=94=80?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/hdl/hdl_user.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/hdl/hdl_user.go b/app/hdl/hdl_user.go index 1d0003d..26b10cf 100644 --- a/app/hdl/hdl_user.go +++ b/app/hdl/hdl_user.go @@ -5,9 +5,11 @@ import ( "applet/app/e" "applet/app/es/hdl" md2 "applet/app/es/md" + "applet/app/lib/auth" "applet/app/md" "applet/app/svc" "applet/app/utils" + "applet/app/utils/cache" "applet/app/utils/qrcode" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "code.fnuoos.com/EggPlanet/egg_models.git/src/model" @@ -16,6 +18,7 @@ import ( "code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es" "code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" "context" + "fmt" "github.com/gin-gonic/gin" "github.com/olivere/elastic/v7" "github.com/syyongx/php2go" @@ -365,8 +368,8 @@ func Delete(c *gin.Context) { } } // 清掉token - //cacheKey := fmt.Sprintf(auth.TokenKey, user.Id) - //_, err = cache.SetEx(cacheKey, "", 1) + cacheKey := fmt.Sprintf(auth.TokenKey, user.Id) + _, err = cache.SetEx(cacheKey, "", 1) e.OutSuc(c, "success", nil) return } From 01b3c2f1a1a8ee2d23b4e94e3eb485994f06bcde Mon Sep 17 00:00:00 2001 From: shenjiachi <shenjiachi@fnuoos.com> Date: Tue, 10 Dec 2024 15:47:24 +0800 Subject: [PATCH 5/7] update --- app/hdl/friend_circle/hdl_friend_circle.go | 2 +- app/svc/friend_circle/svc_firend_circle.go | 6 ++--- .../friend_circle/svc_firend_circle_test.go | 26 +++++++++++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 app/svc/friend_circle/svc_firend_circle_test.go diff --git a/app/hdl/friend_circle/hdl_friend_circle.go b/app/hdl/friend_circle/hdl_friend_circle.go index fce2a06..9649c3e 100644 --- a/app/hdl/friend_circle/hdl_friend_circle.go +++ b/app/hdl/friend_circle/hdl_friend_circle.go @@ -154,7 +154,7 @@ func RecommendList(c *gin.Context) { e.OutErr(c, err1.Code, err1.Error()) return } - resp, err := svc2.GetRecommendList(c, req) + resp, err := svc2.GetRecommendList(req) if err != nil { e.OutErr(c, e.ERR, err.Error()) return diff --git a/app/svc/friend_circle/svc_firend_circle.go b/app/svc/friend_circle/svc_firend_circle.go index 26f9b9a..e99f110 100644 --- a/app/svc/friend_circle/svc_firend_circle.go +++ b/app/svc/friend_circle/svc_firend_circle.go @@ -91,7 +91,7 @@ func MySelfList(c *gin.Context, req friend_circles.MySelfListReq) (resp friend_c searchResult, err := es.EsClient.Search(). Index(md.EggFriendCircleEsIndex). // 替换为你的索引名称 Query(query). - Sort("create_at", false). // 按时间倒排 + Sort("created_at", false). // 按时间倒排 From(from). Size(req.PageSize). Pretty(true). @@ -121,7 +121,7 @@ func MySelfList(c *gin.Context, req friend_circles.MySelfListReq) (resp friend_c return } -func GetRecommendList(c *gin.Context, req friend_circles.RecommendListReq) (resp friend_circles.RecommendListResp, err error) { +func GetRecommendList(req friend_circles.RecommendListReq) (resp friend_circles.RecommendListResp, err error) { // 分页参数 from := (req.Page - 1) * req.PageSize @@ -132,7 +132,7 @@ func GetRecommendList(c *gin.Context, req friend_circles.RecommendListReq) (resp searchResult, err := es.EsClient.Search(). Index(md.EggFriendCircleEsAlias). // 替换为你的索引名称 Query(query). - //Sort("create_at", false). // 按时间倒排 + Sort("created_at", false). // 按时间倒排 From(from). Size(req.PageSize). Pretty(true). diff --git a/app/svc/friend_circle/svc_firend_circle_test.go b/app/svc/friend_circle/svc_firend_circle_test.go new file mode 100644 index 0000000..5e34ab0 --- /dev/null +++ b/app/svc/friend_circle/svc_firend_circle_test.go @@ -0,0 +1,26 @@ +package svc + +import ( + "applet/app/md/friend_circles" + "code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es" + "fmt" + "testing" +) + +func TestGetRecommendList(test *testing.T) { + req := friend_circles.RecommendListReq{ + Page: 1, + PageSize: 10, + } + es.Init("http://120.55.48.175:9200", "elastic", "fnuo123") + fmt.Println("start") + list, err := GetRecommendList(req) + if err != nil { + fmt.Println(err) + return + } + fmt.Println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<") + if &list != nil { + fmt.Println(list) + } +} From e048752deefcae9f8200710aed15b2bca21b4f8c Mon Sep 17 00:00:00 2001 From: shenjiachi <shenjiachi@fnuoos.com> Date: Tue, 10 Dec 2024 15:48:36 +0800 Subject: [PATCH 6/7] update --- .../friend_circle/svc_firend_circle_test.go | 26 ------------------- 1 file changed, 26 deletions(-) delete mode 100644 app/svc/friend_circle/svc_firend_circle_test.go diff --git a/app/svc/friend_circle/svc_firend_circle_test.go b/app/svc/friend_circle/svc_firend_circle_test.go deleted file mode 100644 index 5e34ab0..0000000 --- a/app/svc/friend_circle/svc_firend_circle_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package svc - -import ( - "applet/app/md/friend_circles" - "code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es" - "fmt" - "testing" -) - -func TestGetRecommendList(test *testing.T) { - req := friend_circles.RecommendListReq{ - Page: 1, - PageSize: 10, - } - es.Init("http://120.55.48.175:9200", "elastic", "fnuo123") - fmt.Println("start") - list, err := GetRecommendList(req) - if err != nil { - fmt.Println(err) - return - } - fmt.Println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<") - if &list != nil { - fmt.Println(list) - } -} From b3ce7899e42df8c6af56a3bf799c827f680c0965 Mon Sep 17 00:00:00 2001 From: shenjiachi <shenjiachi@fnuoos.com> Date: Tue, 10 Dec 2024 17:12:41 +0800 Subject: [PATCH 7/7] update --- app/hdl/ModuleSetting.go | 1 - 1 file changed, 1 deletion(-) diff --git a/app/hdl/ModuleSetting.go b/app/hdl/ModuleSetting.go index b5f5211..6f85d8b 100644 --- a/app/hdl/ModuleSetting.go +++ b/app/hdl/ModuleSetting.go @@ -30,7 +30,6 @@ func GetModuleSetting(c *gin.Context) { "3": "bottom_bar", "4": "invitation_download_landing_page", "5": "invitation_poster", - "6": "about_us", "7": "down_channel", "8": "contribution", "9": "egg_score",