From 579e58522c83dfc2fe54f3d0fc225ef12091b269 Mon Sep 17 00:00:00 2001
From: heyuntao <heyuntao@LAPTOP-MP4HD5NS>
Date: 星期六, 07 十月 2023 10:57:34 +0800
Subject: [PATCH] no message

---
 application/api/controller/User.php |   42 +++++++++++++++++++++++++++++++++++++++---
 1 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/application/api/controller/User.php b/application/api/controller/User.php
index 6aeea5f..1b1171f 100644
--- a/application/api/controller/User.php
+++ b/application/api/controller/User.php
@@ -22,13 +22,13 @@
 use app\api\logic\ActivityInfo as InfoActivityInfo;
 use app\common\model\UserExtend as ModelUserExtend;
 use think\Db;
-
+use EasyWeChat\Kernel\Support\AES;
 /**
  * 浼氬憳鎺ュ彛
  */
 class User extends Api
 {
-    protected $noNeedLogin = ['GetRecomInviter','login', 'mobilelogin', 'resetpwd', 'changemobile', 'wxapplogin','bind_mobile_login','register'];
+    protected $noNeedLogin = ['GetDfgToken','GetRecomInviter','login', 'mobilelogin', 'resetpwd', 'changemobile', 'wxapplogin','bind_mobile_login','register'];
     protected $noNeedRight = '*';
 
     public function _initialize()
@@ -53,6 +53,21 @@
         $data = ['userinfo' => $userInfo];
         $this->success('鑾峰彇鎴愬姛', $data);
     }
+
+
+    public function GetDfgToken()
+    {
+        $userId=$this->request->post('userid');
+        if (!$userId) {
+            $this->error(__('Invalid parameters'));
+        }
+        //aes鍔犲瘑
+        $enKey="wp4hs3bvu7wq2mud";
+        $iv = 'fedcba9876543210';
+        $decrypted = base64_encode(AES::encrypt($userId,$enKey, $iv));
+        $this->success($decrypted);
+    }
+
 
 
     /**
@@ -720,7 +735,7 @@
                 $save_data['login_deviceid'] = $deviceid;
             }
             else{
-                $save_data['login_deviceid'] = 'cus'.com_create_guid();
+                $save_data['login_deviceid'] = 'cus'.self::guid();
             }
             if($f_user['invitation_id'] != 0)$save_data['f_invitation_id'] = $f_user['invitation_id'];
             $res2 = $ModelUser->where(['id'=>$f_user['id']])->setInc('fans',1);
@@ -741,6 +756,27 @@
         $this->success('缁戝畾鎴愬姛',[]);    
     }
 
+   public function guid()
+    {
+
+        if (function_exists('com_create_guid')) {
+
+            return com_create_guid();
+
+        } else {
+
+            mt_srand((double)microtime() * 10000);
+            $charid = strtoupper(md5(uniqid(rand(), true)));
+            $uuid = substr($charid, 0, 8)
+                . substr($charid, 8, 4)
+                . substr($charid, 12, 4)
+                . substr($charid, 16, 4)
+                . substr($charid, 20, 12);
+            return $uuid;
+
+        }
+    }
+
     /**
      * 鑾峰彇鐢ㄦ埛棰勪及閲戦 
      *

--
Gitblit v1.9.3