Authored by whb

添加获取用户数据

@@ -72,4 +72,43 @@ trait YHMApi_App_V2_Base { @@ -72,4 +72,43 @@ trait YHMApi_App_V2_Base {
72 'image_list' => $image_list 72 'image_list' => $image_list
73 ); 73 );
74 } 74 }
  75 +
  76 + /**
  77 + * 通过uid获取用户数据
  78 + * @param integer $uid
  79 + *
  80 + * return array
  81 + */
  82 + public static function _getUserInfo($uid)
  83 + {
  84 + $baseInfo = YHMPassport_Models_Profile_Client::getByUid($uid);
  85 + if (empty($baseInfo))
  86 + {
  87 + return array();
  88 + }
  89 + //星级评定结果
  90 + $store_info = YHMStore_Models_Store_Client::getByUid($uid);
  91 + $star = YHMComment_Models_Comment_Client::getStarByStoreId($store_info['id']);
  92 + $head_ico = empty($baseInfo['head_ico']) ? YHMConfig_Image::USER_HEAD_ICO : $baseInfo['head_ico'];
  93 + $backgroup = empty($baseInfo['background_img']) ? YHMConfig_Image::USER_BACKGROUD_IMG : $baseInfo['background_img'];
  94 + $gender = empty($baseInfo['gender']) ? 0 : $baseInfo['gender'];
  95 + $area_code = empty($baseInfo['area_code']) ? 0 : $baseInfo['area_code'];
  96 + return array(
  97 + 'uid' => $uid,
  98 + 'nick_name' => $baseInfo['nick_name'],
  99 + 'gender' => $gender,
  100 + 'area_code' => $area_code,
  101 + 'identify' => $baseInfo['identity'],
  102 + 'head_ico' => YHMUpload_Images::template($head_ico, 'yhfair-user-head'),
  103 + 'background_img' => YHMUpload_Images::template($backgroup, 'yhfair-user-background'),
  104 + 'star' => $star,
  105 + 'user_type'=> $baseInfo['user_type'],
  106 + 'store_type' => $store_info['store_type'], //3为Master,2为潮店,1为潮人
  107 + 'is_real_name' =>($store_info['is_real']==0)?"N":"Y",
  108 + 'has_deposit' =>($store_info['is_bail']==0)?"N":"Y",
  109 + 'store_id' => $store_info['id'],
  110 + 'introduce' => $baseInfo['introduce'],
  111 + );
  112 + }
  113 +
75 } 114 }