调整可用券数量校验

This commit is contained in:
2021-01-25 08:53:18 +08:00
parent 8dc55beb74
commit dd133b2266
5 changed files with 49 additions and 369 deletions

View File

@@ -1,114 +0,0 @@
<?php return array (
'aslong/sms' =>
array (
'providers' =>
array (
0 => 'AsLong\\Sms\\ServiceProvider',
),
'aliases' =>
array (
'Sms' => 'AsLong\\Sms\\Facades\\Sms',
),
),
'encore/laravel-admin' =>
array (
'providers' =>
array (
0 => 'Encore\\Admin\\AdminServiceProvider',
),
'aliases' =>
array (
'Admin' => 'Encore\\Admin\\Facades\\Admin',
),
),
'facade/ignition' =>
array (
'providers' =>
array (
0 => 'Facade\\Ignition\\IgnitionServiceProvider',
),
'aliases' =>
array (
'Flare' => 'Facade\\Ignition\\Facades\\Flare',
),
),
'fideloper/proxy' =>
array (
'providers' =>
array (
0 => 'Fideloper\\Proxy\\TrustedProxyServiceProvider',
),
),
'intervention/image' =>
array (
'providers' =>
array (
0 => 'Intervention\\Image\\ImageServiceProvider',
),
'aliases' =>
array (
'Image' => 'Intervention\\Image\\Facades\\Image',
),
),
'laravel-admin-ext/wang-editor' =>
array (
'providers' =>
array (
0 => 'Encore\\WangEditor\\WangEditorServiceProvider',
),
),
'laravel/tinker' =>
array (
'providers' =>
array (
0 => 'Laravel\\Tinker\\TinkerServiceProvider',
),
),
'maatwebsite/excel' =>
array (
'providers' =>
array (
0 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
),
'aliases' =>
array (
'Excel' => 'Maatwebsite\\Excel\\Facades\\Excel',
),
),
'nesbot/carbon' =>
array (
'providers' =>
array (
0 => 'Carbon\\Laravel\\ServiceProvider',
),
),
'nunomaduro/collision' =>
array (
'providers' =>
array (
0 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
),
),
'overtrue/laravel-wechat' =>
array (
'providers' =>
array (
0 => 'Overtrue\\LaravelWeChat\\ServiceProvider',
),
'aliases' =>
array (
'EasyWeChat' => 'Overtrue\\LaravelWeChat\\Facade',
),
),
'simplesoftwareio/simple-qrcode' =>
array (
'providers' =>
array (
0 => 'SimpleSoftwareIO\\QrCode\\QrCodeServiceProvider',
),
'aliases' =>
array (
'QrCode' => 'SimpleSoftwareIO\\QrCode\\Facades\\QrCode',
),
),
);

View File

