|
@@ -28,11 +28,28 @@ class UserLike extends Model
|
|
|
->where($where)
|
|
|
->limit($pageStart,$pageNum)
|
|
|
->select();
|
|
|
- if($list) foreach($list as $k => $v) {
|
|
|
- if($v['hobby_ids']) {
|
|
|
- $list[$k]['hobby_ids'] = \app\common\model\Hobby::getHobbyNames($v['hobby_ids']);
|
|
|
- } else {
|
|
|
- $list[$k]['hobby_ids'] = [];
|
|
|
+ if($list) {
|
|
|
+ $public_key = "-----BEGIN PUBLIC KEY-----" .PHP_EOL.
|
|
|
+ wordwrap(config('public_key'), 64, PHP_EOL, true) .
|
|
|
+ PHP_EOL."-----END PUBLIC KEY-----";
|
|
|
+ foreach($list as $k => &$v) {
|
|
|
+ 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);
|
|
|
+
|
|
|
+ if($v['hobby_ids']) {
|
|
|
+ $list[$k]['hobby_ids'] = \app\common\model\Hobby::getHobbyNames($v['hobby_ids']);
|
|
|
+ } else {
|
|
|
+ $list[$k]['hobby_ids'] = [];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return $list;
|
|
@@ -45,16 +62,33 @@ class UserLike extends Model
|
|
|
$where = [];
|
|
|
$where["a.user_id"] = $user_id;
|
|
|
$list = $this->alias("a")
|
|
|
- ->field("a.id,a.fans_id as user_id,u.nickname,u.avatar,u.age,u.constellation,hobby_ids,profession,u.copy_mobile,u.mobile")
|
|
|
+ ->field("a.id,a.fans_id as user_id,u.nickname,u.avatar,u.age,u.constellation,u.wechat,hobby_ids,profession,u.copy_mobile,u.mobile")
|
|
|
->join("hx_user u","u.id = a.fans_id","left")
|
|
|
->where($where)
|
|
|
->limit($pageStart,$pageNum)
|
|
|
->select();
|
|
|
- if($list) foreach($list as $k => $v) {
|
|
|
- if($v['hobby_ids']) {
|
|
|
- $list[$k]['hobby_ids'] = \app\common\model\Hobby::getHobbyNames($v['hobby_ids']);
|
|
|
- } else {
|
|
|
- $list[$k]['hobby_ids'] = [];
|
|
|
+ if($list) {
|
|
|
+ $public_key = "-----BEGIN PUBLIC KEY-----" .PHP_EOL.
|
|
|
+ wordwrap(config('public_key'), 64, PHP_EOL, true) .
|
|
|
+ PHP_EOL."-----END PUBLIC KEY-----";
|
|
|
+ foreach($list as $k => &$v) {
|
|
|
+ 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);
|
|
|
+
|
|
|
+ if($v['hobby_ids']) {
|
|
|
+ $list[$k]['hobby_ids'] = \app\common\model\Hobby::getHobbyNames($v['hobby_ids']);
|
|
|
+ } else {
|
|
|
+ $list[$k]['hobby_ids'] = [];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return $list;
|