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
...@@ -84,6 +84,17 @@ class DistributorController extends Base ...@@ -84,6 +84,17 @@ class DistributorController extends Base
$info = DistributorService::distributor($params); $info = DistributorService::distributor($params);
$this->success(['result' => $info]); $this->success(['result' => $info]);
} }
/**
* 获取分享二维码
*
*/
public function distributor_code_urlAction()
{
$params = $this->params;
$info = DistributorService::distributorCodeUrl($params);
$this->success(['result' => $info]);
}
/** /**
* 获取待审核的团长列表 * 获取待审核的团长列表
...@@ -156,7 +167,7 @@ class DistributorController extends Base ...@@ -156,7 +167,7 @@ class DistributorController extends Base
*/ */
public function add_distributorAction() public function add_distributorAction()
{ {
} }
......
...@@ -3,7 +3,10 @@ ...@@ -3,7 +3,10 @@
use App\Base\Base; use App\Base\Base;
use App\Services\marketing\MarketingGoodsService; use App\Services\marketing\MarketingGoodsService;
use App\Exception\custom\DistributorException; use App\Exception\custom\DistributorException;
use App\Models\goods\mysql\GoodsSku;
use Helpers\Aes; use Helpers\Aes;
use Api\PhpServices\JwUser\JwUser;
use Api\PhpServices\Ksy\Ksyun;
class MarketinggoodsController extends Base class MarketinggoodsController extends Base
{ {
...@@ -40,9 +43,41 @@ class MarketinggoodsController extends Base ...@@ -40,9 +43,41 @@ class MarketinggoodsController extends Base
throw new DistributorException(['cus'=>16]); throw new DistributorException(['cus'=>16]);
} }
$goodsShareId = Aes::encrypt($content); $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['goods_share_id'] = $goodsShareId;
$data['share_img_url'] = ''; $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]; $result = ['result' => $data];
$this->success($result); $this->success($result);
} }
......
...@@ -11,7 +11,9 @@ use App\Exception\custom\DistributorException; ...@@ -11,7 +11,9 @@ use App\Exception\custom\DistributorException;
use Api\PhpServices\Sensitive\Sensitive; use Api\PhpServices\Sensitive\Sensitive;
use Api\PhpServices\JwUser\JwUser; use Api\PhpServices\JwUser\JwUser;
use Api\PhpUtils\Common\TimeOut; use Api\PhpUtils\Common\TimeOut;
use App\Exception\custom\CodeSpecialException; use App\Exception\custom\CodeSpecialException;
use Api\PhpServices\ShopImage\GetImage;
use Api\PhpServices\ShopImage\QR;
class DistributorService class DistributorService
{ {
...@@ -33,6 +35,14 @@ class DistributorService ...@@ -33,6 +35,14 @@ class DistributorService
$where['parent_user_id'] = $params['user_id']; $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'])) { if (!empty($params['last_id'])) {
$where['id[<]'] = $params['last_id']; $where['id[<]'] = $params['last_id'];
} }
...@@ -42,7 +52,8 @@ class DistributorService ...@@ -42,7 +52,8 @@ class DistributorService
$list = Distributor::getRecords($where); $list = Distributor::getRecords($where);
$last = end($list); $last = end($list);
$lastId = !empty($last['id']) ? $last['id'] : ''; $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; return $data;
} }
...@@ -281,7 +292,10 @@ class DistributorService ...@@ -281,7 +292,10 @@ class DistributorService
} }
} }
/**
* 获取二维码
*
*/
public static function distributor($params) public static function distributor($params)
{ {
...@@ -291,7 +305,7 @@ class DistributorService ...@@ -291,7 +305,7 @@ class DistributorService
$where['user_id'] = $params['user_id']; $where['user_id'] = $params['user_id'];
$data = []; $data = [];
$info = Distributor::getRecord($where); $info = Distributor::getRecord($where);
if (!empty($info)) { if (!empty($info)) {
$data['distributor_code'] = $info['distributor_code']; $data['distributor_code'] = $info['distributor_code'];
$data['is_distributor'] = 1; $data['is_distributor'] = 1;
...@@ -303,6 +317,45 @@ class DistributorService ...@@ -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