增加来源

This commit is contained in:
2020-12-07 10:00:08 +08:00
parent 8b481f76df
commit 6d7bfdd4f4
3 changed files with 49 additions and 15 deletions

9
bootstrap/cache/events.php vendored Normal file
View File

@@ -0,0 +1,9 @@
<?php return array (
'App\\Providers\\EventServiceProvider' =>
array (
'App\\Events\\ConponCallback' =>
array (
0 => 'App\\Listeners\\ConponCallbackListener',
),
),
);

View File

@@ -35,6 +35,9 @@ class Init
//订单id //订单id
public $orderid; public $orderid;
//来源
public $from;
//查询到的卡券规则和商品id 只有平安券才有 //查询到的卡券规则和商品id 只有平安券才有
public $queryData; public $queryData;
@@ -99,6 +102,15 @@ class Init
} }
//设置来源
public function setFrom($from)
{
$this->from = $from;
return $this;
}
/** /**
* Notes: 插入日志 * Notes: 插入日志
* @Author: 玄尘 * @Author: 玄尘
@@ -139,6 +151,10 @@ class Init
//统一门店 相同金额 3分钟之内看作是一笔订单 //统一门店 相同金额 3分钟之内看作是一笔订单
public function CheckCount() public function CheckCount()
{ {
if (!empty($this->from) && in_array($this->from, [''])) {
return true;
}
if ($this->queryData) { if ($this->queryData) {
if (isset($this->queryData['thirdPartyGoodsId']) && $this->queryData['thirdPartyGoodsId'] == 'YSD-full0-0') { if (isset($this->queryData['thirdPartyGoodsId']) && $this->queryData['thirdPartyGoodsId'] == 'YSD-full0-0') {
return true; return true;
@@ -163,7 +179,7 @@ class Init
$count = floor($this->total / 100); $count = floor($this->total / 100);
if ($check_count > 0) { if ($check_count > 0) {
// if ($this->total < 100) { // if ($this->total < 100) {
// return '核销失败订单金额少于100只能核销一张优惠券。'; // return '核销失败订单金额少于100只能核销一张优惠券。';
// } // }
if ($check_count >= $count) { if ($check_count >= $count) {

View File

@@ -117,9 +117,17 @@ class Coupon
* @param float $total 订单金额 * @param float $total 订单金额
* @param string $outletId 网点id * @param string $outletId 网点id
* @param string $orderid 订单id * @param string $orderid 订单id
* @param string $from 来源
* @return string * @return string
*/ */
public static function Redemption(User $user, string $redemptionCode, float $total, string $outletId, string $orderid = '') public static function Redemption(
User $user,
string $redemptionCode,
float $total,
string $outletId,
string $orderid = '',
string $from = ''
)
{ {
try { try {
@@ -133,6 +141,7 @@ class Coupon
->setTotal($total) ->setTotal($total)
->setOutletId($outletId) ->setOutletId($outletId)
->setOrderId($orderid) ->setOrderId($orderid)
->setFrom($from)
->start(); ->start();
} catch (\Exception $e) { } catch (\Exception $e) {