Просмотр исходного кода

fix(user):修复港澳台证件号年龄计算问题- 兼容港澳台证件号的年龄计算逻辑- 根据证件类型判断使用不同的生日数据源-修复因证件号格式不同导致的年龄计算错误

shichen месяцев назад: 10
Родитель
Сommit
d88c22329b
1 измененных файлов с 8 добавлено и 1 удалено
  1. 8 1
      app/common/repositories/user/UserRepository.php

+ 8 - 1
app/common/repositories/user/UserRepository.php

@@ -2911,7 +2911,14 @@ class UserRepository extends BaseRepository
2911 2911
             //            $birth = strtotime(substr($certification["user_card"], 6, 8));
2912 2912
             $old_age = $this->getSex($certification["user_card"])?60:55;
2913 2913
             //            $age = $this->howOld($birth);
2914
-            $age=$this->calculateAge($birth_data);
2914
+
2915
+
2916
+            // 兼容港澳台证件号
2917
+            if ($certification['card_type'] == 1){
2918
+                $age=$this->calculateAge($birth_data);
2919
+            }else{
2920
+                $age=$this->calculateAge($certification['birthday']);
2921
+            }
2915 2922
 
2916 2923
             if ($age < $old_age) {
2917 2924
                 //                $yes = $old_age - $age;