Explorar el Código

fix(auth): 修复用户认证状态查询逻辑

- 修改了用户认证状态查询条件,添加status=1的过滤条件
- 调整了认证状态赋值逻辑,确保未认证用户返回-1
- 优化了数据库查询结构,提高查询准确性
shichen hace 4 meses
padre
commit
feb6c2bb31
Se han modificado 1 ficheros con 5 adiciones y 2 borrados
  1. 5 2
      app/controller/api/Auth.php

+ 5 - 2
app/controller/api/Auth.php

@@ -774,8 +774,11 @@ class Auth extends BaseController
774 774
         $data["is_merchant"]=$is_merchant===0||$is_merchant>0?$is_merchant:-1;
775 775
         $data['phone1'] =substr($data['phone'], 0, 3) . '****' . substr($data['phone'], 7, 4);
776 776
         $data['longtime'] = intval((time()- strtotime($data['create_time'])) / 86400);
777
-        $is_ertification=Db::name("user_certification")->where("uid",$user["uid"])->value("status");
778
-        $data["is_ertification"]=$is_ertification>0||$is_ertification===0?$is_ertification:-1;
777
+        $is_ertification = Db::name("user_certification")->where("uid", $user["uid"])->where(['status'=>1])->find();
778
+        if (!$is_ertification){
779
+            $is_ertification = -1;
780
+        }
781
+        $data["is_ertification"] = $is_ertification;
779 782
         $mer_staff=Db::name("store_staff")->where(["uid"=>$user["uid"]])->value("department");
780 783
         $data["is_mer_staff"]=$mer_staff?explode(",",$mer_staff):0;
781 784
         $volunteer = Db::name("volunteer") -> where(["uid"=>$user["uid"]]) -> value("grade");