Commit 826e71ae authored by clone's avatar clone

bug

parent 7076e1e4
......@@ -88,7 +88,7 @@ class OrderLog extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function collectingBill()
public function collectingBillV2()
{
$params = $this->params;
......@@ -119,6 +119,51 @@ class OrderLog extends Basic
$transfer_img = isset($params["transfer_img"]) ? json_decode($params["transfer_img"] ,true): "";
Log::record("********************transfer_img**". json_encode($transfer_img));
$source = isset($params["source"]) ? $params["source"] : 0;
$is_ok = $this->service_->addCollectingBillV2($params["agent_id"], $params["agent_name"], $params["report_id"], $params["order_id"], $params["order_no"],
$params["collecting_bill"], $params["house_number"], $params["industry_type"], $remark, $transfer_img, $source);
if ($is_ok > 0) {
return $this->response("200", "request success", [ "bill_id" => $is_ok ]);
}
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 collectingBill()
{
$params = $this->params;
if (!isset($params["agent_id"]) || !isset($params["agent_id"]) || !isset($params["report_id"]) || !isset($params["order_id"]) || !isset($params["order_no"])
|| !isset($params["collecting_bill"]) || !isset($params["house_number"]) || !isset($params["industry_type"])) {
return $this->response("101", "请求参数错误");
}
/* $params = array(
"agent_id" => 1,//收款经纪人id
"agent_name" => 1,//收款经纪人id
"report_id" => 111,//报备id
"order_id" => 2, //关联order表id
"order_no" => "123123123", //订单no
// `type` '付款类型 10意向金 20定金 30保管金 40押金 50 租金 60 进场费 70转让费 80其他',
//`pay_type` '支付方式 10支付宝 20 微信 30pos机器 40转账 50现金',
// `money` '入账金额 存分',
"collecting_bill" => [ { "type" : 10, "pay_type" : 10, "money" : 1100 }, { "type" :10, "pay_type" : 10, "money": 1200 } ],
"house_number" => "3301号",
"industry_type" => "asdasdasd",
"remark" => "没什么备注",
"transfer_img" => "12312312312"
);*/
$params["collecting_bill"] = json_decode($params["collecting_bill"], true);
$remark = isset($params["remark"]) ? $params["remark"] : "";
$transfer_img = isset($params["transfer_img"]) ? $params["transfer_img"] : "";
$source = $params["source"] ? $params["source"] : 0;
$is_ok = $this->service_->addCollectingBill($params["agent_id"], $params["agent_name"], $params["report_id"], $params["order_id"], $params["order_no"],
$params["collecting_bill"], $params["house_number"], $params["industry_type"], $remark, $transfer_img, $source);
......@@ -128,6 +173,7 @@ class OrderLog extends Basic
return $this->response("101", "request faild");
}
/**
* 获取上次提交付款的门牌号业态等
* @return \think\Response
......
......@@ -59,7 +59,7 @@ class OrderLogService
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function addCollectingBill($agent_id, $agent_name, $report_id, $order_id, $order_no, $collecting_bill, $house_number,
public function addCollectingBillV2($agent_id, $agent_name, $report_id, $order_id, $order_no, $collecting_bill, $house_number,
$industry_type, $remark, $transfer_img, $source)
{
$bill_arr = $params = [];
......@@ -91,6 +91,52 @@ class OrderLogService
return $father_id;
}
/**
* 批量插入收款记录
* @param $agent_id
* @param $agent_name
* @param $report_id
* @param $order_id
* @param $order_no
* @param $collecting_bill
* @param $house_number
* @param $industry_type
* @param $remark
* @param $transfer_img
* @param $source
* @return int|string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function addCollectingBill($agent_id, $agent_name, $report_id, $order_id, $order_no, $collecting_bill, $house_number,
$industry_type, $remark, $transfer_img, $source)
{
$bill_arr = $params = [];
$father_id = 0;
foreach ($collecting_bill as $collecting) {
if (isset($collecting["type"]) && isset($collecting["pay_type"]) && isset($collecting["money"])) {
if ($father_id == 0) {
$params = $this->collectingBillBin($father_id, $collecting, $agent_id, $agent_name, $report_id, $order_id, $order_no,
$house_number, $industry_type, $remark, $transfer_img, $source);
$father_id = $this->payLogModel->insertPayLog($params);
} else {
array_push($bill_arr, $this->collectingBillBin($father_id, $collecting, $agent_id, $agent_name, $report_id, $order_id, $order_no,
$house_number, $industry_type, $remark, $transfer_img, $source));
}
}
}
if ($father_id > 0) {
$pushMarchIn = new PushMessageService($params["report_id"], 2);
$pushMarchIn->pushMarchInMessage($params["report_id"], 2); //推送
}
//todo if bill_arr not null, save database table
if (!empty($bill_arr)) {
return $this->payLogModel->addPayLog($bill_arr);
}
return $father_id;
}
private function collectingBillBin($father_id, $collecting_arr, $agent_id, $agent_name, $report_id, $order_id, $order_no, $house_number,
$industry_type, $remark, $transfer_img, $source)
{
......
......@@ -381,6 +381,7 @@ Route::group('broker', [
'getBeforeBillInfo' => [ 'api_broker/OrderLog/getBeforeBillInfo', [ 'method' => 'get|post' ] ],
'savePosBillMessage' => [ 'api_broker/OrderLog/savePosBillMessage', [ 'method' => 'get|post' ] ],
'collectingBill' => [ 'api_broker/OrderLog/collectingBill', [ 'method' => 'get|post' ] ],
'collectingBillV2' => [ 'api_broker/OrderLog/collectingBillV2', [ 'method' => 'get|post' ] ],
'refund' => [ 'api_broker/OrderLog/refund', [ 'method' => 'get|post' ] ],
'bargain' => [ 'api_broker/OrderLog/bargain', [ 'method' => 'get|post' ] ],
'statusBargain' => [ 'api_broker/OrderLog/statusBargain', [ 'method' => 'get|post' ] ],
......
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