Commit 76619ab7 authored by clone's avatar clone

1

parent 609a955a
<?php
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\api_broker\service\OfficePayLogService;
use app\api_broker\service\PayLogService;
use think\Request;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/12/13
* Time : 3:41 PM
* Intro:
*/
class OfficePayLog extends Basic
{
private $service_;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->service_ = new OfficePayLogService();
}
/**
* 获取上次提交收款的门牌号等
* @return \think\Response
*/
public function getBeForNum()
{
$params = $this->params;
/* $params = array(
"order_id" => 15523, //关联order表id
);*/
if (!isset($params["order_id"])) {
return $this->response("101", "订单编号不能为空");
}
$billInfo = $this->service_->getBeForNum($params["order_id"]);
if (count($billInfo) > 0) {
return $this->response("200", "request success", $billInfo[0]);
} else {
return $this->response("200", "request null");
}
}
/**
* 剩余可以调整或退款的钱
* @return \think\Response
*/
public function adjustment()
{
$params = $this->params;
/* $params = array(
"pay_id" => 1,
);*/
if (empty($params["pay_id"])) {
return $this->response("101", "请求参数错误");
}
$result = $this->service_->adjustment($params["pay_id"]);
if ($result == -1) {
return $this->response("101", "不存在此条记录");
}
return $this->response("200", "success", ["residue_money" => $result]);
}
/**
* 新增或编辑退款申请
* @return \think\Response
* @throws \think\Exception
*/
public function refund()
{
$params = $this->params;
if (!isset($params["agent_id"]) || !isset($params["agent_name"]) || !isset($params["report_id"]) ||
!isset($params["order_id"]) || !isset($params["order_no"]) || !isset($params["name"]) || !isset($params["phone"])
|| !isset($params["refund_money"]) || !isset($params["bank"]) || !isset($params["card_no"])
|| !isset($params["receipt_number"]) || !isset($params["type"])
|| !isset($params["refund_cause"]) || !isset($params["refund_way"])) {
return $this->response("101", "请求参数错误");
}
/* $params = array(
"agent_id" => 1,//退款经纪人id
"agent_name" => 1,//退款经纪人id
"report_id" => 1,//报备id
"order_id" => 1, //关联order表id
"order_no" => "12312312312312", //订单no
"refund_money" => 1200, //退款金额
"name" => "qweqwe", //收款人姓名
"phone" => "123123123", //收款人电话
"bank" => "asdasdasd", //收款人银行
"card_no" => "123123123123", //银行卡号
"remark" => "没什么备注", //其他说明
"remark_img" => "12312312312",
"receipt_number" => "12312312312",
"type" => "12312312312", //退款类型:0退意向金1意向金转定2退保管金3保管金转定4退中介费5退案场费
"refund_cause" => "12312312312", //退款原因
"pay_log_id" => 1, //支付id
"refund_way" => 0, //退款方式:0银行卡
);*/
$refund_id = isset($params["refund_id"]) ? $params["refund_id"] : 0;
if($refund_id == 0 && !isset($params["remark_img"])){
return $this->response("101", "请上传图片");
}
$agent_id = $params["agent_id"];
$agent_name = $params["agent_name"];
$report_id = $params["report_id"];
$order_id = $params["order_id"];
$order_no = $params["order_no"];
$refund_money = $params["refund_money"];
$name = $params["name"];
$phone = $params["phone"];
$bank = $params["bank"];
$card_no = $params["card_no"];
$receipt_number = $params["receipt_number"];
$type = $params["type"];
$refund_cause = $params["refund_cause"];
$pay_log_id = $params["pay_log_id"];
$refund_way = $params["refund_way"];
$remark = isset($params["remark"]) ? $params["remark"] : "";
$remark_img = isset($params["remark_img"]) ? json_decode($params["remark_img"], true) : "";
$del_img =isset($params["del_img"]) ? $params["del_img"] : "";
//todo 判断此单是否有付款
$is_ok = $this->service_->addRefund($agent_id, $agent_name, $report_id, $order_id, $order_no, $refund_money, $name,
$phone, $bank, $card_no, $receipt_number, $type, $refund_cause, $pay_log_id, $refund_way, $remark, $remark_img
,$refund_id,$del_img);
if ($is_ok > 0) {
return $this->response("200", "request success", []);
} elseif ($is_ok == -2) {
return $this->response("101", "退款金不能大于剩余的支付金额");
} elseif ($is_ok == -3) {
return $this->response("101", "有财务驳回退款,请在原退款上修改.");
}
return $this->response("101", "request faild");
}
/**
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getRefund(){
$params = $this->params;
/* $params = array(
"refund_id" =>1
);*/
if(!isset($params["refund_id"])){
return $this->response("101","请求参数错误");
}
$result = $this->service_->getRefundDetail($params["refund_id"]);
if($result["code"] == 200){
return $this->response("200","success",$result["data"]);
}elseif($result["code"] == 101){
return $this->response("101",$result["msg"]);
}
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -929,6 +929,8 @@ Route::group('broker', [
'getOpenList' => ['api_broker/PayLogOpen/getOpenList', ['method' => 'GET|POST']],
'openCheck' => ['api_broker/PayLogOpen/openCheck', ['method' => 'GET|POST']],
'refund' => ['api_broker/PayLogOpen/refund', ['method' => 'get|post']],
'getRefund' => ['api_broker/PayLogOpen/getRefund', ['method' => 'get|post']],
]);
......@@ -988,9 +990,12 @@ Route::group('office', [
'reportListForPc' => ['api_broker/OfficeReport/reportListForPc', ['method' => 'get']],
'appAgentAuth' => ['api_broker/OfficeReport/appAgentAuth', ['method' => 'get']],
'getRoomListByReport' => ['api_broker/OfficeRoom/getRoomListByReport', ['method' => 'get|post']],
'addShopFollowUp' => ['api_broker/OfficeRoom/addShopFollowUp', ['method' => 'get|post']],
'getMyBuildingRoom' => ['api_broker/OfficeRoom/getMyBuildingRoom', ['method' => 'get|post']],
'getRoomListByReport' => ['api_broker/OfficeRoom/getRoomListByReport', ['method' => 'get|post']],
'addShopFollowUp' => ['api_broker/OfficeRoom/addShopFollowUp', ['method' => 'get|post']],
'getMyBuildingRoom' => ['api_broker/OfficeRoom/getMyBuildingRoom', ['method' => 'get|post']],
'getBeForNum' => ['api_broker/OfficePayLog/getBeForNum', ['method' => 'get|post']],
'adjustment' => ['api_broker/OfficePayLog/adjustment', ['method' => 'get|post']],
]);
Route::group('office_index', [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment