Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-group
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
hujiebin
hilo-group
Commits
cc0ffcd3
Commit
cc0ffcd3
authored
Mar 13, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
申请加入家族
parent
2fbe9c7f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
group_power_apply.go
domain/model/groupPower_m/group_power_apply.go
+9
-6
bizCode.go
myerr/bizerr/bizCode.go
+1
-0
3.5.0.sql
mysql/3.5.0.sql
+2
-2
No files found.
domain/model/groupPower_m/group_power_apply.go
View file @
cc0ffcd3
...
@@ -4,6 +4,7 @@ import (
...
@@ -4,6 +4,7 @@ import (
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/domain"
"gorm.io/gorm"
"gorm.io/gorm"
"hilo-group/myerr"
"hilo-group/myerr"
"hilo-group/myerr/bizerr"
"time"
"time"
)
)
...
@@ -17,12 +18,14 @@ type GroupPowerApplyJoin struct {
...
@@ -17,12 +18,14 @@ type GroupPowerApplyJoin struct {
}
}
func
InsertGroupPowerApplyJoin
(
model
*
domain
.
Model
,
userId
,
familyId
uint64
)
error
{
func
InsertGroupPowerApplyJoin
(
model
*
domain
.
Model
,
userId
,
familyId
uint64
)
error
{
nowTime
:=
time
.
Now
()
sql
:=
"insert into group_power_apply_join(user_id,group_power_id,is_accept) "
+
sql
:=
"insert into group_power_apply_join(user_id,group_power_id,is_accept,created_time,updated_time) "
+
"select ?, ?, ? where not exists (select id from group_power_apply_join where user_id=? and group_power_id=? and is_accept=0)"
"value(?,?,?,?,?) on duplicate key update is_accept=?,created_time=?,updated_time=?"
result
:=
model
.
Db
.
Exec
(
sql
,
userId
,
familyId
,
0
,
userId
,
familyId
)
err
:=
model
.
Db
.
Exec
(
sql
,
userId
,
familyId
,
0
,
nowTime
,
nowTime
,
0
,
nowTime
,
nowTime
)
.
Error
if
result
.
Error
!=
nil
{
if
err
!=
nil
{
return
myerr
.
WrapErr
(
result
.
Error
)
return
myerr
.
WrapErr
(
err
)
}
if
result
.
RowsAffected
<=
0
{
return
myerr
.
WrapErr
(
bizerr
.
GroupPowerHaveAlreadyApply
)
}
}
return
nil
return
nil
}
}
...
...
myerr/bizerr/bizCode.go
View file @
cc0ffcd3
...
@@ -84,6 +84,7 @@ var (
...
@@ -84,6 +84,7 @@ var (
GroupPowerHaveNoJoin
=
myerr
.
NewBusinessCode
(
15011
,
"You have no joined power"
,
myerr
.
BusinessData
{})
// 还未加入国家势力
GroupPowerHaveNoJoin
=
myerr
.
NewBusinessCode
(
15011
,
"You have no joined power"
,
myerr
.
BusinessData
{})
// 还未加入国家势力
GroupPowerHaveNoPower
=
myerr
.
NewBusinessCode
(
15012
,
"You have no power"
,
myerr
.
BusinessData
{})
// 没有权限
GroupPowerHaveNoPower
=
myerr
.
NewBusinessCode
(
15012
,
"You have no power"
,
myerr
.
BusinessData
{})
// 没有权限
GroupPowerHaveNoApply
=
myerr
.
NewBusinessCode
(
15013
,
"User have no apply"
,
myerr
.
BusinessData
{})
// 没有找到申请
GroupPowerHaveNoApply
=
myerr
.
NewBusinessCode
(
15013
,
"User have no apply"
,
myerr
.
BusinessData
{})
// 没有找到申请
GroupPowerHaveAlreadyApply
=
myerr
.
NewBusinessCode
(
15014
,
"Already applied"
,
myerr
.
BusinessData
{})
// 已经申请过
TaskHasAward
=
myerr
.
NewBusinessCode
(
19001
,
"task has award"
,
myerr
.
BusinessData
{})
TaskHasAward
=
myerr
.
NewBusinessCode
(
19001
,
"task has award"
,
myerr
.
BusinessData
{})
...
...
mysql/3.5.0.sql
View file @
cc0ffcd3
...
@@ -27,6 +27,6 @@ CREATE TABLE `group_power_apply_join` (
...
@@ -27,6 +27,6 @@ CREATE TABLE `group_power_apply_join` (
`updated_time`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
,
`updated_time`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
,
`is_accept`
tinyint
NOT
NULL
DEFAULT
'0'
COMMENT
'是否已经接受'
,
`is_accept`
tinyint
NOT
NULL
DEFAULT
'0'
COMMENT
'是否已经接受'
,
PRIMARY
KEY
(
`id`
),
PRIMARY
KEY
(
`id`
),
UNIQUE
KEY
`u_apply`
(
`user_id`
,
`group_power_id`
)
USING
BTREE
,
KEY
`group_power_id`
(
`group_power_id`
)
,
KEY
`
group_power_id`
(
`group_power_id`
)
KEY
`
user_id`
(
`user_id`
)
USING
BTREE
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_unicode_ci
COMMENT
=
'申请加入家族'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_unicode_ci
COMMENT
=
'申请加入家族'
;
\ No newline at end of file
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