Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
go_sku_server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2e918fed
authored
Mar 13, 2023
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' into dev
parents
4863368e
bcd4ffc0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
21 deletions
conf/dev/database.ini
model/ly_sku.go
service/service_ly.go
service/service_ly_common.go
service/service_tags.go
service/service_zy.go
conf/dev/database.ini
View file @
2e918fed
...
...
@@ -5,7 +5,7 @@ ShowSQL = false
[spu]
user_name
=
spu
password
=
spu
host
=
192.168.1.23
4
host
=
192.168.1.23
8
database
=
liexin_spu
table_prefix
=
lie_
type
=
mysql
...
...
@@ -13,7 +13,7 @@ type = mysql
[liexin_data]
user_name
=
spu
password
=
spu
host
=
192.168.1.23
4
host
=
192.168.1.23
8
database
=
liexin_data
table_prefix
=
lie_
type
=
mysql
...
...
@@ -39,7 +39,7 @@ type = mysql
[sku0]
user_name
=
spu
password
=
spu
host
=
192.168.1.23
4
host
=
192.168.1.23
8
database
=
liexin_sku_0
table_prefix
=
lie_
type
=
mysql
...
...
@@ -47,7 +47,7 @@ type = mysql
[sku_0]
user_name
=
spu
password
=
spu
host
=
192.168.1.23
4
host
=
192.168.1.23
8
database
=
liexin_sku_0
table_prefix
=
lie_
type
=
mysql
...
...
@@ -55,7 +55,7 @@ type = mysql
[sku_1]
user_name
=
spu
password
=
spu
host
=
192.168.1.23
4
host
=
192.168.1.23
8
database
=
liexin_sku_1
table_prefix
=
lie_
type
=
mysql
...
...
@@ -63,7 +63,7 @@ type = mysql
[sku_2]
user_name
=
spu
password
=
spu
host
=
192.168.1.23
4
host
=
192.168.1.23
8
database
=
liexin_sku_2
table_prefix
=
lie_
type
=
mysql
...
...
@@ -71,7 +71,7 @@ type = mysql
[sku_3]
user_name
=
spu
password
=
spu
host
=
192.168.1.23
4
host
=
192.168.1.23
8
database
=
liexin_sku_3
table_prefix
=
lie_
type
=
mysql
...
...
@@ -79,7 +79,7 @@ type = mysql
[sku_4]
user_name
=
spu
password
=
spu
host
=
192.168.1.23
4
host
=
192.168.1.23
8
database
=
liexin_sku_4
table_prefix
=
lie_
type
=
mysql
...
...
@@ -87,7 +87,7 @@ type = mysql
[sku_5]
user_name
=
spu
password
=
spu
host
=
192.168.1.23
4
host
=
192.168.1.23
8
database
=
liexin_sku_5
table_prefix
=
lie_
type
=
mysql
...
...
@@ -95,7 +95,7 @@ type = mysql
[sku_6]
user_name
=
spu
password
=
spu
host
=
192.168.1.23
4
host
=
192.168.1.23
8
database
=
liexin_sku_6
table_prefix
=
lie_
type
=
mysql
...
...
@@ -103,7 +103,7 @@ type = mysql
[sku_7]
user_name
=
spu
password
=
spu
host
=
192.168.1.23
4
host
=
192.168.1.23
8
database
=
liexin_sku_7
table_prefix
=
lie_
type
=
mysql
...
...
@@ -111,7 +111,7 @@ type = mysql
[sku_8]
user_name
=
spu
password
=
spu
host
=
192.168.1.23
4
host
=
192.168.1.23
8
database
=
liexin_sku_8
table_prefix
=
lie_
type
=
mysql
...
...
@@ -119,7 +119,7 @@ type = mysql
[sku_9]
user_name
=
spu
password
=
spu
host
=
192.168.1.23
4
host
=
192.168.1.23
8
database
=
liexin_sku_9
table_prefix
=
lie_
type
=
mysql
...
...
model/ly_sku.go
View file @
2e918fed
package
model
import
(
"strings"
"github.com/tidwall/gjson"
)
...
...
@@ -166,6 +168,7 @@ func InitSkuData(sku string) (data LySku) {
data
.
GoodsDetails
=
goodsDetail
goodsImages
:=
gjson
.
Get
(
sku
,
"goods_images"
)
.
String
()
goodsImages
=
strings
.
Replace
(
goodsImages
,
"http://img.ichunt.com"
,
"https://img.ichunt.com"
,
1
)
data
.
GoodsImages
=
goodsImages
canal
:=
gjson
.
Get
(
sku
,
"canal"
)
.
String
()
...
...
service/service_ly.go
View file @
2e918fed
...
...
@@ -5,12 +5,12 @@ import (
"go_sku_server/pkg/gredis"
"go_sku_server/service/sorter"
"sort"
"strings"
"sync"
"github.com/gin-gonic/gin"
"github.com/gogf/gf/util/gconv"
"github.com/gomodule/redigo/redis"
"github.com/syyongx/php2go"
"github.com/tidwall/gjson"
)
...
...
@@ -65,10 +65,13 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
sku
=
ls
.
GetGoodsImages
(
sku
,
spu
)
//pdf
pdf
:=
gjson
.
Get
(
spu
,
"pdf"
)
.
String
()
spuLargeImage
:=
gjson
.
Get
(
spu
,
"images_l"
)
.
String
()
if
pdf
==
""
||
(
php2go
.
Strlen
(
spuLargeImage
)
<
5
)
{
sku
.
Pdf
=
""
}
else
{
// spuLargeImage := gjson.Get(spu, "images_l").String()
if
pdf
!=
""
{
pdf
=
strings
.
Replace
(
pdf
,
"http://img.ichunt.com"
,
"https://img.ichunt.com"
,
1
)
//还要针对如果是自己的上传服务的pdf文件,还要补上类型用于预览
if
(
strings
.
Contains
(
pdf
,
"files.ichunt.net"
)
||
strings
.
Contains
(
pdf
,
"file.liexindev.net"
))
&&
!
strings
.
Contains
(
pdf
,
"fileType=pdf"
)
{
pdf
+=
"?fileType=pdf"
}
sku
.
Pdf
=
pdf
}
...
...
service/service_ly_common.go
View file @
2e918fed
...
...
@@ -32,6 +32,8 @@ func (ls *LyService) GetGoodsImages(sku model.LySku, spu string) model.LySku {
if
strings
.
Contains
(
sku
.
GoodsImages
,
"rocelec"
)
{
sku
.
GoodsImages
=
""
}
sku
.
GoodsImages
=
strings
.
Replace
(
sku
.
GoodsImages
,
"http://img.ichunt.com"
,
"https://img.ichunt.com"
,
1
)
sku
.
ImagesL
=
strings
.
Replace
(
sku
.
ImagesL
,
"http://img.ichunt.com"
,
"https://img.ichunt.com"
,
1
)
return
sku
}
...
...
service/service_tags.go
View file @
2e918fed
...
...
@@ -18,7 +18,7 @@ type TagsService struct {
const
TagZiyingSku
=
4
//获取Spu的属性
func
(
ts
*
TagsService
)
GetTags
(
skuId
string
,
self_supplier_type
int64
)
(
goodsTags
model
.
GoodsTag
)
{
func
(
ts
*
TagsService
)
GetTags
(
skuId
string
,
self_supplier_type
int64
)
(
goodsTags
model
.
GoodsTag
)
{
redisCon
:=
gredis
.
Conn
(
"default_r"
)
defer
redisCon
.
Close
()
goodsTagsStr
,
_
:=
redis
.
String
(
redisCon
.
Do
(
"HGET"
,
"goods_tag"
,
skuId
))
...
...
@@ -39,6 +39,15 @@ func (ts *TagsService) GetTags(skuId string,self_supplier_type int64) (goodsTags
tagNames
=
append
(
tagNames
,
tagName
)
tags
=
append
(
tags
,
int
(
tagResult
.
Int
()))
}
//todo hcy 2023.1.10 增加额外商品标签
customerTag
:=
gjson
.
Get
(
goodsTagsStr
,
"customer_tag"
)
.
String
()
if
customerTag
!=
""
{
customerTagArr
:=
php2go
.
Explode
(
" "
,
php2go
.
Trim
(
customerTag
))
for
_
,
cname
:=
range
customerTagArr
{
tagNames
=
append
(
tagNames
,
cname
)
}
}
}
//如果是自营商品Id,就写死当天发货标签
if
len
(
skuId
)
<
10
&&
self_supplier_type
==
1
{
...
...
service/service_zy.go
View file @
2e918fed
...
...
@@ -214,13 +214,17 @@ func (qs *ZiyingService) ZyGoodsDetail(ctx *gin.Context, goodsIds []string, ch c
if
img
!=
""
{
goodsImages
,
_
=
gredis
.
String
(
redisConn
.
Do
(
"HGET"
,
"Self_SelfGoodsSource"
,
img
))
}
A
.
Set
(
"goods_images"
,
gjson
.
Get
(
goodsImages
,
"url"
)
.
String
())
image
:=
gjson
.
Get
(
goodsImages
,
"url"
)
.
String
()
image
=
strings
.
Replace
(
image
,
"http://img.ichunt.com"
,
"https://img.ichunt.com"
,
1
)
A
.
Set
(
"goods_images"
,
image
)
pdf
:=
gjson
.
Get
(
info
,
"pdf"
)
.
String
()
if
pdf
!=
""
{
pdf
,
_
=
gredis
.
String
(
redisConn
.
Do
(
"HGET"
,
"Self_SelfGoodsSource"
,
pdf
))
}
A
.
Set
(
"pdf"
,
gjson
.
Get
(
pdf
,
"url"
)
.
String
())
pdf
=
gjson
.
Get
(
pdf
,
"url"
)
.
String
()
pdf
=
strings
.
Replace
(
pdf
,
"http://img.ichunt.com"
,
"https://img.ichunt.com"
,
1
)
A
.
Set
(
"pdf"
,
pdf
)
}
A
.
Set
(
"scm_brand_name"
,
gjson
.
Get
(
info
,
"scm_brand_name"
)
.
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