Commit bcae1fc3 authored by clone's avatar clone

1

parent 27491105
......@@ -43,6 +43,7 @@ class PayLogOpen extends Basic
"house_address" => "123123",
"remark" => "123123",
"open_img" => "123123",
"type" => 1 //默认为1 单独申请开业 2和该地址相关的收款全部申请开业
);*/
$checkResult = $this->validate($params, "PayLogOpenValidate.applyForOpen");
......@@ -57,6 +58,7 @@ class PayLogOpen extends Basic
$house_id = $params["house_id"];
$house_address = $params["house_address"];
$intro = $params["intro"];
$type = $params["type"] ? $params["type"] : 1;
try {
$open_img = json_decode($params["open_img"], true);
} catch (Exception $exception) {
......@@ -64,7 +66,7 @@ class PayLogOpen extends Basic
}
$return_id = $this->service_->addApplyForOpen($pay_log_id, $report_id, $bargain_id, $agent_id, $house_id, $intro,
$house_address, $open_img, $order_id, $this->agentId);
$house_address, $open_img, $order_id, $this->agentId,$type);
if ($return_id > 0) {
return $this->response("200", "success", ["id" => $return_id]);
} elseif ($return_id == -1){
......
......@@ -42,25 +42,47 @@ class PayLogOpenService
* @return int
* @throws \think\Exception
*/
public function addApplyForOpen($pay_log_id, $report_id, $bargain_id, $agent_id, $house_id, $intro, $house_address, $open_img, $order_id, $operation_id)
public function addApplyForOpen($pay_log_id, $report_id, $bargain_id, $agent_id, $house_id, $intro, $house_address,
$open_img, $order_id, $operation_id, $type)
{
$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){
if ($pay_open_data) {
return -1;
}
$return_id = 0;
switch ($type) {
case 1:
$return_id = $this->payLogOpenModel->addPayLogOpen(
$this->payLogOpenBin($pay_log_id, $report_id, $bargain_id, $agent_id, $house_id, $intro, $house_address, $order_id)
);
//save img
if ($return_id > 0) {
$this->oImgModel->addImgAll($return_id, 5, $open_img);
}
break;
case 2:
//查询所有和改地址相关的未申请开业的收款
$params["b.house_id"] = $house_id;
$params["a.is_open"] = 0;
$params["a.is_del"] = 0;
$payLogArr = $this->payLogModel->selectListByHouseId("id", $params);
foreach ($payLogArr as $item){
$return_id = $this->payLogOpenModel->addPayLogOpen(
$this->payLogOpenBin($item["id"], $report_id, $bargain_id, $agent_id, $house_id, $intro, $house_address, $order_id)
);
if ($return_id > 0) {
$this->oImgModel->addImgAll($return_id, 5, $open_img);
}
}
}
//save img
if ($return_id > 0) {
//todo 推送
$verifyService = new VerifyService();
$leaderId = $verifyService->getLeaderIdByAgentId($agent_id);
if($leaderId > 0){
if ($leaderId > 0) {
$push_service = new PushMessageService();
$push_service->record(13, 0, [$leaderId], $operation_id, ['message' => "有业务员提交了开业申请,请及时审核"]);
}
......@@ -91,7 +113,7 @@ class PayLogOpenService
$this->payLogOpenModel->editData(['status' => $status], $open_id); //更新状态
if ($status == 3) {
$pay_log_id = $this->payLogOpenModel->getFieldOneValue('pay_log_id', ['id'=>$open_id]);
$pay_log_id = $this->payLogOpenModel->getFieldOneValue('pay_log_id', ['id' => $open_id]);
if ($pay_log_id) {
$update_data['id'] = $pay_log_id;
......@@ -180,7 +202,7 @@ class PayLogOpenService
$list[$key]["img_path"] = CHAT_IMG_URL;
$list[$key]["img_arr"] = $img_arr;
$log_list = $this->payLogOpenLogModel->getAllList($field_log, 0, ["open_id"=>$item["id"]]);
$log_list = $this->payLogOpenLogModel->getAllList($field_log, 0, ["open_id" => $item["id"]]);
$list[$key]["log_list"] = $log_list;
}
return $list;
......
......@@ -350,6 +350,7 @@ class PayLogOpen extends Basic
"house_address" => "123123",
"remark" => "123123",
"open_img" => "123123",
"type" => 1 //默认为1 单独申请开业 2和该地址相关的收款全部申请开业
);*/
$checkResult = $this->validate($params, "api_broker/PayLogOpenValidate.applyForOpen");
......@@ -366,6 +367,7 @@ class PayLogOpen extends Basic
$house_id = $params["house_id"];
$house_address = $params["house_address"];
$intro = $params["intro"];
$type = $params["type"] ? $params["type"] : 1;
try {
$open_img = json_decode($params["open_img"], true);
} catch (\Exception $exception) {
......@@ -373,7 +375,7 @@ class PayLogOpen extends Basic
}
$return_id = $service_->addApplyForOpen($pay_log_id, $report_id, $bargain_id, $agent_id, $house_id, $intro,
$house_address, $open_img, $order_id, $this->userId);
$house_address, $open_img, $order_id, $this->userId,$type);
if ($return_id > 0) {
return $this->response("200", "success", ["id" => $return_id]);
} elseif ($return_id == -1){
......
......@@ -647,5 +647,15 @@ class OPayLogModel extends Model
return $result;
}
public function selectListByHouseId($filed,$params)
{
return $this->db_->field($filed)
->alias("a")
->join("o_order b", "a.order_id = b.id", "left")
->where($params)
->select();
}
}
\ No newline at end of file
......@@ -33,6 +33,19 @@ class OPayLogOpen extends BaseModel
}
}
public function addPayLogOpenAll($params)
{
Db::startTrans();
try {
$this->db_->insertAll($params);
Db::commit();
return 1;
} catch (\Exception $e) {
Db::rollback();
return 0;
}
}
/**
* @param int $pageNo
* @param int $pageSize
......
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