Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
goods
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
bp
goods
Commits
aaa7a155
Commit
aaa7a155
authored
Jun 17, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:C端商家商品列表
parent
90f7f75b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
3 deletions
+77
-3
GoodsListCValidate.php
application/library/Validate/GoodsListCValidate.php
+21
-0
Goods.php
application/modules/Goods/controllers/Goods.php
+16
-1
GoodsService.php
application/services/goods/GoodsService.php
+39
-1
application.ini
conf/application.ini
+1
-1
No files found.
application/library/Validate/GoodsListCValidate.php
0 → 100644
View file @
aaa7a155
<?php
namespace
Validate
;
/**
* Class GoodsListCValidate
*
* @package Validate
*/
class
GoodsListCValidate
extends
BaseValidate
{
protected
$rule
=
[
'life_account_id'
=>
'require'
,
];
protected
$message
=
[
"life_account_id"
=>
"生活号id不能为空"
,
];
}
\ No newline at end of file
application/modules/Goods/controllers/Goods.php
View file @
aaa7a155
...
...
@@ -9,6 +9,7 @@ use \Validate\GoodsAddValidate;
use
\Validate\GoodsEditValidate
;
use
\Validate\GoodsInfoOpValidate
;
use
\Validate\GoodsInfoFeValidate
;
use
\Validate\GoodsListCValidate
;
use
\App\Services\goods\ElasticGoodService
;
...
...
@@ -132,11 +133,25 @@ class GoodsController extends Base
* c端 es:商品列表 (sku list)
* @throws Exception
*/
public
function
goods_list_
c
Action
()
public
function
goods_list_
es
Action
()
{
$params
=
$this
->
params
;
$data
=
ElasticGoodService
::
searchDoc
(
$params
);
$this
->
success
([
"result"
=>
$data
]);
}
/**
* 商家 - 商品列表 (sku list)
* @throws Exception
*/
public
function
goods_list_cAction
()
{
(
new
GoodsListCValidate
())
->
validate
();
$params
=
$this
->
params
;
$data
=
GoodsService
::
getCGoodsSkuList
(
$params
[
"life_account_id"
]);
$this
->
success
([
"result"
=>
$data
]);
}
}
\ No newline at end of file
application/services/goods/GoodsService.php
View file @
aaa7a155
...
...
@@ -533,9 +533,47 @@ class GoodsService
}
public
static
function
getCGoodsSpuList
(
$params
=
[])
/**
* 商家 c端商品列表
* @param $lifeAccountId
* @return array
*/
public
static
function
getCGoodsSkuList
(
$lifeAccountId
)
{
$statusList
=
[
[
"type"
=>
"online"
,
"name"
=>
"上架中"
],
[
"type"
=>
"auditing"
,
"name"
=>
"审核中"
],
[
"type"
=>
"rejected"
,
"name"
=>
"被驳回"
],
[
"type"
=>
"offline"
,
"name"
=>
"已下架"
],
];
$list
=
GoodsSku
::
select
([
"goods_sku_id"
,
"name"
,
"url"
,
"total_amount_sold"
,
"inventory_rest"
,
"original_price"
,
"price"
,
"status"
,
"online_status"
],
[
"life_account_id"
=>
$lifeAccountId
]);
$data
=
[
"online"
=>
[],
"auditing"
=>
[],
"rejected"
=>
[],
"offline"
=>
[],
];
if
(
!
empty
(
$list
))
{
foreach
(
$list
as
$sku
)
{
if
(
$sku
[
"status"
]
==
GoodsSku
::
STATUS_PASS
&&
$sku
[
"online_status"
]
==
GoodsSku
::
ONLINE_STATUS_ONLINE
)
{
$data
[
"online"
][]
=
$sku
;
}
if
(
$sku
[
"status"
]
==
GoodsSku
::
STATUS_AUDIT
)
{
$data
[
"auditing"
][]
=
$sku
;
}
if
(
$sku
[
"status"
]
==
GoodsSku
::
STATUS_REJECT
)
{
$data
[
"rejected"
][]
=
$sku
;
}
if
(
$sku
[
"online_status"
]
==
GoodsSku
::
ONLINE_STATUS_OFFLINE
)
{
$data
[
"offline"
][]
=
$sku
;
}
}
}
return
[
"status_list"
=>
$statusList
,
"data"
=>
$data
];
}
/**
...
...
conf/application.ini
View file @
aaa7a155
...
...
@@ -24,7 +24,7 @@ exception.sys.code = -1
exception.sys.msg
=
"system error"
[prod
uct
: common : exception]
[prod : common : exception]
[pre : common : exception]
[test : common : exception]
[dev : common : exception]
\ No newline at end of file
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