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
093098e3
Commit
093098e3
authored
Oct 18, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整
parent
929aabe2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
154 additions
and
53 deletions
+154
-53
Site.php
application/api_broker/controller/Site.php
+0
-50
Site.php
application/index/controller/Site.php
+117
-0
Site.php
application/index/validate/Site.php
+32
-0
route.php
application/route.php
+5
-3
No files found.
application/api_broker/controller/Site.php
deleted
100644 → 0
View file @
929aabe2
<?php
namespace
app\api_broker\controller
;
/**
* Created by PhpStorm.
* User: zhuwei
* Date:2018-10-18
* Time:10:50:55
*/
use
app\api_broker\extend\Basic
;
use
app\model\ASite
;
use
think\Request
;
class
Site
extends
Basic
{
protected
$aSite
;
public
function
__construct
(
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
aSite
=
new
ASite
();
}
/**
* 获取站点列表
* User: 朱伟
* Date:2018-10-18
* Time:10:50:55
*/
public
function
getSiteList
()
{
$params
=
$this
->
params
;
/*$params = array(
"id" => 5740
);*/
$field
=
'id,name,city'
;
$get_params
[
'is_del'
]
=
0
;
$res
=
$this
->
aSite
->
getSite
(
$field
,
$params
);
$data
[
'list'
]
=
$res
;
return
$this
->
response
(
"200"
,
"成功"
,
$data
);
}
}
\ No newline at end of file
application/index/controller/Site.php
0 → 100644
View file @
093098e3
<?php
namespace
app\index\controller
;
/**
* Created by PhpStorm.
* User: zhuwei
* Date:2018-10-18
* Time:10:50:55
*/
use
app\index\extend\Basic
;
use
app\model\ASite
;
use
think\Request
;
class
Site
extends
Basic
{
protected
$aSite
;
public
function
__construct
(
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
aSite
=
new
ASite
();
}
/**
* 新增数据
* User: 朱伟
* Date:2018-10-18
* Time:10:50:55
*/
public
function
addSite
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/*$params = array(
"name" => 上海站,
"city" => 上海市,
);*/
$checkResult
=
$this
->
validate
(
$params
,
"Site.addSite"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
//先判断是否已经存在数据
$field
=
'id,status'
;
$get_params
[
'name'
]
=
$params
[
"name"
];
$get_params
[
'city'
]
=
$params
[
"city"
];
$res
=
$this
->
aSite
->
saveSite
(
$field
,
$get_params
);
if
(
$res
){
//如果存在
return
$this
->
response
(
"101"
,
"重复添加"
);
}
else
{
//不存在则新增数据
$insert
[
"name"
]
=
$params
[
'name'
];
$insert
[
"city"
]
=
$params
[
'city'
];
$insert
[
"is_del"
]
=
0
;
$res
=
$this
->
aSite
->
saveSite
(
$insert
);
//int(1)
}
if
(
$res
)
{
return
$this
->
response
(
"200"
,
"成功"
);
}
else
{
return
$this
->
response
(
"101"
,
"失败"
);
}
}
/**
* 获取站点列表
* User: 朱伟
* Date:2018-10-18
* Time:10:50:55
*/
public
function
getSiteList
()
{
$params
=
$this
->
params
;
/*$params = array(
"id" => 5740
);*/
$field
=
'id,name,city'
;
$get_params
[
'is_del'
]
=
0
;
$res
=
$this
->
aSite
->
getSite
(
$field
,
$params
);
$data
[
'list'
]
=
$res
;
return
$this
->
response
(
"200"
,
"成功"
,
$data
);
}
/**
* 关闭或开启站点
* @return \think\Response
*/
public
function
delImageDepot
(){
$params
=
$this
->
params
;
$checkResult
=
$this
->
validate
(
$params
,
"Site.delImageDepot"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
$params_
[
'id'
]
=
$params
[
'id'
];
$params_
[
'is_del'
]
=
$params
[
'is_del'
];
$res
=
$this
->
aSite
->
updateSite
(
$params_
);
//int(1)
if
(
$res
==
1
){
return
$this
->
response
(
"200"
,
"成功"
,[
'data'
=>
$res
]);
}
else
{
return
$this
->
response
(
"300"
,
"失败"
);
}
}
}
\ No newline at end of file
application/index/validate/Site.php
0 → 100755
View file @
093098e3
<?php
namespace
app\index\validate
;
use
think\Validate
;
class
Site
extends
Validate
{
protected
$rule
=
[
'name'
=>
'require'
,
'city'
=>
'require'
,
'id'
=>
'require|number|gt:0'
];
protected
$message
=
[
'name.require'
=>
'站点名不能为空'
,
'city.require'
=>
'城市名不能为空'
,
'id.require'
=>
'id为必填字段'
,
'id.number'
=>
'id只能为数字'
,
'id.gt'
=>
'id必须大于0'
,
];
protected
$scene
=
[
'addSite'
=>
[
'name'
,
'city'
],
'delImageDepot'
=>
[
'id'
],
];
}
\ No newline at end of file
application/route.php
View file @
093098e3
...
...
@@ -334,7 +334,10 @@ Route::group('index', [
'getCityLatAadLng'
=>
[
'index/BatchProcessing/getCityLatAadLng'
,
[
'method'
=>
'get | post'
]
],
//批量设置商圈的经纬度
//站点相关
'addSite'
=>
[
'index/Site/addSite'
,
[
'method'
=>
'POST|GET'
]
],
//获取站点列表 朱伟 2018-10-18
'getSiteList'
=>
[
'index/Site/getSiteList'
,
[
'method'
=>
'POST|GET'
]
],
//获取站点列表 朱伟 2018-10-18
'delImageDepot'
=>
[
'index/Site/delImageDepot'
,
[
'method'
=>
'POST|GET'
]
],
//关闭或开启站点 朱伟 2018-10-18
]);
...
...
@@ -640,8 +643,7 @@ Route::group('broker', [
'addUserCallAgent'
=>
[
'api_broker/CallAgent/addUserCallAgent'
,
[
'method'
=>
'POST|GET'
]
],
//客户来电记录
//站点相关
'getSiteList'
=>
[
'api_broker/Site/getSiteList'
,
[
'method'
=>
'POST|GET'
]
],
//获取站点列表 朱伟 2018-10-18
]);
...
...
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