Commit d68298c1 authored by luhongguang's avatar luhongguang

Merge branch 'develop' of https://git.yidian-inc.com:8021/bp/goods into develop

parents 400bb296 e2711753
......@@ -28,8 +28,8 @@ class MarketinggoodsController extends Base
$userId = !empty($params['user_id']) ? $params['user_id'] : '';
$marketingId = !empty($params['marketing_id']) ? $params['marketing_id'] : '';
$goodsSkuId = !empty($params['goods_sku_id']) ? $params['goods_sku_id'] : '';
$appid = !empty($params['appid']) ? $params['appid'] : 'merchant-b';
$content = $userId .'_' .$marketingId . '_' .$goodsSkuId;
if (empty($userId)) {
throw new DistributorException(['cus'=>14]);
......@@ -61,15 +61,22 @@ class MarketinggoodsController extends Base
if (!empty($goodsSkuInfo["desc_pic_url"])) {
$image = explode(",", $goodsSkuInfo["desc_pic_url"]);
$ksyun = Ksyun::getDownUrl($image, 'merchant-b', 'bp-yidian', 60);
$descPicUrlList = array_values($ksyun);
$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');
//$descPicUrlList = array_values($ksyun);
}
$goodsImg = !empty($descPicUrlList[0]) ? $descPicUrlList[0] : '';//商品图片url地址
//$goodsImg = !empty($descPicUrlList[0]) ? $descPicUrlList[0] : '';//商品图片url地址
//$qr_string = "";//二维码扫描后的内容
$data['goods_share_id'] = $goodsShareId;
$data['share_img_url'] = '';
$url = config('interface','goods.marketing.generate_share_goods');
if(empty($url)){
throw new InterfaceException(['cus'=>0]);
}
$goods_share_url = 'ticket/detail.html?view=1P&fromType=1&goods_sku_id=awPZqLl5KtXQZh6k&goodsShareId='. $goodsShareId;
$data['goods_share_id'] = $goods_share_url;
$data['share_img_url'] = $goodsImg;
$data['share_data'] = [
'goods_img' => $goodsImg,
'price' => $price,
......
......@@ -14,6 +14,7 @@ use Api\PhpUtils\Common\TimeOut;
use App\Exception\custom\CodeSpecialException;
use Api\PhpServices\ShopImage\GetImage;
use Api\PhpServices\ShopImage\QR;
use App\Exception\custom\InterfaceException;
class DistributorService
{
......@@ -138,6 +139,8 @@ class DistributorService
$mobile = !empty($params['mobile']) ? $params['mobile'] : '';
$distributorCode = !empty($params['distributor_code']) ? $params['distributor_code'] : '';
$smsCode = !empty($params['sms_code']) ? $params['sms_code'] : '';
$shareUserId = !empty($params['share_user_id']) ? $params['share_user_id'] : '';
if (empty($smsCode)) {
throw new DistributorException(['cus'=>11]);
}
......@@ -146,7 +149,7 @@ class DistributorService
if (empty($distributorCode)) {
throw new DistributorException(['cus'=>9]);
}
$info = Distributor::getRecord(['distributor_code' => $distributorCode]);
$info = Distributor::getRecord(['user_id' => $shareUserId]);
if (empty($info)) {
throw new DistributorException(['cus'=>10]);
......@@ -342,34 +345,13 @@ class DistributorService
$where['user_id'] = $params['user_id'];
$data = [];
$info = Distributor::getRecord($where);
//$distributorCodeUrl = (new GetImage())->getLeaderShare($info['distributor_code']);
// $qr = new QR("http://www.baidu.com");
// $qr->setWriteFile(1);
// $aa = $qr->get();
// print_r($aa);
//echo $info['distributor_code'] = "http://www.baidu.com";
$distributorCodeUrl = (new GetImage())->getLeaderShare("123456");
//$distributorCodeUrl = (new GetImage())->getCoupon("店铺测试", "商品苹果", "99.23", "北京", "哼哼");
//$distributorCodeUrl = (new GetImage())->getCoupon("店铺测试", "商品苹果", "99.23", "北京", "哼哼");
//$distributorCodeUrl = (new GetImage())->getGoods('', '', "以后", "商品苹果", "111", "12", $old_price = 0, $buy_count=0);
//$qr = new QR("http://www.baidu.com");
//$qr->setWriteFile(1);
// $pngData = $qr->get();
//return $distributorCodeUrl ;
$url = config('interface','goods.wx.appgc');
if(empty($url)){
throw new InterfaceException(['cus'=>0]);
}
$codeUrl = $url.'/#/ticket/commander/'.$params['user_id'].'/-';
$distributorCodeUrl = (new GetImage())->getLeaderShare($codeUrl);
}
......
......@@ -166,6 +166,7 @@ class MarketingGoodsService
/**
* 获取图片地址,这里因为bucket可能不同,不保证图片顺序
* @param $picUrlStr
......@@ -175,7 +176,7 @@ class MarketingGoodsService
{
$data = $ksyunParams = [];
$strList = explode(",", $picUrlStr);
foreach ($strList as $str) {
foreach ($strList as $key => $str) {
$arr = explode("/", $str);
if (count($arr) != 2) {
continue;
......@@ -183,12 +184,11 @@ class MarketingGoodsService
$bucket = $arr[0];
$objectId = $arr[1];
$ksyunParams[$bucket][] = $objectId;
}
foreach ($ksyunParams as $bucket => $objectIds) {
$ksyun = Ksyun::getDownUrl($objectIds, 'merchant-b', $bucket, 60);
$data = array_merge($data, array_values($ksyun));
$url = Ksyun::getPicUrl("merchant-b", 'goods_temp', $bucket . '/' . $objectId, 200, 200, 'jpeg');
$data[] = $url;
}
return $data;
}
}
......
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