@@ -1,222 +0,0 @@
<?php return array (
'providers' =>
array (
0 => 'Illuminate\\Auth\\AuthServiceProvider',
1 => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
2 => 'Illuminate\\Bus\\BusServiceProvider',
3 => 'Illuminate\\Cache\\CacheServiceProvider',
4 => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
5 => 'Illuminate\\Cookie\\CookieServiceProvider',
6 => 'Illuminate\\Database\\DatabaseServiceProvider',
7 => 'Illuminate\\Encryption\\EncryptionServiceProvider',
8 => 'Illuminate\\Filesystem\\FilesystemServiceProvider',
9 => 'Illuminate\\Foundation\\Providers\\FoundationServiceProvider',
10 => 'Illuminate\\Hashing\\HashServiceProvider',
11 => 'Illuminate\\Mail\\MailServiceProvider',
12 => 'Illuminate\\Notifications\\NotificationServiceProvider',
13 => 'Illuminate\\Pagination\\PaginationServiceProvider',
14 => 'Illuminate\\Pipeline\\PipelineServiceProvider',
15 => 'Illuminate\\Queue\\QueueServiceProvider',
16 => 'Illuminate\\Redis\\RedisServiceProvider',
17 => 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider',
18 => 'Illuminate\\Session\\SessionServiceProvider',
19 => 'Illuminate\\Translation\\TranslationServiceProvider',
20 => 'Illuminate\\Validation\\ValidationServiceProvider',
21 => 'Illuminate\\View\\ViewServiceProvider',
22 => 'AsLong\\Sms\\ServiceProvider',
23 => 'Encore\\Admin\\AdminServiceProvider',
24 => 'Facade\\Ignition\\IgnitionServiceProvider',
25 => 'Fideloper\\Proxy\\TrustedProxyServiceProvider',
26 => 'Intervention\\Image\\ImageServiceProvider',
27 => 'Encore\\WangEditor\\WangEditorServiceProvider',
28 => 'Laravel\\Tinker\\TinkerServiceProvider',
29 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
30 => 'Carbon\\Laravel\\ServiceProvider',
31 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
32 => 'Overtrue\\LaravelWeChat\\ServiceProvider',
33 => 'SimpleSoftwareIO\\QrCode\\QrCodeServiceProvider',
34 => 'App\\Providers\\AppServiceProvider',
35 => 'App\\Providers\\AuthServiceProvider',
36 => 'App\\Providers\\EventServiceProvider',
37 => 'App\\Providers\\RouteServiceProvider',
38 => 'App\\Api\\ApiServiceProvider',
39 => 'App\\Merchant\\MerchantServiceProvider',
),
'eager' =>
array (
0 => 'Illuminate\\Auth\\AuthServiceProvider',
1 => 'Illuminate\\Cookie\\CookieServiceProvider',
2 => 'Illuminate\\Database\\DatabaseServiceProvider',
3 => 'Illuminate\\Encryption\\EncryptionServiceProvider',
4 => 'Illuminate\\Filesystem\\FilesystemServiceProvider',
5 => 'Illuminate\\Foundation\\Providers\\FoundationServiceProvider',
6 => 'Illuminate\\Notifications\\NotificationServiceProvider',
7 => 'Illuminate\\Pagination\\PaginationServiceProvider',
8 => 'Illuminate\\Session\\SessionServiceProvider',
9 => 'Illuminate\\View\\ViewServiceProvider',
10 => 'AsLong\\Sms\\ServiceProvider',
11 => 'Encore\\Admin\\AdminServiceProvider',
12 => 'Facade\\Ignition\\IgnitionServiceProvider',
13 => 'Fideloper\\Proxy\\TrustedProxyServiceProvider',
14 => 'Intervention\\Image\\ImageServiceProvider',
15 => 'Encore\\WangEditor\\WangEditorServiceProvider',
16 => 'Laravel\\Tinker\\TinkerServiceProvider',
17 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
18 => 'Carbon\\Laravel\\ServiceProvider',
19 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
20 => 'Overtrue\\LaravelWeChat\\ServiceProvider',
21 => 'SimpleSoftwareIO\\QrCode\\QrCodeServiceProvider',
22 => 'App\\Providers\\AppServiceProvider',
23 => 'App\\Providers\\AuthServiceProvider',
24 => 'App\\Providers\\EventServiceProvider',
25 => 'App\\Providers\\RouteServiceProvider',
26 => 'App\\Api\\ApiServiceProvider',
27 => 'App\\Merchant\\MerchantServiceProvider',
),
'deferred' =>
array (
'Illuminate\\Broadcasting\\BroadcastManager' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
'Illuminate\\Contracts\\Broadcasting\\Factory' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
'Illuminate\\Contracts\\Broadcasting\\Broadcaster' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
'Illuminate\\Bus\\Dispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
'Illuminate\\Contracts\\Bus\\Dispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
'Illuminate\\Contracts\\Bus\\QueueingDispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
'cache' => 'Illuminate\\Cache\\CacheServiceProvider',
'cache.store' => 'Illuminate\\Cache\\CacheServiceProvider',
'cache.psr6' => 'Illuminate\\Cache\\CacheServiceProvider',
'memcached.connector' => 'Illuminate\\Cache\\CacheServiceProvider',
'command.cache.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.cache.forget' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.clear-compiled' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.auth.resets.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.config.cache' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.config.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.db.wipe' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.down' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.environment' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.event.cache' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.event.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.event.list' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.key.generate' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.optimize' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.optimize.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.package.discover' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.preset' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.failed' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.flush' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.forget' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.listen' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.restart' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.retry' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.work' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.route.cache' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.route.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.route.list' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.seed' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleFinishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleRunCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.storage.link' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.up' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.view.cache' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.view.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.cache.table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.channel.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.console.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.controller.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.event.generate' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.event.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.exception.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.factory.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.job.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.listener.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.mail.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.middleware.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.model.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.notification.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.notification.table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.observer.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.policy.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.provider.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.failed-table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.request.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.resource.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.rule.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.seeder.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.session.table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.serve' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.test.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.vendor.publish' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'migrator' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'migration.repository' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'migration.creator' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.migrate' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.migrate.fresh' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.migrate.install' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.migrate.refresh' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.migrate.reset' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.migrate.rollback' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.migrate.status' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.migrate.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'composer' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'hash' => 'Illuminate\\Hashing\\HashServiceProvider',
'hash.driver' => 'Illuminate\\Hashing\\HashServiceProvider',
'mailer' => 'Illuminate\\Mail\\MailServiceProvider',
'swift.mailer' => 'Illuminate\\Mail\\MailServiceProvider',
'swift.transport' => 'Illuminate\\Mail\\MailServiceProvider',
'Illuminate\\Mail\\Markdown' => 'Illuminate\\Mail\\MailServiceProvider',
'Illuminate\\Contracts\\Pipeline\\Hub' => 'Illuminate\\Pipeline\\PipelineServiceProvider',
'queue' => 'Illuminate\\Queue\\QueueServiceProvider',
'queue.worker' => 'Illuminate\\Queue\\QueueServiceProvider',
'queue.listener' => 'Illuminate\\Queue\\QueueServiceProvider',
'queue.failer' => 'Illuminate\\Queue\\QueueServiceProvider',
'queue.connection' => 'Illuminate\\Queue\\QueueServiceProvider',
'redis' => 'Illuminate\\Redis\\RedisServiceProvider',
'redis.connection' => 'Illuminate\\Redis\\RedisServiceProvider',
'auth.password' => 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider',
'auth.password.broker' => 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider',
'translator' => 'Illuminate\\Translation\\TranslationServiceProvider',
'translation.loader' => 'Illuminate\\Translation\\TranslationServiceProvider',
'validator' => 'Illuminate\\Validation\\ValidationServiceProvider',
'validation.presence' => 'Illuminate\\Validation\\ValidationServiceProvider',
),
'when' =>
array (
'Illuminate\\Broadcasting\\BroadcastServiceProvider' =>
array (
),
'Illuminate\\Bus\\BusServiceProvider' =>
array (
),
'Illuminate\\Cache\\CacheServiceProvider' =>
array (
),
'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider' =>
array (
),
'Illuminate\\Hashing\\HashServiceProvider' =>
array (
),
'Illuminate\\Mail\\MailServiceProvider' =>
array (
),
'Illuminate\\Pipeline\\PipelineServiceProvider' =>
array (
),
'Illuminate\\Queue\\QueueServiceProvider' =>
array (
),
'Illuminate\\Redis\\RedisServiceProvider' =>
array (
),
'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider' =>
array (
),
'Illuminate\\Translation\\TranslationServiceProvider' =>
array (
),
'Illuminate\\Validation\\ValidationServiceProvider' =>
array (
),
),
);

