dengbiao 1 week ago
parent
commit
61d5d6af4b
13 changed files with 410 additions and 190 deletions
  1. +0
    -1
      app/hdl/ModuleSetting.go
  2. +3
    -1
      app/hdl/friend_circle/hdl_friend_circle.go
  3. +59
    -0
      app/hdl/hdl_user.go
  4. +1
    -0
      app/md/md_advertising.go
  5. +3
    -0
      app/md/md_login.go
  6. +5
    -1
      app/md/md_mq.go
  7. +2
    -1
      app/router/router.go
  8. +7
    -8
      app/svc/friend_circle/svc_firend_circle.go
  9. +13
    -3
      app/svc/svc_advertising.go
  10. +120
    -67
      docs/docs.go
  11. +118
    -64
      docs/swagger.json
  12. +78
    -43
      docs/swagger.yaml
  13. +1
    -1
      go.mod

+ 0
- 1
app/hdl/ModuleSetting.go View File

@@ -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",


+ 3
- 1
app/hdl/friend_circle/hdl_friend_circle.go View File

@@ -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)
}

@@ -152,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


+ 59
- 0
app/hdl/hdl_user.go View File

@@ -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
}

+ 1
- 0
app/md/md_advertising.go View File

@@ -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:"名称"`


+ 3
- 0
app/md/md_login.go View File

@@ -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"`


+ 5
- 1
app/md/md_mq.go View File

@@ -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"`


+ 2
- 1
app/router/router.go View File

@@ -122,6 +122,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") // 积分中心
{
@@ -200,7 +201,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) // 发送朋友圈


+ 7
- 8
app/svc/friend_circle/svc_firend_circle.go View File

@@ -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
}
@@ -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,24 +121,23 @@ 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

// 构建查询
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("created_at", false). // 按时间倒排
From(from).
Size(req.PageSize).
Pretty(true).
Do(context.Background())
if err != nil {
logx.Fatalf("Error searching for documents: %v", err)
return
}



+ 13
- 3
app/svc/svc_advertising.go View File

@@ -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


+ 120
- 67
docs/docs.go View File

@@ -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() {


+ 118
- 64
docs/swagger.json View File

@@ -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": {


+ 78
- 43
docs/swagger.yaml View File

@@ -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:


+ 1
- 1
go.mod View File

@@ -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


Loading…
Cancel
Save