切换导航条
此项目
正在载入...
登录
王智
/
spare
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
杨育虎
4 years ago
提交
64ab4820513cc09d4ac4af8983b05ef80a680770
1 个父辈
79858045
2
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
128 行增加
和
73 行删除
application/admin/controller/Product.php
application/admin/lang/zh-cn/product.php
application/admin/view/product/add.html
application/admin/view/product/edit.html
public/assets/js/backend/product.js
application/admin/controller/Product.php
查看文件 @
64ab482
...
...
@@ -3,7 +3,7 @@
namespace
app\admin\controller
;
use
app\common\controller\Backend
;
use
think\Db
;
/**
*
*
...
...
@@ -75,50 +75,4 @@ class Product extends Backend
}
return
$this
->
view
->
fetch
();
}
/**
* 添加
*/
public
function
add
()
{
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
$params
=
$this
->
preExcludeFields
(
$params
);
if
(
$this
->
dataLimit
&&
$this
->
dataLimitFieldAutoFill
)
{
$params
[
$this
->
dataLimitField
]
=
$this
->
auth
->
id
;
}
$result
=
false
;
Db
::
startTrans
();
try
{
//是否采用模型验证
if
(
$this
->
modelValidate
)
{
$name
=
str_replace
(
"
\\
model
\\
"
,
"
\\
validate
\\
"
,
get_class
(
$this
->
model
));
$validate
=
is_bool
(
$this
->
modelValidate
)
?
(
$this
->
modelSceneValidate
?
$name
.
'.add'
:
$name
)
:
$this
->
modelValidate
;
$this
->
model
->
validateFailException
(
true
)
->
validate
(
$validate
);
}
$result
=
$this
->
model
->
allowField
(
true
)
->
save
(
$params
);
Db
::
commit
();
}
catch
(
ValidateException
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
catch
(
PDOException
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
catch
(
Exception
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
if
(
$result
!==
false
)
{
$this
->
success
();
}
else
{
$this
->
error
(
__
(
'No rows were inserted'
));
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
return
$this
->
view
->
fetch
();
}
}
...
...
application/admin/lang/zh-cn/product.php
查看文件 @
64ab482
...
...
@@ -15,8 +15,15 @@ return [
'Tidu2'
=>
'价格梯度2'
,
'Tidu3'
=>
'价格梯度3'
,
'Tidu4'
=>
'价格梯度4'
,
'Price2'
=>
'价格2'
,
'Price1'
=>
'价格1'
,
'Createtime'
=>
'创建时间'
,
'Updatetime'
=>
'更改时间'
,
'Price3'
=>
'价格3'
,
'Price4'
=>
'价格4'
,
'Price5'
=>
'价格5'
,
'Tidu5'
=>
'价格梯度5'
,
'Price'
=>
'商品单价'
,
'Classa.class'
=>
'分类'
,
'Classcon.class_con'
=>
'详细分类'
,
'Logo.logo'
=>
'品牌'
...
...
application/admin/view/product/add.html
查看文件 @
64ab482
...
...
@@ -21,21 +21,21 @@
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('
Logo
_id')}:
</label>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('
Class
_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-
logo_id"
data-rule=
"required"
data-field=
"logo"
data-source=
"logo/index"
class=
"form-control selectpage"
name=
"row[logo
_id]"
type=
"text"
value=
""
>
<input
id=
"c-
class_id"
data-rule=
"required"
data-source=
"class/index"
class=
"form-control selectpage"
name=
"row[class
_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Class_id')}:
</label>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Class_
con_
id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-class_
id"
data-rule=
"required"
data-field=
"class"
data-source=
"classa/index"
class=
"form-control selectpage"
name=
"row[class
_id]"
type=
"text"
value=
""
>
<input
id=
"c-class_
con_id"
data-rule=
"required"
data-source=
"class/con/index"
class=
"form-control selectpage"
name=
"row[class_con
_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('
Class_con
_id')}:
</label>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('
Logo
_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-
class_con_id"
data-rule=
"required"
data-field=
"class_con"
data-source=
"class_con/index"
class=
"form-control selectpage"
name=
"row[class_con
_id]"
type=
"text"
value=
""
>
<input
id=
"c-
logo_id"
data-rule=
"required"
data-source=
"logo/index"
class=
"form-control selectpage"
name=
"row[logo
_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
...
...
@@ -73,25 +73,67 @@
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Tidu1')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-tidu1"
data-rule=
"required"
class=
"form-control"
name=
"row[tidu1]"
type=
"text"
>
<input
id=
"c-tidu1"
class=
"form-control"
name=
"row[tidu1]"
type=
"text"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Tidu2')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-tidu2"
data-rule=
"required"
class=
"form-control"
name=
"row[tidu2]"
type=
"text"
>
<input
id=
"c-tidu2"
class=
"form-control"
name=
"row[tidu2]"
type=
"text"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Tidu3')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-tidu3"
data-rule=
"required"
class=
"form-control"
name=
"row[tidu3]"
type=
"text"
>
<input
id=
"c-tidu3"
class=
"form-control"
name=
"row[tidu3]"
type=
"text"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Tidu4')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-tidu4"
data-rule=
"required"
class=
"form-control"
name=
"row[tidu4]"
type=
"text"
>
<input
id=
"c-tidu4"
class=
"form-control"
name=
"row[tidu4]"
type=
"text"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Price2')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-price2"
class=
"form-control"
step=
"0.01"
name=
"row[price2]"
type=
"number"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Price1')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-price1"
class=
"form-control"
step=
"0.01"
name=
"row[price1]"
type=
"number"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Price3')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-price3"
class=
"form-control"
step=
"0.01"
name=
"row[price3]"
type=
"number"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Price4')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-price4"
class=
"form-control"
step=
"0.01"
name=
"row[price4]"
type=
"number"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Price5')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-price5"
class=
"form-control"
step=
"0.01"
name=
"row[price5]"
type=
"number"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Tidu5')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-tidu5"
class=
"form-control"
name=
"row[tidu5]"
type=
"text"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Price')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-price"
data-rule=
"required"
class=
"form-control"
step=
"0.01"
name=
"row[price]"
type=
"number"
>
</div>
</div>
<div
class=
"form-group layer-footer"
>
...
...
application/admin/view/product/edit.html
查看文件 @
64ab482
...
...
@@ -21,21 +21,21 @@
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('
Logo
_id')}:
</label>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('
Class
_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-
logo_id"
data-rule=
"required"
data-field=
"logo"
data-source=
"logo/index"
class=
"form-control selectpage"
name=
"row[logo_id]"
type=
"text"
value=
"{$row.logo
_id|htmlentities}"
>
<input
id=
"c-
class_id"
data-rule=
"required"
data-source=
"class/index"
class=
"form-control selectpage"
name=
"row[class_id]"
type=
"text"
value=
"{$row.class
_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Class_id')}:
</label>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Class_
con_
id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-class_
id"
data-rule=
"required"
data-field=
"class"
data-source=
"classa/index"
class=
"form-control selectpage"
name=
"row[class_id]"
type=
"text"
value=
"{$row.class
_id|htmlentities}"
>
<input
id=
"c-class_
con_id"
data-rule=
"required"
data-source=
"class/con/index"
class=
"form-control selectpage"
name=
"row[class_con_id]"
type=
"text"
value=
"{$row.class_con
_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('
Class_con
_id')}:
</label>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('
Logo
_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-
class_con_id"
data-rule=
"required"
data-field=
"class_con"
data-source=
"class_con/index"
class=
"form-control selectpage"
name=
"row[class_con_id]"
type=
"text"
value=
"{$row.class_con
_id|htmlentities}"
>
<input
id=
"c-
logo_id"
data-rule=
"required"
data-source=
"logo/index"
class=
"form-control selectpage"
name=
"row[logo_id]"
type=
"text"
value=
"{$row.logo
_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
...
...
@@ -73,25 +73,67 @@
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Tidu1')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-tidu1"
data-rule=
"required"
class=
"form-control"
name=
"row[tidu1]"
type=
"text"
value=
"{$row.tidu1|htmlentities}"
>
<input
id=
"c-tidu1"
class=
"form-control"
name=
"row[tidu1]"
type=
"text"
value=
"{$row.tidu1|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Tidu2')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-tidu2"
data-rule=
"required"
class=
"form-control"
name=
"row[tidu2]"
type=
"text"
value=
"{$row.tidu2|htmlentities}"
>
<input
id=
"c-tidu2"
class=
"form-control"
name=
"row[tidu2]"
type=
"text"
value=
"{$row.tidu2|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Tidu3')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-tidu3"
data-rule=
"required"
class=
"form-control"
name=
"row[tidu3]"
type=
"text"
value=
"{$row.tidu3|htmlentities}"
>
<input
id=
"c-tidu3"
class=
"form-control"
name=
"row[tidu3]"
type=
"text"
value=
"{$row.tidu3|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Tidu4')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-tidu4"
data-rule=
"required"
class=
"form-control"
name=
"row[tidu4]"
type=
"text"
value=
"{$row.tidu4|htmlentities}"
>
<input
id=
"c-tidu4"
class=
"form-control"
name=
"row[tidu4]"
type=
"text"
value=
"{$row.tidu4|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Price2')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-price2"
class=
"form-control"
step=
"0.01"
name=
"row[price2]"
type=
"number"
value=
"{$row.price2|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Price1')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-price1"
class=
"form-control"
step=
"0.01"
name=
"row[price1]"
type=
"number"
value=
"{$row.price1|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Price3')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-price3"
class=
"form-control"
step=
"0.01"
name=
"row[price3]"
type=
"number"
value=
"{$row.price3|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Price4')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-price4"
class=
"form-control"
step=
"0.01"
name=
"row[price4]"
type=
"number"
value=
"{$row.price4|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Price5')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-price5"
class=
"form-control"
step=
"0.01"
name=
"row[price5]"
type=
"number"
value=
"{$row.price5|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Tidu5')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-tidu5"
class=
"form-control"
name=
"row[tidu5]"
type=
"text"
value=
"{$row.tidu5|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Price')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-price"
data-rule=
"required"
class=
"form-control"
step=
"0.01"
name=
"row[price]"
type=
"number"
value=
"{$row.price|htmlentities}"
>
</div>
</div>
<div
class=
"form-group layer-footer"
>
...
...
public/assets/js/backend/product.js
查看文件 @
64ab482
...
...
@@ -27,19 +27,29 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{
field
:
'id'
,
title
:
__
(
'Id'
)},
{
field
:
'avatar'
,
title
:
__
(
'Avatar'
),
events
:
Table
.
api
.
events
.
image
,
formatter
:
Table
.
api
.
formatter
.
image
},
{
field
:
'name'
,
title
:
__
(
'Name'
)},
{
field
:
'classa.class'
,
title
:
__
(
'Classa.class'
)},
{
field
:
'classcon.class_con'
,
title
:
__
(
'Classcon.class_con'
)},
{
field
:
'logo.logo'
,
title
:
__
(
'Logo.logo'
)},
{
field
:
'con'
,
title
:
__
(
'Con'
)},
{
field
:
'class_id'
,
title
:
__
(
'Class_id'
)},
{
field
:
'class_con_id'
,
title
:
__
(
'Class_con_id'
)},
{
field
:
'logo_id'
,
title
:
__
(
'Logo_id'
)},
{
field
:
'fengzhuang'
,
title
:
__
(
'Fengzhuang'
)},
// {field: 'book_avatar', title: __('book_avatar')},
{
field
:
'con'
,
title
:
__
(
'Con'
)},
{
field
:
'stock'
,
title
:
__
(
'Stock'
)},
{
field
:
'book_avatar'
,
title
:
__
(
'Book_avatar'
),
events
:
Table
.
api
.
events
.
image
,
formatter
:
Table
.
api
.
formatter
.
image
},
{
field
:
'tidu1'
,
title
:
__
(
'Tidu1'
)},
{
field
:
'tidu2'
,
title
:
__
(
'Tidu2'
)},
{
field
:
'tidu3'
,
title
:
__
(
'Tidu3'
)},
{
field
:
'tidu4'
,
title
:
__
(
'Tidu4'
)},
{
field
:
'stock'
,
title
:
__
(
'Stock'
)},
{
field
:
'price2'
,
title
:
__
(
'Price2'
),
operate
:
'BETWEEN'
},
{
field
:
'price1'
,
title
:
__
(
'Price1'
),
operate
:
'BETWEEN'
},
{
field
:
'createtime'
,
title
:
__
(
'Createtime'
),
operate
:
'RANGE'
,
addclass
:
'datetimerange'
,
formatter
:
Table
.
api
.
formatter
.
datetime
},
{
field
:
'updatetime'
,
title
:
__
(
'Updatetime'
),
operate
:
'RANGE'
,
addclass
:
'datetimerange'
,
formatter
:
Table
.
api
.
formatter
.
datetime
},
{
field
:
'price3'
,
title
:
__
(
'Price3'
),
operate
:
'BETWEEN'
},
{
field
:
'price4'
,
title
:
__
(
'Price4'
),
operate
:
'BETWEEN'
},
{
field
:
'price5'
,
title
:
__
(
'Price5'
),
operate
:
'BETWEEN'
},
{
field
:
'tidu5'
,
title
:
__
(
'Tidu5'
)},
{
field
:
'price'
,
title
:
__
(
'Price'
),
operate
:
'BETWEEN'
},
{
field
:
'classa.class'
,
title
:
__
(
'Classa.class'
)},
{
field
:
'classcon.class_con'
,
title
:
__
(
'Classcon.class_con'
)},
{
field
:
'logo.logo'
,
title
:
__
(
'Logo.logo'
)},
{
field
:
'operate'
,
title
:
__
(
'Operate'
),
table
:
table
,
events
:
Table
.
api
.
events
.
operate
,
formatter
:
Table
.
api
.
formatter
.
operate
}
]
]
...
...
请
注册
或
登录
后发表评论