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
6de8d11e
Commit
6de8d11e
authored
May 23, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
粉钻大厅
parent
f08e5a90
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
1 deletion
+58
-1
group.go
cv/group_cv/group.go
+1
-0
group_info.go
route/group_r/group_info.go
+23
-1
url_test.go
test/url_test.go
+34
-0
No files found.
cv/group_cv/group.go
View file @
6de8d11e
...
@@ -154,6 +154,7 @@ type SimpleRoleInfo struct {
...
@@ -154,6 +154,7 @@ type SimpleRoleInfo struct {
type
BannerElement
struct
{
type
BannerElement
struct
{
H5Url
string
`json:"h5Url"`
// h5链接
H5Url
string
`json:"h5Url"`
// h5链接
BannerUrl
string
`json:"bannerUrl"`
// 图片地址
BannerUrl
string
`json:"bannerUrl"`
// 图片地址
ActionUrl
string
`json:"actionUrl"`
// 统跳地址
}
}
type
RoomInfo
struct
{
type
RoomInfo
struct
{
...
...
route/group_r/group_info.go
View file @
6de8d11e
...
@@ -38,6 +38,7 @@ import (
...
@@ -38,6 +38,7 @@ import (
"hilo-group/myerr/bizerr"
"hilo-group/myerr/bizerr"
"hilo-group/req"
"hilo-group/req"
"hilo-group/resp"
"hilo-group/resp"
"net/url"
"sort"
"sort"
"strconv"
"strconv"
"strings"
"strings"
...
@@ -592,6 +593,7 @@ func GetRoomInfo(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -592,6 +593,7 @@ func GetRoomInfo(c *gin.Context) (*mycontext.MyContext, error) {
result
.
Banners
=
append
(
result
.
Banners
,
group_cv
.
BannerElement
{
result
.
Banners
=
append
(
result
.
Banners
,
group_cv
.
BannerElement
{
H5Url
:
i
.
Url
,
H5Url
:
i
.
Url
,
BannerUrl
:
i
.
Image
,
BannerUrl
:
i
.
Image
,
ActionUrl
:
i
.
Url
,
// 支持direction=1横屏
})
})
}
}
}
else
{
}
else
{
...
@@ -751,6 +753,8 @@ type GroupBanner struct {
...
@@ -751,6 +753,8 @@ type GroupBanner struct {
BannerUrl
string
`json:"bannerUrl"`
BannerUrl
string
`json:"bannerUrl"`
//群主Id
//群主Id
GroupId
string
`json:"groupId"`
GroupId
string
`json:"groupId"`
//统跳地址 http开头:web页面,query参数direction(0:竖屏 1:横屏); hilo开头:原生页面
ActionUrl
string
`json:"actionUrl"`
}
}
// @Tags 群组
// @Tags 群组
...
@@ -827,11 +831,27 @@ func GroupBannerList(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -827,11 +831,27 @@ func GroupBannerList(c *gin.Context) (*mycontext.MyContext, error) {
if
v
.
Area
==
3
&&
!
utils
.
IsInStringList
(
country
,
v
.
CountryList
)
{
if
v
.
Area
==
3
&&
!
utils
.
IsInStringList
(
country
,
v
.
CountryList
)
{
continue
continue
}
}
actionUrl
:=
v
.
Url
if
uri
,
err
:=
url
.
Parse
(
actionUrl
);
err
==
nil
{
query
:=
uri
.
RawQuery
queryArr
:=
strings
.
Split
(
query
,
"&"
)
v
:=
url
.
Values
{}
if
len
(
queryArr
)
>
0
{
for
_
,
q
:=
range
queryArr
{
if
arr
:=
strings
.
Split
(
q
,
"="
);
len
(
arr
)
==
2
{
v
.
Add
(
arr
[
0
],
arr
[
1
])
}
}
}
//v.Add("direction", "1") // 横屏的需要这样
uri
.
RawQuery
=
v
.
Encode
()
actionUrl
=
uri
.
String
()
}
groupBanners
=
append
(
groupBanners
,
GroupBanner
{
groupBanners
=
append
(
groupBanners
,
GroupBanner
{
H5Url
:
v
.
Url
,
H5Url
:
v
.
Url
,
BannerUrl
:
v
.
Image
,
BannerUrl
:
v
.
Image
,
GroupId
:
groupMap
[
v
.
GroupCode
],
GroupId
:
groupMap
[
v
.
GroupCode
],
ActionUrl
:
actionUrl
,
})
})
}
}
resp
.
ResponseOk
(
c
,
groupBanners
)
resp
.
ResponseOk
(
c
,
groupBanners
)
...
@@ -841,6 +861,7 @@ func GroupBannerList(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -841,6 +861,7 @@ func GroupBannerList(c *gin.Context) (*mycontext.MyContext, error) {
type
RoomBanner
struct
{
type
RoomBanner
struct
{
H5Url
string
`json:"h5Url"`
// h5链接
H5Url
string
`json:"h5Url"`
// h5链接
BannerUrl
string
`json:"bannerUrl"`
// 图片地址
BannerUrl
string
`json:"bannerUrl"`
// 图片地址
ActionUrl
string
`json:"actionUrl"`
// 统跳地址 http开头:web页面,query参数direction(0:竖屏 1:横屏); hilo开头:原生页面
}
}
// @Tags 群组
// @Tags 群组
...
@@ -893,6 +914,7 @@ func RoomBannerList(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -893,6 +914,7 @@ func RoomBannerList(c *gin.Context) (*mycontext.MyContext, error) {
result
=
append
(
result
,
RoomBanner
{
result
=
append
(
result
,
RoomBanner
{
H5Url
:
i
.
Url
,
H5Url
:
i
.
Url
,
BannerUrl
:
i
.
Image
,
BannerUrl
:
i
.
Image
,
ActionUrl
:
i
.
Url
,
})
})
}
}
resp
.
ResponseOk
(
c
,
result
)
resp
.
ResponseOk
(
c
,
result
)
...
...
test/url_test.go
0 → 100644
View file @
6de8d11e
package
test
import
(
"fmt"
"net/url"
"path"
"strings"
"testing"
)
func
TestUrlParse
(
t
*
testing
.
T
)
{
//rawUrl := "https://pkg.go.dev/net/url?a=b&c=d#example-ParseQuery"
rawUrl
:=
"https://pkg.go.dev/net/url"
uri
,
err
:=
url
.
Parse
(
rawUrl
)
if
err
!=
nil
{
return
}
query
:=
uri
.
RawQuery
queryArr
:=
strings
.
Split
(
query
,
"&"
)
v
:=
url
.
Values
{}
if
len
(
queryArr
)
>
0
{
for
_
,
q
:=
range
queryArr
{
if
arr
:=
strings
.
Split
(
q
,
"="
);
len
(
arr
)
==
2
{
v
.
Add
(
arr
[
0
],
arr
[
1
])
}
}
}
v
.
Add
(
"v1"
,
"v1"
)
v
.
Add
(
"v2"
,
"v2"
)
uri
.
RawQuery
=
v
.
Encode
()
uri
.
Path
=
path
.
Join
(
uri
.
Path
,
"/ccc/ddd"
)
fmt
.
Println
(
fmt
.
Sprintf
(
"修改后的URL是:%s"
,
uri
.
String
()))
}
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