فهرست منبع

获取用户信息

afa 9 ماه پیش
والد
کامیت
34f45da620
2فایلهای تغییر یافته به همراه5 افزوده شده و 4 حذف شده
  1. 4 3
      application/api/controller/User.php
  2. 1 1
      application/common/model/UserArea.php

+ 4 - 3
application/api/controller/User.php

@@ -38,7 +38,7 @@ class User extends Api
      * 获取用户信息
      * @return void
      */
-    public function userInfo()
+    public function userInfo(UserArea $userArea, LedgerWalletModel $ledgerWalletModel)
     {
         $user = $this->auth->getUser();
         $resp = [
@@ -51,11 +51,12 @@ class User extends Api
             'phone'           => $user['phone'], // 手机号
             'rental_power'    => '0', // 自己购买的算力
             'team_power'      => '0', // 团队总算里
-            'balance'         => LedgerWalletModel::getWalletChaBao($this->auth->id), // 余额
+            'balance'         => $ledgerWalletModel::getWalletChaBao($this->auth->id), // 余额
             'rwa_num'         => $user['rwa_num'], // 总茶权
             'parent_id'       => $user['parent_id'], // 上级ID
             'parent_address'  => '', // 上级的地址
-            'invite_link'     => Config::get('rental.invite_domain') . '/?inviteCode=' . $user['address'],
+            'invite_link'     => config('rental.invite_domain') . '/?inviteCode=' . $user['address'],
+            'address'         => $userArea::getUserDefaultAdders($user['id']),  // 用户地址
         ];
 
         $this->success('', $resp);

+ 1 - 1
application/common/model/UserArea.php

@@ -43,7 +43,7 @@ class UserArea  extends Model
     //获取用户默认地址
     public static function getUserDefaultAdders(int $uid)
     {
-        return self::where()->find();
+        return self::where('user_id', $uid)->where('type_id', self::DefaultAdders)->field('area_code,address')->find();
     }
 
     //  修改默认地址