Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dd133b2266 | |||
| 8dc55beb74 | |||
| 70d4278071 | |||
| 2e8bc33d99 | |||
| 5dc96a5cb1 | |||
| 6d7bfdd4f4 | |||
| 8b481f76df | |||
| a54e71a7ce |
@@ -1,247 +1,282 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Admin\Controllers\Activity;
|
namespace App\Admin\Controllers\Activity;
|
||||||
|
|
||||||
use App\Admin\Renderable\Activity\Grants;
|
use App\Admin\Renderable\Activity\Grants;
|
||||||
use App\Models\Activity;
|
use App\Models\Activity;
|
||||||
use App\Models\ActivityGrant;
|
use App\Models\ActivityGrant;
|
||||||
use App\Models\ActivityRule;
|
use App\Models\ActivityRule;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Encore\Admin\Controllers\HasResourceActions;
|
use Encore\Admin\Controllers\HasResourceActions;
|
||||||
use Encore\Admin\Form;
|
use Encore\Admin\Form;
|
||||||
use Encore\Admin\Grid;
|
use Encore\Admin\Grid;
|
||||||
use Encore\Admin\Layout\Content;
|
use Encore\Admin\Layout\Content;
|
||||||
use Illuminate\Support\MessageBag;
|
use Illuminate\Support\MessageBag;
|
||||||
use Illuminate\Routing\Controller as AdminController;
|
use Illuminate\Routing\Controller as AdminController;
|
||||||
|
|
||||||
class IndexController extends AdminController
|
class IndexController extends AdminController
|
||||||
{
|
{
|
||||||
|
|
||||||
use HasResourceActions;
|
use HasResourceActions;
|
||||||
|
|
||||||
protected $title = '活动管理';
|
protected $title = '活动管理';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get content title.
|
* Get content title.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function title()
|
protected function title()
|
||||||
{
|
{
|
||||||
return $this->title;
|
return $this->title;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Index interface.
|
* Index interface.
|
||||||
* @param Content $content
|
* @param Content $content
|
||||||
* @return Content
|
* @return Content
|
||||||
*/
|
*/
|
||||||
public function index(Content $content)
|
public function index(Content $content)
|
||||||
{
|
{
|
||||||
return $content
|
return $content
|
||||||
->title($this->title())
|
->title($this->title())
|
||||||
->description($this->description['index'] ?? trans('admin.list'))
|
->description($this->description['index'] ?? trans('admin.list'))
|
||||||
->body($this->grid());
|
->body($this->grid());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit interface.
|
* Edit interface.
|
||||||
* @param mixed $id
|
* @param mixed $id
|
||||||
* @param Content $content
|
* @param Content $content
|
||||||
* @return Content
|
* @return Content
|
||||||
*/
|
*/
|
||||||
public function edit($id, Content $content)
|
public function edit($id, Content $content)
|
||||||
{
|
{
|
||||||
return $content
|
return $content
|
||||||
->title($this->title())
|
->title($this->title())
|
||||||
->description($this->description['edit'] ?? trans('admin.edit'))
|
->description($this->description['edit'] ?? trans('admin.edit'))
|
||||||
->body($this->form($id)->edit($id));
|
->body($this->form($id)->edit($id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create interface.
|
* Create interface.
|
||||||
* @param Content $content
|
* @param Content $content
|
||||||
* @return Content
|
* @return Content
|
||||||
*/
|
*/
|
||||||
public function create(Content $content)
|
public function create(Content $content)
|
||||||
{
|
{
|
||||||
return $content
|
return $content
|
||||||
->title($this->title())
|
->title($this->title())
|
||||||
->description($this->description['create'] ?? trans('admin.create'))
|
->description($this->description['create'] ?? trans('admin.create'))
|
||||||
->body($this->form());
|
->body($this->form());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function grid()
|
protected function grid()
|
||||||
{
|
{
|
||||||
$grid = new Grid(new Activity);
|
$grid = new Grid(new Activity);
|
||||||
|
$grid->model()->withCount('coupons');
|
||||||
$grid->actions(function ($actions) {
|
|
||||||
$actions->disableView();
|
$grid->actions(function ($actions) {
|
||||||
});
|
$actions->disableView();
|
||||||
|
});
|
||||||
$grid->filter(function ($filter) {
|
|
||||||
$filter->column(1 / 2, function ($filter) {
|
$grid->filter(function ($filter) {
|
||||||
$filter->equal('status', '状态')->select(Activity::STATUS);
|
$filter->column(1 / 2, function ($filter) {
|
||||||
$filter->equal('type', '类型')->select(Activity::TYPES);
|
$filter->equal('status', '状态')->select(Activity::STATUS);
|
||||||
|
$filter->equal('type', '类型')->select(Activity::TYPES);
|
||||||
$users = User::whereHas('identity', function ($query) {
|
|
||||||
$query->where('identity_id', 1);
|
$users = User::whereHas('identity', function ($query) {
|
||||||
})->get()->pluck('nickname', 'id');
|
$query->where('identity_id', 1);
|
||||||
|
})->get()->pluck('nickname', 'id');
|
||||||
});
|
|
||||||
|
});
|
||||||
$filter->column(1 / 2, function ($filter) {
|
|
||||||
$filter->between('start_at', '开始时间')->datetime();
|
$filter->column(1 / 2, function ($filter) {
|
||||||
$filter->between('end_at', '结束时间')->datetime();
|
$filter->between('start_at', '开始时间')->datetime();
|
||||||
});
|
$filter->between('end_at', '结束时间')->datetime();
|
||||||
|
$filter->equal('channel', '核销途径')->select(Activity::CHANNELS);
|
||||||
});
|
|
||||||
|
});
|
||||||
$grid->column('id', '#ID#');
|
|
||||||
$grid->column('title', '活动名称');
|
});
|
||||||
$grid->column('code', '活动编号');
|
|
||||||
$grid->column('rule.code', '卡券规则');
|
$grid->column('id', '#ID#');
|
||||||
$grid->column('类型')->display(function () {
|
$grid->column('title', '活动名称');
|
||||||
return $this->type_text;
|
$grid->column('code', '活动编号');
|
||||||
});
|
$grid->column('total', '可发券总数');
|
||||||
|
$grid->column('coupons_count', '已发券总数');
|
||||||
$grid->column('days', '延期(天)');
|
$grid->column('rule.code', '卡券规则');
|
||||||
$grid->column('rule.full', '满足金额');
|
$grid->column('类型')->display(function () {
|
||||||
$grid->column('rule.take', '扣除金额');
|
return $this->type_text;
|
||||||
$grid->column('发券')
|
});
|
||||||
->display(function () {
|
|
||||||
return $this->grants->pluck('user_nickname');
|
$grid->column('channel', '核销途径')
|
||||||
})
|
->using(Activity::CHANNELS)
|
||||||
->label()
|
->label([
|
||||||
->hide();
|
Activity::CHANNEL_YSD => 'info',
|
||||||
|
Activity::CHANNEL_UNION => 'success',
|
||||||
$grid->column('核券')
|
]);
|
||||||
->display(function () {
|
|
||||||
return $this->verifications->pluck('user_nickname');
|
$grid->column('days', '延期(天)');
|
||||||
})
|
$grid->column('rule.full', '满足金额');
|
||||||
->label()
|
$grid->column('rule.take', '扣除金额');
|
||||||
->hide();
|
$grid->column('发券')
|
||||||
|
->display(function () {
|
||||||
$grid->column('开始时间')->display(function () {
|
return $this->grants->pluck('user_nickname');
|
||||||
return $this->type == Activity::TYPE_SCOPE ? $this->start_at->format('Y-m-d') : '---';
|
})
|
||||||
});
|
->label()
|
||||||
$grid->column('结束时间')->display(function () {
|
->hide();
|
||||||
return $this->type == Activity::TYPE_SCOPE ? $this->end_at->format('Y-m-d') : '---';
|
|
||||||
});
|
$grid->column('核券')
|
||||||
|
->display(function () {
|
||||||
$grid->status('状态')->switch([
|
return $this->verifications->pluck('user_nickname');
|
||||||
'on' => ['value' => 1, 'text' => '正常', 'color' => 'primary'],
|
})
|
||||||
'off' => ['value' => 0, 'text' => '关闭', 'color' => 'danger'],
|
->label()
|
||||||
]);
|
->hide();
|
||||||
|
|
||||||
$grid->column('created_at', '创建时间');
|
$grid->column('开始时间')->display(function () {
|
||||||
|
return $this->type == Activity::TYPE_SCOPE ? $this->start_at->format('Y-m-d') : '---';
|
||||||
return $grid;
|
});
|
||||||
}
|
$grid->column('结束时间')->display(function () {
|
||||||
|
return $this->type == Activity::TYPE_SCOPE ? $this->end_at->format('Y-m-d') : '---';
|
||||||
/**
|
});
|
||||||
* Make a form builder.
|
|
||||||
* @return Form
|
$grid->status('状态')->switch([
|
||||||
*/
|
'on' => ['value' => 1, 'text' => '正常', 'color' => 'primary'],
|
||||||
protected function form($id = '')
|
'off' => ['value' => 0, 'text' => '关闭', 'color' => 'danger'],
|
||||||
{
|
]);
|
||||||
$form = new Form(new Activity);
|
|
||||||
|
$grid->column('created_at', '创建时间');
|
||||||
$form->text('title', '活动名称')->required();
|
|
||||||
$form->textarea('description', '活动说明')->required();
|
return $grid;
|
||||||
|
}
|
||||||
$form->select('activity_rule_id', '所属规则')
|
|
||||||
->options(function ($option, $info) {
|
/**
|
||||||
return ActivityRule::where('status', 1)->pluck('title', 'id');
|
* Make a form builder.
|
||||||
})
|
* @return Form
|
||||||
->required();
|
*/
|
||||||
|
protected function form($id = '')
|
||||||
$form->radio('type', '类型')
|
{
|
||||||
->options(Activity::TYPES)
|
$form = new Form(new Activity);
|
||||||
->when(Activity::TYPE_EXTEND, function (Form $form) {
|
|
||||||
$form->number('days', '延期天数')->default(60)->help('到期日期=发券日期+延期天数');
|
$form->text('title', '活动名称')->required();
|
||||||
})
|
$form->textarea('description', '活动说明')->required();
|
||||||
->when(Activity::TYPE_SCOPE, function (Form $form) {
|
|
||||||
$form->dateRange('start_at', 'end_at', '有效时间');
|
$form->select('activity_rule_id', '所属规则')
|
||||||
})
|
->options(function ($option, $info) {
|
||||||
->required();
|
return ActivityRule::where('status', 1)->pluck('title', 'id');
|
||||||
|
})
|
||||||
$form->switch('status', '状态')->default(1);
|
->required();
|
||||||
$form->switch('need_check', '多次校验')
|
|
||||||
->default(1)
|
$form->number('total', '总数')
|
||||||
->help('同一订单,多次核销时校验,订单每满100元可核销一笔。');
|
->help('可发券总数,0为不限制')
|
||||||
|
->default(10000)
|
||||||
$grantdef = $verificationsdef = '';
|
->required();
|
||||||
if ($id) {
|
|
||||||
$grantdef = Activity::find($id)->grants()->pluck('user_id')->toArray();
|
$form->radio('type', '类型')
|
||||||
$verificationsdef = Activity::find($id)->verifications()->pluck('user_id')->toArray();
|
->options(Activity::TYPES)
|
||||||
}
|
->when(Activity::TYPE_EXTEND, function (Form $form) {
|
||||||
|
$form->number('days', '延期天数')->default(60)->help('到期日期=发券日期+延期天数');
|
||||||
$users = User::with('info')->whereHas('identity', function ($q) {
|
})
|
||||||
$q->where('identity_id', 1);
|
->when(Activity::TYPE_SCOPE, function (Form $form) {
|
||||||
})->orderBy('id', 'desc')->get()->pluck('nickname', 'id');
|
$form->dateRange('start_at', 'end_at', '有效时间');
|
||||||
|
})
|
||||||
$form->listbox('grants.user_id', '可发券渠道')
|
->required();
|
||||||
->options($users)
|
|
||||||
->default($grantdef)
|
$form->radio('channel', '核销途径')
|
||||||
->required();
|
->options(Activity::CHANNELS)
|
||||||
|
->default(Activity::CHANNEL_YSD)
|
||||||
$form->listbox('verifications.user_id', '可核券渠道')
|
->help('券码核销的途径:亿时代是自己核销,银联是银联pos核销')
|
||||||
->options($users)
|
->required();
|
||||||
->default($verificationsdef)
|
|
||||||
->required();
|
$form->switch('status', '状态')->default(1);
|
||||||
|
$form->switch('need_check', '多次校验')
|
||||||
$form->saving(function (Form $form) {
|
->default(1)
|
||||||
$request = request();
|
->help('同一订单,多次核销时校验,订单每满100元可核销一笔。');
|
||||||
if ($request->type == Activity::TYPE_EXTEND && empty($request->days)) {
|
|
||||||
$error = new MessageBag([
|
$grantdef = $verificationsdef = '';
|
||||||
'title' => '错误',
|
if ($id) {
|
||||||
'message' => '必须添加延期天数',
|
$grantdef = Activity::find($id)->grants()->pluck('user_id')->toArray();
|
||||||
]);
|
$verificationsdef = Activity::find($id)->verifications()->pluck('user_id')->toArray();
|
||||||
|
}
|
||||||
return back()->withInput()->with(compact('error'));
|
|
||||||
}
|
$users = User::with('info')->whereHas('identity', function ($q) {
|
||||||
|
$q->where('identity_id', 1);
|
||||||
if ($request->type == Activity::TYPE_SCOPE && (empty($request->start_at) || empty($request->end_at))) {
|
})->orderBy('id', 'desc')->get()->pluck('nickname', 'id');
|
||||||
$error = new MessageBag([
|
|
||||||
'title' => '错误',
|
$form->listbox('grants.user_id', '可发券渠道')
|
||||||
'message' => '必须添加延期天数',
|
->options($users)
|
||||||
]);
|
->default($grantdef)
|
||||||
|
->required();
|
||||||
return back()->withInput()->with(compact('error'));
|
|
||||||
}
|
$form->listbox('verifications.user_id', '可核券渠道')
|
||||||
if (request()->start) {
|
->options($users)
|
||||||
$form->start_at = $form->start_at . ' 00:00:01';
|
->default($verificationsdef)
|
||||||
}
|
->required();
|
||||||
|
|
||||||
if (request()->end_at) {
|
$form->saving(function (Form $form) {
|
||||||
$form->end_at = $form->end_at . ' 23:59:59';
|
$request = request();
|
||||||
}
|
|
||||||
});
|
if ($request->total < 0) {
|
||||||
|
$error = new MessageBag([
|
||||||
$form->saved(function (Form $form) {
|
'title' => '错误',
|
||||||
$users = [];
|
'message' => '可发券总数必须大于0',
|
||||||
foreach ($form->grants['user_id'] as $key => $user_id) {
|
]);
|
||||||
if ($user_id) {
|
|
||||||
$form->model()->grants()->updateOrCreate([
|
return back()->withInput()->with(compact('error'));
|
||||||
'user_id' => $user_id,
|
}
|
||||||
]);
|
|
||||||
$users[] = $user_id;
|
if ($request->type == Activity::TYPE_EXTEND && empty($request->days)) {
|
||||||
}
|
$error = new MessageBag([
|
||||||
}
|
'title' => '错误',
|
||||||
$form->model()->grants()->whereNotIn('user_id', $users)->delete();
|
'message' => '必须添加延期天数',
|
||||||
$users = [];
|
]);
|
||||||
foreach ($form->verifications['user_id'] as $key => $user_id) {
|
|
||||||
if ($user_id) {
|
return back()->withInput()->with(compact('error'));
|
||||||
$form->model()->verifications()->updateOrCreate([
|
}
|
||||||
'user_id' => $user_id,
|
|
||||||
]);
|
if ($request->type == Activity::TYPE_SCOPE && (empty($request->start_at) || empty($request->end_at))) {
|
||||||
$users[] = $user_id;
|
$error = new MessageBag([
|
||||||
}
|
'title' => '错误',
|
||||||
}
|
'message' => '必须添加延期天数',
|
||||||
$form->model()->verifications()->whereNotIn('user_id', $users)->delete();
|
]);
|
||||||
});
|
|
||||||
|
return back()->withInput()->with(compact('error'));
|
||||||
return $form;
|
}
|
||||||
}
|
|
||||||
|
if (request()->start) {
|
||||||
}
|
$form->start_at = $form->start_at . ' 00:00:01';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request()->end_at) {
|
||||||
|
$form->end_at = $form->end_at . ' 23:59:59';
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$form->saved(function (Form $form) {
|
||||||
|
$users = [];
|
||||||
|
foreach ($form->grants['user_id'] as $key => $user_id) {
|
||||||
|
if ($user_id) {
|
||||||
|
$form->model()->grants()->updateOrCreate([
|
||||||
|
'user_id' => $user_id,
|
||||||
|
]);
|
||||||
|
$users[] = $user_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$form->model()->grants()->whereNotIn('user_id', $users)->delete();
|
||||||
|
$users = [];
|
||||||
|
foreach ($form->verifications['user_id'] as $key => $user_id) {
|
||||||
|
if ($user_id) {
|
||||||
|
$form->model()->verifications()->updateOrCreate([
|
||||||
|
'user_id' => $user_id,
|
||||||
|
]);
|
||||||
|
$users[] = $user_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$form->model()->verifications()->whereNotIn('user_id', $users)->delete();
|
||||||
|
});
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -54,25 +54,27 @@ class RuleController extends AdminController
|
|||||||
|
|
||||||
$form->switch('status', '状态')->default(1);
|
$form->switch('status', '状态')->default(1);
|
||||||
$form->saving(function (Form $form) {
|
$form->saving(function (Form $form) {
|
||||||
$code = $form->code;
|
if ($form->code) {
|
||||||
|
$code = $form->code;
|
||||||
|
|
||||||
$ticket = explode('-', $code);
|
$ticket = explode('-', $code);
|
||||||
if (!is_array($ticket) || count($ticket) != 3) {
|
if (!is_array($ticket) || count($ticket) != 3) {
|
||||||
$error = new MessageBag([
|
$error = new MessageBag([
|
||||||
'title' => '错误',
|
'title' => '错误',
|
||||||
'message' => '规则编号格式错误',
|
'message' => '规则编号格式错误',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return back()->withInput()->with(compact('error'));
|
return back()->withInput()->with(compact('error'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$full = $ticket[1]; //full100
|
||||||
|
$price = $ticket[2];
|
||||||
|
preg_match('/\d+/', $full, $match);
|
||||||
|
|
||||||
|
$form->full = $match[0];
|
||||||
|
$form->take = $price;
|
||||||
}
|
}
|
||||||
|
|
||||||
$full = $ticket[1]; //full100
|
|
||||||
$price = $ticket[2];
|
|
||||||
preg_match('/\d+/', $full, $match);
|
|
||||||
|
|
||||||
$form->full = $match[0];
|
|
||||||
$form->take = $price;
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
|
|||||||
@@ -20,83 +20,183 @@ class HomeController extends Controller
|
|||||||
->title('数据看版1')
|
->title('数据看版1')
|
||||||
->row(function (Row $row) {
|
->row(function (Row $row) {
|
||||||
$row->column(2, function (Column $column) {
|
$row->column(2, function (Column $column) {
|
||||||
$column->append(new InfoBox('渠道商', 'users', 'yellow', '/admin/users?identity[identity_id]=1', User::whereHas('identity', function ($q) {$q->where('identity_id', 1);})->count()));
|
$column->append(new InfoBox(
|
||||||
|
'渠道商',
|
||||||
|
'users',
|
||||||
|
'yellow',
|
||||||
|
'/admin/users?identity[identity_id]=1',
|
||||||
|
User::whereHas('identity', function ($q) {
|
||||||
|
$q->where('identity_id', 1);
|
||||||
|
})->count()
|
||||||
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
->row(function (Row $row) {
|
->row(function (Row $row) {
|
||||||
$row->column(2, function (Column $column) {
|
$row->column(2, function (Column $column) {
|
||||||
$column->append(new InfoBox('核销卡券总数', '', 'blue', '/admin/coupons', Coupon::whereIn('status', [2, 3])->count()));
|
$column->append(new InfoBox(
|
||||||
});
|
'核销卡券总数',
|
||||||
|
'',
|
||||||
$row->column(2, function (Column $column) {
|
'blue',
|
||||||
$column->append(new InfoBox('核销成功', '', 'blue', '/admin/coupons', Coupon::where('status', 2)->count()));
|
'/admin/coupons',
|
||||||
|
Coupon::whereIn('status', [2, 3])->count()
|
||||||
|
));
|
||||||
});
|
});
|
||||||
$row->column(2, function (Column $column) {
|
$row->column(2, function (Column $column) {
|
||||||
$column->append(new InfoBox('核销失败', '', 'black', '/admin/coupons', Coupon::where('status', 3)->count()));
|
$column->append(new InfoBox(
|
||||||
|
'核销成功',
|
||||||
|
'',
|
||||||
|
'blue',
|
||||||
|
'/admin/coupons',
|
||||||
|
Coupon::where('status', 2)->count()
|
||||||
|
));
|
||||||
});
|
});
|
||||||
$row->column(2, function (Column $column) {
|
$row->column(2, function (Column $column) {
|
||||||
$column->append(new InfoBox('资金通道结算', '', 'red', '/admin/coupons', Coupon::where('status', 2)->sum('price')));
|
$column->append(new InfoBox(
|
||||||
|
'核销失败',
|
||||||
|
'',
|
||||||
|
'black',
|
||||||
|
'/admin/coupons',
|
||||||
|
Coupon::where('status', 3)->count()
|
||||||
|
));
|
||||||
});
|
});
|
||||||
$row->column(2, function (Column $column) {
|
$row->column(2, function (Column $column) {
|
||||||
$column->append(new InfoBox('应打款金额', '', 'green', '/admin/coupons', Coupon::where('status', 2)->sum('profit')));
|
$column->append(new InfoBox(
|
||||||
|
'资金通道结算',
|
||||||
|
'',
|
||||||
|
'red',
|
||||||
|
'/admin/coupons',
|
||||||
|
Coupon::where('status', 2)->sum('price')
|
||||||
|
));
|
||||||
});
|
});
|
||||||
$row->column(2, function (Column $column) {
|
$row->column(2, function (Column $column) {
|
||||||
$column->append(new InfoBox('已打款金额', '', 'green', '/admin/coupons', Coupon::where('status', 2)->where('is_profit', 1)->sum('profit')));
|
$column->append(new InfoBox(
|
||||||
|
'应打款金额',
|
||||||
|
'',
|
||||||
|
'green',
|
||||||
|
'/admin/coupons',
|
||||||
|
Coupon::where('status', 2)->sum('profit')
|
||||||
|
));
|
||||||
|
});
|
||||||
|
$row->column(2, function (Column $column) {
|
||||||
|
$column->append(new InfoBox(
|
||||||
|
'已打款金额',
|
||||||
|
'',
|
||||||
|
'green',
|
||||||
|
'/admin/coupons',
|
||||||
|
Coupon::where('status', 2)
|
||||||
|
->where('is_profit', 1)
|
||||||
|
->sum('profit')
|
||||||
|
));
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
->row(function (Row $row) {
|
->row(function (Row $row) {
|
||||||
|
|
||||||
$coupons = Coupon::where('status', 2)
|
|
||||||
->whereDate('created_at', now()->format('Y-m-d'))
|
|
||||||
->get();
|
|
||||||
$lists = [
|
$lists = [
|
||||||
'ysd10' => $coupons->where('thirdPartyGoodsId', 'YSD-full100-10')->count(),
|
'ysd10' => Coupon::where('status', 2)
|
||||||
'ysd25' => $coupons->where('thirdPartyGoodsId', 'YSD-full100-25')->count(),
|
->whereDate('created_at', now()->format('Y-m-d'))
|
||||||
'ysd50' => $coupons->where('thirdPartyGoodsId', 'YSD-full100-50')->count(),
|
->where('thirdPartyGoodsId', 'YSD-full100-10')
|
||||||
'ysd100' => $coupons->where('thirdPartyGoodsId', 'YSD-full200-100')->count(),
|
->count(),
|
||||||
|
'ysd25' => Coupon::where('status', 2)
|
||||||
|
->whereDate('created_at', now()->format('Y-m-d'))
|
||||||
|
->where('thirdPartyGoodsId', 'YSD-full100-25')
|
||||||
|
->count(),
|
||||||
|
'ysd50' => Coupon::where('status', 2)
|
||||||
|
->whereDate('created_at', now()->format('Y-m-d'))
|
||||||
|
->where('thirdPartyGoodsId', 'YSD-full100-50')
|
||||||
|
->count(),
|
||||||
|
'ysd100' => Coupon::where('status', 2)
|
||||||
|
->whereDate('created_at', now()->format('Y-m-d'))
|
||||||
|
->where('thirdPartyGoodsId', 'YSD-full200-100')
|
||||||
|
->count(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$row->column(2, function (Column $column) use ($lists) {
|
$row->column(2, function (Column $column) use ($lists) {
|
||||||
$column->append(new InfoBox('100元减10元成功今日总数', '', 'blue', '/admin/coupons', $lists['ysd10']));
|
$column->append(new InfoBox(
|
||||||
|
'100元减10元成功今日总数',
|
||||||
|
'',
|
||||||
|
'blue',
|
||||||
|
'/admin/coupons',
|
||||||
|
$lists['ysd10']
|
||||||
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
$row->column(2, function (Column $column) use ($lists) {
|
$row->column(2, function (Column $column) use ($lists) {
|
||||||
$column->append(new InfoBox('100元减25元成功今日总数', '', 'blue', '/admin/coupons', $lists['ysd25']));
|
$column->append(new InfoBox(
|
||||||
|
'100元减25元成功今日总数',
|
||||||
|
'',
|
||||||
|
'blue',
|
||||||
|
'/admin/coupons',
|
||||||
|
$lists['ysd25']
|
||||||
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
$row->column(2, function (Column $column) use ($lists) {
|
$row->column(2, function (Column $column) use ($lists) {
|
||||||
$column->append(new InfoBox('100元减50元成功今日总数', '', 'blue', '/admin/coupons', $lists['ysd50']));
|
$column->append(new InfoBox(
|
||||||
|
'100元减50元成功今日总数',
|
||||||
|
'',
|
||||||
|
'blue',
|
||||||
|
'/admin/coupons',
|
||||||
|
$lists['ysd50']
|
||||||
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
$row->column(2, function (Column $column) use ($lists) {
|
$row->column(2, function (Column $column) use ($lists) {
|
||||||
$column->append(new InfoBox('200元减100元成功今日总数', '', 'blue', '/admin/coupons', $lists['ysd100']));
|
$column->append(new InfoBox(
|
||||||
|
'200元减100元成功今日总数',
|
||||||
|
'',
|
||||||
|
'blue',
|
||||||
|
'/admin/coupons',
|
||||||
|
$lists['ysd100']
|
||||||
|
));
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
->row(function (Row $row) {
|
->row(function (Row $row) {
|
||||||
|
|
||||||
$coupons = Coupon::where('status', 2)->get();
|
$lists = [
|
||||||
$lists = [
|
'ysd10' => Coupon::where('status', 2)->where('thirdPartyGoodsId', 'YSD-full100-10')->count(),
|
||||||
'ysd10' => $coupons->where('thirdPartyGoodsId', 'YSD-full100-10')->count(),
|
'ysd25' => Coupon::where('status', 2)->where('thirdPartyGoodsId', 'YSD-full100-25')->count(),
|
||||||
'ysd25' => $coupons->where('thirdPartyGoodsId', 'YSD-full100-25')->count(),
|
'ysd50' => Coupon::where('status', 2)->where('thirdPartyGoodsId', 'YSD-full100-50')->count(),
|
||||||
'ysd50' => $coupons->where('thirdPartyGoodsId', 'YSD-full100-50')->count(),
|
'ysd100' => Coupon::where('status', 2)->where('thirdPartyGoodsId', 'YSD-full200-100')->count(),
|
||||||
'ysd100' => $coupons->where('thirdPartyGoodsId', 'YSD-full200-100')->count(),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$row->column(2, function (Column $column) use ($lists) {
|
$row->column(2, function (Column $column) use ($lists) {
|
||||||
$column->append(new InfoBox('100元减10元成功总数', '', 'blue', '/admin/coupons', $lists['ysd10']));
|
$column->append(new InfoBox(
|
||||||
|
'100元减10元成功总数',
|
||||||
|
'',
|
||||||
|
'blue',
|
||||||
|
'/admin/coupons',
|
||||||
|
$lists['ysd10']
|
||||||
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
$row->column(2, function (Column $column) use ($lists) {
|
$row->column(2, function (Column $column) use ($lists) {
|
||||||
$column->append(new InfoBox('100元减25元成功总数', '', 'blue', '/admin/coupons', $lists['ysd25']));
|
$column->append(new InfoBox(
|
||||||
|
'100元减25元成功总数',
|
||||||
|
'',
|
||||||
|
'blue',
|
||||||
|
'/admin/coupons',
|
||||||
|
$lists['ysd25']
|
||||||
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
$row->column(2, function (Column $column) use ($lists) {
|
$row->column(2, function (Column $column) use ($lists) {
|
||||||
$column->append(new InfoBox('100元减50元成功总数', '', 'blue', '/admin/coupons', $lists['ysd50']));
|
$column->append(new InfoBox(
|
||||||
|
'100元减50元成功总数',
|
||||||
|
'',
|
||||||
|
'blue',
|
||||||
|
'/admin/coupons',
|
||||||
|
$lists['ysd50']
|
||||||
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
$row->column(2, function (Column $column) use ($lists) {
|
$row->column(2, function (Column $column) use ($lists) {
|
||||||
$column->append(new InfoBox('200元减100元成功总数', '', 'blue', '/admin/coupons', $lists['ysd100']));
|
$column->append(new InfoBox(
|
||||||
|
'200元减100元成功总数',
|
||||||
|
'',
|
||||||
|
'blue',
|
||||||
|
'/admin/coupons',
|
||||||
|
$lists['ysd100']
|
||||||
|
));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,67 +1,68 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Listeners;
|
namespace App\Listeners;
|
||||||
|
|
||||||
use App\Events\ConponCallback;
|
use App\Events\ConponCallback;
|
||||||
use App\Models\ActivityCouponLog;
|
use App\Models\ActivityCouponLog;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use RuntimeException;
|
||||||
class ConponCallbackListener implements ShouldQueue
|
|
||||||
{
|
class ConponCallbackListener implements ShouldQueue
|
||||||
|
{
|
||||||
public $queue = 'LISTENER';
|
|
||||||
|
public $queue = 'LISTENER';
|
||||||
/**
|
|
||||||
* Handle the event.
|
/**
|
||||||
* @param RoomLoginDone $event
|
* Handle the event.
|
||||||
* @return void
|
* @param RoomLoginDone $event
|
||||||
*/
|
* @return void
|
||||||
public function handle(ConponCallback $event)
|
*/
|
||||||
{
|
public function handle(ConponCallback $event)
|
||||||
$acticity_coupon = $event->acticity_coupon;
|
{
|
||||||
|
$acticity_coupon = $event->acticity_coupon;
|
||||||
$user = $acticity_coupon->outlet->parent;
|
|
||||||
if ($user->callback) {
|
$user = $acticity_coupon->outlet->parent;
|
||||||
$client = new Client();
|
if ($user->callback) {
|
||||||
|
$client = new Client();
|
||||||
$response = $client->request('post', $user->callback, [
|
|
||||||
'timeout' => 30,
|
$response = $client->request('post', $user->callback, [
|
||||||
'query' => [
|
'timeout' => 30,
|
||||||
'code' => $acticity_coupon->code,
|
'query' => [
|
||||||
'status' => $acticity_coupon->status,
|
'code' => $acticity_coupon->code,
|
||||||
],
|
'status' => $acticity_coupon->status,
|
||||||
]);
|
],
|
||||||
|
]);
|
||||||
$data = [
|
|
||||||
'code' => $acticity_coupon->code,
|
$data = [
|
||||||
'type' => $acticity_coupon->status == 2 ? 'Verification' : 'Destroy',
|
'code' => $acticity_coupon->code,
|
||||||
'url' => $user->callback,
|
'type' => $acticity_coupon->status == 2 ? 'Verification' : 'Destroy',
|
||||||
];
|
'url' => $user->callback,
|
||||||
|
];
|
||||||
$error = false;
|
|
||||||
|
$error = false;
|
||||||
if ($response->getStatusCode() == 200) {
|
|
||||||
$body = $response->getBody();
|
if ($response->getStatusCode() == 200) {
|
||||||
$result = json_decode($body->getContents(), true);
|
$body = $response->getBody();
|
||||||
|
$result = json_decode($body->getContents(), true);
|
||||||
$data['status'] = $result['code'] ?? '';
|
|
||||||
$data['source'] = $result;
|
$data['status'] = $result['code'] ?? '';
|
||||||
$data['remark'] = $result['message'] ?? '';
|
$data['source'] = $result;
|
||||||
|
$data['remark'] = $result['message'] ?? '';
|
||||||
} else {
|
|
||||||
$data['status'] = 0;
|
} else {
|
||||||
$data['source'] = '';
|
$data['status'] = 0;
|
||||||
$data['remark'] = '接口错误';
|
$data['source'] = '';
|
||||||
$error = true;
|
$data['remark'] = '接口错误';
|
||||||
}
|
$error = true;
|
||||||
ActivityCouponLog::create($data);
|
}
|
||||||
|
ActivityCouponLog::create($data);
|
||||||
if ($error) {
|
|
||||||
throw new RuntimeException($data['remark']);
|
if ($error) {
|
||||||
}
|
throw new RuntimeException($data['remark']);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,137 +1,149 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Models\Traits\BelongsToUser;
|
use App\Models\Traits\BelongsToUser;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class Activity extends Model
|
class Activity extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
use BelongsToUser;
|
use BelongsToUser;
|
||||||
|
|
||||||
const TYPE_EXTEND = 1;
|
protected $dates = [
|
||||||
const TYPE_SCOPE = 2;
|
'start_at',
|
||||||
const TYPES = [
|
'end_at',
|
||||||
self::TYPE_EXTEND => '延期',
|
];
|
||||||
self::TYPE_SCOPE => '固定',
|
|
||||||
];
|
const TYPE_EXTEND = 1;
|
||||||
|
const TYPE_SCOPE = 2;
|
||||||
const STATUS_OPEN = 1;
|
const TYPES = [
|
||||||
const STATUS_CLOSE = 0;
|
self::TYPE_EXTEND => '延期',
|
||||||
const STATUS = [
|
self::TYPE_SCOPE => '固定',
|
||||||
self::STATUS_OPEN => '正常',
|
];
|
||||||
self::STATUS_CLOSE => '关闭',
|
|
||||||
];
|
const STATUS_OPEN = 1;
|
||||||
|
const STATUS_CLOSE = 0;
|
||||||
protected $dates = [
|
const STATUS = [
|
||||||
'start_at',
|
self::STATUS_OPEN => '正常',
|
||||||
'end_at',
|
self::STATUS_CLOSE => '关闭',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
const CHANNEL_YSD = 1;
|
||||||
* 默认加载的关联
|
const CHANNEL_UNION = 2;
|
||||||
* @var array
|
const CHANNELS = [
|
||||||
*/
|
self::CHANNEL_YSD => '亿时代',
|
||||||
protected $with = ['rule'];
|
self::CHANNEL_UNION => '银联',
|
||||||
|
];
|
||||||
protected static function boot(): void
|
|
||||||
{
|
/**
|
||||||
parent::boot();
|
* 默认加载的关联
|
||||||
|
* @var array
|
||||||
self::creating(function ($model) {
|
*/
|
||||||
$model->code = 'ysd' . date('Ym') . mt_rand(100, 999);
|
protected $with = ['rule'];
|
||||||
});
|
|
||||||
}
|
protected static function boot(): void
|
||||||
|
{
|
||||||
//活动类型 固定期限 延期
|
parent::boot();
|
||||||
public function getTypeTextAttribute()
|
|
||||||
{
|
self::creating(function ($model) {
|
||||||
return self::TYPES[$this->type] ?? '未知';
|
$model->code = 'ysd' . date('Ym') . mt_rand(100, 999);
|
||||||
}
|
});
|
||||||
|
}
|
||||||
//活动状态
|
|
||||||
public function getStatusTextAttribute()
|
//活动类型 固定期限 延期
|
||||||
{
|
public function getTypeTextAttribute()
|
||||||
return self::STATUS[$this->status] ?? '未知';
|
{
|
||||||
}
|
return self::TYPES[$this->type] ?? '未知';
|
||||||
|
}
|
||||||
//关联卡券规则 ysd-full100-10
|
|
||||||
public function rule()
|
//活动状态
|
||||||
{
|
public function getStatusTextAttribute(): string
|
||||||
return $this->belongsTo(ActivityRule::class, 'activity_rule_id');
|
{
|
||||||
}
|
return self::STATUS[$this->status] ?? '未知';
|
||||||
|
}
|
||||||
//关联券表
|
|
||||||
public function coupons()
|
//关联卡券规则 ysd-full100-10
|
||||||
{
|
public function rule()
|
||||||
return $this->hasMany(ActivityCoupon::class);
|
{
|
||||||
}
|
return $this->belongsTo(ActivityRule::class, 'activity_rule_id');
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Notes: 关联可发券渠道
|
//关联券表
|
||||||
* @Author: 玄尘
|
public function coupons()
|
||||||
* @Date : 2020/8/21 11:09
|
{
|
||||||
*/
|
return $this->hasMany(ActivityCoupon::class);
|
||||||
public function grants()
|
}
|
||||||
{
|
|
||||||
return $this->hasMany(ActivityGrant::class);
|
/**
|
||||||
|
* Notes: 关联可发券渠道
|
||||||
}
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/8/21 11:09
|
||||||
/**
|
*/
|
||||||
* Notes: 关联可核销渠道
|
public function grants()
|
||||||
* @Author: 玄尘
|
{
|
||||||
* @Date : 2020/8/21 11:09
|
return $this->hasMany(ActivityGrant::class);
|
||||||
*/
|
|
||||||
public function verifications()
|
}
|
||||||
{
|
|
||||||
return $this->hasMany(ActivityVerification::class);
|
/**
|
||||||
|
* Notes: 关联可核销渠道
|
||||||
}
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/8/21 11:09
|
||||||
public function canGrant()
|
*/
|
||||||
{
|
public function verifications()
|
||||||
return $this->status;
|
{
|
||||||
}
|
return $this->hasMany(ActivityVerification::class);
|
||||||
|
|
||||||
//发券
|
}
|
||||||
public function grant($mobile, $outletId = null)
|
|
||||||
{
|
public function canGrant()
|
||||||
|
{
|
||||||
try {
|
return $this->status;
|
||||||
$code = 'YSD' . date('ymd') . mt_rand(100000, 999999);
|
}
|
||||||
|
|
||||||
if ($this->type == SELF::TYPE_EXTEND) {
|
//发券
|
||||||
$start_at = now();
|
public function grant($mobile, $outletId = null)
|
||||||
$end_at = now()->addDays($this->days);
|
{
|
||||||
} else {
|
|
||||||
$start_at = $this->start_at->startOfDay();
|
try {
|
||||||
$end_at = $this->end_at->endOfDay();
|
//判断生成何种码
|
||||||
}
|
if ($this->channel == self::CHANNEL_UNION) {
|
||||||
|
$code = '66406' . date('ymdH') . mt_rand(1000000, 9999999);
|
||||||
DB::beginTransaction();
|
} else {
|
||||||
$coupon = ActivityCoupon::create([
|
$code = 'YSD' . date('ymd') . mt_rand(100000, 999999);
|
||||||
'activity_id' => $this->id,
|
}
|
||||||
'code' => $code,
|
|
||||||
'mobile' => $mobile,
|
if ($this->type == SELF::TYPE_EXTEND) {
|
||||||
'outletId' => $outletId,
|
$start_at = now();
|
||||||
'full' => $this->rule->full,
|
$end_at = now()->addDays($this->days);
|
||||||
'price' => $this->rule->take,
|
} else {
|
||||||
'start_at' => $start_at,
|
$start_at = $this->start_at->startOfDay();
|
||||||
'end_at' => $end_at,
|
$end_at = $this->end_at->endOfDay();
|
||||||
'status' => ActivityCoupon::STATUS_INIT,
|
}
|
||||||
]);
|
|
||||||
|
DB::beginTransaction();
|
||||||
DB::commit();
|
$coupon = ActivityCoupon::create([
|
||||||
|
'activity_id' => $this->id,
|
||||||
return $coupon;
|
'code' => $code,
|
||||||
} catch (\Exception $e) {
|
'mobile' => $mobile,
|
||||||
DB::rollback();
|
'outletId' => $outletId,
|
||||||
|
'full' => $this->rule->full,
|
||||||
return $e->getMessage();
|
'price' => $this->rule->take,
|
||||||
}
|
'start_at' => $start_at,
|
||||||
|
'end_at' => $end_at,
|
||||||
}
|
'status' => ActivityCoupon::STATUS_INIT,
|
||||||
|
]);
|
||||||
}
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return $coupon;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollback();
|
||||||
|
|
||||||
|
return $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
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,14 +102,23 @@ class Init
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置来源
|
||||||
|
public function setFrom($from)
|
||||||
|
{
|
||||||
|
$this->from = $from;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: 插入日志
|
* Notes: 插入日志
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2020/6/30 10:29
|
* @Date : 2020/6/30 10:29
|
||||||
* @param $url
|
* @param $url
|
||||||
* @param $method
|
* @param $method
|
||||||
* @param $params
|
* @param $params
|
||||||
* @param string $type
|
* @param string $type
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function createLog($url, $method, $params, $type = 'pingan')
|
public function createLog($url, $method, $params, $type = 'pingan')
|
||||||
@@ -139,38 +151,56 @@ 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) {
|
||||||
if ($check_count > 0) {
|
return "核销失败,此订单您无法再使用优惠券";
|
||||||
// if ($this->total < 100) {
|
|
||||||
// return '核销失败,订单金额少于100只能核销一张优惠券。';
|
|
||||||
// }
|
|
||||||
if ($check_count >= $count) {
|
|
||||||
return "核销失败,此订单您只能使用 {$count} 张优惠券";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//取差值
|
||||||
|
$diff = bcsub($this->total, $check_count);
|
||||||
|
|
||||||
|
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} 张优惠券";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,10 +212,10 @@ class Init
|
|||||||
public function HasCheck()
|
public function HasCheck()
|
||||||
{
|
{
|
||||||
$info = Coupon::where('redemptionCode', $this->redemptionCode)
|
$info = Coupon::where('redemptionCode', $this->redemptionCode)
|
||||||
->where('outletId', $this->outletId)
|
->where('outletId', $this->outletId)
|
||||||
->where('total', $this->total)
|
->where('total', $this->total)
|
||||||
->where('status', 2)
|
->where('status', 2)
|
||||||
->first();
|
->first();
|
||||||
if ($info) {
|
if ($info) {
|
||||||
return '核销失败,此优惠券已被使用';
|
return '核销失败,此优惠券已被使用';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,9 @@ 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,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace XuanChen\Coupon\Action\ysd;
|
|||||||
|
|
||||||
use App\Models\Activity;
|
use App\Models\Activity;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Carbon\Carbon;
|
||||||
use XuanChen\Coupon\Action\Init;
|
use XuanChen\Coupon\Action\Init;
|
||||||
|
|
||||||
class YsdGrant extends Init
|
class YsdGrant extends Init
|
||||||
@@ -13,7 +14,7 @@ class YsdGrant extends Init
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$activity = Activity::where('code', $this->activityId)->first();
|
$activity = Activity::withCount('coupons')->where('code', $this->activityId)->first();
|
||||||
if (!$activity) {
|
if (!$activity) {
|
||||||
return '发券失败,没有找到这个活动。';
|
return '发券失败,没有找到这个活动。';
|
||||||
}
|
}
|
||||||
@@ -21,6 +22,14 @@ class YsdGrant extends Init
|
|||||||
if (!$activity->status) {
|
if (!$activity->status) {
|
||||||
return '发券失败,活动已经关闭。';
|
return '发券失败,活动已经关闭。';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($activity->type == Activity::TYPE_SCOPE && Carbon::now()->gt($activity->end_at)) {
|
||||||
|
return '发券失败,此活动已经结束。';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activity->total > 0 && $activity->coupons_count >= $activity->total) {
|
||||||
|
return '发券失败,已达到可发券总数。';
|
||||||
|
}
|
||||||
|
|
||||||
$outlet = User::where('outlet_id', $this->outletId)->first();
|
$outlet = User::where('outlet_id', $this->outletId)->first();
|
||||||
if (!$outlet) {
|
if (!$outlet) {
|
||||||
|
|||||||
@@ -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