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
a630d76e
Commit
a630d76e
authored
Dec 19, 2019
by
侯贺政
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品详情页模板
Signed-off-by:
houhezheng
<
houhezheng@romens.cn
>
parent
272cc68c
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
467 additions
and
19 deletions
+467
-19
urlmanager.php
backend/config/urlmanager.php
+4
-2
GoodsDetailSettingController.php
...controllers/v1/shopgoods/GoodsDetailSettingController.php
+289
-0
ShopGoods.php
backend/models/v1/shopgoods/ShopGoods.php
+20
-0
ShopGoodsDetailSetting.php
backend/models/v1/shopgoods/ShopGoodsDetailSetting.php
+152
-0
ShopPackagingcostsBranches.php
backend/models/v1/transport/ShopPackagingcostsBranches.php
+2
-17
No files found.
backend/config/urlmanager.php
View file @
a630d76e
...
@@ -345,12 +345,14 @@ return [
...
@@ -345,12 +345,14 @@ return [
],
],
'extraPatterns'
=>
[
'extraPatterns'
=>
[
'GET,OPTIONS setting-list'
=>
'setting-list'
,
'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'
,
'POST,OPTIONS setting-add'
=>
'setting-add'
,
'PUT,OPTIONS setting-update'
=>
'setting-update'
,
'PUT,OPTIONS setting-update'
=>
'setting-update'
,
'DELETE,OPTIONS setting-del'
=>
'setting-del'
,
'DELETE,OPTIONS setting-del'
=>
'setting-del'
,
'POST,OPTIONS associated-goods-import'
=>
'associated-goods-import'
,
'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 @
a630d76e
This diff is collapsed.
Click to expand it.
backend/models/v1/shopgoods/ShopGoods.php
View file @
a630d76e
...
@@ -4,6 +4,7 @@ namespace app\models\v1\shopgoods;
...
@@ -4,6 +4,7 @@ namespace app\models\v1\shopgoods;
use
Yii
;
use
Yii
;
use
app\models\v1\BaseModel
;
use
app\models\v1\BaseModel
;
use
yii\data\ActiveDataProvider
;
/**
/**
* This is the model class for table "shop_goods".
* This is the model class for table "shop_goods".
...
@@ -250,6 +251,7 @@ class ShopGoods extends BaseModel
...
@@ -250,6 +251,7 @@ class ShopGoods extends BaseModel
'IS_GIFT_INTERNET'
=>
'Is Gift Internet'
,
'IS_GIFT_INTERNET'
=>
'Is Gift Internet'
,
];
];
}
}
/**
/**
* 获取商品信息
* 获取商品信息
*/
*/
...
@@ -260,4 +262,22 @@ class ShopGoods extends BaseModel
...
@@ -260,4 +262,22 @@ class ShopGoods extends BaseModel
->
where
([
'CODE'
=>
$code
])
->
where
([
'CODE'
=>
$code
])
->
all
();
->
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 @
a630d76e
<?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'
,
'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'
],
];
}
/**
* {@inheritdoc}
*/
public
function
attributeLabels
()
{
return
[
'GUID'
=>
'Guid'
,
'ORG_GUID'
=>
'组织机构号'
,
'NAME'
=>
'版式名称'
,
'STATUS'
=>
'状态'
,
'START_TIME'
=>
'生效开始时间'
,
'END_TIME'
=>
'生效结束时间'
,
'HEAD_PIC_URL'
=>
'顶部内容'
,
'FOOT_PIC_URL'
=>
'底部内容'
,
];
}
/**
* {@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 @
a630d76e
...
@@ -17,8 +17,6 @@ use Yii;
...
@@ -17,8 +17,6 @@ use Yii;
*/
*/
class
ShopPackagingcostsBranches
extends
\app\models\v1\BaseModel
class
ShopPackagingcostsBranches
extends
\app\models\v1\BaseModel
{
{
public
$CODE
;
//门店编码
public
$NAME
;
//门店名称
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
...
@@ -56,16 +54,6 @@ class ShopPackagingcostsBranches extends \app\models\v1\BaseModel
...
@@ -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
...
@@ -79,12 +67,9 @@ class ShopPackagingcostsBranches extends \app\models\v1\BaseModel
->
leftJoin
(
'SHOP_BRANCH sb'
,
's.BRANCH_GUID=sb.GUID'
)
->
leftJoin
(
'SHOP_BRANCH sb'
,
's.BRANCH_GUID=sb.GUID'
)
->
where
([
's.ACTIVITY_TYPE'
=>
'TRANSPORTFEE'
,
's.ACTIVITY_GUID'
=>
$guid
])
->
where
([
's.ACTIVITY_TYPE'
=>
'TRANSPORTFEE'
,
's.ACTIVITY_GUID'
=>
$guid
])
->
orderBy
([
's.GUID'
=>
SORT_ASC
])
->
orderBy
([
's.GUID'
=>
SORT_ASC
])
->
asArray
()
->
all
();
->
all
();
$list
=
[];
return
$query
;
foreach
(
$query
as
$request
)
{
$list
[]
=
$request
->
toArray
([],
[
'CODE'
,
'NAME'
]);
}
return
$list
;
}
}
/**
/**
...
...
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