细节优化

feat/task1-c-wallet
gongfuxiang 2019-06-10 00:54:01 +08:00
parent 7397122917
commit 22f36f06b9
2 changed files with 17 additions and 8 deletions

View File

@ -24,8 +24,6 @@ use app\service\GoodsService;
*/
class Search extends Common
{
private $params;
/**
* 构造方法
* @author Devil
@ -115,9 +113,6 @@ class Search extends Common
*/
private function ParamsInit()
{
// 参数
$params = input();
// 品牌id
$this->params['brand_id'] = isset($params['brand_id']) ? intval($params['brand_id']) : 0;

View File

@ -1934,11 +1934,19 @@ class UserService
* @version 1.0.0
* @date 2019-05-05
* @desc description
* @param [int] $user_id [用户id]
* @param [int] $user_id [用户id]
* @param [array] $user [指定用户信息]
* @param [boolean] $is_privacy [是否隐私处理展示用户名]
*/
public static function GetUserViewInfo($user_id)
public static function GetUserViewInfo($user_id, $user = [], $is_privacy = false)
{
$user = Db::name('User')->field('username,nickname,mobile,email,avatar')->find($user_id);
// 是否指定用户信息
if(empty($user) && !empty($user_id))
{
$user = Db::name('User')->field('username,nickname,mobile,email,avatar')->find($user_id);
}
// 开始处理用户信息
if(!empty($user))
{
$user['user_name_view'] = $user['username'];
@ -1955,6 +1963,12 @@ class UserService
$user['user_name_view'] = $user['email'];
}
// 处理展示用户
if($is_privacy === true)
{
$user['user_name_view'] = substr($user['user_name_view'], 0, 3).'***'.substr($user['user_name_view'], -3);
}
// 头像
if(!empty($user['avatar']))
{