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;
}
/** /**
* 获取列表 * 获取列表
...@@ -115,7 +165,7 @@ class PayLogOpenService ...@@ -115,7 +165,7 @@ class PayLogOpenService
$list[$key]["img_path"] = CHAT_IMG_URL; $list[$key]["img_path"] = CHAT_IMG_URL;
$list[$key]["img_arr"] = $img_arr; $list[$key]["img_arr"] = $img_arr;
$log_list = $this->payLogOpenLogModel->getAllList($field_log, $item["id"], []); $log_list = $this->payLogOpenLogModel->getAllList($field_log, $item["id"], []);
$list[$key]["log_list"] = $log_list; $list[$key]["log_list"] = $log_list;
} }
return $list; return $list;
......
...@@ -32,7 +32,7 @@ class VerifyService ...@@ -32,7 +32,7 @@ class VerifyService
public function getAgentsByAgentId($agent_id) public function getAgentsByAgentId($agent_id)
{ {
$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);
if (count($result) > 0) { if (count($result) > 0) {
$arr_list = []; $arr_list = [];
switch ($result[0]["level"]) { switch ($result[0]["level"]) {
...@@ -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,10 +96,10 @@ class VerifyService ...@@ -70,10 +96,10 @@ 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);
if (count($result) > 0) { if (count($result) > 0) {
$arr_list = []; $arr_list = [];
switch ($type) { switch ($type) {
...@@ -110,9 +136,9 @@ class VerifyService ...@@ -110,9 +136,9 @@ class VerifyService
*/ */
public function getAgentsByAgentIdAndStatus($agent_id) public function getAgentsByAgentIdAndStatus($agent_id)
{ {
$params["id"] = $agent_id; $params["id"] = $agent_id;
$params["status"] = array("in", "0,1,3"); $params["status"] = array("in", "0,1,3");
$result = $this->agentModel->searchAgentsByKeyword("id,store_id,district_id,level", $params); $result = $this->agentModel->searchAgentsByKeyword("id,store_id,district_id,level", $params);
if (count($result) > 0) { if (count($result) > 0) {
$arr_list = []; $arr_list = [];
switch ($result[0]["level"]) { switch ($result[0]["level"]) {
...@@ -121,13 +147,13 @@ class VerifyService ...@@ -121,13 +147,13 @@ class VerifyService
case 20: case 20:
unset($params["id"]); unset($params["id"]);
$params["store_id"] = $result[0]["store_id"]; $params["store_id"] = $result[0]["store_id"];
$arr_list = $this->agentModel->searchAgentsByKeyword("id", $params); $arr_list = $this->agentModel->searchAgentsByKeyword("id", $params);
break; break;
case 30: case 30:
case 40: case 40:
unset($params["id"]); unset($params["id"]);
$params["district_id"] = $result[0]["district_id"]; $params["district_id"] = $result[0]["district_id"];
$arr_list = $this->agentModel->searchAgentsByKeyword("id", $params); $arr_list = $this->agentModel->searchAgentsByKeyword("id", $params);
break; break;
default: default:
return $agent_id; return $agent_id;
...@@ -158,7 +184,7 @@ class VerifyService ...@@ -158,7 +184,7 @@ class VerifyService
public function getAgentsByWhere($agent_id) public function getAgentsByWhere($agent_id)
{ {
$params["id"] = $agent_id; $params["id"] = $agent_id;
$result = $this->agentModel->getAgentsByKeyword("id,store_id,district_id,level", $params); $result = $this->agentModel->getAgentsByKeyword("id,store_id,district_id,level", $params);
if (count($result) > 0) { if (count($result) > 0) {
$arr_list = []; $arr_list = [];
switch ($result[0]["level"]) { switch ($result[0]["level"]) {
...@@ -234,10 +260,10 @@ class VerifyService ...@@ -234,10 +260,10 @@ class VerifyService
*/ */
public function getCaseHouseIdByAgentId($agent_id) public function getCaseHouseIdByAgentId($agent_id)
{ {
$houseToAgentModel = new GHousesToAgents(); $houseToAgentModel = new GHousesToAgents();
$params["a.agents_id"] = $agent_id; $params["a.agents_id"] = $agent_id;
$params["a.type"] = 1; //案场权限人 $params["a.type"] = 1; //案场权限人
$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);
...@@ -258,10 +284,10 @@ class VerifyService ...@@ -258,10 +284,10 @@ class VerifyService
*/ */
public function getCaseHouseIdByAgentIdV2($agent_id) public function getCaseHouseIdByAgentIdV2($agent_id)
{ {
$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);
...@@ -282,10 +308,10 @@ class VerifyService ...@@ -282,10 +308,10 @@ class VerifyService
*/ */
public function getPanpartyAndExclusiveHouseIdByAgentId($agent_id) public function getPanpartyAndExclusiveHouseIdByAgentId($agent_id)
{ {
$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);
...@@ -306,11 +332,11 @@ class VerifyService ...@@ -306,11 +332,11 @@ class VerifyService
*/ */
public function getPanpartyByAgentId($agent_id) public function getPanpartyByAgentId($agent_id)
{ {
$houseToAgentModel = new GHousesToAgents(); $houseToAgentModel = new GHousesToAgents();
$params["a.agents_id"] = $agent_id; $params["a.agents_id"] = $agent_id;
$params["a.type"] = 2; $params["a.type"] = 2;
$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);
$ids = ""; $ids = "";
if (count($house_arr) > 0) { if (count($house_arr) > 0) {
......
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