Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-user
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenweijian
hilo-user
Commits
b472585a
Commit
b472585a
authored
May 31, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cp关系绑定
parent
2850b364
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
17 deletions
+17
-17
cp_relation.go
domain/service/cp_s/cp_relation.go
+4
-4
cp_relation.go
route/cp_r/cp_relation.go
+13
-13
No files found.
domain/service/cp_s/cp_relation.go
View file @
b472585a
...
...
@@ -16,13 +16,13 @@ import (
"hilo-user/myerr/bizerr"
)
func
InviteCpRelation
(
myCtx
*
mycontext
.
MyContext
,
myUserId
uint64
,
userCode
,
lang
string
)
error
{
func
InviteCpRelation
(
myCtx
*
mycontext
.
MyContext
,
myUserId
uint64
,
externalId
,
lang
string
)
error
{
model
:=
domain
.
CreateModelContext
(
myCtx
)
user
,
err
:=
user_m
.
GetUser
(
model
,
myUserId
)
if
err
!=
nil
{
return
err
}
userInvite
,
err
:=
user_m
.
GetUserBy
Code
(
model
,
userCode
)
userInvite
,
err
:=
user_m
.
GetUserBy
ExtId
(
model
,
externalId
)
if
err
!=
nil
{
return
err
}
...
...
@@ -89,13 +89,13 @@ func InviteCpRelation(myCtx *mycontext.MyContext, myUserId uint64, userCode, lan
return
nil
}
func
CancelCpRelation
(
myCtx
*
mycontext
.
MyContext
,
myUserId
uint64
,
userCode
,
lang
string
)
error
{
func
CancelCpRelation
(
myCtx
*
mycontext
.
MyContext
,
myUserId
uint64
,
externalId
,
lang
string
)
error
{
model
:=
domain
.
CreateModelContext
(
myCtx
)
user
,
err
:=
user_m
.
GetUser
(
model
,
myUserId
)
if
err
!=
nil
{
return
err
}
userRec
,
err
:=
user_m
.
GetUserBy
Code
(
model
,
userCode
)
userRec
,
err
:=
user_m
.
GetUserBy
ExtId
(
model
,
externalId
)
if
err
!=
nil
{
return
err
}
...
...
route/cp_r/cp_relation.go
View file @
b472585a
...
...
@@ -24,12 +24,12 @@ import (
// @Tags cp关系
// @Summary 检查用户是否绑定了cp
// @Param
code query int true "用户code
"
// @Param
externalId query string true "用户的externalId
"
// @Success 200 {object} cp_cv.CheckCpRelationRes
// @Router /v2/cp/relation/check [get]
func
CheckUserCpRelation
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myCtx
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
userCode
:=
c
.
Query
(
"code
"
)
externalId
:=
c
.
Query
(
"externalId
"
)
_
,
lang
,
err
:=
req
.
GetUserIdLang
(
c
,
myCtx
)
if
err
!=
nil
{
...
...
@@ -37,7 +37,7 @@ func CheckUserCpRelation(c *gin.Context) (*mycontext.MyContext, error) {
}
model
:=
domain
.
CreateModelContext
(
myCtx
)
user
,
err
:=
user_m
.
GetUserBy
Code
(
model
,
userCode
)
user
,
err
:=
user_m
.
GetUserBy
ExtId
(
model
,
externalId
)
if
err
!=
nil
{
return
myCtx
,
err
}
...
...
@@ -56,13 +56,13 @@ func CheckUserCpRelation(c *gin.Context) (*mycontext.MyContext, error) {
// @Tags cp关系
// @Summary 发送cp邀请/发起解除cp
// @Param
code formData int true "对方用户code
"
// @Param
externalId formData string true "对方的externalId
"
// @Param type formData int true "类型1.发起邀请2.发起解除"
// @Success 200
// @Router /v2/cp/relation [post]
func
CpRelation
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myCtx
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
userCode
:=
c
.
PostForm
(
"code
"
)
externalId
:=
c
.
PostForm
(
"externalId
"
)
myUserId
,
lang
,
err
:=
req
.
GetUserIdLang
(
c
,
myCtx
)
if
err
!=
nil
{
...
...
@@ -75,14 +75,14 @@ func CpRelation(c *gin.Context) (*mycontext.MyContext, error) {
}
if
optType
==
1
{
// 邀请
err
=
cp_s
.
InviteCpRelation
(
myCtx
,
myUserId
,
userCode
,
lang
)
err
=
cp_s
.
InviteCpRelation
(
myCtx
,
myUserId
,
externalId
,
lang
)
if
err
!=
nil
{
myCtx
.
Log
.
Errorf
(
"InviteCpRelation myUserId:%d, err:%v"
,
myUserId
,
err
)
return
myCtx
,
err
}
}
else
{
// 发起解除
err
=
cp_s
.
CancelCpRelation
(
myCtx
,
myUserId
,
userCode
,
lang
)
err
=
cp_s
.
CancelCpRelation
(
myCtx
,
myUserId
,
externalId
,
lang
)
if
err
!=
nil
{
myCtx
.
Log
.
Errorf
(
"CancelCpRelation myUserId:%d, err:%v"
,
myUserId
,
err
)
return
myCtx
,
err
...
...
@@ -95,13 +95,13 @@ func CpRelation(c *gin.Context) (*mycontext.MyContext, error) {
// @Tags cp关系
// @Summary 回应cp邀请
// @Param
code formData int true "对方的用户code
"
// @Param
externalId formData string true "对方用户的externalId
"
// @Param type formData int true "类型1.接受2.拒绝"
// @Success 200
// @Router /v2/cp/relation/invite/reply [post]
func
ReplyCpInvite
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myCtx
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
userCode
:=
c
.
PostForm
(
"code
"
)
externalId
:=
c
.
PostForm
(
"externalId
"
)
optType
,
err
:=
strconv
.
Atoi
(
c
.
PostForm
(
"type"
))
if
err
!=
nil
||
optType
>
2
||
optType
<
1
{
return
myCtx
,
bizerr
.
InvalidParameter
...
...
@@ -117,7 +117,7 @@ func ReplyCpInvite(c *gin.Context) (*mycontext.MyContext, error) {
if
err
!=
nil
{
return
myCtx
,
err
}
userSender
,
err
:=
user_m
.
GetUserBy
Code
(
model
,
userCode
)
userSender
,
err
:=
user_m
.
GetUserBy
ExtId
(
model
,
externalId
)
if
err
!=
nil
{
return
myCtx
,
err
}
...
...
@@ -213,13 +213,13 @@ func ReplyCpInvite(c *gin.Context) (*mycontext.MyContext, error) {
// @Tags cp关系
// @Summary 回应cp解除
// @Param
code formData int true "对方的用户code
"
// @Param
externalId formData string true "对方的externalId
"
// @Param type formData int true "类型1.撤销2.接受"
// @Success 200
// @Router /v2/cp/relation/cancel/reply [post]
func
ReplyCpCancel
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myCtx
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
userCode
:=
c
.
PostForm
(
"code
"
)
externalId
:=
c
.
PostForm
(
"externalId
"
)
optType
,
err
:=
strconv
.
Atoi
(
c
.
PostForm
(
"type"
))
if
err
!=
nil
||
optType
>
2
||
optType
<
1
{
return
myCtx
,
bizerr
.
InvalidParameter
...
...
@@ -235,7 +235,7 @@ func ReplyCpCancel(c *gin.Context) (*mycontext.MyContext, error) {
if
err
!=
nil
{
return
myCtx
,
err
}
user2
,
err
:=
user_m
.
GetUserBy
Code
(
model
,
userCode
)
user2
,
err
:=
user_m
.
GetUserBy
ExtId
(
model
,
externalId
)
if
err
!=
nil
{
return
myCtx
,
err
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment