Compare commits
6 Commits
67834f3e29
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| dd133b2266 | |||
| 8dc55beb74 | |||
| 70d4278071 | |||
| 2e8bc33d99 | |||
| 5dc96a5cb1 | |||
| 6d7bfdd4f4 |
@@ -93,6 +93,8 @@ class IndexController extends AdminController
|
|||||||
$filter->column(1 / 2, function ($filter) {
|
$filter->column(1 / 2, function ($filter) {
|
||||||
$filter->between('start_at', '开始时间')->datetime();
|
$filter->between('start_at', '开始时间')->datetime();
|
||||||
$filter->between('end_at', '结束时间')->datetime();
|
$filter->between('end_at', '结束时间')->datetime();
|
||||||
|
$filter->equal('channel', '核销途径')->select(Activity::CHANNELS);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -101,12 +103,19 @@ class IndexController extends AdminController
|
|||||||
$grid->column('title', '活动名称');
|
$grid->column('title', '活动名称');
|
||||||
$grid->column('code', '活动编号');
|
$grid->column('code', '活动编号');
|
||||||
$grid->column('total', '可发券总数');
|
$grid->column('total', '可发券总数');
|
||||||
$grid->column('coupons_count', '可发券总数');
|
$grid->column('coupons_count', '已发券总数');
|
||||||
$grid->column('rule.code', '卡券规则');
|
$grid->column('rule.code', '卡券规则');
|
||||||
$grid->column('类型')->display(function () {
|
$grid->column('类型')->display(function () {
|
||||||
return $this->type_text;
|
return $this->type_text;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$grid->column('channel', '核销途径')
|
||||||
|
->using(Activity::CHANNELS)
|
||||||
|
->label([
|
||||||
|
Activity::CHANNEL_YSD => 'info',
|
||||||
|
Activity::CHANNEL_UNION => 'success',
|
||||||
|
]);
|
||||||
|
|
||||||
$grid->column('days', '延期(天)');
|
$grid->column('days', '延期(天)');
|
||||||
$grid->column('rule.full', '满足金额');
|
$grid->column('rule.full', '满足金额');
|
||||||
$grid->column('rule.take', '扣除金额');
|
$grid->column('rule.take', '扣除金额');
|
||||||
@@ -159,7 +168,7 @@ class IndexController extends AdminController
|
|||||||
->required();
|
->required();
|
||||||
|
|
||||||
$form->number('total', '总数')
|
$form->number('total', '总数')
|
||||||
->help('可发券总数')
|
->help('可发券总数,0为不限制')
|
||||||
->default(10000)
|
->default(10000)
|
||||||
->required();
|
->required();
|
||||||
|
|
||||||
@@ -173,6 +182,12 @@ class IndexController extends AdminController
|
|||||||
})
|
})
|
||||||
->required();
|
->required();
|
||||||
|
|
||||||
|
$form->radio('channel', '核销途径')
|
||||||
|
->options(Activity::CHANNELS)
|
||||||
|
->default(Activity::CHANNEL_YSD)
|
||||||
|
->help('券码核销的途径:亿时代是自己核销,银联是银联pos核销')
|
||||||
|
->required();
|
||||||
|
|
||||||
$form->switch('status', '状态')->default(1);
|
$form->switch('status', '状态')->default(1);
|
||||||
$form->switch('need_check', '多次校验')
|
$form->switch('need_check', '多次校验')
|
||||||
->default(1)
|
->default(1)
|
||||||
|
|||||||
@@ -184,11 +184,20 @@ class UserController extends Controller
|
|||||||
$total = $res['total'] ?? ''; //订单总额;
|
$total = $res['total'] ?? ''; //订单总额;
|
||||||
$outletId = $res['outletId'] ?? ''; //网点id;
|
$outletId = $res['outletId'] ?? ''; //网点id;
|
||||||
$orderid = $res['orderid'] ?? ''; //订单id;
|
$orderid = $res['orderid'] ?? ''; //订单id;
|
||||||
|
$from = $res['from'] ?? ''; //来源;
|
||||||
|
|
||||||
$redemptionCode = trim($redemptionCode);
|
$redemptionCode = trim($redemptionCode);
|
||||||
$outletId = trim($outletId);
|
$outletId = trim($outletId);
|
||||||
|
|
||||||
$coupon = Coupon::Redemption($this->user, $redemptionCode, $total, $outletId, $orderid);
|
$coupon = Coupon::Redemption(
|
||||||
|
$this->user,
|
||||||
|
$redemptionCode,
|
||||||
|
$total,
|
||||||
|
$outletId,
|
||||||
|
$orderid,
|
||||||
|
$from
|
||||||
|
);
|
||||||
|
|
||||||
if (is_string($coupon)) {
|
if (is_string($coupon)) {
|
||||||
return $this->error($coupon, $log);
|
return $this->error($coupon, $log);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,11 @@ class Activity extends Model
|
|||||||
|
|
||||||
use BelongsToUser;
|
use BelongsToUser;
|
||||||
|
|
||||||
|
protected $dates = [
|
||||||
|
'start_at',
|
||||||
|
'end_at',
|
||||||
|
];
|
||||||
|
|
||||||
const TYPE_EXTEND = 1;
|
const TYPE_EXTEND = 1;
|
||||||
const TYPE_SCOPE = 2;
|
const TYPE_SCOPE = 2;
|
||||||
const TYPES = [
|
const TYPES = [
|
||||||
@@ -24,9 +29,11 @@ class Activity extends Model
|
|||||||
self::STATUS_CLOSE => '关闭',
|
self::STATUS_CLOSE => '关闭',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $dates = [
|
const CHANNEL_YSD = 1;
|
||||||
'start_at',
|
const CHANNEL_UNION = 2;
|
||||||
'end_at',
|
const CHANNELS = [
|
||||||
|
self::CHANNEL_YSD => '亿时代',
|
||||||
|
self::CHANNEL_UNION => '银联',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -51,7 +58,7 @@ class Activity extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
//活动状态
|
//活动状态
|
||||||
public function getStatusTextAttribute()
|
public function getStatusTextAttribute(): string
|
||||||
{
|
{
|
||||||
return self::STATUS[$this->status] ?? '未知';
|
return self::STATUS[$this->status] ?? '未知';
|
||||||
}
|
}
|
||||||
@@ -100,7 +107,12 @@ class Activity extends Model
|
|||||||
{
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
//判断生成何种码
|
||||||
|
if ($this->channel == self::CHANNEL_UNION) {
|
||||||
|
$code = '66406' . date('ymdH') . mt_rand(1000000, 9999999);
|
||||||
|
} else {
|
||||||
$code = 'YSD' . date('ymd') . mt_rand(100000, 999999);
|
$code = 'YSD' . date('ymd') . mt_rand(100000, 999999);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->type == SELF::TYPE_EXTEND) {
|
if ($this->type == SELF::TYPE_EXTEND) {
|
||||||
$start_at = now();
|
$start_at = now();
|
||||||
|
|||||||
9
bootstrap/cache/events.php
vendored
Normal file
9
bootstrap/cache/events.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?php return array (
|
||||||
|
'App\\Providers\\EventServiceProvider' =>
|
||||||
|
array (
|
||||||
|
'App\\Events\\ConponCallback' =>
|
||||||
|
array (
|
||||||
|
0 => 'App\\Listeners\\ConponCallbackListener',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
114
bootstrap/cache/packages.php
vendored
114
bootstrap/cache/packages.php
vendored
@@ -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',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
222
bootstrap/cache/services.php
vendored
222
bootstrap/cache/services.php
vendored
@@ -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 (
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
@@ -46,4 +46,9 @@ return [
|
|||||||
7 => '未激活',
|
7 => '未激活',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'froms' => [
|
||||||
|
'bsshop',//本时商城
|
||||||
|
'bslive',//本时生活
|
||||||
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -14,4 +14,8 @@ return [
|
|||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
'froms' => [
|
||||||
|
'bsshop',//本时商城
|
||||||
|
'bslive',//本时生活
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ class Init
|
|||||||
//查询到的卡券规则和商品id 只有平安券才有
|
//查询到的卡券规则和商品id 只有平安券才有
|
||||||
public $queryData;
|
public $queryData;
|
||||||
|
|
||||||
|
//来源
|
||||||
|
public $from;
|
||||||
|
|
||||||
//设置渠道
|
//设置渠道
|
||||||
public function setUser($user)
|
public function setUser($user)
|
||||||
{
|
{
|
||||||
@@ -99,6 +102,15 @@ class Init
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置来源
|
||||||
|
public function setFrom($from)
|
||||||
|
{
|
||||||
|
$this->from = $from;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: 插入日志
|
* Notes: 插入日志
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
@@ -139,37 +151,55 @@ class Init
|
|||||||
//统一门店 相同金额 3分钟之内看作是一笔订单
|
//统一门店 相同金额 3分钟之内看作是一笔订单
|
||||||
public function CheckCount()
|
public function CheckCount()
|
||||||
{
|
{
|
||||||
|
//排除来源
|
||||||
|
if (!empty($this->from) && in_array($this->from, config('xuanchen_coupon.froms'))) {
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//已核销的券的满多少金额
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class PinganAction extends Init implements CouponContracts
|
|||||||
->setOutletId($this->outletId)
|
->setOutletId($this->outletId)
|
||||||
->setTotal($this->total)
|
->setTotal($this->total)
|
||||||
->setOrderId($this->orderid)
|
->setOrderId($this->orderid)
|
||||||
|
->setFrom($this->from)
|
||||||
->start();
|
->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ class YsdAction extends Init implements CouponContracts
|
|||||||
->setOutletId($this->outletId)
|
->setOutletId($this->outletId)
|
||||||
->setTotal($this->total)
|
->setTotal($this->total)
|
||||||
->setOrderId($this->orderid)
|
->setOrderId($this->orderid)
|
||||||
|
->setFrom($this->from)
|
||||||
->start();
|
->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user