Browse Source

账号修改优化

wufeng 2 years ago
parent
commit
5192672a6e
1 changed files with 7 additions and 8 deletions
  1. 7 8
      app/abutment/logic/Account.php

+ 7 - 8
app/abutment/logic/Account.php

@@ -65,13 +65,13 @@ class Account
     }
 
     //获取用户信息
-    public static function getUserInfo(string $token='')
+    public static function getUserInfo(string $token = '')
     {
         $db = new SupplierUserModel();
 
         $res = $db
-            ->where(['is_del' => $db::$is_del_normal,'status'=>$db::$status_normal,'token' => $token])
-            ->where('expire_time','>=',date('Y-m-d H:i:s'))
+            ->where(['is_del' => $db::$is_del_normal, 'status' => $db::$status_normal, 'token' => $token])
+            ->where('expire_time', '>=', date('Y-m-d H:i:s'))
             ->findOrEmpty()
             ->toArray();
 
@@ -327,12 +327,11 @@ class Account
             }
 
             //除了保留id,其余删除
-            if (!empty($retain)) $relation_db->where([
-                'is_del' => $db::$is_del_normal,
-                'uid' => $param['uid']
-            ])->whereNotIn('id', $retain)->save(['is_del' => $db::$is_del_deleted]);
+            $delete_where = [['is_del', '=', $db::$is_del_normal], ['uid', '=', $param['uid']]];
+            if (!empty($retain)) $delete_where[] = ['id', 'not in', $retain];
+            $relation_db->where($delete_where)->save(['is_del' => $db::$is_del_deleted]);
 
-            if ($insert) $relation_db->saveAll($insert);
+            if ($insert) $relation_db->insertAll($insert);
 
             Db::connect('mysql_sys')->commit();