1
0

first commit

This commit is contained in:
2020-08-06 14:58:51 +08:00
commit 17096657dc
780 changed files with 92857 additions and 0 deletions

View File

@@ -0,0 +1,96 @@
<?php
// +------------------------------------------------+
// |http://www.cjango.com |
// +------------------------------------------------+
// | 修复BUG不是一朝一夕的事情等我喝醉了再说吧 |
// +------------------------------------------------+
// | Author: 小陈叔叔 <Jason.Chen> |
// +------------------------------------------------+
namespace app\common\model;
class MemberInfo extends _Init
{
protected $createTime = false;
protected $readonly = ['image'];
/**
* 获取头像地址
* @param [type] $value [description]
* @param [type] $data [description]
* @return [type] [description]
*/
protected function getAvatarAttr($value, $data)
{
$avatar = $data['headimgurl'];
if (!empty($avatar) && strpos($avatar, 'wx.qlogo.cn')) {
return rtrim($avatar, '0') . '132';
} elseif (empty($avatar)) {
return '/static/system/images/avatar.jpg';
} else {
return $avatar;
}
}
/**
* 获取头像地址
* @param [type] $value [description]
* @param [type] $data [description]
* @return [type] [description]
*/
protected function getQrcodeAttr($value, $data)
{
$path = Storage::where('id', $data['qrcode'])->value('path');
return $path ?? '';
}
/**
* 判断用户是否为 未过期的VIP会员
* @param [type] $value [description]
* @param [type] $data [description]
* @return [type] [description]
*/
protected function getIsVipAttr($value, $data)
{
if ($data['vip_time'] > time() && $data["is_vip"] == 1) {
return 1;
} else {
return 0;
}
}
protected function getVipTextAttr($value, $data)
{
if ($data['vip_time'] > time() && $data["is_vip"] == 1) {
return 'VIP会员';
} else {
return '普通会员';
}
}
protected function getVipTimeAttr($value, $data)
{
if ($value < time()) {
return '永久';
} else {
return date('Y-m-d', $value);
}
}
protected function getVipEndTimeAttr($value, $data)
{
return $data['vip_time'];
}
protected function getIndexTplAttr($value, $data)
{
if ($this->is_vip) {
return $value;
} else {
return 1;
}
}
protected function getMessageCountAttr($value, $data)
{
return Message::where('to_uid', $data['uid'])->count();
}
}