Commit c627004b authored by clone's avatar clone

1

parent 068dc649
...@@ -67,6 +67,8 @@ class PayLogOpen extends Basic ...@@ -67,6 +67,8 @@ class PayLogOpen extends Basic
$house_address, $open_img, $order_id); $house_address, $open_img, $order_id);
if ($return_id > 0) { if ($return_id > 0) {
return $this->response("200", "success", ["id" => $return_id]); return $this->response("200", "success", ["id" => $return_id]);
} elseif ($return_id == -1){
return $this->response("101", "开盘申请已提交,请勿重复提交");
} else { } else {
return $this->response("101", "save error"); return $this->response("101", "save error");
} }
......
...@@ -40,12 +40,26 @@ class PayLogOpenService ...@@ -40,12 +40,26 @@ class PayLogOpenService
*/ */
public function addApplyForOpen($pay_log_id, $report_id, $bargain_id, $agent_id, $house_id, $intro, $house_address, $open_img, $order_id) public function addApplyForOpen($pay_log_id, $report_id, $bargain_id, $agent_id, $house_id, $intro, $house_address, $open_img, $order_id)
{ {
$params["pay_log_id"] = $pay_log_id;
$params["agent_id"] = $agent_id;
$pay_open_data = $this->payLogOpenModel->getFind("id", 0, $params);
if($pay_open_data){
return -1;
}
$return_id = $this->payLogOpenModel->addPayLogOpen( $return_id = $this->payLogOpenModel->addPayLogOpen(
$this->payLogOpenBin($pay_log_id, $report_id, $bargain_id, $agent_id, $house_id, $intro, $house_address, $order_id) $this->payLogOpenBin($pay_log_id, $report_id, $bargain_id, $agent_id, $house_id, $intro, $house_address, $order_id)
); );
//save img //save img
if ($return_id > 0) { if ($return_id > 0) {
$this->oImgModel->addImgAll($return_id, 5, $open_img); $this->oImgModel->addImgAll($return_id, 5, $open_img);
//todo 推送
$verifyService = new VerifyService();
$leaderId = $verifyService->getLeaderIdByAgentId($agent_id);
if($leaderId > 0){
$push_service = new PushMessageService();
$push_service->record(13, 0, $leaderId, 0, ['message' => "有业务员提交了开业申请,请及时审核"]);
}
} }
return $return_id; return $return_id;
} }
...@@ -63,14 +77,16 @@ class PayLogOpenService ...@@ -63,14 +77,16 @@ class PayLogOpenService
*/ */
public function addOpenCheck($open_id, $status, $remark, $operation_id, $operation_name) public function addOpenCheck($open_id, $status, $remark, $operation_id, $operation_name)
{ {
$id = $this->payLogOpenLogModel->getAllList('open_id', 0, ['status' => $status, 'open_id'=>$open_id]); //检查当前状态是否审核过 $id = $this->payLogOpenLogModel->getAllList('open_id', 0, ['status' => $status, 'open_id' => $open_id]); //检查当前状态是否审核过
if (empty($id)) { if (empty($id)) {
$num = $this->payLogOpenLogModel->addOpenCheck( $num = $this->payLogOpenLogModel->addOpenCheck(
$this->OpenLogCheckBin($open_id, $status, $remark, $operation_id, $operation_name) $this->OpenLogCheckBin($open_id, $status, $remark, $operation_id, $operation_name)
); );
if ($num > 0) { if ($num > 0) {
$this->payLogOpenModel->editData(['status'=>$status], $open_id); //更新状态 $this->payLogOpenModel->editData(['status' => $status], $open_id); //更新状态
//todo 推送
$this->pushCheck($open_id, $status);
} }
} else { } else {
$num = 0; $num = 0;
...@@ -78,6 +94,40 @@ class PayLogOpenService ...@@ -78,6 +94,40 @@ class PayLogOpenService
return $num; return $num;
} }
/**
* @param $open_id
* @param $status
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
private function pushCheck($open_id, $status)
{
$push_agent = $this->payLogOpenModel->getFind('agent_id', $open_id);
if (!$push_agent) {
return false;
}
$message = "";
switch ($status) {
case 1:
$message = "你的开业申请总监审核通过";
break;
case 2:
$message = "你的开业申请财务一审通过";
break;
case 3:
$message = "你的开业申请财务二审通过";
break;
default:
return false;
}
$push_service = new PushMessageService();
$push_service->record(13, 0, $push_agent, 0, ['message' => $message]);
return true;
}
/** /**
* 获取列表 * 获取列表
......
...@@ -62,6 +62,32 @@ class VerifyService ...@@ -62,6 +62,32 @@ class VerifyService
return null; return null;
} }
/**
* @param $agent_id
* @return int
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getLeaderIdByAgentId($agent_id)
{
$params["id"] = $agent_id;
$result = $this->agentModel->searchAgentsByKeyword("id,store_id,district_id,level", $params);
$arr_list = [];
if (count($result) > 0) {
$params["district_id"] = $result[0]["district_id"];
$params["level"] = 40;
$arr_list = $this->agentModel->searchAgentsByKeyword("id",$params);
}
if(count($arr_list) > 0){
return $arr_list[0]["id"];
}
return 0;
}
/** /**
* @param $agent_id * @param $agent_id
* @param $type * @param $type
...@@ -70,7 +96,7 @@ class VerifyService ...@@ -70,7 +96,7 @@ class VerifyService
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getAgentsByAgentIdAndType($agent_id,$type) public function getAgentsByAgentIdAndType($agent_id, $type)
{ {
$params["id"] = $agent_id; $params["id"] = $agent_id;
$result = $this->agentModel->searchAgentsByKeyword("id,store_id,district_id,level", $params); $result = $this->agentModel->searchAgentsByKeyword("id,store_id,district_id,level", $params);
...@@ -260,7 +286,7 @@ class VerifyService ...@@ -260,7 +286,7 @@ class VerifyService
{ {
$houseToAgentModel = new GHousesToAgents(); $houseToAgentModel = new GHousesToAgents();
$params["a.agents_id"] = $agent_id; $params["a.agents_id"] = $agent_id;
$params["a.type"] = array("in",'1,2,3'); //案场权限人,盘方和独家 $params["a.type"] = array("in", '1,2,3'); //案场权限人,盘方和独家
$params["a.is_del"] = 0; $params["a.is_del"] = 0;
$house_arr = $houseToAgentModel->getHouseByAgentId("a.houses_id,b.internal_title", $params); $house_arr = $houseToAgentModel->getHouseByAgentId("a.houses_id,b.internal_title", $params);
...@@ -284,7 +310,7 @@ class VerifyService ...@@ -284,7 +310,7 @@ class VerifyService
{ {
$houseToAgentModel = new GHousesToAgents(); $houseToAgentModel = new GHousesToAgents();
$params["a.agents_id"] = $agent_id; $params["a.agents_id"] = $agent_id;
$params["a.type"] = array("in",'2,3'); //盘方和独家 $params["a.type"] = array("in", '2,3'); //盘方和独家
$params["a.is_del"] = 0; $params["a.is_del"] = 0;
$house_arr = $houseToAgentModel->getHouseByAgentId("a.houses_id,b.internal_title", $params); $house_arr = $houseToAgentModel->getHouseByAgentId("a.houses_id,b.internal_title", $params);
......
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