Commit 606ec7fc authored by jianghaiming's avatar jianghaiming

update:set

parent 54b16b0c
......@@ -8,6 +8,8 @@ use Helpers\Aes;
use Api\PhpServices\JwUser\JwUser;
use Api\PhpServices\Ksy\Ksyun;
use Api\PhpServices\ShopImage\GetImage;
use App\Services\goods\GoodsService;
class MarketinggoodsController extends Base
{
const KS3_BASE_URL = 'ks3-cn-beijing.ksyun.com';
......@@ -60,14 +62,17 @@ class MarketinggoodsController extends Base
$oldPrice = !empty($goodsSkuInfo['original_price']) ? $goodsSkuInfo['original_price'] : '';
$price = !empty($goodsSkuInfo['price']) ? $goodsSkuInfo['price'] : '';
if (!empty($goodsSkuInfo["desc_pic_url"])) {
$url = explode(",", $goodsSkuInfo["desc_pic_url"]);
//$url = explode(",", $goodsSkuInfo["desc_pic_url"]);
//$ksyun = Ksyun::getDownUrl($image, 'merchant-b', 'bp-yidian', 60);
$goodsImg = Ksyun::getPicUrl($appid,"goods_temp",$url[0],200,200,'jpeg');
//$goodsImg = Ksyun::getPicUrl($appid,"goods_temp",$url[0],200,200,'jpeg');
//$descPicUrlList = array_values($ksyun);
$goodsImg = GoodsService::getUrlList($goodsSkuInfo["desc_pic_url"]);
$goodsImg = !empty($goodsImg[0]) ? $goodsImg[0] : '';
}
$url = config('interface','goods.wx.appgc');
if(empty($url)){
throw new InterfaceException(['cus'=>0]);
......
......@@ -15,6 +15,7 @@ use Api\PhpServices\Sensitive\Sensitive;
use App\Exception\custom\InterfaceException;
use Api\PhpUtils\Http\Request;
use Helpers\Aes;
use Api\PhpServices\Ksy\Ksyun;
class CommonService
{
......@@ -57,4 +58,29 @@ class CommonService
return $goodsShareId;
}
public static function getUrlList($picUrlStr)
{
$data = $ksyunParams = [];
$strList = explode(",", $picUrlStr);
foreach ($strList as $key => $str) {
$arr = explode("/", $str);
if (count($arr) != 2) {
if (preg_match("/^http[s]{0,1}:\/\/([\w.]+\/?)\S*/", $str)) {
$data[] = $str;
} else {
continue;
}
} else {
$bucket = $arr[0];
$objectId = $arr[1];
$url = Ksyun::getPicUrl("merchant-b", 'goods_temp', $bucket . '/' . $objectId, 200, 200, 'jpeg');
$data[] = $url;
}
}
return $data;
}
}
\ No newline at end of file
......@@ -16,6 +16,7 @@ use App\Exception\custom\CodeSpecialException;
use Api\PhpServices\ShopImage\GetImage;
use Api\PhpServices\ShopImage\QR;
use App\Exception\custom\InterfaceException;
use App\Services\goods\GoodsService;
class DistributorService
{
......
......@@ -121,7 +121,7 @@ class MarketingGoodsService
$list[$i]['original_price'] = !empty($goodsSkuList[$value['goods_sku_id']]['original_price']) ? $goodsSkuList[$value['goods_sku_id']]['original_price'] : '';
$list[$i]['price'] = !empty($goodsSkuList[$value['goods_sku_id']]['price']) ? $goodsSkuList[$value['goods_sku_id']]['price'] : '';
$list[$i]['total_amount_order'] = !empty($goodsSkuList[$value['goods_sku_id']]['total_amount_order']) ? $goodsSkuList[$value['goods_sku_id']]['total_amount_order'] : '';
$list[$i]['desc_pic_url'] = !empty($goodsSkuList[$value['goods_sku_id']]['desc_pic_url']) ? self::getUrlList($goodsSkuList[$value['goods_sku_id']]['desc_pic_url']) : '';
$list[$i]['desc_pic_url'] = !empty($goodsSkuList[$value['goods_sku_id']]['desc_pic_url']) ? GoodsService::getUrlList($goodsSkuList[$value['goods_sku_id']]['desc_pic_url']) : '';
$shopId = !empty($list[$i]['shop_id']) ? $list[$i]['shop_id'] : '';
$list[$i]['shop_name'] = !empty($subShopList[$shopId]['shop_name']) ? $subShopList[$shopId]['shop_name'] : '';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment