shish 1 год назад
Родитель
Сommit
2750684e9e
1 измененных файлов с 90 добавлено и 22 удалено
  1. 90 22
      biz-hd/ll/classes/LlUserClass.php

+ 90 - 22
biz-hd/ll/classes/LlUserClass.php

@@ -12,35 +12,103 @@ class LlUserClass extends BaseClass
 
     public static $baseFile = '\bizHd\ll\models\LlUser';
 
-    public static function getInfo($id,$sensitive=true){
-        //$user = LlUserClass::getById($id);
+    public static function getInfo($id, $sensitive = true)
+    {
+        $user = LlUserClass::getById($id, true);
+        if (empty($user)) {
+            util::fail('没有找到失信人员信息');
+        }
+        $name = $user->name ?? '';
+        $firstDate = $user->firstDate ?? '';
+        $lastDate = $user->lastDate ?? '';
+        $breakNum = $user->breakNum ?? 0;
+        $breakAmount = $user->breakAmount ?? 0;
+        $mobileRes = LlMobileClass::getAllByCondition(['userId' => $id], null, '*');
+        $mobileList = [];
+        if (!empty($mobileRes)) {
+            foreach ($mobileRes as $key => $val) {
+                $mobile = $val['mobile'] ?? '';
+                if (empty($mobile)) {
+                    continue;
+                }
+                if ($sensitive) {
+                    $mobile = substr_replace($mobile, '****', 3, 4);
+                }
+                $mobileList[] = $mobile;
+            }
+        }
+        $wxRes = LlWxClass::getAllByCondition(['userId' => $id], null, '*');
+        $wxList = [];
+        if (!empty($wxRes)) {
+            foreach ($wxRes as $key => $val) {
+                $wx = $val['wx'] ?? '';
+                if (empty($wx)) {
+                    continue;
+                }
+                if ($sensitive) {
+                    $wxNum = strlen($wx);
+                    $num = ceil($wxNum / 3);
+                    $str = '';
+                    for ($i = 1; $i <= $num; $i++) {
+                        $str .= '*';
+                    }
+                    $wx = substr_replace($wx, $str, -$num);
+                }
+                $wxList[] = $wx;
+            }
+        }
+        $noRes = LlNoClass::getAllByCondition(['userId' => $id], null, '*');
+        $noList = [];
+        if (!empty($noRes)) {
+            foreach ($noRes as $key => $val) {
+                $no = $val['no'] ?? '';
+                if (empty($no)) {
+                    continue;
+                }
+                if ($sensitive) {
+                    $no = substr_replace($no, '*********', 6, 9);
+                }
+                $noList[] = $no;
+            }
+        }
+        $userInfo = [
+            'name' => $name,
+            'mobileList' => $mobileList,
+            'wxList' => $wxList,
+            'noList' => $noList,
+            'firstDate' => $firstDate,
+            'lastDate' => $lastDate,
+            'breakNum' => $breakNum,
+            'breakAmount' => $breakAmount,
+        ];
+        return $userInfo;
     }
 
-    public static function getUserList($where,$sensitive=true)
+    public static function getUserList($where, $sensitive = true)
     {
         $order = 'addTime DESC';
         $data = self::getList('*', $where, $order);
-        if(isset($data['list']) && $data['list']){
-            foreach($data['list'] as $key => $val){
-                if($sensitive){
-                    $mobile = $val['mobile']??'';
-                    if(!empty($mobile)){
+        if (isset($data['list']) && $data['list']) {
+            foreach ($data['list'] as $key => $val) {
+                if ($sensitive) {
+                    $mobile = $val['mobile'] ?? '';
+                    if (!empty($mobile)) {
                         $mobile = substr_replace($mobile, '****', 3, 4);
                     }
                     $data['list'][$key]['mobile'] = $mobile;
-                    $wx = $val['wx']??'';
-                    if(!empty($wx)){
+                    $wx = $val['wx'] ?? '';
+                    if (!empty($wx)) {
                         $wxNum = strlen($wx);
-                        $num = ceil($wxNum/3);
+                        $num = ceil($wxNum / 3);
                         $str = '';
-                        for($i=1;$i<=$num;$i++){
+                        for ($i = 1; $i <= $num; $i++) {
                             $str .= '*';
                         }
                         $wx = substr_replace($wx, $str, -$num);
                     }
                     $data['list'][$key]['wx'] = $wx;
-                    $no = $val['no']??'';
-                    if(!empty($no)){
+                    $no = $val['no'] ?? '';
+                    if (!empty($no)) {
                         $no = substr_replace($no, '*********', 6, 9);
                     }
                     $data['list'][$key]['no'] = $no;
@@ -50,11 +118,11 @@ class LlUserClass extends BaseClass
         return $data;
     }
 
-    public static function replaceUser($userInfo,$shop)
+    public static function replaceUser($userInfo, $shop)
     {
-        $shopId = $shop->id??'';
-        $shopMobile = $shop->mobile??'';
-        $shopFullName = $shop->merchantName.' '.$shop->shopName;
+        $shopId = $shop->id ?? '';
+        $shopMobile = $shop->mobile ?? '';
+        $shopFullName = $shop->merchantName . ' ' . $shop->shopName;
         $userId = 0;
         $baseId = 0;
         $thatDate = $userInfo['date'] ?? '';
@@ -88,11 +156,11 @@ class LlUserClass extends BaseClass
 
         if (!empty($baseId)) {
             $base = LlBaseClass::getById($baseId, true);
-            if(empty($base)){
+            if (empty($base)) {
                 noticeUtil::push("用户提供的老赖信息,有baseId:{$baseId}但没base信息,提借者:{$shopId} {$shopMobile} {$shopFullName}", '15280215347');
-                util::fail('用户信息有问题,请联系客服,baseId:'.$baseId);
+                util::fail('用户信息有问题,请联系客服,baseId:' . $baseId);
             }
-            if(!empty($no) && $no != $base->no){
+            if (!empty($no) && $no != $base->no) {
                 noticeUtil::push("用户提供的老赖身份证号是{$no},但baseId:{$baseId}的身份证号是另个:{$base->no},提借者:{$shopId} {$shopMobile} {$shopFullName}", '15280215347');
                 util::fail('请提身份证号有问题,请联系客服');
             }
@@ -101,7 +169,7 @@ class LlUserClass extends BaseClass
             if (!empty($no)) {
                 $base = LlBaseClass::getByCondition(['no' => $no], true);
                 if (empty($base)) {
-                    $baseData = ['no' => $no, 'name' => $name,'firstDate'=>$thatDate,'lastDate'=>$thatDate];
+                    $baseData = ['no' => $no, 'name' => $name, 'firstDate' => $thatDate, 'lastDate' => $thatDate];
                     $base = LlBaseClass::add($baseData, true);
                 }
             }