<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # 用戶注冊 注意用戶注冊需要core_user和core_identity表配合,注意使用事務。 ## 手機號注冊示例 其他比如郵箱注冊、微信注冊參考修改 ``` use?app\core\model\Useras?coreUserModel; use?app\core\model\Identityas?coreIdentityModel; // 判斷已注冊 $identityInfo= []; $identityInfo['cloudAlias'] = 0 $identityInfo['identityType'] = 'mobile'; // 取值emial/mobile/wxmp/wxapp等 $identityInfo['verified'] = 1; $identityInfo['identifier'] = input('post.mobile'); // 如果是微信登錄此字段存儲微信openid $identityInfo['identityGroup'] = '+86'; // 如果是微信登錄此字段存儲微信公眾號的appid if (coreIdentityModel::where($identityInfo)->count()) { throw new \think\Exception('該手機號已經被注冊', 0); } try?{ Db::startTrans(); // 注冊新用戶 $time = micro_time(); $dataDb = []; $dataDb['cloudId'] = 0; $dataDb['cloudAlias'] = 0; $dataDb['userKey'] = \think\helper\Str::random(64); // 秘鑰 $dataDb['nickname'] = 'm_' . $time; $dataDb['username'] = 'm_' . $time; $dataDb['password'] = user_md5(input('post.password'), $dataDb['userKey']); // 密碼不能明文需要加密存儲 $dataDb['avatar'] = ''; $dataDb['status'] = 1; $dataDb['registerTime'] = time(); $userInfo = coreUserModel::create($dataDb); if (!$userInfo) { throw new \Exception("注冊失敗", 0); } // 綁定手機號 、綁定郵箱、綁定微信openid或者其他OAuth2登錄的openid $dataIdentity = []; $dataIdentity['uid'] = $userInfo->id; $dataIdentity['cloudAlias'] =0; $dataIdentity['identityType'] = $identityInfo['identityType']; $dataIdentity['identityGroup'] = $identityInfo['identityGroup']; $dataIdentity['identifier'] = $identityInfo['identifier']; $dataIdentity['verified'] = 1; $dataIdentity['createTime'] = time(); $userIdentityInfo = coreIdentityModel::create($dataIdentity); if (!$userIdentityInfo->id) { throw new \Exception("注冊失敗", 0); } Db::commit(); return$userInfo; }catch(\Exception$e)?{ Db::rollback(); throw new\Exception($e->getMessage(),?0); } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看