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
e4e0f932
Commit
e4e0f932
authored
Jul 18, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
办公室门店列表
parent
4c07227a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
13 deletions
+70
-13
StoreFee.php
application/index/controller/StoreFee.php
+69
-13
route.php
application/route.php
+1
-0
No files found.
application/index/controller/StoreFee.php
View file @
e4e0f932
...
@@ -9,6 +9,7 @@ namespace app\index\controller;
...
@@ -9,6 +9,7 @@ namespace app\index\controller;
use
app\index\extend\Basic
;
use
app\index\extend\Basic
;
use
app\model\AAgents
;
use
app\model\AStore
;
use
app\model\AStore
;
use
app\model\FOffice
;
use
app\model\FOffice
;
use
think\Request
;
use
think\Request
;
...
@@ -44,7 +45,7 @@ class StoreFee extends Basic
...
@@ -44,7 +45,7 @@ class StoreFee extends Basic
return
$this
->
response
(
"101"
,
$checkResult
);
return
$this
->
response
(
"101"
,
$checkResult
);
}
}
$office
=
$this
->
getOffice
(
'
'
,
$params
[
'office_name'
]);
$office
=
$this
->
getOffice
(
'
id'
,[
'office_name'
=>
$params
[
'office_name'
]
]);
if
(
$office
)
{
if
(
$office
)
{
return
$this
->
response
(
"101"
,
'已存在该办公室!'
);
return
$this
->
response
(
"101"
,
'已存在该办公室!'
);
}
}
...
@@ -86,7 +87,7 @@ class StoreFee extends Basic
...
@@ -86,7 +87,7 @@ class StoreFee extends Basic
return
$this
->
response
(
"101"
,
$checkResult
);
return
$this
->
response
(
"101"
,
$checkResult
);
}
}
$office
=
$this
->
getOffice
(
$params
[
'id'
],
$name
=
''
);
$office
=
$this
->
getOffice
(
'id'
,[
'id'
=>
$params
[
'id'
]]
);
if
(
!
$office
)
{
if
(
!
$office
)
{
return
$this
->
response
(
"101"
,
'不存在该办公室!'
);
return
$this
->
response
(
"101"
,
'不存在该办公室!'
);
}
}
...
@@ -163,25 +164,79 @@ class StoreFee extends Basic
...
@@ -163,25 +164,79 @@ class StoreFee extends Basic
/**
/**
* 根据ID或者办公室名字查询是否存在
* 根据ID或者办公室名字查询是否存在
* @param $
i
d
* @param $
fiel
d
* @param $
name
* @param $
conditions
* @return array|false|\PDOStatement|string|\think\Model
* @return array|false|\PDOStatement|string|\think\Model
*/
*/
public
function
getOffice
(
$
id
=
''
,
$name
=
''
)
public
function
getOffice
(
$
field
,
$conditions
)
{
{
$conditions
=
[];
if
(
$id
)
{
$conditions
[
'id'
]
=
$id
;
}
if
(
$name
)
{
$conditions
[
'office_name'
]
=
$name
;
}
$field
=
'id'
;
$result
=
$this
->
f_office
->
findByOne
(
$field
,
$conditions
);
$result
=
$this
->
f_office
->
findByOne
(
$field
,
$conditions
);
return
$result
;
return
$result
;
}
}
/*
* 办公室门店列表
*/
public
function
getStoreList
()
{
$params
=
$this
->
params
;
$params
=
array
(
"id"
=>
'1'
,
//id
);
$checkResult
=
$this
->
validate
(
$params
,
"StoreFeeValidate.getOfficeInfo"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
$office
=
$this
->
getOffice
(
'id'
,[
'id'
=>
$params
[
'id'
]]);
if
(
!
$office
)
{
return
$this
->
response
(
"101"
,
'不存在该办公室!'
);
}
$m_store
=
new
AStore
();
$store_params
[
'office_id'
]
=
$params
[
'id'
];
$store_field
=
'id,store_name'
;
$store_result
=
$m_store
->
getStore
(
$store_params
,
$store_field
);
if
(
!
$store_result
)
{
return
$this
->
response
(
"200"
,
"成功"
,
[]);
}
foreach
(
$store_result
as
$k
=>
$v
)
{
$people_num_list
=
$this
->
getPeopleListAndNum
(
$v
[
'id'
]);
$store_result
[
$k
][
'people_num'
]
=
$people_num_list
[
'people_num'
];
$store_result
[
$k
][
'people_list'
]
=
$people_num_list
[
'people_list'
];
}
$data
[
'list'
]
=
$store_result
;
return
$this
->
response
(
"200"
,
"成功"
,
$data
);
}
/**
* 查门店人数和名单
* @param $store_id
* @return mixed
*/
public
function
getPeopleListAndNum
(
$store_id
)
{
$params
=
[];
$params
[
"store_id"
]
=
$store_id
;
$params
[
"status"
]
=
0
;
$m_agent
=
new
AAgents
();
$m_agent_res
=
$m_agent
->
getAgentsByStoreId
(
$params
);
$people_num
=
count
(
$m_agent_res
);
$people_list
=
""
;
if
(
$people_num
>
0
)
{
foreach
(
$m_agent_res
as
$k
=>
$v
)
{
$people_list
.=
$v
[
"name"
]
.
","
;
}
$people_list
=
rtrim
(
$people_list
,
","
);
}
$return
[
'people_list'
]
=
$people_list
;
$return
[
'people_num'
]
=
$people_num
;
return
$return
;
}
}
}
\ No newline at end of file
application/route.php
View file @
e4e0f932
...
@@ -522,6 +522,7 @@ Route::group('index', [
...
@@ -522,6 +522,7 @@ Route::group('index', [
'getOfficeList'
=>
[
'index/StoreFee/getOfficeList'
,
[
'method'
=>
'POST|GET'
]
],
'getOfficeList'
=>
[
'index/StoreFee/getOfficeList'
,
[
'method'
=>
'POST|GET'
]
],
'getOfficeInfo'
=>
[
'index/StoreFee/getOfficeInfo'
,
[
'method'
=>
'POST|GET'
]
],
'getOfficeInfo'
=>
[
'index/StoreFee/getOfficeInfo'
,
[
'method'
=>
'POST|GET'
]
],
'editOffice'
=>
[
'index/StoreFee/editOffice'
,
[
'method'
=>
'POST|GET'
]
],
'editOffice'
=>
[
'index/StoreFee/editOffice'
,
[
'method'
=>
'POST|GET'
]
],
'getStoreList'
=>
[
'index/StoreFee/getStoreList'
,
[
'method'
=>
'POST|GET'
]
],
]);
]);
...
...
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