View File

@@ -35,12 +35,12 @@ class Init
//订单id //订单id
public $orderid; public $orderid;
//来源
public $from;
//查询到的卡券规则和商品id 只有平安券才有 //查询到的卡券规则和商品id 只有平安券才有
public $queryData; public $queryData;
//来源
public $from;
//设置渠道 //设置渠道
public function setUser($user) public function setUser($user)
{ {
@@ -152,7 +152,7 @@ class Init
public function CheckCount() public function CheckCount()
{ {
//排除来源 //排除来源
if (!empty($this->from) && in_array($this->from, config('pingan.froms'))) { if (!empty($this->from) && in_array($this->from, config('xuanchen_coupon.froms'))) {
return true; return true;
} }
@@ -162,31 +162,44 @@ class Init
} }
} }
//已核销的券的满多少金额
if ($this->orderid) { if ($this->orderid) {
$check_count = Coupon::where('orderid', $this->orderid) $check_count = Coupon::where('orderid', $this->orderid)
->where('outletId', $this->outletId) ->where('outletId', $this->outletId)
->where('total', $this->total) ->where('total', $this->total)
->where('status', 2) ->where('status', 2)
->where('created_at', '>=', now()->subMinutes(3)->format('Y-m-d H:i:s')) ->where('created_at', '>=', now()->subMinutes(3)->format('Y-m-d H:i:s'))
->count(); ->sum('full');
} else { } else {
$check_count = Coupon::where('outletId', $this->outletId) $check_count = Coupon::where('outletId', $this->outletId)
->where('total', $this->total) ->where('total', $this->total)
->where('status', 2) ->where('status', 2)
->where('created_at', '>=', now()->subMinutes(3)->format('Y-m-d H:i:s')) ->where('created_at', '>=', now()->subMinutes(3)->format('Y-m-d H:i:s'))
->count(); ->sum('full');
} }
$count = floor($this->total / 100); //金额判断
if ($check_count >= $this->total) {
return "核销失败,此订单您无法再使用优惠券";
}
if ($check_count > 0) { //取差值
// if ($this->total < 100) { $diff = bcsub($this->total, $check_count);
// return '核销失败订单金额少于100只能核销一张优惠券。';
if ($diff < $this->ticket['full']) {
return "核销失败,此订单您无法再使用优惠券.";
}
// $count = floor($this->total / 100);
//
// if ($check_count > 0) {
// // if ($this->total < 100) {
// // return '核销失败订单金额少于100只能核销一张优惠券。';
// // }
// if ($check_count >= $count) {
// return "核销失败,此订单您只能使用 {$count} 张优惠券";
// }
// } // }
if ($check_count >= $count) {
return "核销失败,此订单您只能使用 {$count} 张优惠券";
}
}
return true; return true;
} }

