afa 5 달 전
부모
커밋
86f979ebbc
2개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 0
      application/api/common.php
  2. 3 1
      application/api/controller/User.php

+ 5 - 0
application/api/common.php

@@ -72,3 +72,8 @@ function isErc20AddressValid($address) {
     // 检查地址是否符合以太坊地址的基本格式
     return preg_match('/^[0-9a-fA-F]{40}$/', $address) === 1;
 }
+
+//判断绝对路径
+function isHttpOrHttps($url) {
+    return strpos($url, 'http://') === 0 || strpos($url, 'https://') === 0;
+}

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

@@ -62,7 +62,7 @@ class User extends Api
             'is_super'        => $user['is_super'], // 新人福利标识
             'direct_super'    => ['one'=>3, 'two'=>10,'direct_super'=>$user['direct_super'], 'address_level'=>$user['address_level']], // 推广新人福等级标识
             'is_ecology'      => $user['is_ecology'], // 生态标识  
-            'avatar'          => !empty($user['avatar'])? $user['avatar']:$this->request->domain().'/assets/img/logo.png', // 头像
+            'avatar'          => isHttpOrHttps($user['avatar'])? $user['avatar']: $this->request->domain().'/assets/img/logo.png', // 头像
             'parent_address'  => '', // 上级的地址
             'invite_link'     => config('rental.invite_domain') . '/?inviteCode=' . $user['address'],
             'take_address'    => $userArea::getUserDefaultAdders($user['id']),  // 用户地址
@@ -70,6 +70,8 @@ class User extends Api
         $this->success('', $resp);
     }
 
+
+
     /**
      * 获取我的查询列表   
      * param int $type_id 0总览 1转让中 2已转让 3存储中 4已赠送 5已提货