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
a3f785f8
Commit
a3f785f8
authored
Jul 18, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
绑定解绑门店
parent
9c782cb2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
53 deletions
+64
-53
StoreFee.php
application/index/controller/StoreFee.php
+40
-0
StoreFeeValidate.php
application/index/validate/StoreFeeValidate.php
+12
-1
AStore.php
application/model/AStore.php
+11
-0
FOffice.php
application/model/FOffice.php
+1
-52
No files found.
application/index/controller/StoreFee.php
View file @
a3f785f8
...
@@ -239,4 +239,43 @@ class StoreFee extends Basic
...
@@ -239,4 +239,43 @@ class StoreFee extends Basic
}
}
/**
* 绑定解绑门店
* @return \think\Response
*/
public
function
bindStore
()
{
$params
=
$this
->
params
;
// $params = array(
// "id" => '1',//id
// );[ 'office_id', 'store_id' ]
$checkResult
=
$this
->
validate
(
$params
,
"StoreFeeValidate.bindStore"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
$m_store
=
new
AStore
();
if
(
$params
[
'office_id'
]
==
0
)
{
//解绑
$conditions
[
'office_id'
]
=
0
;
$conditions
[
'id'
]
=
$params
[
'store_id'
];
$return
=
$m_store
->
updateStore
(
$conditions
);
}
else
{
$store_params
[
'id'
]
=
$params
[
'store_id'
];
$store_params
[
'office_id'
]
=
array
(
'gt'
,
0
);
$store_result
=
$m_store
->
getStore
(
$store_params
,
'id'
);
if
(
$store_result
)
return
$this
->
response
(
"101"
,
"该门店已绑定或已绑定其他办公室"
);
//绑定
$conditions
[
'id'
]
=
$params
[
'store_id'
];
$conditions
[
'office_id'
]
=
$params
[
'office_id'
];
$return
=
$m_store
->
updateStore
(
$conditions
);
}
return
$this
->
response
(
"200"
,
"成功"
,
$return
);
}
}
}
\ No newline at end of file
application/index/validate/StoreFeeValidate.php
View file @
a3f785f8
...
@@ -12,7 +12,9 @@ class StoreFeeValidate extends Validate {
...
@@ -12,7 +12,9 @@ class StoreFeeValidate extends Validate {
'office_address'
=>
'require'
,
'office_address'
=>
'require'
,
'rent'
=>
'require|number|gt:0'
,
'rent'
=>
'require|number|gt:0'
,
'id'
=>
'require|number|gt:0'
,
'id'
=>
'require|number|gt:0'
,
'office_id'
=>
'require|number'
,
'store_id'
=>
'require|number|gt:0'
,
];
];
protected
$message
=
[
protected
$message
=
[
...
@@ -26,12 +28,20 @@ class StoreFeeValidate extends Validate {
...
@@ -26,12 +28,20 @@ class StoreFeeValidate extends Validate {
'id.require'
=>
'id为必填字段'
,
'id.require'
=>
'id为必填字段'
,
'id.number'
=>
'id只能为数字'
,
'id.number'
=>
'id只能为数字'
,
'id.gt'
=>
'id必须大于0'
,
'id.gt'
=>
'id必须大于0'
,
'office_id.require'
=>
'office_id为必填字段'
,
'office_id.number'
=>
'office_id只能为数字'
,
'store_id.require'
=>
'store_id为必填字段'
,
'store_id.number'
=>
'store_id只能为数字'
,
'store_id.gt'
=>
'store_id必须大于0'
,
];
];
protected
$scene
=
[
protected
$scene
=
[
'addOffice'
=>
[
'site_id'
,
'office_name'
,
'office_address'
,
'rent'
],
'addOffice'
=>
[
'site_id'
,
'office_name'
,
'office_address'
,
'rent'
],
'getOfficeInfo'
=>
[
'id'
],
'getOfficeInfo'
=>
[
'id'
],
'editOffice'
=>
[
'id'
,
'site_id'
,
'office_name'
,
'office_address'
,
'rent'
],
'editOffice'
=>
[
'id'
,
'site_id'
,
'office_name'
,
'office_address'
,
'rent'
],
'bindStore'
=>
[
'office_id'
,
'store_id'
],
];
];
}
}
\ No newline at end of file
application/model/AStore.php
View file @
a3f785f8
...
@@ -337,4 +337,14 @@ class AStore extends BaseModel
...
@@ -337,4 +337,14 @@ class AStore extends BaseModel
->
count
();
->
count
();
return
$store_num
;
return
$store_num
;
}
}
/**
* 更新数据
* @param $params
* @return mixed
*/
public
function
updateStore
(
$params
)
{
return
Db
::
table
(
$this
->
table
)
->
update
(
$params
);
}
}
}
\ No newline at end of file
application/model/FOffice.php
View file @
a3f785f8
...
@@ -84,57 +84,6 @@ class FOffice extends BaseModel
...
@@ -84,57 +84,6 @@ class FOffice extends BaseModel
{
{
return
$this
->
db_
->
update
(
$params
);
return
$this
->
db_
->
update
(
$params
);
}
}
//
// /**
// * 根据id获取单个字段值
// *
// * @param $id
// * @param $where
// * @param $fields
// * @return mixed
// */
// public function getOfficeById($fields, $id, $where = [])
// {
// $where['is_del'] = 0;
// if ($id) {
// $where['id'] = $id;
// }
// $return = $this->db_->where($where)->value($fields);
// return $return;
// }
//
// /**
// * @param $id
// * @param $fields
// * @return false|\PDOStatement|string|\think\Collection
// * @throws \think\db\exception\DataNotFoundException
// * @throws \think\db\exception\ModelNotFoundException
// * @throws \think\exception\DbException
// */
// public function getOfficeByIdList($id, $fields)
// {
// $return = $this->db_->field($fields)->where('id', 'in',$id)->select();
// return $return;
// }
//
// /**
// * @param string $fields
// * @param array $where
// * @return bool|false|\PDOStatement|string|\think\Collection
// * User HuJun
// * Date 19-5-9 上午10:00
// */
// public function getOfficeList($fields = 'id,name,city', $where = [])
// {
// if (!isset($where['is_del'])) {
// $where['is_del'] = 0;
// }
// try {
// $result = $this->db_->field($fields)->where($where)->select();
// } catch (\Exception $e) {
// $result = false;
// }
// 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