Commit 0da7c929 authored by luhongguang's avatar luhongguang

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

parents 65a6a5e0 beac815e
......@@ -64,5 +64,6 @@ class GoodsException extends BaseException
45 => '还没有try,就去执行confirm',
46 => '已经执行过cancel',
47 => 'sku rollback error',
48 => '商户结算价不能大于分润价加支付价',
];
}
\ No newline at end of file
......@@ -24,23 +24,13 @@ class MarketingService
{
const ONLINE_LIFE_ACCOUNT_ID = "19019625839230981";
const ONLINE_LIFE_ACCOUNT_ID_TEST = "17963416161910792";
const CHARGEFEE = 0.006;
/**
* 写死的自营生活号
* @return string
*/
public static function getPublicLifeAccountId()
{
/**
$env = \Yaf\Application::app()->environ();
if (in_array($env, ['dev'])) {
$lifeAccountId = "13076446786650120";
} elseif (in_array($env, ['test'])) {
$lifeAccountId = "15559498695737346";
}else {
// $lifeAccountId = self::ONLINE_LIFE_ACCOUNT_ID;
$lifeAccountId = self::ONLINE_LIFE_ACCOUNT_ID_TEST;//测试用
}
*/
$lifeAccountId = config('lifeaccount','life_account_id');
return $lifeAccountId;
}
......@@ -492,24 +482,29 @@ class MarketingService
throw new MarketingException(['cus' => 5]);
}
$colums = [];
$goodCount = !empty($goodsSkuId) ? count($goodsSkuId) : 0;
$goodCount = !empty($goodsSkuId) ? count($goodsSkuId) : 0;
$goodsSkuList = GoodsSku::select('*', ['goods_sku_id' => $goodsSkuId]);
foreach ($goodsSkuList as $key => $value) {
$clearPrice = !empty($value["clear_price"]) ? $value["clear_price"]*100 : 0;
$price = !empty($value["price"]) ? $value["price"]*100 : 0;
// if ($commissionMode == Marketing::COMMISSION_MODE_RATE) {
// $commissionTotal = ($firstCommissionRate + $secondCommissionRate) / 1000 * $price;
// if ($price - $commissionTotal < $clearPrice) {
// throw new GoodsException(['cus' => 36]);
// }
// }
//
// if ($commissionMode == Marketing::COMMISSION_MODE_FIXED) {
// $commissionTotal = ($firstCommissionRate + $secondCommissionRate);
// if ($price - $commissionTotal < $clearPrice) {
// throw new GoodsException(['cus' => 36]);
// }
// }
$clearPrice = !empty($value["clear_price"]) ? $value["clear_price"] : 0;
$price = !empty($value["price"]) ? $value["price"] : 0;
$chargeFee = !empty($price) ? bcmul($price , self::CHARGEFEE,2) : 0; //手续费
if (!empty($clearPrice) && $clearPrice > 0) {
if ($commissionMode == Marketing::COMMISSION_MODE_RATE) {
$commissionTotal = ($firstCommissionRate + $secondCommissionRate) / 10000 * $price;
if (($price - $commissionTotal-$chargeFee) < $clearPrice) {
throw new GoodsException(['cus' => 48]);
}
}
if ($commissionMode == Marketing::COMMISSION_MODE_FIXED) {
$commissionTotal = ($firstCommissionRate + $secondCommissionRate)/100;
if (($price - $commissionTotal -$chargeFee)< $clearPrice) {
throw new GoodsException(['cus' => 48]);
}
}
}
$colums[$key]['marketing_id'] = $marketingId;
$colums[$key]['goods_spu_id'] = $value['goods_spu_id'];
......
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