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
cbca1e2a
authored
Dec 05, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'dev/ver/1.0.0'
parents
d133c867
18c8b8dc
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
70 additions
and
20 deletions
app/Http/Controllers/Api/Controller.php
app/Http/Controllers/Api/SearchApiController.php
app/Http/Services/ClassService.php
public/assets/js/brand/list.js
public/assets/js/class/class.js
public/assets/js/search/search.js
public/assets/js/sku/sku.js
routes/api.php
app/Http/Controllers/Api/Controller.php
View file @
cbca1e2a
...
@@ -73,4 +73,5 @@ class Controller extends BaseController
...
@@ -73,4 +73,5 @@ class Controller extends BaseController
];
];
Log
::
error
(
json_encode
(
$err_info
,
JSON_UNESCAPED_UNICODE
));
Log
::
error
(
json_encode
(
$err_info
,
JSON_UNESCAPED_UNICODE
));
}
}
}
}
app/Http/Controllers/Api/SearchApiController.php
0 → 100644
View file @
cbca1e2a
<?php
namespace
App\Http\Controllers\Api
;
use
App\Http\ApiHelper\ApiCode
;
use
App\Http\Requests\InquirySave
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Http
;
//搜索
class
SearchApiController
extends
Controller
{
public
$soUrl
;
public
function
__construct
(){
$this
->
soUrl
=
env
(
"so_url"
);
}
//搜索列表
public
function
skuLists
(
Request
$request
)
{
$response
=
Http
::
asForm
()
->
post
(
$this
->
soUrl
.
"/semour/skuLists"
,
$request
->
input
());
$data
=
json_decode
(
$response
->
body
(),
true
);
return
$this
->
setSuccess
(
"查询成功"
,
ApiCode
::
API_CODE_SUCCESS
,
\Arr
::
get
(
$data
,
"data"
));
}
//商品详情
public
function
goodsDetail
(
Request
$request
)
{
$response
=
Http
::
asForm
()
->
post
(
$this
->
soUrl
.
"/semour/goodsDetail"
,
$request
->
input
());
$data
=
json_decode
(
$response
->
body
(),
true
);
return
$this
->
setSuccess
(
"查询成功"
,
ApiCode
::
API_CODE_SUCCESS
,
\Arr
::
get
(
$data
,
"data"
));
}
}
app/Http/Services/ClassService.php
View file @
cbca1e2a
...
@@ -9,6 +9,10 @@ class ClassService
...
@@ -9,6 +9,10 @@ class ClassService
//获取首页需要的所有分类,没有英文名称的不要
//获取首页需要的所有分类,没有英文名称的不要
public
static
function
getClassificationForHome
()
public
static
function
getClassificationForHome
()
{
{
$cache
=
Redis
::
get
(
'semour_classification_cache'
);
if
(
$cache
)
{
return
json_decode
(
$cache
,
true
);
}
//先获取所有分类
//先获取所有分类
$classData
=
\Http
::
get
(
config
(
'website.footstone_url'
)
.
'/open/getClassification'
)
->
json
();
$classData
=
\Http
::
get
(
config
(
'website.footstone_url'
)
.
'/open/getClassification'
)
->
json
();
$secondClassList
=
[];
$secondClassList
=
[];
...
@@ -56,13 +60,20 @@ class ClassService
...
@@ -56,13 +60,20 @@ class ClassService
}
}
}
}
}
}
return
array_values
(
$topFields
);
$data
=
array_values
(
$topFields
);
Redis
::
set
(
'semour_classification_cache'
,
json_encode
(
$data
));
Redis
::
expire
(
'semour_classification_cache'
,
600
);
return
$data
;
}
}
return
[];
return
[];
}
}
public
static
function
getClassificationById
(
$classId
,
$includeChildren
=
false
)
public
static
function
getClassificationById
(
$classId
,
$includeChildren
=
false
)
{
{
$cache
=
Redis
::
get
(
'semour_classification_cache_'
.
$classId
);
if
(
$cache
)
{
return
json_decode
(
$cache
,
true
);
}
$classData
=
\Http
::
get
(
config
(
'website.footstone_url'
)
.
'/open/getClassification'
)
->
json
();
$classData
=
\Http
::
get
(
config
(
'website.footstone_url'
)
.
'/open/getClassification'
)
->
json
();
if
(
isset
(
$classData
[
'code'
])
&&
$classData
[
'code'
]
==
0
)
{
if
(
isset
(
$classData
[
'code'
])
&&
$classData
[
'code'
]
==
0
)
{
$classificationCache
=
$classData
[
'data'
];
$classificationCache
=
$classData
[
'data'
];
...
@@ -87,6 +98,8 @@ class ClassService
...
@@ -87,6 +98,8 @@ class ClassService
}
}
}
}
$classification
[
'sku_number'
]
=
$totalSkuNumber
;
$classification
[
'sku_number'
]
=
$totalSkuNumber
;
Redis
::
set
(
'semour_classification_cache_'
.
$classId
,
json_encode
(
$classification
));
Redis
::
expire
(
'semour_classification_cache_'
.
$classId
,
600
);
return
$classification
;
return
$classification
;
}
}
return
[];
return
[];
...
...
public/assets/js/brand/list.js
View file @
cbca1e2a
...
@@ -39,7 +39,7 @@ define('brandlist', ['tool', 'liexin_pop', 'artTemplate', 'pagination'], functio
...
@@ -39,7 +39,7 @@ define('brandlist', ['tool', 'liexin_pop', 'artTemplate', 'pagination'], functio
data_
[
"single_price/sort"
]
=
"desc"
data_
[
"single_price/sort"
]
=
"desc"
}
}
}
}
$
.
liexin_ajax
(
SO_URL
+
'/semour
/skuLists'
,
'POST'
,
data_
,
function
(
res
)
{
$
.
liexin_ajax
(
'/api/search
/skuLists'
,
'POST'
,
data_
,
function
(
res
)
{
if
(
res
.
code
==
0
)
{
if
(
res
.
code
==
0
)
{
var
dataArr
=
res
.
data
.
lists
||
[];
var
dataArr
=
res
.
data
.
lists
||
[];
$
(
".brandlistCount"
).
html
(
res
.
data
.
total
||
0
)
$
(
".brandlistCount"
).
html
(
res
.
data
.
total
||
0
)
...
...
public/assets/js/class/class.js
View file @
cbca1e2a
...
@@ -26,7 +26,7 @@ define('class_p', ['tool', 'liexin_pop', 'artTemplate', 'pagination'], function
...
@@ -26,7 +26,7 @@ define('class_p', ['tool', 'liexin_pop', 'artTemplate', 'pagination'], function
if
(
$
(
"#class_id_three"
).
val
())
{
if
(
$
(
"#class_id_three"
).
val
())
{
data_
[
"class_id2/eq"
]
=
$
(
"#class_id_three"
).
val
()
data_
[
"class_id2/eq"
]
=
$
(
"#class_id_three"
).
val
()
}
}
$
.
liexin_ajax
(
SO_URL
+
'/semour
/skuLists'
,
'POST'
,
data_
,
function
(
res
)
{
$
.
liexin_ajax
(
'/api/search
/skuLists'
,
'POST'
,
data_
,
function
(
res
)
{
if
(
res
.
code
==
0
)
{
if
(
res
.
code
==
0
)
{
var
dataArr
=
res
.
data
.
lists
||
[];
var
dataArr
=
res
.
data
.
lists
||
[];
$
(
".search_result_count"
).
html
(
res
.
data
.
total
||
0
)
$
(
".search_result_count"
).
html
(
res
.
data
.
total
||
0
)
...
...
public/assets/js/search/search.js
View file @
cbca1e2a
...
@@ -39,7 +39,7 @@ define('search', ['tool', 'liexin_pop', 'artTemplate', 'pagination'], function (
...
@@ -39,7 +39,7 @@ define('search', ['tool', 'liexin_pop', 'artTemplate', 'pagination'], function (
data_
[
"single_price/sort"
]
=
"desc"
data_
[
"single_price/sort"
]
=
"desc"
}
}
}
}
$
.
liexin_ajax
(
SO_URL
+
'/semour
/skuLists'
,
'POST'
,
data_
,
function
(
res
)
{
$
.
liexin_ajax
(
'/api/search
/skuLists'
,
'POST'
,
data_
,
function
(
res
)
{
console
.
log
(
res
)
console
.
log
(
res
)
if
(
res
.
code
==
0
)
{
if
(
res
.
code
==
0
)
{
var
dataArr
=
res
.
data
.
lists
||
[];
var
dataArr
=
res
.
data
.
lists
||
[];
...
@@ -73,7 +73,7 @@ define('search', ['tool', 'liexin_pop', 'artTemplate', 'pagination'], function (
...
@@ -73,7 +73,7 @@ define('search', ['tool', 'liexin_pop', 'artTemplate', 'pagination'], function (
search
.
page
=
api
.
getCurrent
()
search
.
page
=
api
.
getCurrent
()
search
.
getData
();
search
.
getData
();
}
}
});
});
}
else
{
}
else
{
tool
.
NoData
(
".data-td"
)
tool
.
NoData
(
".data-td"
)
...
@@ -134,9 +134,9 @@ define('search', ['tool', 'liexin_pop', 'artTemplate', 'pagination'], function (
...
@@ -134,9 +134,9 @@ define('search', ['tool', 'liexin_pop', 'artTemplate', 'pagination'], function (
search
.
onePriceRow
(
$
(
this
).
parents
(
".td-group"
))
search
.
onePriceRow
(
$
(
this
).
parents
(
".td-group"
))
return
return
}
}
search
.
onePriceRow
(
$
(
this
).
parents
(
".td-group"
))
search
.
onePriceRow
(
$
(
this
).
parents
(
".td-group"
))
},
600
))
},
600
))
//加购物车
//加购物车
$
(
"body"
).
on
(
"click"
,
".addCarSearch"
,
function
(){
$
(
"body"
).
on
(
"click"
,
".addCarSearch"
,
function
(){
...
@@ -149,7 +149,7 @@ define('search', ['tool', 'liexin_pop', 'artTemplate', 'pagination'], function (
...
@@ -149,7 +149,7 @@ define('search', ['tool', 'liexin_pop', 'artTemplate', 'pagination'], function (
liexin_pop
.
Tip
({
title
:
res
.
msg
})
liexin_pop
.
Tip
({
title
:
res
.
msg
})
tool
.
getCarNum
()
tool
.
getCarNum
()
}
else
{
}
else
{
liexin_pop
.
Tip
({
title
:
res
.
msg
})
liexin_pop
.
Tip
({
title
:
res
.
msg
})
}
}
})
})
...
@@ -193,7 +193,7 @@ define('search', ['tool', 'liexin_pop', 'artTemplate', 'pagination'], function (
...
@@ -193,7 +193,7 @@ define('search', ['tool', 'liexin_pop', 'artTemplate', 'pagination'], function (
return
false
;
return
false
;
}
}
})
})
//计算合计价格
//计算合计价格
var
ac_price
=
obj
.
find
(
".price-group.act"
).
find
(
".jtpcval"
).
text
();
var
ac_price
=
obj
.
find
(
".price-group.act"
).
find
(
".jtpcval"
).
text
();
...
@@ -204,4 +204,4 @@ define('search', ['tool', 'liexin_pop', 'artTemplate', 'pagination'], function (
...
@@ -204,4 +204,4 @@ define('search', ['tool', 'liexin_pop', 'artTemplate', 'pagination'], function (
})
})
seajs
.
use
([
'search'
])
seajs
.
use
([
'search'
])
\ No newline at end of file
public/assets/js/sku/sku.js
View file @
cbca1e2a
...
@@ -10,7 +10,7 @@ define('sku', ['liexin_pop', 'tool', 'artTemplate'], function (require, exports,
...
@@ -10,7 +10,7 @@ define('sku', ['liexin_pop', 'tool', 'artTemplate'], function (require, exports,
sku
.
handle
()
sku
.
handle
()
},
},
getData
:
function
()
{
getData
:
function
()
{
$
.
liexin_ajax
(
SO_URL
+
'/semour
/goodsDetail'
,
'POST'
,
{
goods_id
:
$
(
"#sku_goods_id"
).
val
()
},
function
(
res
)
{
$
.
liexin_ajax
(
'/api/search
/goodsDetail'
,
'POST'
,
{
goods_id
:
$
(
"#sku_goods_id"
).
val
()
},
function
(
res
)
{
console
.
log
(
res
)
console
.
log
(
res
)
if
(
res
.
code
==
0
)
{
if
(
res
.
code
==
0
)
{
var
json_
=
res
.
data
var
json_
=
res
.
data
...
@@ -63,9 +63,9 @@ define('sku', ['liexin_pop', 'tool', 'artTemplate'], function (require, exports,
...
@@ -63,9 +63,9 @@ define('sku', ['liexin_pop', 'tool', 'artTemplate'], function (require, exports,
return
return
}
}
sku
.
addCar
(
1
)
sku
.
addCar
(
1
)
})
})
},
},
addCar
:
function
(
status
){
addCar
:
function
(
status
){
var
data_
=
{
var
data_
=
{
...
@@ -82,7 +82,7 @@ define('sku', ['liexin_pop', 'tool', 'artTemplate'], function (require, exports,
...
@@ -82,7 +82,7 @@ define('sku', ['liexin_pop', 'tool', 'artTemplate'], function (require, exports,
window
.
location
.
href
=
"/confirm"
window
.
location
.
href
=
"/confirm"
}
}
}
else
{
}
else
{
liexin_pop
.
Tip
({
title
:
res
.
msg
})
liexin_pop
.
Tip
({
title
:
res
.
msg
})
}
}
})
})
...
@@ -99,7 +99,7 @@ define('sku', ['liexin_pop', 'tool', 'artTemplate'], function (require, exports,
...
@@ -99,7 +99,7 @@ define('sku', ['liexin_pop', 'tool', 'artTemplate'], function (require, exports,
$
(
this
).
addClass
(
"act"
);
$
(
this
).
addClass
(
"act"
);
return
false
;
return
false
;
}
}
if
(
$
(
this
).
index
()
==
0
)
{
if
(
$
(
this
).
index
()
==
0
)
{
//第一个阶梯
//第一个阶梯
...
@@ -125,18 +125,18 @@ define('sku', ['liexin_pop', 'tool', 'artTemplate'], function (require, exports,
...
@@ -125,18 +125,18 @@ define('sku', ['liexin_pop', 'tool', 'artTemplate'], function (require, exports,
return
false
;
return
false
;
}
}
})
})
//计算合计价格
//计算合计价格
var
ac_price
=
Number
(
$
(
".jtpgroupxps.act"
).
find
(
".jtpcval"
).
text
());
var
ac_price
=
Number
(
$
(
".jtpgroupxps.act"
).
find
(
".jtpcval"
).
text
());
$
(
".countskud"
).
text
(
value_
)
$
(
".countskud"
).
text
(
value_
)
$
(
".skupriced"
).
text
(
ac_price
)
$
(
".skupriced"
).
text
(
ac_price
)
$
(
".skupricedtotal"
).
text
(((
ac_price
*
value_
)
||
0
).
toFixed
(
2
))
$
(
".skupricedtotal"
).
text
(((
ac_price
*
value_
)
||
0
).
toFixed
(
2
))
}
}
}
}
module
.
exports
=
sku
.
init
();
module
.
exports
=
sku
.
init
();
})
})
seajs
.
use
([
'sku'
])
seajs
.
use
([
'sku'
])
\ No newline at end of file
routes/api.php
View file @
cbca1e2a
...
@@ -22,6 +22,10 @@ Route::middleware(['api'])->namespace('Api')->group(function () {
...
@@ -22,6 +22,10 @@ Route::middleware(['api'])->namespace('Api')->group(function () {
Route
::
POST
(
'auth/set_forget_password'
,
'AuthApiController@setForgetPassword'
);
Route
::
POST
(
'auth/set_forget_password'
,
'AuthApiController@setForgetPassword'
);
Route
::
get
(
'country/list'
,
'CountryApiController@list'
);
Route
::
get
(
'country/list'
,
'CountryApiController@list'
);
Route
::
get
(
'brand/list'
,
'BrandApiController@list'
);
Route
::
get
(
'brand/list'
,
'BrandApiController@list'
);
Route
::
POST
(
'/search/skuLists'
,
'SearchApiController@skuLists'
);
Route
::
POST
(
'/search/goodsDetail'
,
'SearchApiController@goodsDetail'
);
});
});
...
...
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