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
5d91a009
Commit
5d91a009
authored
May 16, 2019
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
5dd9c64a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
222 additions
and
35 deletions
+222
-35
PayLogOpen.php
application/api_broker/controller/PayLogOpen.php
+61
-11
PayLogOpenService.php
application/api_broker/service/PayLogOpenService.php
+94
-3
PayLogOpenValidate.php
application/api_broker/validate/PayLogOpenValidate.php
+37
-21
OPayLogOpen.php
application/model/OPayLogOpen.php
+16
-0
OPayLogOpenLog.php
application/model/OPayLogOpenLog.php
+14
-0
No files found.
application/api_broker/controller/PayLogOpen.php
View file @
5d91a009
...
...
@@ -4,6 +4,7 @@ namespace app\api_broker\controller;
use
app\api_broker\extend\Basic
;
use
app\api_broker\service\PayLogOpenService
;
use
Think\Exception
;
use
think\Request
;
/**
...
...
@@ -23,18 +24,27 @@ class PayLogOpen extends Basic
$this
->
service_
=
new
PayLogOpenService
();
}
/**
* 开盘申请
* @return \think\Response
* @throws Exception
*/
public
function
applyForOpen
()
{
$params
=
$this
->
params
;
$params
=
array
(
"pay_log_id"
=>
1
,
"report_id"
=>
1
,
"bargain_id"
=>
1
,
"order_id"
=>
1
,
"agent_id"
=>
1
,
"house_id"
=>
1
,
"house_address"
=>
"123123"
,
);
$params
=
$this
->
params
;
/* $params = array(
"pay_log_id" => 1,
"report_id" => 1,
"bargain_id" => 1,
"order_id" => 1,
"agent_id" => 1,
"house_id" => 1,
"intro" => "123123",
"house_address" => "123123",
"remark" => "123123",
"open_img" => "123123",
);*/
$checkResult
=
$this
->
validate
(
$params
,
"PayLogOpenValidate.applyForOpen"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
...
...
@@ -45,13 +55,53 @@ class PayLogOpen extends Basic
$agent_id
=
$params
[
"agent_id"
];
$house_id
=
$params
[
"house_id"
];
$house_address
=
$params
[
"house_address"
];
$return_id
=
$this
->
service_
->
addApplyForOpen
(
$pay_log_id
,
$report_id
,
$bargain_id
,
$agent_id
,
$house_id
,
$house_address
);
$intro
=
$params
[
"intro"
];
try
{
$open_img
=
json_decode
(
$params
[
"open_img"
],
true
);
}
catch
(
Exception
$exception
)
{
return
$this
->
response
(
"101"
,
"申请开盘图片解析错误:"
.
$exception
);
}
$return_id
=
$this
->
service_
->
addApplyForOpen
(
$pay_log_id
,
$report_id
,
$bargain_id
,
$agent_id
,
$house_id
,
$intro
,
$house_address
,
$open_img
);
if
(
$return_id
>
0
)
{
return
$this
->
response
(
"200"
,
"success"
,
[
"id"
=>
$return_id
]);
}
else
{
return
$this
->
response
(
"101"
,
"save error"
);
}
}
/**
* 审核开业
* @return \think\Response
*/
public
function
openCheck
()
{
$params
=
$this
->
params
;
/* $params = array(
"open_id" => 1,
"status" => 1, //1总监审核 2财务一审 3财务二审
"remark" => 1,
"operation_id" => 1,
"operation_name" => "222",
);*/
$checkResult
=
$this
->
validate
(
$params
,
"PayLogOpenValidate.openCheck"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
$open_id
=
$params
[
"open_id"
];
$status
=
$params
[
"status"
];
$remark
=
$params
[
"remark"
];
$operation_id
=
$params
[
"operation_id"
];
$operation_name
=
$params
[
"operation_name"
];
$return_id
=
$this
->
service_
->
addOpenCheck
(
$open_id
,
$status
,
$remark
,
$operation_id
,
$operation_name
);
if
(
$return_id
>
0
)
{
return
$this
->
response
(
"200"
,
"success"
,
[
"id"
=>
$return_id
]);
}
else
{
return
$this
->
response
(
"101"
,
"save error"
);
}
}
...
...
application/api_broker/service/PayLogOpenService.php
View file @
5d91a009
<?php
namespace
app\api_broker\service
;
use
app\model\OImg
;
use
app\model\OPayLogOpen
;
use
app\model\OPayLogOpenLog
;
/**
* Created by PhpStorm.
...
...
@@ -8,10 +12,96 @@ use app\model\OPayLogOpen;
* Date: 2019/5/16
* Time: 15:48
*/
class
PayLogOpenService
{
private
$payLogOpenMode
;
class
PayLogOpenService
{
private
$payLogOpenModel
;
private
$oImgModel
;
private
$payLogOpenLogModel
;
public
function
__construct
()
{
$this
->
payLogOpenMode
=
new
OPayLogOpen
();
$this
->
payLogOpenModel
=
new
OPayLogOpen
();
$this
->
oImgModel
=
new
OImg
();
$this
->
payLogOpenLogModel
=
new
OPayLogOpenLog
();
}
/**
* @param $pay_log_id
* @param $report_id
* @param $bargain_id
* @param $agent_id
* @param $house_id
* @param $intro
* @param $house_address
* @param $open_img
* @return int
* @throws \think\Exception
*/
public
function
addApplyForOpen
(
$pay_log_id
,
$report_id
,
$bargain_id
,
$agent_id
,
$house_id
,
$intro
,
$house_address
,
$open_img
)
{
$return_id
=
$this
->
payLogOpenModel
->
addPayLogOpen
(
$this
->
payLogOpenBin
(
$pay_log_id
,
$report_id
,
$bargain_id
,
$agent_id
,
$house_id
,
$intro
,
$house_address
)
);
//save img
if
(
$return_id
>
0
)
{
$this
->
oImgModel
->
addImgAll
(
$return_id
,
5
,
$open_img
);
}
return
$return_id
;
}
public
function
addOpenCheck
(
$open_id
,
$status
,
$remark
,
$operation_id
,
$operation_name
)
{
return
$this
->
payLogOpenLogModel
->
addOpenCheck
(
$this
->
OpenLogCheckBin
(
$open_id
,
$status
,
$remark
,
$operation_id
,
$operation_name
)
);
}
/**
* bin类
* @param $pay_log_id
* @param $report_id
* @param $bargain_id
* @param $agent_id
* @param $house_id
* @param $intro
* @param $house_address
* @return array
*/
private
function
payLogOpenBin
(
$pay_log_id
,
$report_id
,
$bargain_id
,
$agent_id
,
$house_id
,
$intro
,
$house_address
)
{
$arr
=
[];
$arr
[
"pay_log_id"
]
=
$pay_log_id
;
$arr
[
"report_id"
]
=
$report_id
;
$arr
[
"bargain_id"
]
=
$bargain_id
;
$arr
[
"agent_id"
]
=
$agent_id
;
$arr
[
"house_id"
]
=
$house_id
;
$arr
[
"intro"
]
=
$intro
;
$arr
[
"house_address"
]
=
$house_address
;
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
return
$arr
;
}
/**
* log bin类
* @param $open_id
* @param $status
* @param $remark
* @param $operation_id
* @param $operation_name
* @return array
*/
private
function
OpenLogCheckBin
(
$open_id
,
$status
,
$remark
,
$operation_id
,
$operation_name
)
{
$arr
=
[];
$arr
[
"open_id"
]
=
$open_id
;
$arr
[
"status"
]
=
$status
;
$arr
[
"remark"
]
=
$remark
;
$arr
[
"operation_id"
]
=
$operation_id
;
$arr
[
"operation_name"
]
=
$operation_name
;
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
return
$arr
;
}
}
\ No newline at end of file
application/api_broker/validate/PayLogOpenValidate.php
View file @
5d91a009
...
...
@@ -13,32 +13,47 @@ use think\Validate;
class
PayLogOpenValidate
extends
Validate
{
protected
$rule
=
[
'pay_log_id'
=>
'require|number'
,
'report_id'
=>
'require|number'
,
'bargain_id'
=>
'require|number'
,
'order_id'
=>
'require|number'
,
'agent_id'
=>
'require|number'
,
'house_id'
=>
'require|number'
,
'house_address'
=>
'require'
,
'pay_log_id'
=>
'require|number'
,
'report_id'
=>
'require|number'
,
'bargain_id'
=>
'require|number'
,
'order_id'
=>
'require|number'
,
'agent_id'
=>
'require|number'
,
'house_id'
=>
'require|number'
,
'house_address'
=>
'require'
,
'intro'
=>
'require'
,
'open_id'
=>
'require'
,
'status'
=>
'require|number|in:1,2,3'
,
'operation_id'
=>
'require|number'
,
'operation_name'
=>
'require'
,
];
protected
$message
=
[
'pay_log_id.require'
=>
'收款id为必填字段'
,
'pay_log_id.number'
=>
'收款id只能为数字'
,
'report_id.require'
=>
'报备id不能为空'
,
'report_id.number'
=>
'报备id只能为数字'
,
'bargain_id.require'
=>
'成交报告id不能为空'
,
'bargain_id.number'
=>
'成交报告id只能是数字'
,
'order_id.require'
=>
'订单id不能为空'
,
'order_id.number'
=>
'订单id只能是数字'
,
'agent_id.require'
=>
'经纪人为必填字段'
,
'agent_id.number'
=>
'经纪人id只能为数字'
,
'house_id.require'
=>
'楼盘id不能为空'
,
'house_id.number'
=>
'楼盘id只能是数字'
,
'house_address.require'
=>
'楼盘地址不能为空'
,
'pay_log_id.require'
=>
'收款id为必填字段'
,
'pay_log_id.number'
=>
'收款id只能为数字'
,
'report_id.require'
=>
'报备id不能为空'
,
'report_id.number'
=>
'报备id只能为数字'
,
'bargain_id.require'
=>
'成交报告id不能为空'
,
'bargain_id.number'
=>
'成交报告id只能是数字'
,
'order_id.require'
=>
'订单id不能为空'
,
'order_id.number'
=>
'订单id只能是数字'
,
'agent_id.require'
=>
'经纪人为必填字段'
,
'agent_id.number'
=>
'经纪人id只能为数字'
,
'house_id.require'
=>
'楼盘id不能为空'
,
'house_id.number'
=>
'楼盘id只能是数字'
,
'house_address.require'
=>
'楼盘地址不能为空'
,
'intro.require'
=>
'说明不能为空'
,
'open_id.require'
=>
'申请id不能为空'
,
'open_id.number'
=>
'申请id只能为数字'
,
'status.require'
=>
'状态不能为空'
,
'status.number'
=>
'状态只能位数字'
,
'status.in'
=>
'状态值错误'
,
'operation_id.require'
=>
'操作人id必填'
,
'operation_id.number'
=>
'操作人id只能为数字'
,
'operation_name.require'
=>
'操作人姓名必填'
,
];
protected
$scene
=
[
'applyForOpen'
=>
[
'pay_log_id'
,
'report_id'
,
'bargain_id'
,
'order_id'
,
'agent_id'
,
'house_id'
,
'house_address'
],
'applyForOpen'
=>
[
'pay_log_id'
,
'report_id'
,
'bargain_id'
,
'order_id'
,
'agent_id'
,
'house_id'
,
'house_address'
,
'intro'
],
'openCheck'
=>
[
'open_id'
,
'status'
,
'operation_id'
,
'operation_name'
],
];
}
\ No newline at end of file
application/model/OPayLogOpen.php
View file @
5d91a009
...
...
@@ -17,6 +17,22 @@ class OPayLogOpen extends BaseModel
$this
->
db_
=
Db
::
name
(
$this
->
table
);
}
/**
* @param $params
* @return int
*/
public
function
addPayLogOpen
(
$params
){
Db
::
startTrans
();
try
{
$id
=
$this
->
db_
->
insertGetId
(
$params
);
Db
::
commit
();
return
$id
;
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
return
0
;
}
}
/**
* @param int $pageNo
* @param int $pageSize
...
...
application/model/OPayLogOpenLog.php
View file @
5d91a009
...
...
@@ -18,5 +18,18 @@ class OPayLogOpenLog extends BaseModel
$this
->
db_
=
Db
::
name
(
$this
->
table
);
}
public
function
addOpenCheck
(
$params
){
Db
::
startTrans
();
try
{
$id
=
$this
->
db_
->
insertGetId
(
$params
);
Db
::
commit
();
return
$id
;
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
return
0
;
}
}
}
\ No newline at end of file
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