Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
semour
/
semour_web
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
92492e23
authored
Dec 05, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'dev/ver/1.0.0'
parents
085b623c
bbaa3dbf
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
118 additions
and
97 deletions
.env
app/Http/Services/BrandService.php
app/Http/Services/ClassService.php
app/Http/Services/OrderService.php
config/website.php
resources/views/car/car.blade.php
.env
View file @
92492e23
...
...
@@ -59,3 +59,5 @@ PUBLIC_URL=
GOODS_INFO_URL=http://192.168.1.237:60014
#深茂搜索地址
SO_URL=http://so.semourdev.net
#基石地址
FOOTSTONE_URL=http://footstone.liexindev.net
app/Http/Services/BrandService.php
View file @
92492e23
...
...
@@ -10,24 +10,25 @@ class BrandService
public
static
function
getStandardBrandList
(
$map
)
{
$standardBrandCache
=
Redis
::
hgetall
(
'standard_brand'
);
$standardBrandCache
=
array_map
(
function
(
$value
)
{
return
json_decode
(
$value
,
true
);
},
$standardBrandCache
);
ksort
(
$standardBrandCache
);
$standardBrandCache
=
array_values
(
$standardBrandCache
);
$standardBrandCache
=
array_map
(
function
(
$item
)
{
return
\Arr
::
only
(
$item
,
[
'brand_name_en'
,
'standard_brand_id'
,
'brand_short_name_en'
,
'brand_logo'
]);
},
$standardBrandCache
);
if
(
!
empty
(
$map
[
'brand_name'
]))
{
$fuse
=
new
Fuse
(
$standardBrandCache
,
[
'keys'
=>
[
'brand_name_en'
],
'minMatchCharLength'
=>
3
,
'threshold'
=>
0
]);
return
$fuse
->
search
(
$map
[
'brand_name'
]);
$standardBrandData
=
\Http
::
get
(
config
(
'website.footstone_url'
)
.
'/open/getStandardBrandList'
)
->
json
();
if
(
isset
(
$standardBrandData
[
'code'
])
&&
$standardBrandData
[
'code'
]
==
0
)
{
$standardBrandCache
=
$standardBrandData
[
'data'
];
ksort
(
$standardBrandCache
);
$standardBrandCache
=
array_values
(
$standardBrandCache
);
$standardBrandCache
=
array_map
(
function
(
$item
)
{
return
\Arr
::
only
(
$item
,
[
'brand_name_en'
,
'standard_brand_id'
,
'brand_short_name_en'
,
'brand_logo'
]);
},
$standardBrandCache
);
if
(
!
empty
(
$map
[
'brand_name'
]))
{
$fuse
=
new
Fuse
(
$standardBrandCache
,
[
'keys'
=>
[
'brand_name_en'
],
'minMatchCharLength'
=>
3
,
'threshold'
=>
0
]);
return
$fuse
->
search
(
$map
[
'brand_name'
]);
}
return
$standardBrandCache
;
}
return
$standardBrandCache
;
return
[]
;
}
...
...
@@ -39,31 +40,32 @@ class BrandService
if
(
$standardBrandList
)
{
return
json_decode
(
$standardBrandList
,
true
);
}
$standardBrandCache
=
Redis
::
hgetall
(
'standard_brand'
);
$standardBrandCache
=
array_map
(
function
(
$value
)
{
return
json_decode
(
$value
,
true
);
},
$standardBrandCache
);
$letters
=
generate_letters
();
$standardBrandList
=
[];
foreach
(
$standardBrandCache
as
$standardBrand
)
{
$matchLetter
=
false
;
foreach
(
$letters
as
$letter
)
{
if
(
start_with
(
strtoupper
(
$standardBrand
[
'brand_name'
]),
$letter
))
{
if
(
empty
(
$standardBrand
[
'brand_name_en'
]))
{
continue
;
$standardBrandData
=
\Http
::
get
(
config
(
'website.footstone_url'
)
.
'/open/getStandardBrandList'
)
->
json
();
if
(
isset
(
$standardBrandData
[
'code'
])
&&
$standardBrandData
[
'code'
]
==
0
)
{
$standardBrandCache
=
$standardBrandData
[
'data'
];
$letters
=
generate_letters
();
$standardBrandList
=
[];
foreach
(
$standardBrandCache
as
$standardBrand
)
{
$matchLetter
=
false
;
foreach
(
$letters
as
$letter
)
{
if
(
start_with
(
strtoupper
(
$standardBrand
[
'brand_name'
]),
$letter
))
{
if
(
empty
(
$standardBrand
[
'brand_name_en'
]))
{
continue
;
}
$standardBrandList
[
$letter
][]
=
$standardBrand
;
$matchLetter
=
true
;
}
$standardBrandList
[
$letter
][]
=
$standardBrand
;
$matchLetter
=
true
;
}
if
(
!
$matchLetter
&&
!
empty
(
$standardBrand
[
'brand_name_en'
]))
{
$standardBrandList
[
'#'
][]
=
$standardBrand
;
}
}
if
(
!
$matchLetter
&&
!
empty
(
$standardBrand
[
'brand_name_en'
]))
{
$standardBrandList
[
'#'
][]
=
$standardBrand
;
}
ksort
(
$standardBrandList
);
Redis
::
set
(
$redisKey
,
json_encode
(
$standardBrandList
));
Redis
::
expire
(
$redisKey
,
60
);
return
$standardBrandList
;
}
ksort
(
$standardBrandList
);
Redis
::
set
(
$redisKey
,
json_encode
(
$standardBrandList
));
Redis
::
expire
(
$redisKey
,
60
);
return
$standardBrandList
;
return
[];
}
public
static
function
getStandardBrandInfo
(
$brandId
)
...
...
app/Http/Services/ClassService.php
View file @
92492e23
...
...
@@ -10,78 +10,86 @@ class ClassService
public
static
function
getClassificationForHome
()
{
//先获取所有分类
$class
Cache
=
Redis
::
hgetall
(
'pool_class_info'
);
$class
Data
=
\Http
::
get
(
config
(
'website.footstone_url'
)
.
'/open/getClassification'
)
->
json
(
);
$secondClassList
=
[];
foreach
(
$classCache
as
$key
=>
&
$class
)
{
$class
=
json_decode
(
$class
,
true
);
if
(
!
$class
[
'parent_id'
])
{
if
(
empty
(
$class
[
'class_name_en'
]))
{
continue
;
}
$secondClassList
[]
=
$class
;
}
}
unset
(
$class
);
foreach
(
$classCache
as
$key
=>
$class
)
{
if
(
!
$class
[
'parent_id'
])
{
continue
;
}
foreach
(
$secondClassList
as
&
$secondClass
)
{
if
(
$secondClass
[
'class_id'
]
==
$class
[
'parent_id'
])
{
if
(
isset
(
$classData
[
'code'
])
&&
$classData
[
'code'
]
==
0
)
{
$classCache
=
$classData
[
'data'
];
foreach
(
$classCache
as
$key
=>
&
$class
)
{
if
(
!
$class
[
'parent_id'
])
{
if
(
empty
(
$class
[
'class_name_en'
]))
{
continue
;
}
$class
[
'sku_number'
]
=
Redis
::
hget
(
'pool_class_info_count'
,
$class
[
'class_id'
])
?:
0
;
$secondClass
[
'children'
][]
=
$class
;
$secondClassList
[]
=
$class
;
}
}
unset
(
$secondClass
);
}
unset
(
$class
);
foreach
(
$classCache
as
$key
=>
$class
)
{
if
(
!
$class
[
'parent_id'
])
{
continue
;
}
foreach
(
$secondClassList
as
&
$secondClass
)
{
if
(
$secondClass
[
'class_id'
]
==
$class
[
'parent_id'
])
{
if
(
empty
(
$class
[
'class_name_en'
]))
{
continue
;
}
$secondClass
[
'children'
][]
=
$class
;
}
}
unset
(
$secondClass
);
}
$topClassMapping
=
config
(
'field.top_class_mapping'
);
$topFields
=
[];
foreach
(
$topClassMapping
as
$key
=>
$mapping
)
{
$topFields
[
$key
]
=
[
'class_name'
=>
$key
,
];
}
foreach
(
$topClassMapping
as
$key
=>
$mapping
)
{
foreach
(
$secondClassList
as
$secondClass
)
{
if
(
in_array
(
$secondClass
[
'class_id'
],
$topClassMapping
[
$key
]))
{
if
(
empty
(
$secondClass
[
'class_name_en'
]))
{
continue
;
$topClassMapping
=
config
(
'field.top_class_mapping'
);
$topFields
=
[];
foreach
(
$topClassMapping
as
$key
=>
$mapping
)
{
$topFields
[
$key
]
=
[
'class_name'
=>
$key
,
];
}
foreach
(
$topClassMapping
as
$key
=>
$mapping
)
{
foreach
(
$secondClassList
as
$secondClass
)
{
if
(
in_array
(
$secondClass
[
'class_id'
],
$topClassMapping
[
$key
]))
{
if
(
empty
(
$secondClass
[
'class_name_en'
]))
{
continue
;
}
$topFields
[
$key
][
'img'
]
=
\Arr
::
get
(
config
(
'field.top_class_img_mapping'
),
$key
);
$topFields
[
$key
][
'children'
][]
=
$secondClass
;
}
$topFields
[
$key
][
'img'
]
=
\Arr
::
get
(
config
(
'field.top_class_img_mapping'
),
$key
);
$topFields
[
$key
][
'children'
][]
=
$secondClass
;
}
}
return
array_values
(
$topFields
);
}
return
array_values
(
$topFields
)
;
return
[]
;
}
public
static
function
getClassificationById
(
$classId
,
$includeChildren
=
false
)
public
static
function
getClassificationById
(
$classId
,
$includeChildren
=
false
)
{
$classification
=
Redis
::
hget
(
'pool_class_info'
,
$classId
);
$classification
=
json_decode
(
$classification
,
true
);
if
(
$classification
[
'parent_id'
])
{
return
$classification
;
}
//获取子分类
$classificationCache
=
Redis
::
hgetall
(
'pool_class_info'
);
$totalSkuNumber
=
0
;
foreach
(
$classificationCache
as
$classCache
)
{
$classCache
=
json_decode
(
$classCache
,
true
);
if
(
$classCache
[
'parent_id'
]
==
$classId
)
{
if
(
empty
(
$classCache
[
'class_name_en'
]))
{
continue
;
$classData
=
\Http
::
get
(
config
(
'website.footstone_url'
)
.
'/open/getClassification'
)
->
json
();
if
(
isset
(
$classData
[
'code'
])
&&
$classData
[
'code'
]
==
0
)
{
$classificationCache
=
$classData
[
'data'
];
$classification
=
[];
foreach
(
$classificationCache
as
$class
)
{
if
(
$class
[
'class_id'
]
==
$classId
)
{
$classification
=
$class
;
}
$classCache
[
'sku_number'
]
=
Redis
::
hget
(
'pool_class_info_count'
,
$classCache
[
'class_id'
])
?:
0
;
$totalSkuNumber
+=
$classCache
[
'sku_number'
];
$classification
[
'children'
][]
=
$classCache
;
}
if
(
$classification
[
'parent_id'
])
{
return
$classification
;
}
//获取子分类
$totalSkuNumber
=
0
;
foreach
(
$classificationCache
as
$classCache
)
{
if
(
$classCache
[
'parent_id'
]
==
$classId
)
{
if
(
empty
(
$classCache
[
'class_name_en'
]))
{
continue
;
}
$totalSkuNumber
+=
$classCache
[
'sku_number'
];
$classification
[
'children'
][]
=
$classCache
;
}
}
$classification
[
'sku_number'
]
=
$totalSkuNumber
;
return
$classification
;
}
$classification
[
'sku_number'
]
=
$totalSkuNumber
;
return
$classification
;
return
[];
}
}
app/Http/Services/OrderService.php
View file @
92492e23
...
...
@@ -466,9 +466,9 @@ class OrderService
$temp
=
[];
$return_amount_all
=
0
;
foreach
(
$returnItems
as
$k
=>
$v
){
$
orderGoodsInfo
=
\Arr
::
get
(
$orderItemsArr
,
$v
[
"rec_id"
])
;
$
temp
[]
=
[
"no"
=>
$k
+
1
,
$
recId
=
$v
[
"rec_id"
]
;
$
orderGoodsInfo
=
\Arr
::
get
(
$orderItemsArr
,
$recId
);
$temp
[
$recId
]
=
[
"part_no"
=>
$orderGoodsInfo
[
"goods_name"
],
// 型号名称
"manufacturer"
=>
$orderGoodsInfo
[
"brand_name"
],
// 品牌名称
"price_per_unit"
=>
$orderGoodsInfo
[
"goods_price"
],
// 单价
...
...
@@ -481,6 +481,11 @@ class OrderService
];
$return_amount_all
+=
$v
[
"return_amount"
];
}
$temp
=
array_values
(
$temp
);
foreach
(
$temp
as
$c
=>&
$a
){
$a
[
"no"
]
=
$c
+
1
;
}
return
[
"return_amount_all"
=>
$return_amount_all
,
"items"
=>
$temp
];
}
...
...
config/website.php
0 → 100644
View file @
92492e23
<?php
return
[
'footstone_url'
=>
env
(
'FOOTSTONE_URL'
),
];
resources/views/car/car.blade.php
View file @
92492e23
...
...
@@ -78,7 +78,7 @@
</div>
</div>
<div class="
create
createcarbtn
">Place Order</div>
@if(
empty(
$_COOKIE['sem_email']
))
@if(
Auth::check(
))
<div class="
lgtips
">
Already Registered? <a href="
/
login
?
referer
=
{{
\Illuminate\Support\Facades\URL
::
current
()}}
">Log In</a>
</div>
...
...
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