From 21669a8cf4d972fa56a59097a6e538cd7ed0bdf3 Mon Sep 17 00:00:00 2001
From: 王晓刚 <wxg@bronet.cn>
Date: Thu, 7 Mar 2019 17:09:30 +0800
Subject: [PATCH] 代理人模块

---
 app/index/controller/MeGuaranteeController.php | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/app/index/controller/MeGuaranteeController.php b/app/index/controller/MeGuaranteeController.php
index 184a54e..31f63a2 100644
--- a/app/index/controller/MeGuaranteeController.php
+++ b/app/index/controller/MeGuaranteeController.php
@@ -112,7 +112,6 @@ class MeGuaranteeController extends WeChatBaseController
         if(!empty($param['status'])){//0为全部1为托管中2为即将到期3为未托管
             if($param['status'] == 1){
                 $where['o.status'] = ['eq',1];
-                $where['o.user_id'] = ['eq',$user_id];
                 $where['c.insurer'] = ['eq',$param['insurer']];
 //                $where['o.order_about_time'] = ['>',$time];
 //                $where['o.order_expire_time2'] = ['>',$time];
@@ -123,16 +122,24 @@ class MeGuaranteeController extends WeChatBaseController
                 }else if(!empty($param['agent_phone'])){
                     $whereor = "o.status = 3 and o.order_expire_time2 > ".$time." and c.agent_phone = $param[agent_phone] and c.insurer ="."'"."$insurer"."'";
                 }else{
+                    $where['o.user_id'] = ['eq',$user_id];
                     $whereor = "o.user_id = $user_id and o.status = 3 and o.order_expire_time2 > ".$time." and c.insurer ="."'"."$insurer"."'";
                 }
             }else if($param['status'] == 2){
                 $where['o.status'] = ['eq',3];
-                $where['o.user_id'] = ['eq',$user_id];
                 $where['c.insurer'] = ['eq',$param['insurer']];
                 $where['o.order_expire_time2'] = ['>',$time];
                 $where['o.order_about_time'] = array(array('<',$time),array('>',$time-30*24*60*60));//array(array('gt',1),array('lt',10))
-//                $where['o.order_about_time'] = ['>',$time];
-                $whereor = "o.user_id = $user_id and o.status = 1 and c.insurer = "."'".$insurer."'"." and o.order_about_time < $time and o.order_about_time > ".($time-30*24*60*60)." and o.order_expire_time2 > $time";
+                if(!empty($param['application']) && !empty($param['agent_phone'])){
+                    $whereor = "o.status = 1 and c.insurer = "."'".$insurer."'"." and o.order_about_time < $time and o.order_about_time > ".($time-30*24*60*60)." and o.order_expire_time2 > $time and c.application = "."'"."$param[application]"."'"." and c.agent_phone = $param[agent_phone]";
+                }else if(!empty($param['application'])){
+                    $whereor = "o.status = 1 and c.insurer = "."'".$insurer."'"." and o.order_about_time < $time and o.order_about_time > ".($time-30*24*60*60)." and o.order_expire_time2 > $time and c.application = "."'"."$param[application]"."'"."";
+                }else if(!empty($param['agent_phone'])){
+                    $whereor = "o.status = 1 and c.insurer = "."'".$insurer."'"." and o.order_about_time < $time and o.order_about_time > ".($time-30*24*60*60)." and o.order_expire_time2 > $time and c.agent_phone = $param[agent_phone]";
+                }else{
+                    $where['o.user_id'] = ['eq',$user_id];
+                    $whereor = "o.user_id = $user_id and o.status = 1 and c.insurer = "."'".$insurer."'"." and o.order_about_time < $time and o.order_about_time > ".($time-30*24*60*60)." and o.order_expire_time2 > $time";
+                }
             }else if($param['status'] == 3){
 //                $where['o.status'] = ['eq',2];
 //                $where['c.insurer'] = ['eq',$param['insurer']];
--
libgit2 0.24.0