Commit 734dfb9b authored by zw's avatar zw

bug

parent 32f0cd79
...@@ -6,6 +6,7 @@ use app\api_broker\controller\Agent; ...@@ -6,6 +6,7 @@ use app\api_broker\controller\Agent;
use app\api_broker\service\VerifyService; use app\api_broker\service\VerifyService;
use app\model\AAgents; use app\model\AAgents;
use app\model\GHouses; use app\model\GHouses;
use app\model\GHousesToAgents;
use app\model\ODaily; use app\model\ODaily;
use app\model\ODailyLog; use app\model\ODailyLog;
use app\model\OImg; use app\model\OImg;
...@@ -245,9 +246,12 @@ class DailyPaperService ...@@ -245,9 +246,12 @@ class DailyPaperService
); );
//案场费入账 盘方 //案场费入账 盘方
$params["a.type"] = 92; $params["a.type"] = 92;
$info["case_fee"] = $this->getHouseAndAgentInfo(
$payLogModel->selectPayLogListByBargain($field, $params) $case_fee_arr = $payLogModel->selectPayLogListByBargain($field, $params);
); $case_fee_arr = $this->getHousePan($case_fee_arr);
$info["case_fee"] = $this->getHouseAndAgentInfo($case_fee_arr);
$field_money = "a.id,a.money,b.house_id,b.id as order_id,a.pay_type,a.transfer_name, d.report_agent_id as agent_id, $field_money = "a.id,a.money,b.house_id,b.id as order_id,a.pay_type,a.transfer_name, d.report_agent_id as agent_id,
a.is_dividend,a.receipt_number,a.create_time"; a.is_dividend,a.receipt_number,a.create_time";
...@@ -273,7 +277,36 @@ class DailyPaperService ...@@ -273,7 +277,36 @@ class DailyPaperService
return $info; return $info;
} }
/**
* 获取盘方
* @param $data
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
private function getHousePan($data)
{
$house_id_str = "";
if (count($data) > 0) {
foreach ($data as $k => $v) {
$house_id_str .= $v["house_id"] . ",";
}
$house_id_str = rtrim($house_id_str, ",");
$agent_arr = $this->housePanInfo($house_id_str);
foreach ($data as $k => $v) {
foreach ($agent_arr as $item) {
if ($v["house_id"] == $item["houses_id"]) {
$data[$k]["agent_id"] = $item["agents_id"];
}
}
}
}
return $data;
}
/** /**
* @param $data * @param $data
* @return mixed * @return mixed
...@@ -289,7 +322,6 @@ class DailyPaperService ...@@ -289,7 +322,6 @@ class DailyPaperService
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
$agent_id_str .= $v["agent_id"] . ","; $agent_id_str .= $v["agent_id"] . ",";
$house_id_str .= $v["house_id"] . ","; $house_id_str .= $v["house_id"] . ",";
} }
$agent_id_str = rtrim($agent_id_str, ","); $agent_id_str = rtrim($agent_id_str, ",");
$house_id_str = rtrim($house_id_str, ","); $house_id_str = rtrim($house_id_str, ",");
...@@ -312,7 +344,6 @@ class DailyPaperService ...@@ -312,7 +344,6 @@ class DailyPaperService
$data[$k]["house_address"] = $item["internal_address"]; $data[$k]["house_address"] = $item["internal_address"];
} }
} }
} }
} }
return $data; return $data;
...@@ -346,6 +377,22 @@ class DailyPaperService ...@@ -346,6 +377,22 @@ class DailyPaperService
return $houseModel->getHouseInfo("id,internal_address", $params); return $houseModel->getHouseInfo("id,internal_address", $params);
} }
/**
* 获取盘方
* @param $house_id_str
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
private function housePanInfo($house_id_str)
{
$gModel = new GHousesToAgents();
$params["houses_id"] = array("in", ($house_id_str));
$params["type"] = 2;
return $gModel->getAgentsList("houses_id,agents_id", $params);
}
/** /**
* 根据门店id获取此门店的经纪人id string * 根据门店id获取此门店的经纪人id string
* @param $store_id * @param $store_id
......
...@@ -432,6 +432,22 @@ class GHousesToAgents extends BaseModel ...@@ -432,6 +432,22 @@ class GHousesToAgents extends BaseModel
->column($field); ->column($field);
} }
/**
* @param $field
* @param $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentsList($field, $where)
{
return $this
->field($field)
->where($where)
->select($field);
}
/** /**
* @param $field * @param $field
* @param $where * @param $where
......
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