|
|
@@ -12,249 +12,252 @@ use yii\imagine\Image;
|
|
|
class business
|
|
|
{
|
|
|
|
|
|
- //支付方式对应资金要保存的字段 shish 2019.8.20
|
|
|
- public static function savePayWayAmount($object, $amount, $payWay)
|
|
|
- {
|
|
|
- switch ($payWay) {
|
|
|
- case 0:
|
|
|
- $object->weixin += $amount;
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- $object->alipay += $amount;
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- $object->balancePay += $amount;
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- $object->cash += $amount;
|
|
|
- break;
|
|
|
- default:
|
|
|
- util::fail('付款方式不存在');
|
|
|
- }
|
|
|
- return $object;
|
|
|
- }
|
|
|
+ //支付方式对应资金要保存的字段 shish 2019.8.20
|
|
|
+ public static function savePayWayAmount($object, $amount, $payWay)
|
|
|
+ {
|
|
|
+ switch ($payWay) {
|
|
|
+ case 0:
|
|
|
+ $object->weixin += $amount;
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ $object->alipay += $amount;
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ $object->balancePay += $amount;
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ $object->cash += $amount;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ util::fail('付款方式不存在');
|
|
|
+ }
|
|
|
+ return $object;
|
|
|
+ }
|
|
|
|
|
|
- //对商品图片转化 shish 2019.12.2
|
|
|
- public static function formatGoodsImg($info)
|
|
|
- {
|
|
|
- $shopImg = isset($info['shopImg']) ? $info['shopImg'] : [];
|
|
|
- unset($info['shopImg']);
|
|
|
- //没有保存图片返回空
|
|
|
- if (empty($shopImg)) {
|
|
|
- $info['shortImgList'] = [];
|
|
|
- $info['imgList'] = [];
|
|
|
- $info['smallImgList'] = [];
|
|
|
- return $info;
|
|
|
- }
|
|
|
- $arr = json_decode($shopImg, true);
|
|
|
- //图片内容转化失败返回空
|
|
|
- if (is_array($arr) == false) {
|
|
|
- $info['shortImgList'] = [];
|
|
|
- $info['imgList'] = [];
|
|
|
- $info['smallImgList'] = [];
|
|
|
- return $info;
|
|
|
- }
|
|
|
- $imgList = [];
|
|
|
- $smallImgList = [];
|
|
|
- $prefixImgUrl = imgUtil::getPrefix();
|
|
|
- $imageRoot = dirUtil::getImgUploadDir();
|
|
|
- foreach ($arr as $imgUrl) {
|
|
|
- $smallImg = self::getSmallImg($imgUrl);
|
|
|
- $small = $prefixImgUrl . $smallImg;
|
|
|
- $normal = $prefixImgUrl . $imgUrl;
|
|
|
+ //对商品图片转化 shish 2019.12.2
|
|
|
+ public static function formatGoodsImg($info)
|
|
|
+ {
|
|
|
+ $shopImg = isset($info['shopImg']) ? $info['shopImg'] : [];
|
|
|
+ unset($info['shopImg']);
|
|
|
+ //没有保存图片返回空
|
|
|
+ if (empty($shopImg)) {
|
|
|
+ $info['shortImgList'] = [];
|
|
|
+ $info['imgList'] = [];
|
|
|
+ $info['smallImgList'] = [];
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
+ $arr = json_decode($shopImg, true);
|
|
|
+ //图片内容转化失败返回空
|
|
|
+ if (is_array($arr) == false) {
|
|
|
+ $info['shortImgList'] = [];
|
|
|
+ $info['imgList'] = [];
|
|
|
+ $info['smallImgList'] = [];
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
+ $imgList = [];
|
|
|
+ $smallImgList = [];
|
|
|
+ $prefixImgUrl = imgUtil::getPrefix();
|
|
|
+ $imageRoot = dirUtil::getImgUploadDir();
|
|
|
+ foreach ($arr as $imgUrl) {
|
|
|
+ $smallImg = self::getSmallImg($imgUrl);
|
|
|
+ $small = $prefixImgUrl . $smallImg;
|
|
|
+ $normal = $prefixImgUrl . $imgUrl;
|
|
|
|
|
|
- /*
|
|
|
- $preImg = $imageRoot . str_replace('/uploads', '', $imgUrl);
|
|
|
- if (file_exists($preImg)) {
|
|
|
- //没有小图则生成小图,兼容旧系统
|
|
|
- if (file_exists($imageRoot . $smallImg) == false) {
|
|
|
- $imgInfo = getimagesize($preImg);
|
|
|
- $width = isset($imgInfo[0]) ? $imgInfo[0] : 0;
|
|
|
- $height = isset($imgInfo[1]) ? $imgInfo[1] : 0;
|
|
|
- if ($width > 0) {
|
|
|
- //生成小图 300px
|
|
|
- $smallWidth = 300;
|
|
|
- $smallHeight = ceil((300 * $height) / $width);
|
|
|
- $smallFullPathFile = $imageRoot . str_replace('/uploads', '', $smallImg);
|
|
|
- Image::thumbnail($preImg, $smallWidth, $smallHeight)->save($smallFullPathFile, ['quality' => 100]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- */
|
|
|
+ /*
|
|
|
+ $preImg = $imageRoot . str_replace('/uploads', '', $imgUrl);
|
|
|
+ if (file_exists($preImg)) {
|
|
|
+ //没有小图则生成小图,兼容旧系统
|
|
|
+ if (file_exists($imageRoot . $smallImg) == false) {
|
|
|
+ $imgInfo = getimagesize($preImg);
|
|
|
+ $width = isset($imgInfo[0]) ? $imgInfo[0] : 0;
|
|
|
+ $height = isset($imgInfo[1]) ? $imgInfo[1] : 0;
|
|
|
+ if ($width > 0) {
|
|
|
+ //生成小图 300px
|
|
|
+ $smallWidth = 300;
|
|
|
+ $smallHeight = ceil((300 * $height) / $width);
|
|
|
+ $smallFullPathFile = $imageRoot . str_replace('/uploads', '', $smallImg);
|
|
|
+ Image::thumbnail($preImg, $smallWidth, $smallHeight)->save($smallFullPathFile, ['quality' => 100]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ */
|
|
|
|
|
|
- $imgList[] = $normal;
|
|
|
- $smallImgList[] = $small;
|
|
|
- }
|
|
|
- $info['shortImgList'] = $arr;
|
|
|
- $info['imgList'] = $imgList;
|
|
|
- $info['smallImgList'] = $smallImgList;
|
|
|
- return $info;
|
|
|
- }
|
|
|
+ $imgList[] = $normal;
|
|
|
+ $smallImgList[] = $small;
|
|
|
+ }
|
|
|
+ $info['shortImgList'] = $arr;
|
|
|
+ $info['imgList'] = $imgList;
|
|
|
+ $info['smallImgList'] = $smallImgList;
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
|
|
|
- //对商品款式的转化 shish 2019.12.4
|
|
|
- public static function formatGoodsStyleImg($info)
|
|
|
- {
|
|
|
- $imgUrl = isset($info['picture']) ? $info['picture'] : '';
|
|
|
- if (empty($imgUrl)) {
|
|
|
- $info['img'] = '';
|
|
|
- }
|
|
|
- $prefixImgUrl = imgUtil::getPrefix();
|
|
|
- $smallImg = self::getSmallImg($imgUrl);
|
|
|
- $small = $prefixImgUrl . $smallImg;
|
|
|
+ //对商品款式的转化 shish 2019.12.4
|
|
|
+ public static function formatGoodsStyleImg($info)
|
|
|
+ {
|
|
|
+ $imgUrl = isset($info['picture']) ? $info['picture'] : '';
|
|
|
+ if (empty($imgUrl)) {
|
|
|
+ $info['img'] = '';
|
|
|
+ }
|
|
|
+ $prefixImgUrl = imgUtil::getPrefix();
|
|
|
+ $smallImg = self::getSmallImg($imgUrl);
|
|
|
+ $small = $prefixImgUrl . $smallImg;
|
|
|
|
|
|
|
|
|
- //没有小图的生成小图(兼容旧系统) shish 2020.6.4
|
|
|
- $imageRoot = dirUtil::getImgUploadDir();
|
|
|
- $preImg = $imageRoot . str_replace('/uploads', '', $imgUrl);
|
|
|
- if (file_exists($preImg)) {
|
|
|
- //没有小图则生成小图,兼容旧系统
|
|
|
- if (file_exists($imageRoot . $smallImg) == false) {
|
|
|
- $imgInfo = getimagesize($preImg);
|
|
|
- $width = isset($imgInfo[0]) ? $imgInfo[0] : 0;
|
|
|
- $height = isset($imgInfo[1]) ? $imgInfo[1] : 0;
|
|
|
- if ($width > 0) {
|
|
|
- //生成小图 150px
|
|
|
- $smallWidth = 150;
|
|
|
- $smallHeight = ceil((150 * $height) / $width);
|
|
|
- $smallFullPathFile = $imageRoot . str_replace('/uploads', '', $smallImg);
|
|
|
- Image::thumbnail($preImg, $smallWidth, $smallHeight)->save($smallFullPathFile, ['quality' => 100]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ //没有小图的生成小图(兼容旧系统) shish 2020.6.4
|
|
|
+ $imageRoot = dirUtil::getImgUploadDir();
|
|
|
+ $preImg = $imageRoot . str_replace('/uploads', '', $imgUrl);
|
|
|
+ if (file_exists($preImg)) {
|
|
|
+ //没有小图则生成小图,兼容旧系统
|
|
|
+ if (file_exists($imageRoot . $smallImg) == false) {
|
|
|
+ $imgInfo = getimagesize($preImg);
|
|
|
+ $width = isset($imgInfo[0]) ? $imgInfo[0] : 0;
|
|
|
+ $height = isset($imgInfo[1]) ? $imgInfo[1] : 0;
|
|
|
+ if ($width > 0) {
|
|
|
+ //生成小图 150px
|
|
|
+ $smallWidth = 150;
|
|
|
+ $smallHeight = ceil((150 * $height) / $width);
|
|
|
+ $smallFullPathFile = $imageRoot . str_replace('/uploads', '', $smallImg);
|
|
|
+ Image::thumbnail($preImg, $smallWidth, $smallHeight)->save($smallFullPathFile, ['quality' => 100]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- $info['img'] = $small;
|
|
|
- return $info;
|
|
|
- }
|
|
|
+ $info['img'] = $small;
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
|
|
|
- //图库图片的转化
|
|
|
- public static function formatPic($info)
|
|
|
- {
|
|
|
- $imgUrl = isset($info['img']) ? $info['img'] : '';
|
|
|
- if (empty($imgUrl)) {
|
|
|
- $info['imgUrl'] = '';
|
|
|
- }
|
|
|
- $prefixImgUrl = imgUtil::getPrefix();
|
|
|
- $smallImg = self::getSmallImg($imgUrl);
|
|
|
- $small = $prefixImgUrl . $smallImg;
|
|
|
- $info['imgUrl'] = $small;
|
|
|
- return $info;
|
|
|
- }
|
|
|
+ //图库图片的转化
|
|
|
+ public static function formatPic($info)
|
|
|
+ {
|
|
|
+ $imgUrl = isset($info['img']) ? $info['img'] : '';
|
|
|
+ if (empty($imgUrl)) {
|
|
|
+ $info['imgUrl'] = '';
|
|
|
+ }
|
|
|
+ $prefixImgUrl = imgUtil::getPrefix();
|
|
|
+ $smallImg = self::getSmallImg($imgUrl);
|
|
|
+ $small = $prefixImgUrl . $smallImg;
|
|
|
+ $info['imgUrl'] = $small;
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
|
|
|
- //分类图的处理
|
|
|
- public static function formatCategoryImg($info)
|
|
|
- {
|
|
|
- $imgUrl = isset($info['img']) ? $info['img'] : '';
|
|
|
- if (empty($imgUrl)) {
|
|
|
- $info['imgUrl'] = '';
|
|
|
- }
|
|
|
- $prefixImgUrl = imgUtil::getPrefix();
|
|
|
- $smallImg = self::getSmallImg($imgUrl);
|
|
|
- $small = $prefixImgUrl . $smallImg;
|
|
|
- $info['imgUrl'] = $small;
|
|
|
- return $info;
|
|
|
- }
|
|
|
+ //分类图的处理
|
|
|
+ public static function formatCategoryImg($info)
|
|
|
+ {
|
|
|
+ $imgUrl = isset($info['img']) ? $info['img'] : '';
|
|
|
+ if (empty($imgUrl)) {
|
|
|
+ $info['imgUrl'] = '';
|
|
|
+ }
|
|
|
+ $prefixImgUrl = imgUtil::getPrefix();
|
|
|
+ $smallImg = self::getSmallImg($imgUrl);
|
|
|
+ $small = $prefixImgUrl . $smallImg;
|
|
|
+ $info['imgUrl'] = $small;
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
|
|
|
- //客户头像处理 shish 2019.12.20
|
|
|
- public static function formatUserAvatar($info)
|
|
|
- {
|
|
|
- $imgUrl = isset($info['avatar']) ? $info['avatar'] : '';
|
|
|
- $prefixImgUrl = imgUtil::getPrefix();
|
|
|
- $dir = dirUtil::getImgDir();
|
|
|
- if (empty($imgUrl) || file_exists($dir . $imgUrl) == false) {
|
|
|
- $defaultImg = $prefixImgUrl . '/retail/default-img.png';
|
|
|
- $info['avatarUrl'] = $defaultImg;
|
|
|
- $info['smallAvatarUrl'] = $defaultImg;
|
|
|
- return $info;
|
|
|
- }
|
|
|
- $smallImg = self::getSmallImg($imgUrl);
|
|
|
- $small = $prefixImgUrl . $smallImg;
|
|
|
- $info['smallAvatarUrl'] = $small;
|
|
|
- $info['avatarUrl'] = $prefixImgUrl . $imgUrl;
|
|
|
- $info['avatar'] = $prefixImgUrl . $imgUrl;
|
|
|
- return $info;
|
|
|
- }
|
|
|
+ //客户头像处理 shish 2019.12.20
|
|
|
+ public static function formatUserAvatar($info)
|
|
|
+ {
|
|
|
+ $imgUrl = isset($info['avatar']) ? $info['avatar'] : '';
|
|
|
+ $prefixImgUrl = imgUtil::getPrefix();
|
|
|
+ $dir = dirUtil::getImgDir();
|
|
|
+ if (empty($imgUrl) || file_exists($dir . $imgUrl) == false) {
|
|
|
+ $defaultImg = $prefixImgUrl . '/retail/default-img.png';
|
|
|
+ $info['avatarUrl'] = $defaultImg;
|
|
|
+ $info['smallAvatarUrl'] = $defaultImg;
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
+ $smallImg = self::getSmallImg($imgUrl);
|
|
|
+ $small = $prefixImgUrl . $smallImg;
|
|
|
+ $info['smallAvatarUrl'] = $small;
|
|
|
+ $info['avatarUrl'] = $prefixImgUrl . $imgUrl;
|
|
|
+ $info['avatar'] = $prefixImgUrl . $imgUrl;
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
|
|
|
- public static function formatOrderGoodsCover($info)
|
|
|
- {
|
|
|
- $imgUrl = isset($info['cover']) ? $info['cover'] : '';
|
|
|
- if (empty($imgUrl)) {
|
|
|
- $info['coverUrl'] = '';
|
|
|
- $info['smallCoverUrl'] = '';
|
|
|
- return $info;
|
|
|
- }
|
|
|
- $prefixImgUrl = imgUtil::getPrefix();
|
|
|
- $smallImg = self::getSmallImg($imgUrl);
|
|
|
- $small = $prefixImgUrl . $smallImg;
|
|
|
- $info['smallCoverUrl'] = $small;
|
|
|
- $info['coverUrl'] = $prefixImgUrl . $imgUrl;
|
|
|
- return $info;
|
|
|
- }
|
|
|
+ public static function formatOrderGoodsCover($info)
|
|
|
+ {
|
|
|
+ $imgUrl = isset($info['cover']) ? $info['cover'] : '';
|
|
|
+ if (empty($imgUrl)) {
|
|
|
+ $info['coverUrl'] = '';
|
|
|
+ $info['smallCoverUrl'] = '';
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
+ $prefixImgUrl = imgUtil::getPrefix();
|
|
|
+ $smallImg = self::getSmallImg($imgUrl);
|
|
|
+ $small = $prefixImgUrl . $smallImg;
|
|
|
+ $info['smallCoverUrl'] = $small;
|
|
|
+ $info['coverUrl'] = $prefixImgUrl . $imgUrl;
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
|
|
|
- //商家公众号logo处理 shish 2019.12.20
|
|
|
- public static function formatMerchantLogo($info)
|
|
|
- {
|
|
|
- $imgUrl = isset($info['logo']) ? $info['logo'] : '';
|
|
|
- $prefixImgUrl = imgUtil::getPrefix();
|
|
|
- if (empty($imgUrl)) {
|
|
|
- $info['logoUrl'] = $prefixImgUrl . '/retail/default-img.png';
|
|
|
- $info['smallLogoUrl'] = $prefixImgUrl . '/retail/default-img.png';
|
|
|
- $info['smallWxQrCodeUrl'] = $prefixImgUrl . '/retail/default-img.png';
|
|
|
- $info['wxQrCodeUrl'] = $prefixImgUrl . '/retail/default-img.png';
|
|
|
- return $info;
|
|
|
- }
|
|
|
- //logo
|
|
|
- $smallImg = self::getSmallImg($imgUrl);
|
|
|
- $small = $prefixImgUrl . $smallImg;
|
|
|
- $info['smallLogoUrl'] = $small;
|
|
|
- $info['logoUrl'] = $prefixImgUrl . $imgUrl;
|
|
|
- //二维码
|
|
|
- $smallImg = self::getSmallImg($info['wxQrCodeUrl']);
|
|
|
- $small = $prefixImgUrl . $smallImg;
|
|
|
- $info['smallWxQrCodeUrl'] = $small;
|
|
|
- $info['wxQrCodeUrl'] = $prefixImgUrl . $imgUrl;
|
|
|
+ //商家公众号logo处理 shish 2019.12.20
|
|
|
+ public static function formatMerchantLogo($info)
|
|
|
+ {
|
|
|
+ $imgUrl = isset($info['logo']) ? $info['logo'] : '';
|
|
|
+ $prefixImgUrl = imgUtil::getPrefix();
|
|
|
+ if (empty($imgUrl)) {
|
|
|
+ $info['logoUrl'] = $prefixImgUrl . '/retail/default-img.png';
|
|
|
+ $info['shortLogoUrl'] = 'retail/default-img.png';
|
|
|
+ $info['smallLogoUrl'] = $prefixImgUrl . '/retail/default-img.png';
|
|
|
+ $info['shortSmallLogoUrl'] = 'retail/default-img.png';
|
|
|
+ $info['smallWxQrCodeUrl'] = $prefixImgUrl . '/retail/default-img.png';
|
|
|
+ $info['wxQrCodeUrl'] = $prefixImgUrl . '/retail/default-img.png';
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
+ //logo
|
|
|
+ $smallImg = self::getSmallImg($imgUrl);
|
|
|
+ $small = $prefixImgUrl . $smallImg;
|
|
|
+ $info['smallLogoUrl'] = $small;
|
|
|
+ $info['shortSmallLogoUrl'] = $smallImg;
|
|
|
+ $info['logoUrl'] = $prefixImgUrl . $imgUrl;
|
|
|
+ $info['shortLogoUrl'] = $imgUrl;
|
|
|
+ //二维码
|
|
|
+ $smallImg = self::getSmallImg($info['wxQrCodeUrl']);
|
|
|
+ $small = $prefixImgUrl . $smallImg;
|
|
|
+ $info['smallWxQrCodeUrl'] = $small;
|
|
|
+ $info['wxQrCodeUrl'] = $prefixImgUrl . $imgUrl;
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
|
|
|
- return $info;
|
|
|
- }
|
|
|
+ //上传的图片进行转换 shish 2019.12.28
|
|
|
+ public static function formatUploadImg($imgUrl)
|
|
|
+ {
|
|
|
+ $prefix = imgUtil::getPrefix();
|
|
|
+ $small = self::getSmallImg($imgUrl);
|
|
|
+ $url = $prefix . $imgUrl;
|
|
|
+ $smallUrl = $prefix . $small;
|
|
|
+ return ['url' => $url, 'smallUrl' => $smallUrl];
|
|
|
+ }
|
|
|
|
|
|
- //上传的图片进行转换 shish 2019.12.28
|
|
|
- public static function formatUploadImg($imgUrl)
|
|
|
- {
|
|
|
- $prefix = imgUtil::getPrefix();
|
|
|
- $small = self::getSmallImg($imgUrl);
|
|
|
- $url = $prefix . $imgUrl;
|
|
|
- $smallUrl = $prefix . $small;
|
|
|
- return ['url' => $url, 'smallUrl' => $smallUrl];
|
|
|
- }
|
|
|
+ //取小图,尺寸 200px shish 2019.12.4
|
|
|
+ public static function getSmallImg($imgUrl)
|
|
|
+ {
|
|
|
+ //2021.3.18 去除尺寸,之后可以用oss裁剪
|
|
|
+ return $imgUrl;
|
|
|
+ //如果没有小图需要生成小图
|
|
|
+ $pos = strrpos($imgUrl, '.');
|
|
|
+ $pre = substr($imgUrl, 0, $pos);
|
|
|
+ $ext = substr($imgUrl, ($pos + 1));
|
|
|
+ $smallImg = $pre . '_small.' . $ext;
|
|
|
+ return $smallImg;
|
|
|
+ }
|
|
|
|
|
|
- //取小图,尺寸 200px shish 2019.12.4
|
|
|
- public static function getSmallImg($imgUrl)
|
|
|
- {
|
|
|
- //2021.3.18 去除尺寸,之后可以用oss裁剪
|
|
|
- return $imgUrl;
|
|
|
- //如果没有小图需要生成小图
|
|
|
- $pos = strrpos($imgUrl, '.');
|
|
|
- $pre = substr($imgUrl, 0, $pos);
|
|
|
- $ext = substr($imgUrl, ($pos + 1));
|
|
|
- $smallImg = $pre . '_small.' . $ext;
|
|
|
- return $smallImg;
|
|
|
- }
|
|
|
-
|
|
|
- //平台员工头像处理 shish 2020.1.5
|
|
|
- public static function formatStaffAvatar($info)
|
|
|
- {
|
|
|
- $imgUrl = isset($info['avatar']) ? $info['avatar'] : '';
|
|
|
- if (empty($imgUrl)) {
|
|
|
- $info['avatarUrl'] = '';
|
|
|
- $info['smallAvatarUrl'] = '';
|
|
|
- return $info;
|
|
|
- }
|
|
|
- $prefixImgUrl = imgUtil::getPrefix();
|
|
|
- $smallImg = self::getSmallImg($imgUrl);
|
|
|
- $small = $prefixImgUrl . $smallImg;
|
|
|
- $info['smallAvatarUrl'] = $small;
|
|
|
- $info['avatarUrl'] = $prefixImgUrl . $imgUrl;
|
|
|
- return $info;
|
|
|
- }
|
|
|
+ //平台员工头像处理 shish 2020.1.5
|
|
|
+ public static function formatStaffAvatar($info)
|
|
|
+ {
|
|
|
+ $imgUrl = isset($info['avatar']) ? $info['avatar'] : '';
|
|
|
+ if (empty($imgUrl)) {
|
|
|
+ $info['avatarUrl'] = '';
|
|
|
+ $info['smallAvatarUrl'] = '';
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
+ $prefixImgUrl = imgUtil::getPrefix();
|
|
|
+ $smallImg = self::getSmallImg($imgUrl);
|
|
|
+ $small = $prefixImgUrl . $smallImg;
|
|
|
+ $info['smallAvatarUrl'] = $small;
|
|
|
+ $info['avatarUrl'] = $prefixImgUrl . $imgUrl;
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
|
|
|
}
|