Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-common
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-common
Commits
df1468ff
Commit
df1468ff
authored
Mar 22, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tx操作配套小助手
parent
7a98c379
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
0 deletions
+62
-0
property.go
internal/model/res_m/property.go
+14
-0
headwear.go
txop/headwear_tx/headwear.go
+24
-0
ride.go
txop/ride_tx/ride.go
+24
-0
No files found.
internal/model/res_m/property.go
0 → 100644
View file @
df1468ff
package
res_m
import
(
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/resource/mysql"
)
type
ResProperty
struct
{
mysql
.
Entity
*
domain
.
Model
`gorm:"-"`
Name
mysql
.
Str
PicUrl
mysql
.
Str
EffectUrl
mysql
.
Str
}
\ No newline at end of file
txop/headwear_tx/headwear.go
View file @
df1468ff
...
...
@@ -4,8 +4,12 @@ import (
"errors"
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/internal/enum/headwear_e"
"git.hilo.cn/hilo-common/internal/enum/msg_e"
"git.hilo.cn/hilo-common/internal/model/msg_m"
"git.hilo.cn/hilo-common/internal/model/res_m"
"git.hilo.cn/hilo-common/internal/model/user_m"
"git.hilo.cn/hilo-common/resource/mysql"
"strconv"
"time"
)
...
...
@@ -32,6 +36,26 @@ func SendHeadwear(model *domain.Model, receiverUserId mysql.ID, headdressId mysq
if
_
,
err
=
AddUserHeadwearLog
(
model
,
receiverUserId
,
headdressId
,
headwear_e
.
ActivityTrigger
,
headwear_e
.
AddSecond
,
&
receiveHeadwearDuration
,
nil
,
0
);
err
!=
nil
{
model
.
Log
.
Error
(
err
)
}
// 配套小助手
go
func
()
{
model
:=
domain
.
CreateModelContext
(
model
.
MyContext
)
resHeadwear
:=
res_m
.
ResHeadwear
{}
if
err
:=
model
.
Db
.
Model
(
&
res_m
.
ResHeadwear
{})
.
First
(
&
resHeadwear
,
headdressId
)
.
Error
;
err
!=
nil
{
model
.
Log
.
Errorf
(
"SendHeadwear get ResHeadwear fail:%v"
,
err
)
return
}
user
,
err
:=
user_m
.
GetUser
(
model
,
receiverUserId
)
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"SendHeadwear GetUser fail:%v"
,
err
)
return
}
if
err
:=
msg_m
.
NewUserRecord
(
model
,
receiverUserId
,
msg_e
.
AddProps
,
user
.
Nick
,
user
.
ID
,
""
,
strconv
.
Itoa
(
int
(
days
)),
resHeadwear
.
PicUrl
,
""
,
""
)
.
Persistent
();
err
!=
nil
{
model
.
Log
.
Errorf
(
"SendHeadwear NewUserRecord fail:%v"
,
err
)
return
}
//推送msg
_
=
msg_m
.
SendEmasMsgAssistant
(
model
,
user
.
ExternalId
,
user
.
DeviceType
)
}()
return
err
}
...
...
txop/ride_tx/ride.go
View file @
df1468ff
...
...
@@ -2,9 +2,13 @@ package ride_tx
import
(
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/internal/enum/msg_e"
"git.hilo.cn/hilo-common/internal/enum/property_e"
"git.hilo.cn/hilo-common/internal/model/msg_m"
"git.hilo.cn/hilo-common/internal/model/res_m"
"git.hilo.cn/hilo-common/internal/model/user_m"
"git.hilo.cn/hilo-common/resource/mysql"
"strconv"
"time"
)
...
...
@@ -36,5 +40,25 @@ func SendRide(model *domain.Model, receiverUserId mysql.ID, rideId mysql.ID, day
})
.
Persistent
();
err
!=
nil
{
model
.
Log
.
Error
(
err
)
}
// 配套小助手
go
func
()
{
model
:=
domain
.
CreateModelContext
(
model
.
MyContext
)
resProperty
:=
res_m
.
ResProperty
{}
if
err
:=
model
.
Db
.
Model
(
&
res_m
.
ResProperty
{})
.
First
(
&
resProperty
,
rideId
)
.
Error
;
err
!=
nil
{
model
.
Log
.
Errorf
(
"SendRide get ResProperty fail:%v"
,
err
)
return
}
user
,
err
:=
user_m
.
GetUser
(
model
,
receiverUserId
)
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"SendRide GetUser fail:%v"
,
err
)
return
}
if
err
:=
msg_m
.
NewUserRecord
(
model
,
user
.
ID
,
msg_e
.
AddProps
,
user
.
Nick
,
user
.
ID
,
""
,
strconv
.
Itoa
(
int
(
days
)),
resProperty
.
PicUrl
,
""
,
""
)
.
Persistent
();
err
!=
nil
{
model
.
Log
.
Errorf
(
"SendRide NewUserRecord fail:%v"
,
err
)
return
}
//推送msg
_
=
msg_m
.
SendEmasMsgAssistant
(
model
,
user
.
ExternalId
,
user
.
DeviceType
)
}()
return
nil
}
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