Parcourir la source

完善影集接口

15954078560 il y a 3 ans
Parent
commit
035a713d89

+ 1 - 1
application/api/controller/Eyemargin.php

@@ -146,7 +146,7 @@ class Eyemargin extends Common
         $common_where['a.status'] = 1;
 
         $field = "a.*,u.avatar,u.city_name,u.district_name,u.nickname,u.is_goddess,u.is_auth,vipStatus(u.vip_duetime) as is_vip, 
-        u.age,u.constellation,u.hobby_ids,u.profession,u.declaration,u.lng,u.lat";
+        u.age,u.constellation,u.hobby_ids,u.profession,u.declaration,u.lng,u.lat,u.mobile,u.copy_mobile,u.wechat";
         $list = [];
 
         $a = $this->getFateInfo($redis_ids,$field,$user_id,$common_where);

+ 16 - 1
application/common/model/Eyemargin.php

@@ -25,7 +25,10 @@ class Eyemargin extends Model
             ->select();
         if($results) {
             $userinfo = Db::name('user_info');
-            foreach($results as $k => $v) {
+            $public_key = "-----BEGIN PUBLIC KEY-----" .PHP_EOL.
+                wordwrap(config('public_key'), 64, PHP_EOL, true) .
+                PHP_EOL."-----END PUBLIC KEY-----";
+            foreach($results as $k => &$v) {
                 // 计算距离
                 $results[$k]['distance'] = (int)self::getDistance($v['lng'],$v['lat'],$user_lng,$user_lat);
 //            $results[$k]['distance_txt'] = $results[$k]['distance'] > 15 ? $v['city_name'].'·'.$v['district_name']:"距离:".$results[$k]['distance'].'km';
@@ -53,6 +56,18 @@ class Eyemargin extends Model
                 } else {
                     $results[$k]['is_active'] = 0; //不活跃
                 }
+
+                if ($v['wechat']) {
+                    $wechat = "";
+                    openssl_public_encrypt($v['wechat'], $wechat, $public_key);
+                    $v['wechat'] = base64_encode($wechat);
+                } else {
+                    $v['wechat'] = '';
+                }
+                $mobile = "";
+//                openssl_private_encrypt($data['mobile'], $mobile, $private_key); // 使用私钥加密数据
+                openssl_public_encrypt($v['mobile'], $mobile, $public_key);
+                $v['mobile'] = base64_encode($mobile);
             }
         }
         $distance = array_column($results,'distance');