|
@@ -561,6 +561,14 @@ class RangeService extends Service
|
|
|
return array_column($emp_id,'id');
|
|
|
}
|
|
|
|
|
|
+ public function crtContactSearch($data){
|
|
|
+ $id = CustomerInfo::where('del_time',0)
|
|
|
+ ->where('type',CustomerInfo::type_one)
|
|
|
+ ->where('contact_info','LIKE', '%'.$data['title_t'].'%')
|
|
|
+ ->select('customer_id')->get()->toArray();
|
|
|
+ return array_column($id,'customer_id');
|
|
|
+ }
|
|
|
+
|
|
|
//负责人
|
|
|
public function customerSearch($data){
|
|
|
$emp_id = Employee::where('del_time',0)
|
|
@@ -620,14 +628,20 @@ class RangeService extends Service
|
|
|
list($status, $id) = self::getWaitForSportsCheck($user,$search);
|
|
|
|
|
|
//待审核
|
|
|
+ $check = implode(",", SportsBag::$wait_check);
|
|
|
$args = "(state IN (" . implode(",", SportsBag::$wait_check) ."))";
|
|
|
|
|
|
if($status) {
|
|
|
+ $wait_for_me = $search['wait_for_me'] ?? 0;
|
|
|
$check_2 = implode(',', array_diff(SportsBag::$wait_check, [SportsBag::STATE_ONE]));
|
|
|
- if(empty($id)) {
|
|
|
- $args = "(state IN (" . implode(",", SportsBag::$wait_check) .") and (1=0 or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
- }else{
|
|
|
- $args = "(state IN (" . implode(",", SportsBag::$wait_check) .") and (id IN (" . implode(",", $id) .") or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ $id = implode(",", $id);
|
|
|
+
|
|
|
+ if($wait_for_me){
|
|
|
+ if(empty($id)) {
|
|
|
+ $args = "(state IN (" . $check .") and (1=0 or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ }else{
|
|
|
+ $args = "(state IN (" . $check .") and (id IN (" . $id .") or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}elseif($search['is_check'] == 2){
|
|
@@ -639,7 +653,7 @@ class RangeService extends Service
|
|
|
}
|
|
|
|
|
|
private static function getWaitForSportsCheck($user, $search){
|
|
|
- if(empty($search['wait_for_me'])) return [false, []];
|
|
|
+ if(! isset($search['wait_for_me'])) return [false, []];
|
|
|
|
|
|
//获取待审核
|
|
|
$args = "(state = " . SportsBag::STATE_ONE . ")";
|
|
@@ -659,14 +673,19 @@ class RangeService extends Service
|
|
|
list($status, $id) = self::getWaitForPaymentCheck($user,$search);
|
|
|
|
|
|
//待审核
|
|
|
- $args = "(state IN (" . implode(",", PaymentReceipt::$wait_check) ."))";
|
|
|
+ $check = implode(",", SportsBag::$wait_check);
|
|
|
+ $args = "(state IN (" . $check ."))";
|
|
|
|
|
|
if($status) {
|
|
|
+ $wait_for_me = $search['wait_for_me'] ?? 0;
|
|
|
+ $id = implode(",", $id);
|
|
|
$check_2 = implode(',', array_diff(SportsBag::$wait_check, [PaymentReceipt::STATE_ONE]));
|
|
|
- if(empty($id)) {
|
|
|
- $args = "(state IN (" . implode(",", PaymentReceipt::$wait_check) .") and (1=0 or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
- }else{
|
|
|
- $args = "(state IN (" . implode(",", PaymentReceipt::$wait_check) .") and (id IN (" . implode(",", $id) .") or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ if($wait_for_me){
|
|
|
+ if(empty($id)) {
|
|
|
+ $args = "(state IN (" . $check .") and (1=0 or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ }else{
|
|
|
+ $args = "(state IN (" . $check .") and (id IN (" . $id .") or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}elseif($search['is_check'] == 2){
|
|
@@ -678,7 +697,7 @@ class RangeService extends Service
|
|
|
}
|
|
|
|
|
|
private static function getWaitForPaymentCheck($user, $search){
|
|
|
- if(empty($search['wait_for_me'])) return [false, []];
|
|
|
+ if(! isset($search['wait_for_me'])) return [false, []];
|
|
|
|
|
|
//获取待审核
|
|
|
$args = "(state = " . PaymentReceipt::STATE_ONE . ")";
|
|
@@ -698,14 +717,20 @@ class RangeService extends Service
|
|
|
list($status, $id) = self::getWaitForSalesCheck($user,$search);
|
|
|
|
|
|
//待审核
|
|
|
- $args = "(sales_order_type = " . SalesOrder::Order_type_one . " and state IN (" . implode(",", SalesOrder::$wait_check) ."))";
|
|
|
+ $check = implode(",", SalesOrder::$wait_check);
|
|
|
+ $args = "(sales_order_type = " . SalesOrder::Order_type_one . " and state IN (" . $check ."))";
|
|
|
|
|
|
if($status) {
|
|
|
+ $wait_for_me = $search['wait_for_me'] ?? 0;
|
|
|
+
|
|
|
$check_2 = implode(',', array_diff(SalesOrder::$wait_check, [SalesOrder::State_one]));
|
|
|
- if(empty($id)) {
|
|
|
- $args = "(sales_order_type = " . SalesOrder::Order_type_one . " and state IN (" . implode(",", SalesOrder::$wait_check) .") and (1=0 or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
- }else{
|
|
|
- $args = "(sales_order_type = " . SalesOrder::Order_type_one . " and state IN (" . implode(",", SalesOrder::$wait_check) .") and (id IN (" . implode(",", $id) .") or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ $id = implode(",", $id);
|
|
|
+ if($wait_for_me){
|
|
|
+ if(empty($id)) {
|
|
|
+ $args = "(sales_order_type = " . SalesOrder::Order_type_one . " and state IN (" . $check .") and (1=0 or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ }else{
|
|
|
+ $args = "(sales_order_type = " . SalesOrder::Order_type_one . " and state IN (" . $check .") and (id IN (" . $id .") or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}elseif($search['is_check'] == 2){
|
|
@@ -717,7 +742,7 @@ class RangeService extends Service
|
|
|
}
|
|
|
|
|
|
private static function getWaitForSalesCheck($user, $search){
|
|
|
- if(empty($search['wait_for_me'])) return [false, []];
|
|
|
+ if(! isset($search['wait_for_me'])) return [false, []];
|
|
|
|
|
|
//获取待审核合同
|
|
|
$args = "(sales_order_type = " . SalesOrder::Order_type_one . " and state = " . SalesOrder::State_one . ")";
|
|
@@ -737,14 +762,20 @@ class RangeService extends Service
|
|
|
list($status, $id) = self::getWaitForInvoiceCheck($user,$search);
|
|
|
|
|
|
//待审核
|
|
|
- $args = "(state IN (" . implode(",", InvoiceOrder::$wait_check) ."))";
|
|
|
+ $check = implode(",", InvoiceOrder::$wait_check);
|
|
|
+ $args = "(state IN (" . $check ."))";
|
|
|
|
|
|
if($status) {
|
|
|
- $check_2 = implode(',', array_diff(SportsBag::$wait_check, [InvoiceOrder::STATE_ONE]));
|
|
|
- if(empty($id)) {
|
|
|
- $args = "(state IN (" . implode(",", InvoiceOrder::$wait_check) .") and (1=0 or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
- }else{
|
|
|
- $args = "(state IN (" . implode(",", InvoiceOrder::$wait_check) .") and (id IN (" . implode(",", $id) .") or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ $wait_for_me = $search['wait_for_me'] ?? 0;
|
|
|
+
|
|
|
+ $check_2 = implode(',', array_diff(InvoiceOrder::$wait_check, [InvoiceOrder::STATE_ONE]));
|
|
|
+ $id = implode(",", $id);
|
|
|
+ if($wait_for_me){
|
|
|
+ if(empty($id)) {
|
|
|
+ $args = "(state IN (" . $check .") and (1=0 or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ }else{
|
|
|
+ $args = "(state IN (" . $check .") and (id IN (" . $id .") or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}elseif($search['is_check'] == 2){
|
|
@@ -756,7 +787,7 @@ class RangeService extends Service
|
|
|
}
|
|
|
|
|
|
private static function getWaitForInvoiceCheck($user, $search){
|
|
|
- if(empty($search['wait_for_me'])) return [false, []];
|
|
|
+ if(! isset($search['wait_for_me'])) return [false, []];
|
|
|
|
|
|
//获取待审核数据
|
|
|
$args = "(state = " . InvoiceOrder::STATE_ONE . ")";
|
|
@@ -776,14 +807,20 @@ class RangeService extends Service
|
|
|
list($status, $id) = self::getWaitForReturnExchangeCheck($user,$search);
|
|
|
|
|
|
//待审核
|
|
|
- $args = "(state IN (" . implode(",", ReturnExchangeOrder::$wait_check) ."))";
|
|
|
+ $check = implode(",", ReturnExchangeOrder::$wait_check);
|
|
|
+ $args = "(state IN (" . $check ."))";
|
|
|
|
|
|
if($status) {
|
|
|
- $check_2 = implode(',', array_diff(SportsBag::$wait_check, [ReturnExchangeOrder::State_one]));
|
|
|
- if(empty($id)) {
|
|
|
- $args = "(state IN (" . implode(",", ReturnExchangeOrder::$wait_check) .") and (1=0 or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
- }else{
|
|
|
- $args = "(state IN (" . implode(",", ReturnExchangeOrder::$wait_check) .") and (id IN (" . implode(",", $id) .") or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ $wait_for_me = $search['wait_for_me'] ?? 0;
|
|
|
+
|
|
|
+ $check_2 = implode(',', array_diff(ReturnExchangeOrder::$wait_check, [ReturnExchangeOrder::State_one]));
|
|
|
+ $id = implode(",", $id);
|
|
|
+ if($wait_for_me){
|
|
|
+ if(empty($id)) {
|
|
|
+ $args = "(state IN (" . $check .") and (1=0 or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ }else{
|
|
|
+ $args = "(state IN (" . $check .") and (id IN (" . $id .") or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}elseif($search['is_check'] == 2){
|
|
@@ -795,7 +832,7 @@ class RangeService extends Service
|
|
|
}
|
|
|
|
|
|
private static function getWaitForReturnExchangeCheck($user, $search){
|
|
|
- if(empty($search['wait_for_me'])) return [false, []];
|
|
|
+ if(! isset($search['wait_for_me'])) return [false, []];
|
|
|
|
|
|
//获取待审核数据
|
|
|
$args = "(state = " . ReturnExchangeOrder::State_one . ")";
|
|
@@ -815,14 +852,20 @@ class RangeService extends Service
|
|
|
list($status, $id) = self::getWaitForConstructionCheck($user,$search);
|
|
|
|
|
|
//待审核
|
|
|
- $args = "(state IN (" . implode(",", Construction::$wait_check) ."))";
|
|
|
+ $check = implode(",", Construction::$wait_check);
|
|
|
+ $args = "(state IN (" . $check ."))";
|
|
|
|
|
|
if($status) {
|
|
|
- $check_2 = implode(',', array_diff(SportsBag::$wait_check, [Construction::STATE_ONE]));
|
|
|
- if(empty($id)) {
|
|
|
- $args = "(state IN (" . implode(",", Construction::$wait_check) .") and (1=0 or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
- }else{
|
|
|
- $args = "(state IN (" . implode(",", Construction::$wait_check) .") and (id IN (" . implode(",", $id) .") or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ $wait_for_me = $search['wait_for_me'] ?? 0;
|
|
|
+
|
|
|
+ $check_2 = implode(',', array_diff(Construction::$wait_check, [Construction::STATE_ONE]));
|
|
|
+ $id = implode(",", $id);
|
|
|
+ if($wait_for_me){
|
|
|
+ if(empty($id)) {
|
|
|
+ $args = "(state IN (" . $check .") and (1=0 or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ }else{
|
|
|
+ $args = "(state IN (" . $check .") and (id IN (" . $id .") or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}elseif($search['is_check'] == 2){
|
|
@@ -834,7 +877,7 @@ class RangeService extends Service
|
|
|
}
|
|
|
|
|
|
private static function getWaitForConstructionCheck($user, $search){
|
|
|
- if(empty($search['wait_for_me'])) return [false, []];
|
|
|
+ if(! isset($search['wait_for_me'])) return [false, []];
|
|
|
|
|
|
//获取待审核数据
|
|
|
$args = "(state = " . Construction::STATE_ONE . ")";
|
|
@@ -854,14 +897,20 @@ class RangeService extends Service
|
|
|
list($status, $id) = self::getWaitForPurchaseCheck($user,$search);
|
|
|
|
|
|
//待审核
|
|
|
- $args = "(state IN (" . implode(",", PurchaseOrder::$wait_check) ."))";
|
|
|
+ $check = implode(",", PurchaseOrder::$wait_check);
|
|
|
+ $args = "(state IN (" . $check ."))";
|
|
|
|
|
|
if($status) {
|
|
|
- $check_2 = implode(',', array_diff(SportsBag::$wait_check, [PurchaseOrder::STATE_ONE]));
|
|
|
- if(empty($id)) {
|
|
|
- $args = "(state IN (" . implode(",", PurchaseOrder::$wait_check) .") and (1=0 or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
- }else{
|
|
|
- $args = "(state IN (" . implode(",", PurchaseOrder::$wait_check) .") and (id IN (" . implode(",", $id) .") or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ $wait_for_me = $search['wait_for_me'] ?? 0;
|
|
|
+
|
|
|
+ $check_2 = implode(',', array_diff(PurchaseOrder::$wait_check, [PurchaseOrder::STATE_ONE]));
|
|
|
+ $id = implode(",", $id);
|
|
|
+ if($wait_for_me){
|
|
|
+ if(empty($id)) {
|
|
|
+ $args = "(state IN (" . $check .") and (1=0 or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ }else{
|
|
|
+ $args = "(state IN (" . $check .") and (id IN (" . $id .") or (crt_id = " . $user['id'] ." and state IN (" . $check_2 ."))))";
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}elseif($search['is_check'] == 2){
|
|
@@ -873,7 +922,7 @@ class RangeService extends Service
|
|
|
}
|
|
|
|
|
|
private static function getWaitForPurchaseCheck($user, $search){
|
|
|
- if(empty($search['wait_for_me'])) return [false, []];
|
|
|
+ if(! isset($search['wait_for_me'])) return [false, []];
|
|
|
|
|
|
//获取待审核数据
|
|
|
$args = "(state = " . PurchaseOrder::STATE_ONE . ")";
|