View File

@@ -23,6 +23,7 @@ class Verification extends PingAnInit
$this->query_coupon = (new Query)->setOutletId($this->outletId) $this->query_coupon = (new Query)->setOutletId($this->outletId)
->setCode($this->redemptionCode) ->setCode($this->redemptionCode)
->start(); ->start();
if (is_string($this->query_coupon)) { if (is_string($this->query_coupon)) {
return $this->query_coupon; return $this->query_coupon;
} }
@@ -90,7 +91,7 @@ class Verification extends PingAnInit
return $resdata; return $resdata;
} catch (Exception $e) { } catch (\Exception $e) {
$coupon->status = 3; $coupon->status = 3;
$coupon->remark = '核销失败 ' . $e->getMessage(); $coupon->remark = '核销失败 ' . $e->getMessage();
$coupon->save(); $coupon->save();
@@ -119,6 +120,7 @@ class Verification extends PingAnInit
'productId' => $this->queryData['productId'], 'productId' => $this->queryData['productId'],
'thirdPartyGoodsId' => $this->queryData['thirdPartyGoodsId'], 'thirdPartyGoodsId' => $this->queryData['thirdPartyGoodsId'],
'couponName' => $this->query_coupon['couponName'], 'couponName' => $this->query_coupon['couponName'],
'full' => $this->ticket['full'],
'price' => $this->ticket['price'], 'price' => $this->ticket['price'],
'total' => $this->total, 'total' => $this->total,
'profit' => $this->ticket['profit'], 'profit' => $this->ticket['profit'],
@@ -129,7 +131,7 @@ class Verification extends PingAnInit
return $coupon = Coupon::create($couponData); return $coupon = Coupon::create($couponData);
} catch (Exception $e) { } catch (\Exception $e) {
return $e->getMessage(); return $e->getMessage();
} }
@@ -210,7 +212,7 @@ class Verification extends PingAnInit
} }
$this->ticket = [ $this->ticket = [
'total' => $result[0], 'full' => $result[0],
'price' => $price, 'price' => $price,
'profit' => $code->profit, 'profit' => $code->profit,
]; ];

View File

@@ -36,6 +36,12 @@ class YsdVerification extends Init
return $this->query_coupon; return $this->query_coupon;
} }
//校验卡券
$ticket = $this->checkCoupon();
if (!is_array($ticket)) {
return $ticket;
}
//检查可核销次数100元为1次。 //检查可核销次数100元为1次。
if ($this->query_coupon->activity && $this->query_coupon->activity->need_check) { if ($this->query_coupon->activity && $this->query_coupon->activity->need_check) {
$ret = $this->CheckCount(); $ret = $this->CheckCount();
@@ -44,12 +50,6 @@ class YsdVerification extends Init
} }
} }
//校验卡券
$ticket = $this->checkCoupon();
if (!is_array($ticket)) {
return $ticket;
}
//增加核销记录 //增加核销记录
$coupon = $this->AddCoupon(); $coupon = $this->AddCoupon();
if (is_string($coupon)) { if (is_string($coupon)) {
@@ -79,7 +79,7 @@ class YsdVerification extends Init
event(new ConponCallback($this->query_coupon)); event(new ConponCallback($this->query_coupon));
return $resdata; return $resdata;
} catch (Exception $e) { } catch (\Exception $e) {
DB::rollback(); DB::rollback();
$this->coupon->status = 3; $this->coupon->status = 3;
@@ -144,7 +144,7 @@ class YsdVerification extends Init
} }
return $this->ticket = [ return $this->ticket = [
'total' => $match[0], 'full' => $match[0],
'price' => $price, 'price' => $price,
'profit' => $code->profit, 'profit' => $code->profit,
]; ];
@@ -171,6 +171,7 @@ class YsdVerification extends Init
'redemptionCode' => $this->redemptionCode, 'redemptionCode' => $this->redemptionCode,
'thirdPartyGoodsId' => $this->query_coupon->activity->rule->code, 'thirdPartyGoodsId' => $this->query_coupon->activity->rule->code,
'couponName' => $this->query_coupon->activity->title, 'couponName' => $this->query_coupon->activity->title,
'full' => $this->ticket['full'],
'price' => $this->ticket['price'], 'price' => $this->ticket['price'],
'total' => $this->total, 'total' => $this->total,
'profit' => $this->ticket['profit'], 'profit' => $this->ticket['profit'],
@@ -184,7 +185,7 @@ class YsdVerification extends Init
DB::commit(); DB::commit();
return $this->coupon; return $this->coupon;
} catch (Exception $e) { } catch (\Exception $e) {
DB::rollback(); DB::rollback();
return $e->getMessage(); return $e->getMessage();