Commit 7add9f4f authored by clone's avatar clone

新增分佣方 预计收款时间,分用方搜索

parent 7e063537
...@@ -219,7 +219,8 @@ class OrderLog extends Basic ...@@ -219,7 +219,8 @@ class OrderLog extends Basic
if (!isset($params["submit_agent_id"]) || !isset($params["submit_agent_name"]) || !isset($params["report_id"]) || if (!isset($params["submit_agent_id"]) || !isset($params["submit_agent_name"]) || !isset($params["report_id"]) ||
!isset($params["order_id"]) || !isset($params["order_no"]) || !isset($params["trade_type"]) || !isset($params["order_id"]) || !isset($params["order_no"]) || !isset($params["trade_type"]) ||
//!isset($params["house_number"]) || !isset($params["is_open"]) || !isset($params["industry_type"]) || //!isset($params["estimated_receipt_date"]) ||
!isset($params["house_number"]) || !isset($params["is_open"]) || !isset($params["industry_type"]) ||
!isset($params["price"]) || !isset($params["commission"]) || !isset($params["commission_arr"])) { !isset($params["price"]) || !isset($params["commission"]) || !isset($params["commission_arr"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
...@@ -234,8 +235,8 @@ class OrderLog extends Basic ...@@ -234,8 +235,8 @@ class OrderLog extends Basic
"trade_type" => 10, //成交类型 10出租 20 增佣 30 代理 40 好处费 "trade_type" => 10, //成交类型 10出租 20 增佣 30 代理 40 好处费
"price" => 112131, //成交价格 存分 "price" => 112131, //成交价格 存分
"commission" => 111, //佣金 存分 "commission" => 111, //佣金 存分
"estimated_receipt_date" => '2018-07-15',
//`role` '分佣方 1盘方 2客方 3 反签 4独家 5合作方', //`role` '分佣方 1盘方 2客方 3 反签 4独家 5合作方 6APP盘下载方 7APP客下载方',
//`agent_id`'分佣经纪人id', //`agent_id`'分佣经纪人id',
//`scale`'分佣比例 如 5表示百分之5', //`scale`'分佣比例 如 5表示百分之5',
// `scale_fee` '应分佣金 存分 ', // `scale_fee` '应分佣金 存分 ',
...@@ -247,12 +248,14 @@ class OrderLog extends Basic ...@@ -247,12 +248,14 @@ class OrderLog extends Basic
$house_number = !isset($params["house_number"]) ? null : $params["house_number"]; $house_number = !isset($params["house_number"]) ? null : $params["house_number"];
$is_open = !isset($params["is_open"]) ? 0 : $params["is_open"]; $is_open = !isset($params["is_open"]) ? 0 : $params["is_open"];
$industry_type = !isset($params["industry_type"]) ? null : $params["industry_type"]; $industry_type = !isset($params["industry_type"]) ? null : $params["industry_type"];
$estimated_receipt_date = $params["estimated_receipt_date"];
$params["commission_arr"] = json_decode($params["commission_arr"], true); $params["commission_arr"] = json_decode($params["commission_arr"], true);
$is_ok = $this->service_->addBargain($params["submit_agent_id"], $params["submit_agent_name"], $params["report_id"], $params["order_id"], $params["order_no"], $is_ok = $this->service_->addBargain($params["submit_agent_id"], $params["submit_agent_name"], $params["report_id"],
$params["trade_type"], $params["price"], $params["commission"], $params["commission_arr"], $house_number, $is_open, $industry_type); $params["order_id"], $params["order_no"], $params["trade_type"], $params["price"], $params["commission"],
$params["commission_arr"], $house_number, $is_open, $industry_type, $estimated_receipt_date);
if ($is_ok > 0) { if ($is_ok > 0) {
//todo 更改用户信息 求租->已租 //todo 更改用户信息 求租->已租
......
...@@ -124,13 +124,14 @@ class OrderLogService ...@@ -124,13 +124,14 @@ class OrderLogService
* @param $house_number * @param $house_number
* @param $is_open * @param $is_open
* @param $industry_type * @param $industry_type
* @param $estimated_receipt_date
* @return int|string * @return int|string
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function addBargain($submit_agent_id, $submit_agent_name, $report_id, $order_id, $order_no, $trade_type, $price, public function addBargain($submit_agent_id, $submit_agent_name, $report_id, $order_id, $order_no, $trade_type, $price,
$commission, $commission_arr, $house_number, $is_open, $industry_type) $commission, $commission_arr, $house_number, $is_open, $industry_type, $estimated_receipt_date)
{ {
$bargain_arr = []; $bargain_arr = [];
$father_id = 0; $father_id = 0;
...@@ -140,11 +141,11 @@ class OrderLogService ...@@ -140,11 +141,11 @@ class OrderLogService
&& isset($commission_val["scale_fee"])) { && isset($commission_val["scale_fee"])) {
if ($father_id == 0) { if ($father_id == 0) {
$params = $this->bargainBin($father_id, $commission_val, $submit_agent_id, $submit_agent_name, $report_id, $order_id, $params = $this->bargainBin($father_id, $commission_val, $submit_agent_id, $submit_agent_name, $report_id, $order_id,
$order_no, $trade_type, $price, $commission, $house_number, $is_open, $industry_type); $order_no, $trade_type, $price, $commission, $house_number, $is_open, $industry_type, $estimated_receipt_date);
$father_id = $this->bargainModel->insertBargain($params); $father_id = $this->bargainModel->insertBargain($params);
} else { } else {
array_push($bargain_arr, $this->bargainBin($father_id, $commission_val, $submit_agent_id, $submit_agent_name, $report_id, array_push($bargain_arr, $this->bargainBin($father_id, $commission_val, $submit_agent_id, $submit_agent_name, $report_id,
$order_id, $order_no, $trade_type, $price, $commission, $house_number, $is_open, $industry_type)); $order_id, $order_no, $trade_type, $price, $commission, $house_number, $is_open, $industry_type, $estimated_receipt_date));
} }
} }
array_push($agent_arr, [ $commission_val["agent_id"] ]); array_push($agent_arr, [ $commission_val["agent_id"] ]);
...@@ -166,7 +167,7 @@ class OrderLogService ...@@ -166,7 +167,7 @@ class OrderLogService
} }
private function bargainBin($father_id, $commission_val, $submit_agent_id, $submit_agent_name, $report_id, $order_id, private function bargainBin($father_id, $commission_val, $submit_agent_id, $submit_agent_name, $report_id, $order_id,
$order_no, $trade_type, $price, $commission, $house_number, $is_open, $industry_type) $order_no, $trade_type, $price, $commission, $house_number, $is_open, $industry_type, $estimated_receipt_date)
{ {
$arr["report_id"] = $report_id; $arr["report_id"] = $report_id;
$arr["father_id"] = $father_id; $arr["father_id"] = $father_id;
...@@ -185,6 +186,7 @@ class OrderLogService ...@@ -185,6 +186,7 @@ class OrderLogService
$arr["is_open"] = $is_open; $arr["is_open"] = $is_open;
$arr["create_time"] = date("Y-m-d H:i:s", time()); $arr["create_time"] = date("Y-m-d H:i:s", time());
$arr["update_time"] = date("Y-m-d H:i:s", time()); $arr["update_time"] = date("Y-m-d H:i:s", time());
$arr["estimated_receipt_date"] = $estimated_receipt_date;
$arr["industry_type"] = $industry_type; $arr["industry_type"] = $industry_type;
return $arr; return $arr;
} }
...@@ -834,7 +836,7 @@ class OrderLogService ...@@ -834,7 +836,7 @@ class OrderLogService
$arr["cash"] = $value["cash"]; $arr["cash"] = $value["cash"];
$arr["practical_fee"] = $value["practical_fee"]; $arr["practical_fee"] = $value["practical_fee"];
$arr["service_charge"] = $value["service_charge"]; $arr["service_charge"] = $value["service_charge"];
if(!empty($value["real_fee"]) && !empty($value["create_time"])){ //过滤掉空的 if (!empty($value["real_fee"]) && !empty($value["create_time"])) { //过滤掉空的
$cent_commission["info"][$key] = $arr; $cent_commission["info"][$key] = $arr;
} }
...@@ -992,6 +994,17 @@ class OrderLogService ...@@ -992,6 +994,17 @@ class OrderLogService
case 5: case 5:
return null; return null;
break; break;
case 6:
return null;
break;
case 7:
$userModel = new Users();
$params["a.id"] = $result[0]["user_id"];
$params["a.referrer_source"] = 20;
$params["a.status"] = 0;
$params["b.status"] = 0;
$list = $userModel->getAgentByReferrer($field, $params);
break;
default: default:
return null; return null;
......
...@@ -575,6 +575,15 @@ class Users extends Model ...@@ -575,6 +575,15 @@ class Users extends Model
->where($params) ->where($params)
->select(); ->select();
} }
public function getAgentByReferrer($field, $params)
{
return Db::name($this->table)
->field($field)
->alias("a")
->join("a_agents b", "a.referrer_id=b.id", "left")
->where($params)
->select();
}
/** /**
* 跟进用户手机号查询信息 * 跟进用户手机号查询信息
......
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