Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
newShopBack
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
newshop
newShopBack
Commits
b3eef114
Commit
b3eef114
authored
Dec 20, 2019
by
孙磊
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'development' of
http://gitlab-ebiz.yiyao365.cn/newshop/newshopback
into development
parents
dadff6a2
94d53cd4
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
526 additions
and
19 deletions
+526
-19
urlmanager.php
backend/config/urlmanager.php
+4
-2
GoodsDetailSettingController.php
...controllers/v1/shopgoods/GoodsDetailSettingController.php
+329
-0
ShopGoods.php
backend/models/v1/shopgoods/ShopGoods.php
+20
-0
ShopGoodsDetailSetting.php
backend/models/v1/shopgoods/ShopGoodsDetailSetting.php
+171
-0
ShopPackagingcostsBranches.php
backend/models/v1/transport/ShopPackagingcostsBranches.php
+2
-17
No files found.
backend/config/urlmanager.php
View file @
b3eef114
...
...
@@ -348,12 +348,14 @@ return [
],
'extraPatterns'
=>
[
'GET,OPTIONS setting-list'
=>
'setting-list'
,
'GET,OPTIONS setting-deta
ls'
=>
'setting-deta
ls'
,
'GET,OPTIONS setting-deta
ils'
=>
'setting-detai
ls'
,
'POST,OPTIONS setting-add'
=>
'setting-add'
,
'PUT,OPTIONS setting-update'
=>
'setting-update'
,
'DELETE,OPTIONS setting-del'
=>
'setting-del'
,
'POST,OPTIONS associated-goods-import'
=>
'associated-goods-import'
,
'POST,OPTIONS associated-goods'
=>
'associated-goods'
,
'POST,OPTIONS associated-goods-add'
=>
'associated-goods-add'
,
'GET,OPTIONS associated-goods-list'
=>
'associated-goods-list'
,
'DELETE,OPTIONS associated-goods-del'
=>
'associated-goods-del'
,
]
],
],
...
...
backend/controllers/v1/shopgoods/GoodsDetailSettingController.php
0 → 100644
View file @
b3eef114
This diff is collapsed.
Click to expand it.
backend/models/v1/shopgoods/ShopGoods.php
View file @
b3eef114
...
...
@@ -4,6 +4,7 @@ namespace app\models\v1\shopgoods;
use
Yii
;
use
app\models\v1\BaseModel
;
use
yii\data\ActiveDataProvider
;
/**
* This is the model class for table "shop_goods".
...
...
@@ -250,6 +251,7 @@ class ShopGoods extends BaseModel
'IS_GIFT_INTERNET'
=>
'Is Gift Internet'
,
];
}
/**
* 获取商品信息
*/
...
...
@@ -260,4 +262,22 @@ class ShopGoods extends BaseModel
->
where
([
'CODE'
=>
$code
])
->
all
();
}
/**
* 关联商品列表
* @param array $params 参数数组(GUID,page)
* @return array|null 商品列表
*/
public
function
associatedGoods
(
$params
)
{
$query
=
static
::
find
()
->
select
(
'GUID,CODE,NAME,MAIN_IMAGE_PATH'
)
->
where
([
'DETAIL_SETTING_GUID'
=>
$params
[
'GUID'
]]);
return
new
ActiveDataProvider
([
'query'
=>
$query
->
asArray
(),
'pagination'
=>
[
'pageSize'
=>
isset
(
$params
[
'pageSize'
])
?
0
:
PAGE_SIZE
,
]
]);
}
}
backend/models/v1/shopgoods/ShopGoodsDetailSetting.php
0 → 100644
View file @
b3eef114
<?php
namespace
app\models\v1\shopgoods
;
use
Yii
;
use
yii\data\ActiveDataProvider
;
/**
* This is the model class for table "shop_goodsdetail_setting".
*
* @property string $GUID 主键关联shop_goods表
* @property string|null $ORG_GUID 组织机构号
* @property string|null $NAME 版式名称
* @property int|null $STATUS 状态,1:启用,0:禁用
* @property int|null $START_TIME 生效开始时间
* @property int|null $END_TIME 生效结束时间
* @property string|null $HEAD_PIC_URL 顶部图片地址
* @property string|null $FOOT_PIC_URL 底部图片地址
*/
class
ShopGoodsDetailSetting
extends
\app\models\v1\BaseModel
{
public
$NUM
;
//已关联商品数量
/**
* {@inheritdoc}
*/
public
static
function
tableName
()
{
return
'shop_goodsdetail_setting'
;
}
/**
* {@inheritdoc}
*/
public
function
rules
()
{
return
[
[[
'GUID'
],
'required'
,
'on'
=>
'creation'
],
[[
'STATUS'
],
'integer'
],
[[
'STATUS'
],
'default'
,
'value'
=>
1
],
[[
'START_TIME'
,
'END_TIME'
],
'date'
,
'format'
=>
'Y-M-d H:m:s'
,
'message'
=>
"时间格式为Y-m-d H:i:s"
],
[[
'HEAD_PIC_URL'
,
'FOOT_PIC_URL'
],
'string'
],
[[
'GUID'
,
'ORG_GUID'
],
'string'
,
'max'
=>
50
],
[[
'NAME'
],
'string'
,
'max'
=>
255
],
[[
'GUID'
],
'unique'
,
'on'
=>
'creation'
],
[[
'START_TIME'
],
'validateStartTime'
],
[[
'END_TIME'
],
'validateEndTime'
],
];
}
/**
* {@inheritdoc}
*/
public
function
attributeLabels
()
{
return
[
'GUID'
=>
'Guid'
,
'ORG_GUID'
=>
'组织机构号'
,
'NAME'
=>
'版式名称'
,
'STATUS'
=>
'状态'
,
'START_TIME'
=>
'生效开始时间'
,
'END_TIME'
=>
'生效结束时间'
,
'HEAD_PIC_URL'
=>
'顶部内容'
,
'FOOT_PIC_URL'
=>
'底部内容'
,
];
}
/**
* 预处理生效开始时间为时间戳
*/
public
function
validateStartTime
()
{
$this
->
START_TIME
=
strtotime
(
$this
->
START_TIME
);
}
/**
* 预处理生效结束时间为时间戳
*/
public
function
validateEndTime
()
{
$this
->
END_TIME
=
strtotime
(
$this
->
END_TIME
);
}
/**
* {@inheritdoc}
*/
public
function
fields
()
{
$fields
=
parent
::
fields
();
$fields
[
'START_TIME'
]
=
function
()
{
return
date
(
'Y-m-d H:i:s'
,
$this
->
START_TIME
);
};
$fields
[
'END_TIME'
]
=
function
()
{
return
date
(
'Y-m-d H:i:s'
,
$this
->
END_TIME
);
};
return
$fields
;
}
/**
* {@inheritdoc}
*/
public
function
extraFields
()
{
return
[
'NUM'
,
];
}
/**
* 商品详情页模板列表
* @param array $params 搜索所需参数
* @return array|null 返回查询列表
*/
public
function
goodsDetailList
(
$params
)
{
$query
=
static
::
find
()
->
alias
(
'sgds'
)
->
select
(
'sgds.GUID,sgds.NAME,sgds.STATUS,sgds.START_TIME,sgds.END_TIME,count(sg.GUID) as NUM'
)
->
leftJoin
(
'shop_goods sg'
,
'sg.DETAIL_SETTING_GUID=sgds.GUID'
)
->
groupBy
(
'sgds.GUID'
);
if
(
isset
(
$params
[
'NAME'
]))
{
$query
->
andFilterWhere
([
'like'
,
'sgds.NAME'
,
$params
[
'NAME'
]]);
}
if
(
isset
(
$params
[
'STATUS'
]))
{
$query
->
andFilterWhere
([
'sgds.STATUS'
=>
$params
[
'STATUS'
]]);
}
if
(
isset
(
$params
[
'START_TIME'
]))
{
$query
->
andFilterWhere
([
'>='
,
'sgds.START_TIME'
,
strtotime
(
$params
[
'START_TIME'
])]);
}
if
(
isset
(
$params
[
'END_TIME'
]))
{
$query
->
andFilterWhere
([
'<='
,
'sgds.END_TIME'
,
strtotime
(
$params
[
'END_TIME'
])]);
}
$dataProvider
=
new
ActiveDataProvider
([
'query'
=>
$query
,
'pagination'
=>
[
'pageSize'
=>
PAGE_SIZE
,
],
'sort'
=>
[
'attributes'
=>
[
'START_TIME'
=>
SORT_ASC
,
]
]
]);
$list
=
[];
foreach
(
$dataProvider
->
getModels
()
as
$request
)
{
$list
[]
=
$request
->
toArray
([],
[
'NUM'
]);
}
$dataProvider
->
setModels
(
$list
);
return
$dataProvider
;
}
/**
* 模板详情
* @param string $guid 模板GUID
* @return array|null
*/
public
function
details
(
$guid
)
{
$query
=
static
::
find
()
->
alias
(
'sgds'
)
->
select
(
'sgds.GUID,sgds.NAME,sgds.STATUS,sgds.START_TIME,sgds.END_TIME,count(sg.GUID) as NUM,sgds.HEAD_PIC_URL,sgds.FOOT_PIC_URL'
)
->
leftJoin
(
'shop_goods sg'
,
'sg.DETAIL_SETTING_GUID=sgds.GUID'
)
->
groupBy
(
'sgds.GUID'
)
->
where
([
'sgds.GUID'
=>
$guid
])
->
one
();
$query
->
toArray
([],
[
'NUM'
]);
return
$query
;
}
}
backend/models/v1/transport/ShopPackagingcostsBranches.php
View file @
b3eef114
...
...
@@ -17,8 +17,6 @@ use Yii;
*/
class
ShopPackagingcostsBranches
extends
\app\models\v1\BaseModel
{
public
$CODE
;
//门店编码
public
$NAME
;
//门店名称
/**
* {@inheritdoc}
*/
...
...
@@ -56,16 +54,6 @@ class ShopPackagingcostsBranches extends \app\models\v1\BaseModel
];
}
/**
* {@inheritdoc}
*/
public
function
extraFields
()
{
return
[
'CODE'
,
//门店编码
'NAME'
,
//门店名称
];
}
/**
* 获取指定省级
*
...
...
@@ -79,12 +67,9 @@ class ShopPackagingcostsBranches extends \app\models\v1\BaseModel
->
leftJoin
(
'SHOP_BRANCH sb'
,
's.BRANCH_GUID=sb.GUID'
)
->
where
([
's.ACTIVITY_TYPE'
=>
'TRANSPORTFEE'
,
's.ACTIVITY_GUID'
=>
$guid
])
->
orderBy
([
's.GUID'
=>
SORT_ASC
])
->
asArray
()
->
all
();
$list
=
[];
foreach
(
$query
as
$request
)
{
$list
[]
=
$request
->
toArray
([],
[
'CODE'
,
'NAME'
]);
}
return
$list
;
return
$query
;
}
/**
...
...
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