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
eeb13614
Commit
eeb13614
authored
Mar 16, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/user-bag-activity' into 'master'
活动扶持 See merge request
!2
parents
a8d0809d
69060dbf
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
136 additions
and
38 deletions
+136
-38
enum.go
_const/enum/msg_e/enum.go
+1
-0
base.go
domain/event/base.go
+0
-11
user_bag_send.go
domain/event/user_ev/user_bag_send.go
+33
-0
user_bag.go
domain/model/bag_m/user_bag.go
+9
-1
gift.go
domain/model/res_m/gift.go
+3
-3
event_init.go
domain/service/event_s/event_init.go
+45
-0
go.mod
go.mod
+9
-10
go.sum
go.sum
+8
-6
local.ini
local.ini
+4
-4
main.go
main.go
+2
-1
router.go
route/router.go
+20
-0
bag.go
route/user_r/bag.go
+2
-2
No files found.
_const/enum/msg_e/enum.go
View file @
eeb13614
...
...
@@ -109,6 +109,7 @@ const (
GroupActivityRewardMsg
=
38
// 群组活动钻石奖励提醒
TemplateActAwardMsg
=
39
// 通用模板活动奖励提醒
TemplateSmsCode
=
40
// 通用模板活动奖励提醒
AddUserBag
=
50
// 赠送背包礼物
)
type
MsgSysUserType
=
mysql
.
Type
...
...
domain/event/base.go
deleted
100755 → 0
View file @
a8d0809d
package
event
import
"git.hilo.cn/hilo-common/domain"
// 程序内部事件
type
Base
struct
{
//同步执行
SyncList
[]
func
(
model
*
domain
.
Model
,
event
interface
{})
error
//异步执行
AsyncList
[]
func
(
model
*
domain
.
Model
,
event
interface
{})
error
}
domain/event/user_ev/user_bag_send.go
0 → 100644
View file @
eeb13614
package
user_ev
import
(
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/resource/mysql"
)
//注册监听
var
userBagSendListen
=
new
(
domain
.
EventBase
)
type
UserBagSendEvent
struct
{
UserId
mysql
.
ID
ResType
mysql
.
Type
// 道具类型 1:礼物道具
ResId
mysql
.
ID
// 道具资源id
Count
mysql
.
Num
// 下发数量
Day
int
// 天数
Reason
string
// 原因
}
//添加领域事件,在每个领域模型中init中添加,因为这是静态业务,非动态的。
func
AddUserBagSendSync
(
callback
func
(
model
*
domain
.
Model
,
event
interface
{})
error
)
{
domain
.
AddEventSync
(
userBagSendListen
,
callback
)
}
//加入到异步操作中
func
AddUserBagSendAsync
(
callback
func
(
model
*
domain
.
Model
,
event
interface
{})
error
)
{
domain
.
AddEventAsync
(
userBagSendListen
,
callback
)
}
//领域事件发布
func
PublishUserBagSend
(
model
*
domain
.
Model
,
event
interface
{})
error
{
return
domain
.
PublishEvent
(
userBagSendListen
,
model
,
event
)
}
domain/model/bag_m/user_bag.go
View file @
eeb13614
...
...
@@ -5,6 +5,7 @@ import (
"git.hilo.cn/hilo-common/resource/mysql"
"gorm.io/gorm/clause"
"hilo-user/_const/enum/res_e"
"hilo-user/domain/event/user_ev"
"time"
)
...
...
@@ -104,7 +105,14 @@ func AddUserBag(model *domain.Model, userId mysql.ID, resType mysql.Type, resId
if
err
:=
model
.
DB
()
.
Create
(
userBagDetail
)
.
Error
;
err
!=
nil
{
return
err
}
return
nil
return
user_ev
.
PublishUserBagSend
(
model
,
&
user_ev
.
UserBagSendEvent
{
UserId
:
userId
,
ResType
:
resType
,
ResId
:
resId
,
Count
:
count
,
Day
:
day
,
Reason
:
reason
,
})
})
return
bagId
,
err
}
domain/model/res_m/gift.go
View file @
eeb13614
...
...
@@ -24,11 +24,11 @@ type ResGift struct {
GiftType
mysql
.
Type
}
// 获取所有
有效
的礼物
func
Find
Valid
ResGiftsMap
(
model
*
domain
.
Model
)
(
map
[
mysql
.
ID
]
ResGift
,
error
)
{
// 获取所有的礼物
func
Find
All
ResGiftsMap
(
model
*
domain
.
Model
)
(
map
[
mysql
.
ID
]
ResGift
,
error
)
{
res
:=
make
(
map
[
mysql
.
ID
]
ResGift
,
0
)
rows
:=
make
([]
ResGift
,
0
)
if
err
:=
model
.
DB
()
.
Model
(
ResGift
{})
.
Where
(
"status = ?"
,
mysql
.
USER
)
.
Find
(
&
rows
)
.
Error
;
err
!=
nil
{
if
err
:=
model
.
DB
()
.
Model
(
ResGift
{})
.
Find
(
&
rows
)
.
Error
;
err
!=
nil
{
return
nil
,
err
}
for
i
,
v
:=
range
rows
{
...
...
domain/service/event_s/event_init.go
0 → 100644
View file @
eeb13614
package
event_s
import
(
"fmt"
"git.hilo.cn/hilo-common/domain"
"github.com/pkg/errors"
"hilo-user/_const/enum/msg_e"
"hilo-user/_const/enum/res_e"
"hilo-user/domain/event/user_ev"
"hilo-user/domain/model/msg_m"
"hilo-user/domain/model/res_m"
"hilo-user/domain/model/user_m"
)
func
EventInit
()
{
UserBagSendEvent
()
}
func
UserBagSendEvent
()
{
user_ev
.
AddUserBagSendAsync
(
func
(
model
*
domain
.
Model
,
event
interface
{})
error
{
e
,
ok
:=
event
.
(
*
user_ev
.
UserBagSendEvent
)
if
!
ok
{
return
errors
.
New
(
"AddUserBagSendAsync param fail"
)
}
if
e
.
ResType
!=
res_e
.
ResUserBagGift
{
return
nil
}
user
,
err
:=
user_m
.
GetUser
(
model
,
e
.
UserId
)
if
err
!=
nil
{
return
err
}
gift
,
err
:=
res_m
.
FindResGift
(
model
,
e
.
ResId
)
if
err
!=
nil
{
return
err
}
if
err
:=
msg_m
.
NewUserRecord
(
model
,
e
.
UserId
,
msg_e
.
AddUserBag
,
gift
.
Name
,
0
,
""
,
fmt
.
Sprintf
(
"%d"
,
e
.
Day
),
gift
.
IconUrl
,
""
,
""
)
.
Persistent
();
err
!=
nil
{
model
.
Log
.
Errorf
(
"NewUserRecord fail"
)
}
else
{
msg_m
.
SendEmasMsgAssistant
(
model
,
user
.
ExternalId
,
user
.
DeviceType
)
}
return
nil
})
}
go.mod
View file @
eeb13614
...
...
@@ -5,29 +5,21 @@ go 1.17
replace git.hilo.cn/hilo-common => ../hilo-common
require (
git.hilo.cn/hilo-common v0.0.0-00010101000000-000000000000
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/gin-gonic/gin v1.6.3
github.com/go-redis/redis/v8 v8.11.5
github.com/go-sql-driver/mysql v1.6.0
github.com/hashicorp/consul/api v1.7.0
github.com/jinzhu/copier v0.3.5
github.com/joho/godotenv v1.3.0
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
github.com/pkg/errors v0.9.1
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
github.com/satori/go.uuid v1.2.0
github.com/sirupsen/logrus v1.7.0
github.com/swaggo/gin-swagger v1.2.0
github.com/swaggo/swag v1.6.7
golang.org/x/sync v0.0.0-20190423024810-112230192c58
gopkg.in/ini.v1 v1.63.2
gorm.io/driver/mysql v1.4.3
gorm.io/gorm v1.23.8
)
require (
git.hilo.cn/hilo-common v0.0.0-00010101000000-000000000000 // indirect
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
...
...
@@ -44,7 +36,9 @@ require (
github.com/go-playground/locales v0.13.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-playground/validator/v10 v10.2.0 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/golang/protobuf v1.5.0 // indirect
github.com/hashicorp/consul/api v1.7.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
github.com/hashicorp/go-hclog v0.12.0 // indirect
github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
...
...
@@ -54,10 +48,12 @@ require (
github.com/hashicorp/serf v0.9.3 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/joho/godotenv v1.3.0 // indirect
github.com/jonboulle/clockwork v0.3.0 // indirect
github.com/json-iterator/go v1.1.9 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible // indirect
github.com/lestrrat-go/strftime v1.0.6 // indirect
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e // indirect
github.com/mattn/go-colorable v0.1.6 // indirect
...
...
@@ -66,11 +62,14 @@ require (
github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 // indirect
github.com/ugorji/go/codec v1.1.7 // indirect
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/tools v0.0.0-20190907020128-2ca718005c18 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/ini.v1 v1.63.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gorm.io/driver/mysql v1.4.3 // indirect
)
go.sum
View file @
eeb13614
...
...
@@ -72,12 +72,12 @@ github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB
github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c h1:964Od4U6p2jUkFxvCydnIczKteheJEzHRToSGK3Bnlw=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
...
...
@@ -123,8 +123,11 @@ github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkr
github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/jonboulle/clockwork v0.3.0 h1:9BSCMi8C+0qdApAp4auwX0RkLGUjs956h0EkuQymUhg=
...
...
@@ -211,8 +214,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E=
github.com/swaggo/gin-swagger v1.2.0 h1:YskZXEiv51fjOMTsXrOetAjrMDfFaXD79PEoQBOe2W0=
...
...
@@ -248,7 +251,6 @@ golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 h1:DzZ89McO9/gWPsQXS/FVKAlG02ZjaQ6AlZRBimEYOd0=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
...
...
@@ -267,8 +269,6 @@ golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
...
...
@@ -284,6 +284,7 @@ golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgw
golang.org/x/tools v0.0.0-20190907020128-2ca718005c18 h1:xFbv3LvlvQAmbNJFCBKRv1Ccvnh9FVsW0FX2kTWWowE=
golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
...
...
@@ -304,6 +305,7 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gorm.io/driver/mysql v1.4.3 h1:/JhWJhO2v17d8hjApTltKNADm7K7YI2ogkR7avJUL3k=
gorm.io/driver/mysql v1.4.3/go.mod h1:sSIebwZAVPiT+27jK9HIwvsqOGKx3YMPmrA3mBJR10c=
...
...
local.ini
View file @
eeb13614
...
...
@@ -59,12 +59,12 @@ TX_OVERSEA_APP_ID=40000066
TX_OVERSEA_KEY
=
3ab68ea5bddc8774d90b8c764ae71188914bd5fd06f30b28790c51e44ca7885c
[EMAS]
REGION_ID
=
cn-hangzhou
ACCESS_KEY_ID
=
LTAI
4FhNPzxdzD4w6bHirL9Z
ACCESS_KEY_SECRET
=
OQvUJpXDrjGi3g1F2aHiAIFWIvLdbP
ACCESS_KEY_ID
=
LTAI
dQZv5H1kNZp5
ACCESS_KEY_SECRET
=
UnwY0ClDkqBMLwPx3OJJiLYyk9xYLO
ANDROID_APP_KEY
=
30250713
ANDROID_APP_SECRET
=
cae7b9a9d3e54577d2c3b60bf6d23047
IOS_APP_KEY
=
30
240346
IOS_APP_SECRET
=
57f33ab9ca6a957a8c659f2b0b6d1205
IOS_APP_KEY
=
30
790728
IOS_APP_SECRET
=
4fd69ca084c67d4b5a8d15452f0af26a
APNS
=
DEV
[AGORA]
APP_ID
=
fc3e087f701b4f788099e1924c3cc7b0
...
...
main.go
View file @
eeb13614
...
...
@@ -3,6 +3,7 @@ package main
import
(
"fmt"
"git.hilo.cn/hilo-common/resource/consul"
"hilo-user/domain/service/event_s"
"hilo-user/route"
)
...
...
@@ -14,7 +15,7 @@ const (
func
main
()
{
//cron.Init() // 开启定时任务
//event_s.EventInit()
// 注册事件(内部事件+mysql拟kafka)
event_s
.
EventInit
()
// 注册事件(内部事件+mysql拟kafka)
r
:=
route
.
InitRouter
()
// 注册路由
consul
.
RegisterToConsul
(
PORT
,
RegisterName
,
RegisterTag
)
// 服务注册
r
.
Run
(
fmt
.
Sprintf
(
":%d"
,
PORT
))
// 启动服务
...
...
route/router.go
View file @
eeb13614
package
route
import
(
"fmt"
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/mycontext"
"github.com/gin-gonic/gin"
ginSwagger
"github.com/swaggo/gin-swagger"
"github.com/swaggo/gin-swagger/swaggerFiles"
"hilo-user/_const/enum/msg_e"
_
"hilo-user/docs"
"hilo-user/domain/model/msg_m"
"hilo-user/resp"
"hilo-user/route/user_r"
)
...
...
@@ -36,5 +42,19 @@ func InitRouter() *gin.Engine {
innerProp
.
POST
(
"/headwear/send"
,
wrapper
(
user_r
.
SendUserHeadwear
))
// 下发头饰
innerProp
.
POST
(
"/ride/send"
,
wrapper
(
user_r
.
SendUserRide
))
// 下发座驾
}
r
.
GET
(
"/test"
,
wrapper
(
Test
))
return
r
}
func
Test
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
var
model
=
domain
.
CreateModelContext
(
nil
)
myCtx
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
// 下发hilo小助手通知
if
err
:=
msg_m
.
NewUserRecord
(
model
,
4549
,
msg_e
.
AddProps
,
""
,
0
,
""
,
fmt
.
Sprintf
(
"%d"
,
10
),
"https://image.whoisamy.shop/hilo/manager/1b95e0e63b814261acccc6e1f1736627.png"
,
""
,
""
)
.
Persistent
();
err
!=
nil
{
model
.
Log
.
Errorf
(
"NewUserRecord fail"
)
}
else
{
msg_m
.
SendEmasMsgAssistant
(
model
,
"f98c7fe5698e447c998615332eb660d1"
,
"iOS"
)
}
resp
.
ResponseOk
(
c
,
struct
{}{})
return
myCtx
,
nil
}
route/user_r/bag.go
View file @
eeb13614
...
...
@@ -38,12 +38,12 @@ func UserBag(c *gin.Context) (*mycontext.MyContext, error) {
if
err
!=
nil
{
return
myCtx
,
err
}
all
ValidGifts
,
err
:=
res_m
.
FindValid
ResGiftsMap
(
model
)
all
Gifts
,
err
:=
res_m
.
FindAll
ResGiftsMap
(
model
)
if
err
!=
nil
{
return
myCtx
,
err
}
for
_
,
bagGift
:=
range
userBagGifts
{
if
gift
,
ok
:=
all
Valid
Gifts
[
bagGift
.
ResId
];
ok
{
if
gift
,
ok
:=
allGifts
[
bagGift
.
ResId
];
ok
{
results
=
append
(
results
,
user_cv
.
UserBag
{
BagId
:
bagGift
.
ID
,
ResType
:
res_e
.
ResUserBagGift
,
...
...
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