Commit 9337a3ee authored by jianghaiming's avatar jianghaiming

Merge branch 'ledger20211008' into develop

parents 9b6db038 dc53fb65
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
use App\Base\Base; use App\Base\Base;
use App\Services\marketing\MarketingGoodsService; use App\Services\marketing\MarketingGoodsService;
use App\Services\marketing\MarketingService;
use App\Exception\custom\DistributorException; use App\Exception\custom\DistributorException;
use App\Models\goods\mysql\GoodsSku; use App\Models\goods\mysql\GoodsSku;
use Helpers\Aes; use Helpers\Aes;
...@@ -107,6 +108,19 @@ class MarketinggoodsController extends Base ...@@ -107,6 +108,19 @@ class MarketinggoodsController extends Base
$list = MarketingGoodsService::getMarketingGoodsList($params); $list = MarketingGoodsService::getMarketingGoodsList($params);
$this->success($list); $this->success($list);
} }
/**
* 获取活动商品列表
* @throws Exception
*/
public function get_goods_listAction()
{
$params = $this->params;
$marketingId = !empty($params['marketing_id']) ? $params['marketing_id'] : '';
$list = MarketingService::getGoodsSkuListByMarketingId($marketingId);
$data['goods_list'] = $list;
$this->success($data);
}
......
...@@ -42,6 +42,7 @@ use App\Exception\custom\InterfaceException; ...@@ -42,6 +42,7 @@ use App\Exception\custom\InterfaceException;
class GoodsService class GoodsService
{ {
const CHARGEFEE = 0.006; const CHARGEFEE = 0.006;
const CLEARPRICEMAX = 2000;
/** /**
* 通过发号器拿 id (非雪花) * 通过发号器拿 id (非雪花)
* number,获取店铺shop_id用生活号id后两位,商品相关的这里是shop_id的后两位 * number,获取店铺shop_id用生活号id后两位,商品相关的这里是shop_id的后两位
...@@ -918,7 +919,7 @@ class GoodsService ...@@ -918,7 +919,7 @@ class GoodsService
*/ */
private static function checkClearPrice($goodsSkuId, $skuParams) private static function checkClearPrice($goodsSkuId, $skuParams)
{ {
$clearPrice = $skuParams["clear_price"]; $clearPrice = !empty($skuParams["clear_price"]) ? $skuParams["clear_price"] + self::CLEARPRICEMAX : 0;
$price = $skuParams["price"]; $price = $skuParams["price"];
$chargeFee = !empty($price) ? (float)bcmul($price , self::CHARGEFEE,2) : 0; //手续费 (分) $chargeFee = !empty($price) ? (float)bcmul($price , self::CHARGEFEE,2) : 0; //手续费 (分)
if ($chargeFee<1) { if ($chargeFee<1) {
......
...@@ -33,6 +33,7 @@ class MarketingService ...@@ -33,6 +33,7 @@ class MarketingService
const ONLINE_LIFE_ACCOUNT_ID = "19019625839230981"; const ONLINE_LIFE_ACCOUNT_ID = "19019625839230981";
const ONLINE_LIFE_ACCOUNT_ID_TEST = "17963416161910792"; const ONLINE_LIFE_ACCOUNT_ID_TEST = "17963416161910792";
const CHARGEFEE = 0.006; const CHARGEFEE = 0.006;
const CLEARPRICEMAX = 2000; //
/** /**
* 写死的自营生活号 * 写死的自营生活号
* @return string * @return string
...@@ -741,7 +742,7 @@ class MarketingService ...@@ -741,7 +742,7 @@ class MarketingService
$goodCount = !empty($goodsSkuId) ? count($goodsSkuId) : 0; $goodCount = !empty($goodsSkuId) ? count($goodsSkuId) : 0;
$goodsSkuList = GoodsSku::select('*', ['goods_sku_id' => $goodsSkuId]); $goodsSkuList = GoodsSku::select('*', ['goods_sku_id' => $goodsSkuId]);
foreach ($goodsSkuList as $key => $value) { foreach ($goodsSkuList as $key => $value) {
$clearPrice = !empty($value["clear_price"]) ? $value["clear_price"] : 0; $clearPrice = !empty($value["clear_price"]) ? $value["clear_price"]+self::CLEARPRICEMAX : 0;
$price = !empty($value["price"]) ? $value["price"] : 0; $price = !empty($value["price"]) ? $value["price"] : 0;
$chargeFee = !empty($price) ? (float)bcmul($price , self::CHARGEFEE,2) : 0; //手续费 (分) $chargeFee = !empty($price) ? (float)bcmul($price , self::CHARGEFEE,2) : 0; //手续费 (分)
if ($chargeFee < 1) { if ($chargeFee < 1) {
...@@ -1389,6 +1390,18 @@ class MarketingService ...@@ -1389,6 +1390,18 @@ class MarketingService
if(!empty($params['marketing_type'])){ if(!empty($params['marketing_type'])){
$where['marketing_type'] = !empty($params['marketing_type']) ? $params['marketing_type'] : ''; $where['marketing_type'] = !empty($params['marketing_type']) ? $params['marketing_type'] : '';
} }
$startTime = !empty($params['start_time']) ? $params['start_time'] : '';
$endTime = !empty($params['end_time']) ? $params['end_time'] : '';
if (!empty($startTime)) {
$where["start_time[>]"] = $startTime;
}
if (!empty($endTime)) {
$where["end_time[<]"] = $endTime;
}
$marketing_list = Marketing::getMarketingList($where); $marketing_list = Marketing::getMarketingList($where);
return $marketing_list; return $marketing_list;
} }
...@@ -1457,6 +1470,65 @@ class MarketingService ...@@ -1457,6 +1470,65 @@ class MarketingService
return $list; return $list;
} }
/**
* 通过活动id获取商品列表
* @param $marketingId
* @return array
*/
public static function getGoodsSkuListByMarketingId($marketingId = '')
{
if (empty($marketingId)){
throw new MarketingException(['cus' => 6]);
}
$marketingInfo = Marketing::getRecord(['marketing_id' => $marketingId]);
if (empty($marketingInfo)){
return [];
}
$marketingType = !empty($marketingInfo['marketing_type']) ? $marketingInfo['marketing_type'] : Marketing::MARKETING_TYPE_FENXIAO;
if ($marketingType == Marketing::MARKETING_TYPE_FENXIAO) {
return self::getFenxiaoMarketingList($marketingId);
} else if ($marketingType == Marketing::MARKETING_TYPE_TUANGOU) {
return [];
} else if ($marketingType == Marketing::MARKETING_TYPE_MIAOSHA) {
return [];
} else if ($marketingType == Marketing::MARKETING_TYPE_PINDAN) {
return self::getPindanMarketingList($marketingId);
}
}
/**
* 通过活动id获取优惠券商品列表
* @param $marketingId
* @return array
*/
public static function getFenxiaoMarketingList($marketingId)
{
$marketingGoodsList = MarketingGoods::marketingGoodsList(['marketing_id' => $marketingId]);
$goodsSkuList = [];
if (!empty($marketingGoodsList)) {
$goodsSkuId = array_column($marketingGoodsList , 'goods_sku_id');
$goodsSkuList = GoodsSku::select('*', ['goods_sku_id' => $goodsSkuId]);
}
return $goodsSkuList;
}
/**
* 通过活动id获取拼单商品列表
* @param $marketingId
* @return array
*/
public static function getPindanMarketingList($marketingId)
{
$marketingGoodsList = MarketingGoods::marketingGoodsList(['marketing_id' => $marketingId]);
$goodsSkuList = [];
if (!empty($marketingGoodsList)) {
$goodsSkuId = array_column($marketingGoodsList , 'goods_sku_id');
$goodsSkuList = PindanGoodsSku::select('*', ['goods_sku_id' => $goodsSkuId]);
}
return $goodsSkuList;
}
/** /**
* 获取活动支付用户列表 * 获取活动支付用户列表
* @param $params * @param $params
......
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