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
91d8f8eb
Commit
91d8f8eb
authored
Jul 17, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增数据
parent
cde2d35d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
152 additions
and
2 deletions
+152
-2
StoreFee.php
application/index/controller/StoreFee.php
+120
-0
StoreFeeValidate.php
application/index/validate/StoreFeeValidate.php
+30
-0
FOffice.php
application/model/FOffice.php
+2
-2
No files found.
application/index/controller/StoreFee.php
0 → 100644
View file @
91d8f8eb
<?php
namespace
app\index\controller
;
/**
* Created by PhpStorm.
* User: zhuwei
* Date:2019-07-17
* Time:16:45:37
*/
use
app\index\extend\Basic
;
use
app\model\FOffice
;
use
think\Request
;
class
StoreFee
extends
Basic
{
protected
$f_office
;
public
function
__construct
(
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
f_office
=
new
FOffice
();
}
/**
* 新增数据
* @return \think\Response
*/
public
function
addFeeOffice
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
$params
=
array
(
"site_id"
=>
'10001'
,
//站点id
"office_name"
=>
'鳖'
,
//办公室名
"office_address"
=>
'上海市黄浦区龙华东路800号'
,
//办公室地址
"rent"
=>
5000
,
//租金每月
"operator_id"
=>
5775
,
);
$checkResult
=
$this
->
validate
(
$params
,
"StoreFeeValidate.addFeeOffice"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
$data
[
"site_id"
]
=
$params
[
'name'
];
$data
[
"office_name"
]
=
$params
[
'city'
];
$data
[
"office_address"
]
=
$params
[
'city'
];
$data
[
"rent"
]
=
$params
[
'city'
];
$data
[
"operator_id"
]
=
$this
->
userId
;
$res
=
$this
->
f_office
->
saveOffice
(
$data
);
//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,is_del';
//
// if ($params['is_del']) {
// $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", "失败");
// }
// }
//
// public function siteLogList()
// {
// if (!$this->request->isAjax()) {
// return view('site/siteLogList');
// }
// }
}
\ No newline at end of file
application/index/validate/StoreFeeValidate.php
0 → 100755
View file @
91d8f8eb
<?php
namespace
app\index\validate
;
use
think\Validate
;
class
StoreFeeValidate
extends
Validate
{
protected
$rule
=
[
'site_id'
=>
'require'
,
'office_name'
=>
'require'
,
'office_address'
=>
'require'
,
'rent'
=>
'require|number|gt:0'
,
];
protected
$message
=
[
'site_id.require'
=>
'站点不能为空'
,
'office_name.require'
=>
'办公室名不能为空'
,
'office_address.require'
=>
'办公室地址不能为空'
,
'rent.require'
=>
'租金每月不能为空'
,
'rent.number'
=>
'租金每月只能为数字'
,
'rent.gt'
=>
'租金每月必须大于0'
,
];
protected
$scene
=
[
'addFeeOffice'
=>
[
'site_id'
,
'office_name'
,
'office_address'
,
'rent'
],
];
}
\ No newline at end of file
application/model/FOffice.php
View file @
91d8f8eb
...
@@ -13,7 +13,7 @@ class FOffice extends BaseModel
...
@@ -13,7 +13,7 @@ class FOffice extends BaseModel
public
function
__construct
(
$data
=
[])
public
function
__construct
(
$data
=
[])
{
{
parent
::
__construct
(
$data
);
parent
::
__construct
(
$data
);
$this
->
db_
->
db_
=
Db
::
name
(
$this
->
db_
->
table
);
$this
->
db_
=
Db
::
name
(
$this
->
table
);
}
}
...
@@ -24,7 +24,7 @@ class FOffice extends BaseModel
...
@@ -24,7 +24,7 @@ class FOffice extends BaseModel
*/
*/
public
function
saveOffice
(
$data
)
{
public
function
saveOffice
(
$data
)
{
$time
=
date
(
"Y-m-d H:i:s"
,
time
());
$time
=
date
(
"Y-m-d H:i:s"
,
time
());
$data
[
"is_del"
]
=
0
;
$data
[
'create_time'
]
=
$time
;
$data
[
'create_time'
]
=
$time
;
$data
[
'update_time'
]
=
$time
;
$data
[
'update_time'
]
=
$time
;
return
$this
->
db_
->
insert
(
$data
);
return
$this
->
db_
->
insert
(
$data
);
...
...
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