Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SooonerHotel
Project
Project
Details
Activity
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
吴贤德
SooonerHotel
Commits
6736c928
Commit
6736c928
authored
Jul 05, 2019
by
wangjiangze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
b9ad3da3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
126 additions
and
2 deletions
+126
-2
FrontAction.class.php
SooonerHotel/App/Lib/Action/Hotel/FrontAction.class.php
+25
-0
DeviceStorageModel.class.php
SooonerHotel/App/Lib/Model/DeviceStorageModel.class.php
+38
-0
add.html
SooonerHotel/App/Tpl/Hotel/zh-cn/Front/add.html
+59
-0
index.html
SooonerHotel/App/Tpl/Hotel/zh-cn/Front/index.html
+4
-2
No files found.
SooonerHotel/App/Lib/Action/Hotel/FrontAction.class.php
View file @
6736c928
...
@@ -27,10 +27,13 @@ class FrontAction extends CommonAction{
...
@@ -27,10 +27,13 @@ class FrontAction extends CommonAction{
$model
=
D
(
"Front"
);
$model
=
D
(
"Front"
);
$hotelModel
=
D
(
"Hotel"
);
$hotelModel
=
D
(
"Hotel"
);
$deviceStorageModel
=
D
(
"DeviceStorage"
);
if
(
$id
){
if
(
$id
){
$info
=
$model
->
where
(
"id =
$id
"
)
->
find
();
$info
=
$model
->
where
(
"id =
$id
"
)
->
find
();
$this
->
info
=
$info
;
$this
->
info
=
$info
;
$storage_list
=
$deviceStorageModel
->
field
(
"id,`path`,`size`"
)
->
where
(
"device_id =
$id
"
)
->
select
();
$this
->
storage_list
=
$storage_list
;
}
}
$hotel_lists
=
$hotelModel
->
where
(
"`status`=0"
)
->
select
();
$hotel_lists
=
$hotelModel
->
where
(
"`status`=0"
)
->
select
();
$this
->
hotel_lists
=
$hotel_lists
;
$this
->
hotel_lists
=
$hotel_lists
;
...
@@ -39,6 +42,7 @@ class FrontAction extends CommonAction{
...
@@ -39,6 +42,7 @@ class FrontAction extends CommonAction{
//添加处理
//添加处理
public
function
addHandle
(){
public
function
addHandle
(){
$model
=
D
(
"Front"
);
$model
=
D
(
"Front"
);
$deviceStorageModel
=
D
(
"DeviceStorage"
);
$id
=
I
(
'id'
,
''
,
int
);
$id
=
I
(
'id'
,
''
,
int
);
$data
[
'hotel_id'
]
=
I
(
"hotel_id"
);
$data
[
'hotel_id'
]
=
I
(
"hotel_id"
);
...
@@ -47,13 +51,27 @@ class FrontAction extends CommonAction{
...
@@ -47,13 +51,27 @@ class FrontAction extends CommonAction{
$data
[
'code'
]
=
I
(
"code"
);
$data
[
'code'
]
=
I
(
"code"
);
$data
[
'ip'
]
=
I
(
"ip"
);
$data
[
'ip'
]
=
I
(
"ip"
);
$data
[
'port'
]
=
I
(
"port"
);
$data
[
'port'
]
=
I
(
"port"
);
$data
[
'virtual_ip'
]
=
I
(
"virtual_ip"
);
$data
[
'netcard'
]
=
I
(
"netcard"
);
$data
[
'remark'
]
=
I
(
"remark"
);
$data
[
'remark'
]
=
I
(
"remark"
);
$data
[
'status'
]
=
I
(
"status"
);
$data
[
'status'
]
=
I
(
"status"
);
$path_arr
=
I
(
"post.path"
);
$size_arr
=
I
(
"post.size"
);
if
(
$id
){
if
(
$id
){
$data
[
'id'
]
=
$id
;
$data
[
'id'
]
=
$id
;
$data
[
"updatetime"
]
=
date
(
'Y-m-d H:i:s'
);
$data
[
"updatetime"
]
=
date
(
'Y-m-d H:i:s'
);
$r
=
$model
->
save
(
$data
);
$r
=
$model
->
save
(
$data
);
if
(
$path_arr
){
$deviceStorageModel
->
where
(
"device_id = "
.
$id
)
->
delete
();
foreach
(
$path_arr
as
$key
=>
$value
){
$storageData
[]
=
array
(
"device_id"
=>
$id
,
"path"
=>
$value
,
"size"
=>
$size_arr
[
$key
],
"addtime"
=>
date
(
'Y-m-d H:i:s'
));
}
$r
=
$deviceStorageModel
->
addAll
(
$storageData
);
}
if
(
$r
){
if
(
$r
){
echo
'true'
;
echo
'true'
;
}
else
{
}
else
{
...
@@ -63,6 +81,13 @@ class FrontAction extends CommonAction{
...
@@ -63,6 +81,13 @@ class FrontAction extends CommonAction{
$data
[
"addtime"
]
=
date
(
'Y-m-d H:i:s'
);
$data
[
"addtime"
]
=
date
(
'Y-m-d H:i:s'
);
$id
=
$model
->
add
(
$data
);
$id
=
$model
->
add
(
$data
);
if
(
$path_arr
){
foreach
(
$path_arr
as
$key
=>
$value
){
$storageData
[]
=
array
(
"device_id"
=>
$id
,
"path"
=>
$value
,
"size"
=>
$size_arr
[
$key
],
"addtime"
=>
date
(
'Y-m-d H:i:s'
));
}
$r
=
$deviceStorageModel
->
addAll
(
$storageData
);
}
if
(
$id
){
if
(
$id
){
echo
'true'
;
echo
'true'
;
}
else
{
}
else
{
...
...
SooonerHotel/App/Lib/Model/DeviceStorageModel.class.php
0 → 100644
View file @
6736c928
<?php
class
DeviceStorageModel
extends
RelationModel
{
protected
$tableName
=
'sh_hotel_device_storage'
;
//重新定义表名
public
function
getList
(
$queryType
,
$userInfo
,
$inputs
){
$p
=
$inputs
[
"page"
]
?
$inputs
[
"page"
]
:
1
;
$n
=
$inputs
[
"rows"
]
?
$inputs
[
"rows"
]
:
10
;
$limit
=
"limit "
.
(
$p
-
1
)
*
$n
.
","
.
$n
;
$sort
=
""
;
if
(
$inputs
[
"sort"
])
$sort
=
"order by "
.
$inputs
[
"sort"
]
.
" "
.
$inputs
[
"order"
];
//=============
$searchField
=
$inputs
[
"searchField"
]
?
$inputs
[
"searchField"
]
:
'A.name'
;
$searchValue
=
$inputs
[
"searchValue"
]
?
$inputs
[
"searchValue"
]
:
''
;
$searchHotel
=
$inputs
[
"searchHotel"
]
?
$inputs
[
"searchHotel"
]
:
0
;
if
(
$searchValue
){
$where
=
" and (A.`name` like '%"
.
$searchValue
.
"%' or A.`code` like '%"
.
$searchValue
.
"%') "
;
}
if
(
$searchHotel
){
$where
.=
" and A.hotel_id =
$searchHotel
"
;
}
$model
=
new
Model
();
//======================
$fields
=
"count(A.id) count"
;
//返回列表(limit分页)
if
(
$queryType
==
"list"
){
$where
.=
$sort
.
" "
.
$limit
;
$fields
=
" A.*,B.`name` hotel_name,case A.`status` when 1 then '<font color=red>禁用</font>' when 0 then '<font color=green>启用</font>' end as `status` "
;
}
$sql
=
"select "
.
$fields
.
" from sh_hotel_device A join sh_hotel B on A.hotel_id = B.id where 1=1 "
.
$where
.
";"
;
return
$model
->
query
(
$sql
);
}
}
\ No newline at end of file
SooonerHotel/App/Tpl/Hotel/zh-cn/Front/add.html
View file @
6736c928
...
@@ -61,6 +61,40 @@ body{padding:20px}
...
@@ -61,6 +61,40 @@ body{padding:20px}
<input
type=
"text"
class=
"form-control"
id=
"inputEmail3"
placeholder=
"端口"
name=
"port"
value=
"{$info.port}"
>
<input
type=
"text"
class=
"form-control"
id=
"inputEmail3"
placeholder=
"端口"
name=
"port"
value=
"{$info.port}"
>
</div>
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"inputEmail3"
class=
"col-sm-2 control-label"
>
虚拟IP
</label>
<div
class=
"col-sm-6"
>
<input
type=
"text"
class=
"form-control"
id=
"inputEmail3"
placeholder=
"请输入虚拟IP"
name=
"virtual_ip"
value=
"{$info.virtual_ip}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"inputEmail3"
class=
"col-sm-2 control-label"
>
服务网卡名称
</label>
<div
class=
"col-sm-6"
>
<input
type=
"text"
class=
"form-control"
id=
"inputEmail3"
placeholder=
"服务网卡名称"
name=
"netcard"
value=
"{$info.netcard}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"inputEmail3"
class=
"col-sm-2 control-label"
>
存储路径配置
</label>
<div
class=
"col-sm-3"
>
<input
id=
"pathAddBtn"
type=
"button"
class=
"btn btn-success"
value=
"+ 增加"
/>
</div>
</div>
<div
class=
"path_box"
>
<volist
name=
"storage_list"
id=
"item"
>
<div
class=
"form-group"
>
<label
for=
"inputEmail3"
class=
"col-sm-2 control-label"
>
路径{$key+1}
</label>
<div
class=
"col-sm-3"
>
<input
type=
"text"
class=
"form-control"
id=
"inputEmail3"
placeholder=
"存储根路径(例:/data1)"
name=
"path[]"
value=
"{$item.path}"
>
</div>
<div
class=
"col-sm-3"
>
<input
type=
"text"
class=
"form-control"
id=
"inputEmail3"
placeholder=
"存储大小,单位GB"
name=
"size[]"
value=
"{$item.size}"
>
</div>
<div
class=
"col-sm-2"
>
<input
id=
"pathDelBtn"
type=
"button"
class=
"btn btn-warning"
value=
"- 删除"
/>
</div>
</div>
</volist>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"inputPassword3"
class=
"col-sm-2 control-label"
>
备注
</label>
<label
for=
"inputPassword3"
class=
"col-sm-2 control-label"
>
备注
</label>
<div
class=
"col-sm-9"
>
<div
class=
"col-sm-9"
>
...
@@ -127,6 +161,31 @@ function submitForm(){
...
@@ -127,6 +161,31 @@ function submitForm(){
});
});
}
}
$
().
ready
(
function
(){
$
().
ready
(
function
(){
$
(
"#pathAddBtn"
).
bind
(
"click"
,
function
(){
var
n
=
$
(
".path_box .form-group"
).
length
;
var
path_html
=
'<div class="form-group">'
+
'<label for="inputEmail3" class="col-sm-3 control-label">路径'
+
(
n
+
1
)
+
'</label>'
+
'<div class="col-sm-3">'
+
'<input type="text" class="form-control" id="inputEmail3" placeholder="存储根路径(例:/data1)" name="path[]" value="{$info.path}">'
+
'</div>'
+
'<div class="col-sm-3">'
+
'<input type="text" class="form-control" id="inputEmail3" placeholder="存储大小,单位GB" name="size[]" value="{$info.size}">'
+
'</div>'
+
'<div class="col-sm-2">'
+
'<input id="pathDelBtn" type="button" class="btn btn-warning" value="- 删除"/>'
+
'</div>'
+
'</div>'
;
$
(
".path_box"
).
append
(
path_html
);
});
$
(
"body"
).
on
(
"click"
,
"#pathDelBtn"
,
function
(){
$
(
this
).
parent
().
parent
().
remove
();
var
n
=
$
(
".path_box .form-group"
).
length
;
if
(
n
>
0
){
$
(
".path_box .form-group"
).
each
(
function
(
i
,
item
){
$
(
this
).
find
(
".control-label"
).
text
(
"路径"
+
(
i
+
1
));
});
}
});
<
if
condition
=
"$info"
>
<
if
condition
=
"$info"
>
$
(
"input[name='type'][value='{$info.type}']"
).
attr
(
"checked"
,
true
);
$
(
"input[name='type'][value='{$info.type}']"
).
attr
(
"checked"
,
true
);
$
(
"input[name='status'][value='{$info.status}']"
).
attr
(
"checked"
,
true
);
$
(
"input[name='status'][value='{$info.status}']"
).
attr
(
"checked"
,
true
);
...
...
SooonerHotel/App/Tpl/Hotel/zh-cn/Front/index.html
View file @
6736c928
...
@@ -71,6 +71,8 @@ onRowContextMenu : onRowContextMenu
...
@@ -71,6 +71,8 @@ onRowContextMenu : onRowContextMenu
<th
data-options=
"field:'code',width:20"
>
分前端标识
</th>
<th
data-options=
"field:'code',width:20"
>
分前端标识
</th>
<th
data-options=
"field:'ip',width:30"
>
IP
</th>
<th
data-options=
"field:'ip',width:30"
>
IP
</th>
<th
data-options=
"field:'port',width:20"
>
端口
</th>
<th
data-options=
"field:'port',width:20"
>
端口
</th>
<th
data-options=
"field:'virtual_ip',width:30"
>
虚拟IP
</th>
<th
data-options=
"field:'netcard',width:20"
>
服务网卡名称
</th>
<th
data-options=
"field:'remark',width:40"
>
备注
</th>
<th
data-options=
"field:'remark',width:40"
>
备注
</th>
<th
data-options=
"field:'addtime',width:30"
sortable=
"true"
>
创建时间
</th>
<th
data-options=
"field:'addtime',width:30"
sortable=
"true"
>
创建时间
</th>
<th
data-options=
"field:'updatetime',width:30"
sortable=
"true"
>
更新时间
</th>
<th
data-options=
"field:'updatetime',width:30"
sortable=
"true"
>
更新时间
</th>
...
@@ -149,12 +151,12 @@ function enable(status){
...
@@ -149,12 +151,12 @@ function enable(status){
}
}
}
}
function
add
(){
function
add
(){
pop
(
800
,
45
0
,
true
,
'dg'
,
'datagrid'
,
'/Hotel/Front/add/'
)
pop
(
800
,
60
0
,
true
,
'dg'
,
'datagrid'
,
'/Hotel/Front/add/'
)
}
}
function
edit
(){
function
edit
(){
var
row
=
$
(
'#dg'
).
datagrid
(
'getSelected'
);
var
row
=
$
(
'#dg'
).
datagrid
(
'getSelected'
);
if
(
row
){
if
(
row
){
pop
(
800
,
45
0
,
true
,
'dg'
,
'datagrid'
,
'/Hotel/Front/add/id/'
+
row
.
id
);
pop
(
800
,
60
0
,
true
,
'dg'
,
'datagrid'
,
'/Hotel/Front/add/id/'
+
row
.
id
);
}
else
{
}
else
{
$
.
messager
.
alert
(
'提示'
,
'请选择要操作的记录!'
,
'info'
);
$
.
messager
.
alert
(
'提示'
,
'请选择要操作的记录!'
,
'info'
);
}
}
...
...
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