Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
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
hujun
tl_estate
Commits
9ef8287f
Commit
9ef8287f
authored
Jul 18, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
办公室详情
parent
c1dc4224
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
10 deletions
+63
-10
StoreFee.php
application/index/controller/StoreFee.php
+39
-9
StoreFeeValidate.php
application/index/validate/StoreFeeValidate.php
+10
-0
FOffice.php
application/model/FOffice.php
+14
-1
No files found.
application/index/controller/StoreFee.php
View file @
9ef8287f
...
...
@@ -51,9 +51,9 @@ class StoreFee extends Basic
$data
[
"rent"
]
=
$params
[
'rent'
];
$data
[
"operator_id"
]
=
$this
->
userId
;
$res
=
$this
->
f_office
->
saveOffice
(
$data
);
//int(1)
$res
ult
=
$this
->
f_office
->
saveOffice
(
$data
);
//int(1)
if
(
$res
)
{
if
(
$res
ult
)
{
return
$this
->
response
(
"200"
,
"成功"
);
}
else
{
return
$this
->
response
(
"101"
,
"失败"
);
...
...
@@ -73,7 +73,8 @@ class StoreFee extends Basic
"office_name" => '鳖'
"office_address" => '上海市黄浦区龙华东路800号'
);*/
$pageNo
=
empty
(
$this
->
params
[
'pageNo'
])
?
1
:
$this
->
params
[
'pageNo'
];
$pageSize
=
empty
(
$this
->
params
[
'pageSize'
])
?
10
:
$this
->
params
[
'pageSize'
];
$conditions
=
[];
if
(
!
empty
(
$params
[
'office_name'
]))
{
...
...
@@ -82,16 +83,45 @@ class StoreFee extends Basic
if
(
!
empty
(
$params
[
'office_address'
]))
{
$conditions
[
'office_address'
]
=
[
'LIKE'
,
'%'
.
$params
[
'office_address'
]
.
'%'
];
}
$field
=
'id,office_name,office_address,create_time'
;
$res
=
$this
->
f_office
->
getOffice
(
$field
,
$conditions
);
if
(
!
$res
)
$field
=
'id,
rent,
office_name,office_address,create_time'
;
$res
ult
=
$this
->
f_office
->
getOffice
(
$field
,
$conditions
,
$pageNo
,
$pageSize
);
if
(
!
$res
ult
)
return
$this
->
response
(
"200"
,
"成功"
,
[]);
$m_store
=
new
AStore
();
foreach
(
$res
as
$k
=>
$v
)
{
$res
[
$k
][
'store_num'
]
=
$m_store
->
getOfficeStore
(
$v
[
'id'
]);
//办公室门店数
foreach
(
$result
as
$k
=>
$v
)
{
$result
[
$k
][
'store_num'
]
=
$m_store
->
getOfficeStore
(
$v
[
'id'
]);
//办公室门店数
}
$result_total
=
$this
->
f_office
->
getOfficeTotal
(
$field
,
$conditions
);
$data
[
'list'
]
=
$result
;
$data
[
'total'
]
=
$result_total
;
return
$this
->
response
(
"200"
,
"成功"
,
$data
);
}
/**
* 办公室详情
* @return \think\Response
*/
public
function
getOfficeInfo
()
{
$params
=
$this
->
params
;
// $params = array(
// "id" => '1',//id
// );
$checkResult
=
$this
->
validate
(
$params
,
"StoreFeeValidate.getOfficeInfo"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
$conditions
=
[];
$field
=
'id,site_id,office_name,office_address'
;
$result
=
$this
->
f_office
->
findByOne
(
$field
,
$conditions
);
if
(
!
$result
)
{
return
$this
->
response
(
"101"
,
'此办公室不存在'
);
}
$data
[
'list'
]
=
$res
;
$data
[
'list'
]
=
$res
ult
;
return
$this
->
response
(
"200"
,
"成功"
,
$data
);
}
...
...
application/index/validate/StoreFeeValidate.php
View file @
9ef8287f
...
...
@@ -11,6 +11,10 @@ class StoreFeeValidate extends Validate {
'office_name'
=>
'require'
,
'office_address'
=>
'require'
,
'rent'
=>
'require|number|gt:0'
,
'id'
=>
'require|number|gt:0'
,
];
protected
$message
=
[
...
...
@@ -20,10 +24,15 @@ class StoreFeeValidate extends Validate {
'rent.require'
=>
'租金每月不能为空'
,
'rent.number'
=>
'租金每月只能为数字'
,
'rent.gt'
=>
'租金每月必须大于0'
,
'id.require'
=>
'id为必填字段'
,
'id.number'
=>
'id只能为数字'
,
'id.gt'
=>
'id必须大于0'
,
];
protected
$scene
=
[
'addOffice'
=>
[
'site_id'
,
'office_name'
,
'office_address'
,
'rent'
],
'getOfficeInfo'
=>
[
'id'
],
];
}
\ No newline at end of file
application/model/FOffice.php
View file @
9ef8287f
...
...
@@ -37,6 +37,7 @@ class FOffice extends BaseModel
* @return array|false|\PDOStatement|string|Model
*/
public
function
findByOne
(
$field
,
$params
)
{
$params
[
"is_del"
]
=
0
;
$result
=
$this
->
db_
->
field
(
$field
)
->
where
(
$params
)
...
...
@@ -52,15 +53,27 @@ class FOffice extends BaseModel
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getOffice
(
$field
,
$params
)
public
function
getOffice
(
$field
,
$params
,
$pageNo
,
$pageSize
)
{
$params
[
'is_del'
]
=
0
;
$result
=
$this
->
db_
->
field
(
$field
)
->
where
(
$params
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
return
$result
;
}
public
function
getOfficeTotal
(
$field
,
$params
)
{
$params
[
'is_del'
]
=
0
;
$result
=
$this
->
db_
->
field
(
$field
)
->
where
(
$params
)
->
count
();
return
$result
;
}
//
// /**
// * 更新数据
...
...
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