Commit 9750a7c5 authored by luhongguang's avatar luhongguang

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

parents a47c2b93 a5ed12ee
......@@ -85,6 +85,17 @@ class DistributorController extends Base
$this->success(['result' => $info]);
}
/**
* 获取分享二维码
*
*/
public function distributor_code_urlAction()
{
$params = $this->params;
$info = DistributorService::distributorCodeUrl($params);
$this->success(['result' => $info]);
}
/**
* 获取待审核的团长列表
* 后台管理
......
......@@ -3,7 +3,10 @@
use App\Base\Base;
use App\Services\marketing\MarketingGoodsService;
use App\Exception\custom\DistributorException;
use App\Models\goods\mysql\GoodsSku;
use Helpers\Aes;
use Api\PhpServices\JwUser\JwUser;
use Api\PhpServices\Ksy\Ksyun;
class MarketinggoodsController extends Base
{
......@@ -41,8 +44,40 @@ class MarketinggoodsController extends Base
}
$goodsShareId = Aes::encrypt($content);
$jwUser = (new JwUser())->getUserByUserId(['user_id' => $userId]);
$avatar = '';
$nickName = '';
if (!empty($jwUser['data']) && $jwUser['code'] == 0) {
$avatar = !empty($jwUser['data']['avatar']) ? $jwUser['data']['avatar'] : '';
$nickName = !empty($jwUser['data']['nickName']) ? $jwUser['data']['nickName'] : '';
}
$goodsSkuInfo = GoodsSku::getRecord(['goods_sku_id' => $goodsSkuId]);
$goodsName = !empty($goodsSkuInfo['goods_name']) ? $goodsSkuInfo['goods_name'] : '';
$oldPrice = !empty($goodsSkuInfo['original_price']) ? $goodsSkuInfo['original_price'] : '';
$price = !empty($goodsSkuInfo['price']) ? $goodsSkuInfo['price'] : '';
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);
}
$goodsImg = !empty($descPicUrlList[0]) ? $descPicUrlList[0] : '';//商品图片url地址
//$qr_string = "";//二维码扫描后的内容
$data['goods_share_id'] = $goodsShareId;
$data['share_img_url'] = '';
$data['share_data'] = [
'goods_img' => $goodsImg,
'price' => $price,
'original_price' => $oldPrice,
'goods_name' => $goodsName,
'nick_name' => $nickName,
'avatar' => $avatar,
];
$result = ['result' => $data];
$this->success($result);
}
......
......@@ -12,6 +12,8 @@ use Api\PhpServices\Sensitive\Sensitive;
use Api\PhpServices\JwUser\JwUser;
use Api\PhpUtils\Common\TimeOut;
use App\Exception\custom\CodeSpecialException;
use Api\PhpServices\ShopImage\GetImage;
use Api\PhpServices\ShopImage\QR;
class DistributorService
{
......@@ -33,6 +35,14 @@ class DistributorService
$where['parent_user_id'] = $params['user_id'];
}
$totalNum = Distributor::getCount($where, "*");
$countWhere = [
'parent_user_id' => !empty($params['user_id']) ? $params['user_id'] : '',
"create_time[><]" => [date("Y-m-d 00:00:00"), date("Y-m-d 23:59:59")]
];
$todayNum = Distributor::getCount($countWhere, "*");
if (!empty($params['last_id'])) {
$where['id[<]'] = $params['last_id'];
}
......@@ -42,7 +52,8 @@ class DistributorService
$list = Distributor::getRecords($where);
$last = end($list);
$lastId = !empty($last['id']) ? $last['id'] : '';
$data = ['result' => $list,'last_id' => $lastId];
$data = ['result' => $list,'last_id' => $lastId,'distributor_today_num' => $todayNum,'distributor_total_num' => $totalNum];
return $data;
}
......@@ -281,7 +292,10 @@ class DistributorService
}
}
/**
* 获取二维码
*
*/
public static function distributor($params)
{
......@@ -303,6 +317,45 @@ class DistributorService
}
public static function distributorCodeUrl($params)
{
if (empty($params['user_id'])) {
throw new DistributorException(['cus' => 14]);
}
$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 ;
}
/**
......
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