Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f3d8a7d22c | |||
| 26732a2d51 | |||
| 926682133d | |||
| 6af2c3a78b | |||
| d3bfd98817 | |||
| d43f4b4974 | |||
| 88511c7ab2 | |||
| 9c3050240c | |||
| 1dd3503ee8 | |||
| 4d97481515 | |||
| 59cf8a26c4 | |||
| d8cd8ae9a6 | |||
| 7cfd45bf99 | |||
| c909b9b1ed | |||
| d0ae80aeff | |||
| f6c4ba3ae5 | |||
| 8db6bc92c6 | |||
| 3a8093bb57 | |||
| 648147cd4d | |||
| abfcfab3ba | |||
| 996ed300f5 | |||
| 8c81c76aa0 | |||
| 1f178435a6 |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -3,4 +3,8 @@
|
|||||||
.editorconfig
|
.editorconfig
|
||||||
.env
|
.env
|
||||||
/vendor
|
/vendor
|
||||||
/storage/
|
/storage/app
|
||||||
|
/storage/logs
|
||||||
|
/storage/framework
|
||||||
|
/storage/debugbar/
|
||||||
|
/bootstrap/cache
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class LogController extends AdminController
|
|||||||
function grid()
|
function grid()
|
||||||
{
|
{
|
||||||
$grid = new Grid(new AccountLog);
|
$grid = new Grid(new AccountLog);
|
||||||
$grid->model()->latest();
|
$grid->model()->with(['account'])->latest();
|
||||||
$userId = request()->user_id;
|
$userId = request()->user_id;
|
||||||
$grid->model()->when($userId, function ($query, $userId) {
|
$grid->model()->when($userId, function ($query, $userId) {
|
||||||
$query->where('user_id', $userId);
|
$query->where('user_id', $userId);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class CouponController extends AdminController
|
|||||||
protected function grid()
|
protected function grid()
|
||||||
{
|
{
|
||||||
$grid = new Grid(new ActivityCoupon);
|
$grid = new Grid(new ActivityCoupon);
|
||||||
$grid->model()->latest();
|
$grid->model()->with(['outlet'])->latest();
|
||||||
$grid->disableActions();
|
$grid->disableActions();
|
||||||
$grid->disableCreateButton();
|
$grid->disableCreateButton();
|
||||||
|
|
||||||
|
|||||||
@@ -1,282 +1,247 @@
|
|||||||
<?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->model()->with(['grants.user', 'verifications.user']);
|
||||||
|
$grid->actions(function ($actions) {
|
||||||
$grid->actions(function ($actions) {
|
$actions->disableView();
|
||||||
$actions->disableView();
|
});
|
||||||
});
|
|
||||||
|
$grid->filter(function ($filter) {
|
||||||
$grid->filter(function ($filter) {
|
$filter->column(1 / 2, function ($filter) {
|
||||||
$filter->column(1 / 2, function ($filter) {
|
$filter->equal('status', '状态')->select(Activity::STATUS);
|
||||||
$filter->equal('status', '状态')->select(Activity::STATUS);
|
$filter->equal('type', '类型')->select(Activity::TYPES);
|
||||||
$filter->equal('type', '类型')->select(Activity::TYPES);
|
|
||||||
|
$users = User::whereHas('identity', function ($query) {
|
||||||
$users = User::whereHas('identity', function ($query) {
|
$query->where('identity_id', 1);
|
||||||
$query->where('identity_id', 1);
|
})->get()->pluck('nickname', 'id');
|
||||||
})->get()->pluck('nickname', 'id');
|
|
||||||
|
});
|
||||||
});
|
|
||||||
|
$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);
|
|
||||||
|
});
|
||||||
});
|
|
||||||
|
$grid->column('id', '#ID#');
|
||||||
});
|
$grid->column('title', '活动名称');
|
||||||
|
$grid->column('code', '活动编号');
|
||||||
$grid->column('id', '#ID#');
|
$grid->column('rule.code', '卡券规则');
|
||||||
$grid->column('title', '活动名称');
|
$grid->column('类型')->display(function () {
|
||||||
$grid->column('code', '活动编号');
|
return $this->type_text;
|
||||||
$grid->column('total', '可发券总数');
|
});
|
||||||
$grid->column('coupons_count', '已发券总数');
|
|
||||||
$grid->column('rule.code', '卡券规则');
|
$grid->column('days', '延期(天)');
|
||||||
$grid->column('类型')->display(function () {
|
$grid->column('rule.full', '满足金额');
|
||||||
return $this->type_text;
|
$grid->column('rule.take', '扣除金额');
|
||||||
});
|
$grid->column('发券')
|
||||||
|
->display(function () {
|
||||||
$grid->column('channel', '核销途径')
|
return $this->grants->pluck('user_nickname');
|
||||||
->using(Activity::CHANNELS)
|
})
|
||||||
->label([
|
->label()
|
||||||
Activity::CHANNEL_YSD => 'info',
|
->hide();
|
||||||
Activity::CHANNEL_UNION => 'success',
|
|
||||||
]);
|
$grid->column('核券')
|
||||||
|
->display(function () {
|
||||||
$grid->column('days', '延期(天)');
|
return $this->verifications->pluck('user_nickname');
|
||||||
$grid->column('rule.full', '满足金额');
|
})
|
||||||
$grid->column('rule.take', '扣除金额');
|
->label()
|
||||||
$grid->column('发券')
|
->hide();
|
||||||
->display(function () {
|
|
||||||
return $this->grants->pluck('user_nickname');
|
$grid->column('开始时间')->display(function () {
|
||||||
})
|
return $this->type == Activity::TYPE_SCOPE ? $this->start_at->format('Y-m-d') : '---';
|
||||||
->label()
|
});
|
||||||
->hide();
|
$grid->column('结束时间')->display(function () {
|
||||||
|
return $this->type == Activity::TYPE_SCOPE ? $this->end_at->format('Y-m-d') : '---';
|
||||||
$grid->column('核券')
|
});
|
||||||
->display(function () {
|
|
||||||
return $this->verifications->pluck('user_nickname');
|
$grid->status('状态')->switch([
|
||||||
})
|
'on' => ['value' => 1, 'text' => '正常', 'color' => 'primary'],
|
||||||
->label()
|
'off' => ['value' => 0, 'text' => '关闭', 'color' => 'danger'],
|
||||||
->hide();
|
]);
|
||||||
|
|
||||||
$grid->column('开始时间')->display(function () {
|
$grid->column('created_at', '创建时间');
|
||||||
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.
|
||||||
$grid->status('状态')->switch([
|
* @return Form
|
||||||
'on' => ['value' => 1, 'text' => '正常', 'color' => 'primary'],
|
*/
|
||||||
'off' => ['value' => 0, 'text' => '关闭', 'color' => 'danger'],
|
protected function form($id = '')
|
||||||
]);
|
{
|
||||||
|
$form = new Form(new Activity);
|
||||||
$grid->column('created_at', '创建时间');
|
|
||||||
|
$form->text('title', '活动名称')->required();
|
||||||
return $grid;
|
$form->textarea('description', '活动说明')->required();
|
||||||
}
|
|
||||||
|
$form->select('activity_rule_id', '所属规则')
|
||||||
/**
|
->options(function ($option, $info) {
|
||||||
* Make a form builder.
|
return ActivityRule::where('status', 1)->pluck('title', 'id');
|
||||||
* @return Form
|
})
|
||||||
*/
|
->required();
|
||||||
protected function form($id = '')
|
|
||||||
{
|
$form->radio('type', '类型')
|
||||||
$form = new Form(new Activity);
|
->options(Activity::TYPES)
|
||||||
|
->when(Activity::TYPE_EXTEND, function (Form $form) {
|
||||||
$form->text('title', '活动名称')->required();
|
$form->number('days', '延期天数')->default(60)->help('到期日期=发券日期+延期天数');
|
||||||
$form->textarea('description', '活动说明')->required();
|
})
|
||||||
|
->when(Activity::TYPE_SCOPE, function (Form $form) {
|
||||||
$form->select('activity_rule_id', '所属规则')
|
$form->dateRange('start_at', 'end_at', '有效时间');
|
||||||
->options(function ($option, $info) {
|
})
|
||||||
return ActivityRule::where('status', 1)->pluck('title', 'id');
|
->required();
|
||||||
})
|
|
||||||
->required();
|
$form->switch('status', '状态')->default(1);
|
||||||
|
$form->switch('need_check', '多次校验')
|
||||||
$form->number('total', '总数')
|
->default(1)
|
||||||
->help('可发券总数,0为不限制')
|
->help('同一订单,多次核销时校验,订单每满100元可核销一笔。');
|
||||||
->default(10000)
|
|
||||||
->required();
|
$grantdef = $verificationsdef = '';
|
||||||
|
if ($id) {
|
||||||
$form->radio('type', '类型')
|
$grantdef = Activity::find($id)->grants()->pluck('user_id')->toArray();
|
||||||
->options(Activity::TYPES)
|
$verificationsdef = Activity::find($id)->verifications()->pluck('user_id')->toArray();
|
||||||
->when(Activity::TYPE_EXTEND, function (Form $form) {
|
}
|
||||||
$form->number('days', '延期天数')->default(60)->help('到期日期=发券日期+延期天数');
|
|
||||||
})
|
$users = User::with('info')->whereHas('identity', function ($q) {
|
||||||
->when(Activity::TYPE_SCOPE, function (Form $form) {
|
$q->where('identity_id', 1);
|
||||||
$form->dateRange('start_at', 'end_at', '有效时间');
|
})->orderBy('id', 'desc')->get()->pluck('nickname', 'id');
|
||||||
})
|
|
||||||
->required();
|
$form->listbox('grants.user_id', '可发券渠道')
|
||||||
|
->options($users)
|
||||||
$form->radio('channel', '核销途径')
|
->default($grantdef)
|
||||||
->options(Activity::CHANNELS)
|
->required();
|
||||||
->default(Activity::CHANNEL_YSD)
|
|
||||||
->help('券码核销的途径:亿时代是自己核销,银联是银联pos核销')
|
$form->listbox('verifications.user_id', '可核券渠道')
|
||||||
->required();
|
->options($users)
|
||||||
|
->default($verificationsdef)
|
||||||
$form->switch('status', '状态')->default(1);
|
->required();
|
||||||
$form->switch('need_check', '多次校验')
|
|
||||||
->default(1)
|
$form->saving(function (Form $form) {
|
||||||
->help('同一订单,多次核销时校验,订单每满100元可核销一笔。');
|
$request = request();
|
||||||
|
if ($request->type == Activity::TYPE_EXTEND && empty($request->days)) {
|
||||||
$grantdef = $verificationsdef = '';
|
$error = new MessageBag([
|
||||||
if ($id) {
|
'title' => '错误',
|
||||||
$grantdef = Activity::find($id)->grants()->pluck('user_id')->toArray();
|
'message' => '必须添加延期天数',
|
||||||
$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);
|
|
||||||
})->orderBy('id', 'desc')->get()->pluck('nickname', 'id');
|
if ($request->type == Activity::TYPE_SCOPE && (empty($request->start_at) || empty($request->end_at))) {
|
||||||
|
$error = new MessageBag([
|
||||||
$form->listbox('grants.user_id', '可发券渠道')
|
'title' => '错误',
|
||||||
->options($users)
|
'message' => '必须添加延期天数',
|
||||||
->default($grantdef)
|
]);
|
||||||
->required();
|
|
||||||
|
return back()->withInput()->with(compact('error'));
|
||||||
$form->listbox('verifications.user_id', '可核券渠道')
|
}
|
||||||
->options($users)
|
if (request()->start) {
|
||||||
->default($verificationsdef)
|
$form->start_at = $form->start_at . ' 00:00:01';
|
||||||
->required();
|
}
|
||||||
|
|
||||||
$form->saving(function (Form $form) {
|
if (request()->end_at) {
|
||||||
$request = request();
|
$form->end_at = $form->end_at . ' 23:59:59';
|
||||||
|
}
|
||||||
if ($request->total < 0) {
|
});
|
||||||
$error = new MessageBag([
|
|
||||||
'title' => '错误',
|
$form->saved(function (Form $form) {
|
||||||
'message' => '可发券总数必须大于0',
|
$users = [];
|
||||||
]);
|
foreach ($form->grants['user_id'] as $key => $user_id) {
|
||||||
|
if ($user_id) {
|
||||||
return back()->withInput()->with(compact('error'));
|
$form->model()->grants()->updateOrCreate([
|
||||||
}
|
'user_id' => $user_id,
|
||||||
|
]);
|
||||||
if ($request->type == Activity::TYPE_EXTEND && empty($request->days)) {
|
$users[] = $user_id;
|
||||||
$error = new MessageBag([
|
}
|
||||||
'title' => '错误',
|
}
|
||||||
'message' => '必须添加延期天数',
|
$form->model()->grants()->whereNotIn('user_id', $users)->delete();
|
||||||
]);
|
$users = [];
|
||||||
|
foreach ($form->verifications['user_id'] as $key => $user_id) {
|
||||||
return back()->withInput()->with(compact('error'));
|
if ($user_id) {
|
||||||
}
|
$form->model()->verifications()->updateOrCreate([
|
||||||
|
'user_id' => $user_id,
|
||||||
if ($request->type == Activity::TYPE_SCOPE && (empty($request->start_at) || empty($request->end_at))) {
|
]);
|
||||||
$error = new MessageBag([
|
$users[] = $user_id;
|
||||||
'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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -69,20 +69,20 @@ class LogController extends AdminController
|
|||||||
$grid->column('id', '#ID#');
|
$grid->column('id', '#ID#');
|
||||||
$grid->column('code', '卡券编号');
|
$grid->column('code', '卡券编号');
|
||||||
$grid->column('type', '分类')
|
$grid->column('type', '分类')
|
||||||
->using(ActivityCouponLog::TYPES)
|
->using(ActivityCouponLog::TYPES)
|
||||||
->label([
|
->label([
|
||||||
1 => 'default',
|
1 => 'default',
|
||||||
2 => 'warning',
|
2 => 'warning',
|
||||||
3 => 'info',
|
3 => 'info',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$grid->column('status', '状态')
|
$grid->column('status', '状态')
|
||||||
->using(ActivityCouponLog::STATUS)
|
->using(ActivityCouponLog::STATUS)
|
||||||
->label([
|
->label([
|
||||||
1 => 'default',
|
1 => 'default',
|
||||||
2 => 'warning',
|
2 => 'warning',
|
||||||
3 => 'info',
|
3 => 'info',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$grid->column('remark', '处理结果');
|
$grid->column('remark', '处理结果');
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class IndexController extends AdminController
|
|||||||
$users = User::whereHas('identity', function ($query) {
|
$users = User::whereHas('identity', function ($query) {
|
||||||
$query->where('identity_id', 1);
|
$query->where('identity_id', 1);
|
||||||
})->get()->pluck('nickname', 'id');
|
})->get()->pluck('nickname', 'id');
|
||||||
|
|
||||||
$filter->equal('user_id', '渠道')->select($users);
|
$filter->equal('user_id', '渠道')->select($users);
|
||||||
$filter->equal('thirdPartyGoodsId', '优惠政策')->select(ActivityRule::pluck('title', 'code'));
|
$filter->equal('thirdPartyGoodsId', '优惠政策')->select(ActivityRule::pluck('title', 'code'));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -47,9 +47,10 @@ class CensusController extends AdminController
|
|||||||
{
|
{
|
||||||
$grid = new Grid(new User);
|
$grid = new Grid(new User);
|
||||||
|
|
||||||
$grid->model()->whereHas('identity', function ($q) {
|
$grid->model()
|
||||||
$q->where('identity_id', 1);
|
->whereHas('identity', function ($q) {
|
||||||
});
|
$q->where('identity_id', 1);
|
||||||
|
});
|
||||||
|
|
||||||
$grid->disableCreateButton();
|
$grid->disableCreateButton();
|
||||||
$grid->disableBatchActions();
|
$grid->disableBatchActions();
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use Encore\Admin\Grid;
|
|||||||
class IndexController extends AdminController
|
class IndexController extends AdminController
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $title = '渠道打款处理';
|
protected $title = '平安渠道打款处理';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes:
|
* Notes:
|
||||||
|
|||||||
@@ -33,10 +33,12 @@ class LogController extends AdminController
|
|||||||
$grid->filter(function ($filter) {
|
$grid->filter(function ($filter) {
|
||||||
$filter->column(1 / 2, function ($filter) {
|
$filter->column(1 / 2, function ($filter) {
|
||||||
$filter->between('paid_at', '打款时间')->datetime();
|
$filter->between('paid_at', '打款时间')->datetime();
|
||||||
$users = User::whereHas('identity', function ($query) {
|
$users = User::query()
|
||||||
$query->where('identity_id', 1);
|
->whereHas('identity', function ($query) {
|
||||||
})->get()->pluck('nickname', 'id');
|
$query->where('identity_id', 1);
|
||||||
|
})
|
||||||
|
->get()
|
||||||
|
->pluck('nickname', 'id');
|
||||||
$filter->equal('user_id', '渠道')->select($users);
|
$filter->equal('user_id', '渠道')->select($users);
|
||||||
});
|
});
|
||||||
$filter->column(1 / 2, function ($filter) {
|
$filter->column(1 / 2, function ($filter) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class HomeController extends Controller
|
|||||||
{
|
{
|
||||||
|
|
||||||
return $content
|
return $content
|
||||||
->title('数据看版1')
|
->title('数据看版2')
|
||||||
->row(function (Row $row) {
|
->row(function (Row $row) {
|
||||||
$row->column(2, function (Column $column) {
|
$row->column(2, function (Column $column) {
|
||||||
$column->append(new InfoBox(
|
$column->append(new InfoBox(
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use RuLong\Identity\Models\Identity;
|
|||||||
|
|
||||||
class IdentityController extends AdminController
|
class IdentityController extends AdminController
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $title = '用户身份配置';
|
protected $title = '用户身份配置';
|
||||||
|
|
||||||
protected function grid()
|
protected function grid()
|
||||||
@@ -47,6 +48,7 @@ class IdentityController extends AdminController
|
|||||||
|
|
||||||
$grid->column('remark', '说明');
|
$grid->column('remark', '说明');
|
||||||
$grid->column('updated_at', '修改时间');
|
$grid->column('updated_at', '修改时间');
|
||||||
|
|
||||||
return $grid;
|
return $grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Admin\Controllers\Log;
|
namespace App\Admin\Controllers\Log;
|
||||||
|
|
||||||
|
use App\Admin\Renderable\Log\InData;
|
||||||
|
use App\Admin\Renderable\Log\OutData;
|
||||||
use App\Models\Log;
|
use App\Models\Log;
|
||||||
use Encore\Admin\Controllers\AdminController;
|
use Encore\Admin\Controllers\AdminController;
|
||||||
use Encore\Admin\Grid;
|
use Encore\Admin\Grid;
|
||||||
@@ -15,7 +17,7 @@ class IndexController extends AdminController
|
|||||||
/**
|
/**
|
||||||
* Notes:
|
* Notes:
|
||||||
* @Author: <C.Jason>
|
* @Author: <C.Jason>
|
||||||
* @Date: 2019/9/18 14:50
|
* @Date : 2019/9/18 14:50
|
||||||
* @return Grid
|
* @return Grid
|
||||||
*/
|
*/
|
||||||
protected function grid()
|
protected function grid()
|
||||||
@@ -57,7 +59,15 @@ class IndexController extends AdminController
|
|||||||
return new Table($header, $array);
|
return new Table($header, $array);
|
||||||
});
|
});
|
||||||
$grid->column('method', '模式');
|
$grid->column('method', '模式');
|
||||||
// $grid->column('in_source', '请求参数');
|
// $grid->column('in_source', '请求参数')
|
||||||
|
// ->display(function ($title, $column) {
|
||||||
|
// return '点击展开';
|
||||||
|
// })->modal(InData::class);
|
||||||
|
//
|
||||||
|
// $grid->column('out_source', '返回参数')
|
||||||
|
// ->display(function ($title, $column) {
|
||||||
|
// return '点击展开';
|
||||||
|
// })->modal(OutData::class);
|
||||||
$grid->column('请求参数')->display(function () {
|
$grid->column('请求参数')->display(function () {
|
||||||
$in_source = $this->in_source;
|
$in_source = $this->in_source;
|
||||||
unset($in_source['merchantSign']);
|
unset($in_source['merchantSign']);
|
||||||
@@ -67,9 +77,9 @@ class IndexController extends AdminController
|
|||||||
unset($in_source['json']);
|
unset($in_source['json']);
|
||||||
unset($in_source['query']['merchantSign']);
|
unset($in_source['query']['merchantSign']);
|
||||||
unset($in_source['query']['merchantCert']);
|
unset($in_source['query']['merchantCert']);
|
||||||
|
|
||||||
return $in_source;
|
return $in_source;
|
||||||
});
|
});
|
||||||
// $grid->column('out_source', '返回信息');
|
|
||||||
$grid->column('返回信息')->display(function () {
|
$grid->column('返回信息')->display(function () {
|
||||||
$out_source = $this->out_source;
|
$out_source = $this->out_source;
|
||||||
|
|
||||||
@@ -83,6 +93,7 @@ class IndexController extends AdminController
|
|||||||
if (isset($out_source['data']) && is_string($out_source['data'])) {
|
if (isset($out_source['data']) && is_string($out_source['data'])) {
|
||||||
unset($out_source['data']);
|
unset($out_source['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $out_source;
|
return $out_source;
|
||||||
});
|
});
|
||||||
$grid->column('created_at', '提交时间');
|
$grid->column('created_at', '提交时间');
|
||||||
|
|||||||
91
app/Admin/Controllers/Unionpay/IndexController.php
Normal file
91
app/Admin/Controllers/Unionpay/IndexController.php
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers\Unionpay;
|
||||||
|
|
||||||
|
use App\Admin\Actions\User\Callback;
|
||||||
|
use App\Admin\Actions\User\Profit;
|
||||||
|
use App\Admin\Actions\User\ReCode;
|
||||||
|
use App\Admin\Actions\User\RefD3Key;
|
||||||
|
use App\Admin\Exporters\UsersExport;
|
||||||
|
use App\Admin\Renderable\Unionpay\InData;
|
||||||
|
use App\Admin\Renderable\Unionpay\OutData;
|
||||||
|
use App\Models\Area;
|
||||||
|
use App\Models\UnionpayLog;
|
||||||
|
use App\Models\User;
|
||||||
|
use Auth;
|
||||||
|
use Encore\Admin\Controllers\AdminController;
|
||||||
|
use Encore\Admin\Form;
|
||||||
|
use Encore\Admin\Grid;
|
||||||
|
use Encore\Admin\Widgets\Table;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use RuLong\Identity\Models\Identity;
|
||||||
|
|
||||||
|
class IndexController extends AdminController
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $title = '银联操作日志';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes:
|
||||||
|
* @Author: <C.Jason>
|
||||||
|
* @Date : 2019/9/18 14:50
|
||||||
|
* @return Grid
|
||||||
|
*/
|
||||||
|
protected function grid()
|
||||||
|
{
|
||||||
|
$grid = new Grid(new UnionpayLog);
|
||||||
|
|
||||||
|
$grid->disableActions();
|
||||||
|
|
||||||
|
$grid->model()->orderBy('id', 'desc');
|
||||||
|
|
||||||
|
$grid->filter(function ($filter) {
|
||||||
|
$filter->column(1 / 2, function ($filter) {
|
||||||
|
$filter->equal('msg_txn_code', '交易类型')->select(config('unionpay.type'));
|
||||||
|
});
|
||||||
|
$filter->column(1 / 2, function ($filter) {
|
||||||
|
$filter->equal('req_serial_no', '流水号');
|
||||||
|
$filter->equal('orig_req_serial_no', '原流水号');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->column('id', '#ID#');
|
||||||
|
$grid->column('msg_txn_code', '交易类型')
|
||||||
|
->using(config('unionpay.type'))
|
||||||
|
->label();
|
||||||
|
|
||||||
|
// $grid->column('msg_crrltn_id', '消息关联号');
|
||||||
|
$grid->column('msg_time', '报文日期');
|
||||||
|
$grid->column('mkt_code', '券码');
|
||||||
|
$grid->column('msg_sys_sn', '平台流水号');
|
||||||
|
$grid->column('req_serial_no', '流水号');
|
||||||
|
$grid->column('orig_req_serial_no', '原流水号');
|
||||||
|
$grid->column('status', '状态')
|
||||||
|
->using(UnionpayLog::STATUS)
|
||||||
|
->label([
|
||||||
|
0 => 'success',
|
||||||
|
1 => 'warning',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$grid->column('in_source', '请求参数')
|
||||||
|
->display(function ($title, $column) {
|
||||||
|
return '点击展开';
|
||||||
|
})->modal(InData::class);
|
||||||
|
|
||||||
|
$grid->column('out_source', '返回参数')
|
||||||
|
->display(function ($title, $column) {
|
||||||
|
return '点击展开';
|
||||||
|
})->modal(OutData::class);
|
||||||
|
|
||||||
|
// $grid->column('sett_date', '清算日期');
|
||||||
|
$grid->column('created_at', '注册时间');
|
||||||
|
$grid->disableExport(false);
|
||||||
|
|
||||||
|
$grid->export(function ($export) {
|
||||||
|
$export->filename($this->title . date("YmdHis"));
|
||||||
|
});
|
||||||
|
|
||||||
|
return $grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,7 +6,8 @@ use App\Admin\Actions\User\Callback;
|
|||||||
use App\Admin\Actions\User\Profit;
|
use App\Admin\Actions\User\Profit;
|
||||||
use App\Admin\Actions\User\ReCode;
|
use App\Admin\Actions\User\ReCode;
|
||||||
use App\Admin\Actions\User\RefD3Key;
|
use App\Admin\Actions\User\RefD3Key;
|
||||||
use App\Admin\Exporters\UsersExport;
|
use App\Admin\Renderable\User\Rule;
|
||||||
|
use App\Admin\Renderable\User\ServerKey;
|
||||||
use App\Models\Area;
|
use App\Models\Area;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Auth;
|
use Auth;
|
||||||
@@ -32,7 +33,7 @@ class IndexController extends AdminController
|
|||||||
{
|
{
|
||||||
$user = Auth::guard('admin')->user();
|
$user = Auth::guard('admin')->user();
|
||||||
$grid = new Grid(new User);
|
$grid = new Grid(new User);
|
||||||
|
$grid->model()->with(['parent']);
|
||||||
$grid->actions(function ($actions) use ($user) {
|
$grid->actions(function ($actions) use ($user) {
|
||||||
$actions->disableDelete();
|
$actions->disableDelete();
|
||||||
$actions->disableView();
|
$actions->disableView();
|
||||||
@@ -112,19 +113,7 @@ class IndexController extends AdminController
|
|||||||
|
|
||||||
$grid->column('密钥')->display(function ($title, $column) {
|
$grid->column('密钥')->display(function ($title, $column) {
|
||||||
return '点击查看';
|
return '点击查看';
|
||||||
})->modal(function ($model) {
|
})->modal(ServerKey::class);
|
||||||
$data = [
|
|
||||||
[
|
|
||||||
'服务秘钥', $model->server_key ?? '---',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'DES3秘钥', $model->des3key ?? '---',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
return new Table(['名称', '参数'], $data);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
$grid->column('nickname', '渠道/网点');
|
$grid->column('nickname', '渠道/网点');
|
||||||
$grid->column('用户身份')->display(function () {
|
$grid->column('用户身份')->display(function () {
|
||||||
@@ -142,22 +131,13 @@ class IndexController extends AdminController
|
|||||||
|
|
||||||
$grid->column('分润规则')->display(function ($title, $column) {
|
$grid->column('分润规则')->display(function ($title, $column) {
|
||||||
return '点击展开';
|
return '点击展开';
|
||||||
})->modal(function ($model) {
|
})->modal(Rule::class);
|
||||||
if ($model->code) {
|
|
||||||
$codes = $model->code->map(function ($code) {
|
|
||||||
return $code->only(['name', 'code', 'profit']);
|
|
||||||
});
|
|
||||||
|
|
||||||
return new Table(['名称', '规则项', '分润金额(元)'], $codes->toArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
$grid->column('created_at', '注册时间');
|
$grid->column('created_at', '注册时间');
|
||||||
$grid->disableExport(false);
|
$grid->disableExport(false);
|
||||||
|
|
||||||
$grid->export(function ($export) {
|
$grid->export(function ($export) {
|
||||||
$export->except(['密钥', '分润规则']);
|
$export->except(['密钥', '分润规则', '回调地址']);
|
||||||
$export->column('用户身份', function ($value, $original) {
|
$export->column('用户身份', function ($value, $original) {
|
||||||
return strip_tags($value);
|
return strip_tags($value);
|
||||||
});
|
});
|
||||||
@@ -167,7 +147,7 @@ class IndexController extends AdminController
|
|||||||
$export->column('网点编号', function ($value, $original) {
|
$export->column('网点编号', function ($value, $original) {
|
||||||
return $value . "\t";
|
return $value . "\t";
|
||||||
});
|
});
|
||||||
$export->filename('用户管理' . date("YmdHis"));
|
$export->filename($this->title . date("YmdHis"));
|
||||||
});
|
});
|
||||||
|
|
||||||
return $grid;
|
return $grid;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class IndexController extends AdminController
|
|||||||
protected function grid()
|
protected function grid()
|
||||||
{
|
{
|
||||||
$grid = new Grid(new WoCoupon);
|
$grid = new Grid(new WoCoupon);
|
||||||
|
$grid->model()->with(['user']);
|
||||||
$grid->disableCreateButton();
|
$grid->disableCreateButton();
|
||||||
$grid->disableBatchActions();
|
$grid->disableBatchActions();
|
||||||
// $grid->disableActions();
|
// $grid->disableActions();
|
||||||
|
|||||||
32
app/Admin/Renderable/Log/InData.php
Normal file
32
app/Admin/Renderable/Log/InData.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Renderable\Log;
|
||||||
|
|
||||||
|
use App\Models\Log;
|
||||||
|
use Encore\Admin\Widgets\Table;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
|
||||||
|
class InData implements Renderable
|
||||||
|
{
|
||||||
|
|
||||||
|
public function render($key = null)
|
||||||
|
{
|
||||||
|
$log = Log::find($key);
|
||||||
|
$in_source = $log->in_source;
|
||||||
|
foreach ($in_source as $key => $item) {
|
||||||
|
if (!in_array($key, [])) {
|
||||||
|
|
||||||
|
}
|
||||||
|
if (is_array($item)) {
|
||||||
|
$in_source[$key] = json_encode($item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($in_source) && count($in_source) > 1) {
|
||||||
|
$table = new Table(['名称', '值'], $in_source, ['panel', ' panel-default']);
|
||||||
|
|
||||||
|
return $table->render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
25
app/Admin/Renderable/Log/OutData.php
Normal file
25
app/Admin/Renderable/Log/OutData.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Renderable\Log;
|
||||||
|
|
||||||
|
use App\Models\Log;
|
||||||
|
use Encore\Admin\Widgets\Table;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
|
||||||
|
class OutData implements Renderable
|
||||||
|
{
|
||||||
|
|
||||||
|
public function render($key = null)
|
||||||
|
{
|
||||||
|
$log = Log::find($key);
|
||||||
|
$out_source = $log->out_source;
|
||||||
|
|
||||||
|
if (is_array($out_source) && count($out_source) > 1) {
|
||||||
|
unset($out_source['sign']);
|
||||||
|
$table = new Table(['名称', '值'], $out_source, ['panel ', 'panel-success']);
|
||||||
|
|
||||||
|
return $table->render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
26
app/Admin/Renderable/Unionpay/InData.php
Normal file
26
app/Admin/Renderable/Unionpay/InData.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Renderable\Unionpay;
|
||||||
|
|
||||||
|
use App\Models\UnionpayLog;
|
||||||
|
use App\Models\User;
|
||||||
|
use Encore\Admin\Widgets\Table;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class InData implements Renderable
|
||||||
|
{
|
||||||
|
|
||||||
|
public function render($key = null)
|
||||||
|
{
|
||||||
|
$log = UnionpayLog::find($key);
|
||||||
|
$in_source = $log->in_source;
|
||||||
|
|
||||||
|
if (is_array($in_source) && count($in_source) > 1) {
|
||||||
|
$table = new Table(['名称', '值'], $in_source, ['panel', ' panel-default']);
|
||||||
|
|
||||||
|
return $table->render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
25
app/Admin/Renderable/Unionpay/OutData.php
Normal file
25
app/Admin/Renderable/Unionpay/OutData.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Renderable\Unionpay;
|
||||||
|
|
||||||
|
use App\Models\UnionpayLog;
|
||||||
|
use Encore\Admin\Widgets\Table;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
|
||||||
|
class OutData implements Renderable
|
||||||
|
{
|
||||||
|
|
||||||
|
public function render($key = null)
|
||||||
|
{
|
||||||
|
$log = UnionpayLog::find($key);
|
||||||
|
$out_source = $log->out_source;
|
||||||
|
|
||||||
|
if (is_array($out_source) && count($out_source) > 1) {
|
||||||
|
unset($out_source['sign']);
|
||||||
|
$table = new Table(['名称', '值'], $out_source, ['panel ', 'panel-success']);
|
||||||
|
|
||||||
|
return $table->render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
23
app/Admin/Renderable/User/Rule.php
Normal file
23
app/Admin/Renderable/User/Rule.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Renderable\User;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Encore\Admin\Widgets\Table;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
|
||||||
|
class Rule implements Renderable
|
||||||
|
{
|
||||||
|
|
||||||
|
public function render($key = null)
|
||||||
|
{
|
||||||
|
$user = User::find($key);
|
||||||
|
$codes = $user->code->map(function ($code) {
|
||||||
|
return $code->only(['name', 'code', 'profit']);
|
||||||
|
});
|
||||||
|
$table = new Table(['名称', '规则项', '分润金额(元)'], $codes->toArray());
|
||||||
|
|
||||||
|
return $table->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
30
app/Admin/Renderable/User/ServerKey.php
Normal file
30
app/Admin/Renderable/User/ServerKey.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Renderable\User;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Encore\Admin\Widgets\Table;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
|
||||||
|
class ServerKey implements Renderable
|
||||||
|
{
|
||||||
|
|
||||||
|
public function render($key = null)
|
||||||
|
{
|
||||||
|
$user = User::find($key);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
[
|
||||||
|
'服务秘钥', $user->server_key ?? '---',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'DES3秘钥', $user->des3key ?? '---',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$table = new Table(['名称', '参数'], $data);
|
||||||
|
|
||||||
|
return $table->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -55,4 +55,7 @@ Route::group([
|
|||||||
$router->resource('activitycoupons', 'Activity\CouponController');
|
$router->resource('activitycoupons', 'Activity\CouponController');
|
||||||
$router->resource('activitycouponlogs', 'Activity\LogController');
|
$router->resource('activitycouponlogs', 'Activity\LogController');
|
||||||
|
|
||||||
|
//银联日志
|
||||||
|
$router->resource('unionpays', 'Unionpay\IndexController');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
53
app/Api/Controllers/UnionPayController.php
Normal file
53
app/Api/Controllers/UnionPayController.php
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Api\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use XuanChen\UnionPay\UnionPay;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
|
class UnionPayController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$a = '0.1';
|
||||||
|
$b = '0.1';
|
||||||
|
dump($a > $b);
|
||||||
|
$action = new UnionPay($request->all());
|
||||||
|
// $sign = $action->getSign(false);
|
||||||
|
$sign = 'd8e5bf46d0d9f1da702170c2e141d85cf3ca785106886dbfedb3310ee9ce2ca3f18a2e6c179ec9908fc4f41d05df463634106918bdbefc63b8f199c7d2f3b0d45510b4dd6ccdf4549e11a8551a5098b14c01fdaa5840a4608f462fdafdc14b8f2a35471da315d8245a4ef6281b6e04bd22d5a266500a6caf6e5203202c37111d';
|
||||||
|
$action->sign = $sign;
|
||||||
|
$res = $action->checkSign(false, false);
|
||||||
|
dump('签名: ' . $sign);
|
||||||
|
$res_str = ($res === true) ? '成功' : '失败';
|
||||||
|
dump('验签结果:' . $res_str);
|
||||||
|
dd($action);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 银联接口
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/9/28 16:31
|
||||||
|
* @param Request $request
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function query(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$inputs = $request->all();
|
||||||
|
$sign = $inputs['sign'];
|
||||||
|
unset($inputs['sign']);
|
||||||
|
$action = new UnionPay($inputs, $sign);
|
||||||
|
|
||||||
|
$action->addLog();
|
||||||
|
$action->start();
|
||||||
|
|
||||||
|
$action->updateLog();
|
||||||
|
|
||||||
|
return $action->respond();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -184,20 +184,11 @@ 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(
|
$coupon = Coupon::Redemption($this->user, $redemptionCode, $total, $outletId, $orderid);
|
||||||
$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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,4 +18,9 @@ Route::group(['prefix' => 'V1'], function () {
|
|||||||
Route::post('ticket/cancel', 'WoController@cancel'); //退业务
|
Route::post('ticket/cancel', 'WoController@cancel'); //退业务
|
||||||
Route::post('ticket/query', 'WoController@query'); //退业务
|
Route::post('ticket/query', 'WoController@query'); //退业务
|
||||||
|
|
||||||
|
//银联相关
|
||||||
|
Route::post('unionpay/index', 'UnionPayController@index');
|
||||||
|
Route::post('unionpay/query', 'UnionPayController@query');
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,18 +7,16 @@ use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
|||||||
|
|
||||||
class Handler extends ExceptionHandler
|
class Handler extends ExceptionHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of the exception types that are not reported.
|
* A list of the exception types that are not reported.
|
||||||
*
|
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $dontReport = [
|
protected $dontReport = [
|
||||||
//
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of the inputs that are never flashed for validation exceptions.
|
* A list of the inputs that are never flashed for validation exceptions.
|
||||||
*
|
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $dontFlash = [
|
protected $dontFlash = [
|
||||||
@@ -28,8 +26,7 @@ class Handler extends ExceptionHandler
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Report or log an exception.
|
* Report or log an exception.
|
||||||
*
|
* @param \Exception $exception
|
||||||
* @param \Exception $exception
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function report(Exception $exception)
|
public function report(Exception $exception)
|
||||||
@@ -39,13 +36,13 @@ class Handler extends ExceptionHandler
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Render an exception into an HTTP response.
|
* Render an exception into an HTTP response.
|
||||||
*
|
* @param \Illuminate\Http\Request $request
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Exception $exception
|
||||||
* @param \Exception $exception
|
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function render($request, Exception $exception)
|
public function render($request, Exception $exception)
|
||||||
{
|
{
|
||||||
return parent::render($request, $exception);
|
return parent::render($request, $exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,251 +1,235 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Api\Controllers\ApiResponse;
|
use App\Api\Controllers\ApiResponse;
|
||||||
use SelfCoupon;
|
use App\Models\User;
|
||||||
use App\Models\User;
|
use GuzzleHttp\Client;
|
||||||
use GuzzleHttp\Client;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Request;
|
use XuanChen\Coupon\Coupon;
|
||||||
use XuanChen\Coupon\Coupon;
|
|
||||||
|
class TestController
|
||||||
// use Wo;
|
{
|
||||||
|
|
||||||
class TestController
|
use ApiResponse;
|
||||||
{
|
|
||||||
|
public $baseUrl = 'http://pac.ysd-bs.com/api/V1/';
|
||||||
use ApiResponse;
|
|
||||||
|
public function index(Request $request)
|
||||||
public $baseUrl = 'http://pa.ysd-bs.com/api/V1/';
|
{
|
||||||
|
$user_id = $request->user_id;
|
||||||
public function index(Request $request)
|
$data = $request->data;
|
||||||
{
|
$this->user = User::find(3);
|
||||||
// $user_id = $request->user_id;
|
|
||||||
// $data = $request->data;
|
$data = '5VehIrHTZsS1BY8V5VcKlhTN9hbutq4j+HIT2zRCbSqgPWvClQSxYSP7mn7PmHuiYQpj55NRC6w4397FfdVTq23wd4BOQ964giie/JForTjt0l7UaY23XzKnNjDSKiGqr7DAbd8P3SzJ75ZjKaqUu7UWu3PVylAeesGRbZgpQEF/XKwOW4XMaJGV2tIsowILZCtF+moqHg7yA6hI4vT7iYU3rTq9vk7kpcnfArLKPQ5dxH9FFIegdr7E1S8NVwpTZrxeQEmjDUsGrBcWe/Q9dRWXSlKF1Hdz2qCUCK94fu3gqvEVSYRllTCa5mwQhlYJLs2UTmWMSism7nsivySseSl1/JOvNH0lyvWaV1XDUMKG8oTC+kOPQKxFA3qp2xO9ohRhN0dkpML4JVgkMF1r6rv+rThYQuOL/rnsuY5Jdh4QdPWCItQ05lqI46s2yPyKROrLx7jQ3/+BOyEmP+Cj5W8/trEAVS1HczMj4Jnl3vrcY879ubokUcEatalAuKGM0uLNAqQF5XfHzgXam4coEMek8MjdbxW+Z9+eZFQp/P1ts7yN5qzpac6Y8CrqSMFJZf1vwowp+1peiEC5tCsXlHCsDLPS8Uh1LNnC3sag0XZu7jX5uVR9nxR2c/ibBJOAHcUO+NcjmzoN+dQOeBkb/aWj9B+9mW5RUQmfUk6O+Vwkb5ruZZbXsoJJULj4tHJv87+mVo30e0mBbaPD47+fTp1+qSJtLOOlLO2nEj1NNDBSBGLM4RxTDQ4ju2r6HY9YyMXsbNC2YB8zrXrDsUoB1WSuu5XcaWx8rzA0NpckzNbEIuv0+6fA69gXOhC9xcGGPyEBbko73XHr7W8MIDtWhGOG8kHf1cAMdjwVGS2OUJ6XKZnBMwIzY8cJn4Fi+jXRMFnt+7BxWLToNQsyOoHbYWypeM8FrAb4VQeaxGhBQUXUmHhmAp00jcGEe/ngxn1oVjq6G+pEq8CxBntvQ+GZ975sPaCqkYOjbuHa9Myd2tT6GWbczL/YcR4RRV96ByYYCEOBy01LsBNeo6SSpWYcK4eoLhc70v8s';
|
||||||
// $this->user = User::find(3);
|
$iv = substr($this->user->des3key, 0, 8);
|
||||||
//
|
$ret = openssl_decrypt($data, 'DES-EDE3-CBC', $this->user->des3key, 0, $iv);
|
||||||
// $data = '5VehIrHTZsS1BY8V5VcKlhTN9hbutq4j+HIT2zRCbSqgPWvClQSxYSP7mn7PmHuiYQpj55NRC6w4397FfdVTq23wd4BOQ964giie/JForTjt0l7UaY23XzKnNjDSKiGqr7DAbd8P3SzJ75ZjKaqUu7UWu3PVylAeesGRbZgpQEF/XKwOW4XMaJGV2tIsowILZCtF+moqHg7yA6hI4vT7iYU3rTq9vk7kpcnfArLKPQ5dxH9FFIegdr7E1S8NVwpTZrxeQEmjDUsGrBcWe/Q9dRWXSlKF1Hdz2qCUCK94fu3gqvEVSYRllTCa5mwQhlYJLs2UTmWMSism7nsivySseSl1/JOvNH0lyvWaV1XDUMKG8oTC+kOPQKxFA3qp2xO9ohRhN0dkpML4JVgkMF1r6rv+rThYQuOL/rnsuY5Jdh4QdPWCItQ05lqI46s2yPyKROrLx7jQ3/+BOyEmP+Cj5W8/trEAVS1HczMj4Jnl3vrcY879ubokUcEatalAuKGM0uLNAqQF5XfHzgXam4coEMek8MjdbxW+Z9+eZFQp/P1ts7yN5qzpac6Y8CrqSMFJZf1vwowp+1peiEC5tCsXlHCsDLPS8Uh1LNnC3sag0XZu7jX5uVR9nxR2c/ibBJOAHcUO+NcjmzoN+dQOeBkb/aWj9B+9mW5RUQmfUk6O+Vwkb5ruZZbXsoJJULj4tHJv87+mVo30e0mBbaPD47+fTp1+qSJtLOOlLO2nEj1NNDBSBGLM4RxTDQ4ju2r6HY9YyMXsbNC2YB8zrXrDsUoB1WSuu5XcaWx8rzA0NpckzNbEIuv0+6fA69gXOhC9xcGGPyEBbko73XHr7W8MIDtWhGOG8kHf1cAMdjwVGS2OUJ6XKZnBMwIzY8cJn4Fi+jXRMFnt+7BxWLToNQsyOoHbYWypeM8FrAb4VQeaxGhBQUXUmHhmAp00jcGEe/ngxn1oVjq6G+pEq8CxBntvQ+GZ975sPaCqkYOjbuHa9Myd2tT6GWbczL/YcR4RRV96ByYYCEOBy01LsBNeo6SSpWYcK4eoLhc70v8s';
|
if (false === $ret) {
|
||||||
// $iv = substr($this->user->des3key, 0, 8);
|
return openssl_error_string();
|
||||||
// $ret = openssl_decrypt($data, 'DES-EDE3-CBC', $this->user->des3key, 0, $iv);
|
}
|
||||||
// if (false === $ret) {
|
dd($ret);
|
||||||
// return openssl_error_string();
|
dd();
|
||||||
// }
|
$this->user = User::find(215);
|
||||||
// dd($ret);
|
$ret = [
|
||||||
// dd();
|
'redemptionCode' => '951951858070',
|
||||||
$this->user = User::find(4);
|
'total' => 5,
|
||||||
$ret = [
|
'outletId' => '2006151433887',
|
||||||
'variable' => 100,
|
];
|
||||||
'mobile' => 15663876870,
|
|
||||||
'type' => 'silver',
|
return $this->success($ret);
|
||||||
'remark' => '测试',
|
dd(phpinfo());
|
||||||
];
|
dd();
|
||||||
$res['server_id'] = $this->user->server_id;
|
$num = 100;
|
||||||
$res['des'] = $this->user->des3key;
|
|
||||||
$res['key'] = $this->user->server_key;
|
for ($i = 1; $i <= $num; $i++) {
|
||||||
|
$data = [
|
||||||
return $this->success($ret);
|
'outletId' => '2004020935777',
|
||||||
dd();
|
'activityId' => 'ysd20200740',
|
||||||
$this->user = User::find(4);
|
'mobile' => '15663876870',
|
||||||
$ret = [
|
];
|
||||||
'redemptionCode' => '951951858070',
|
|
||||||
'total' => 5,
|
$this->user = User::find(3);
|
||||||
'outletId' => '2008241014458',
|
|
||||||
];
|
$data = $this->jiami($data);
|
||||||
|
|
||||||
return $this->success($ret);
|
$url = $this->baseUrl . 'user/grant';
|
||||||
dd(phpinfo());
|
$res = $this->http($data, $url);
|
||||||
dd();
|
|
||||||
$num = 100;
|
// if (isset($res['data'])) {
|
||||||
|
// $jiemi = $this->jiemi($res['data']);
|
||||||
for ($i = 1; $i <= $num; $i++) {
|
// dump($jiemi);
|
||||||
$data = [
|
// }
|
||||||
'outletId' => '2004020935777',
|
|
||||||
'activityId' => 'ysd20200740',
|
}
|
||||||
'mobile' => '15663876870',
|
|
||||||
];
|
dump($this->getElapsedTime());
|
||||||
|
dump($this->getMemoryUsage());
|
||||||
$this->user = User::find(3);
|
|
||||||
|
}
|
||||||
$data = $this->jiami($data);
|
|
||||||
|
/**
|
||||||
$url = $this->baseUrl . 'user/grant';
|
* Notes: 发券
|
||||||
$res = $this->http($data, $url);
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/6/29 13:57
|
||||||
// if (isset($res['data'])) {
|
*/
|
||||||
// $jiemi = $this->jiemi($res['data']);
|
public function grant(Request $request)
|
||||||
// dump($jiemi);
|
{
|
||||||
// }
|
$this->user = User::find(3);
|
||||||
|
|
||||||
}
|
$data = $this->jiami($request->all());
|
||||||
|
|
||||||
dump($this->getElapsedTime());
|
$url = $this->baseUrl . 'user/grant';
|
||||||
dump($this->getMemoryUsage());
|
$res = $this->http($data, $url);
|
||||||
|
|
||||||
}
|
return $res;
|
||||||
|
|
||||||
/**
|
// dump($this->getElapsedTime());
|
||||||
* Notes: 发券
|
// dump($this->getMemoryUsage());
|
||||||
* @Author: 玄尘
|
//
|
||||||
* @Date : 2020/6/29 13:57
|
// dd($res);
|
||||||
*/
|
}
|
||||||
public function grant(Request $request)
|
|
||||||
{
|
//查询
|
||||||
$this->user = User::find(3);
|
public function query(Request $request)
|
||||||
|
{
|
||||||
$data = $this->jiami($request->all());
|
$this->user = User::find(3);
|
||||||
|
|
||||||
$url = $this->baseUrl . 'user/grant';
|
$redemptionCode = $request->redemptionCode;
|
||||||
$res = $this->http($data, $url);
|
$outletId = $request->outletId;
|
||||||
|
|
||||||
return $res;
|
$data = $this->jiami($request->all());
|
||||||
|
|
||||||
// dump($this->getElapsedTime());
|
$url = $this->baseUrl . 'user/query';
|
||||||
// dump($this->getMemoryUsage());
|
$res = $this->http($data, $url);
|
||||||
//
|
|
||||||
// dd($res);
|
return $res;
|
||||||
}
|
if (isset($res['data'])) {
|
||||||
|
$jiemi = $this->jiemi($res['data']);
|
||||||
//查询
|
dump($jiemi);
|
||||||
public function query(Request $request)
|
}
|
||||||
{
|
|
||||||
$this->user = User::find(3);
|
dump($this->getElapsedTime());
|
||||||
|
dump($this->getMemoryUsage());
|
||||||
$redemptionCode = $request->redemptionCode;
|
|
||||||
$outletId = $request->outletId;
|
dump($res);
|
||||||
|
|
||||||
$data = $this->jiami($request->all());
|
}
|
||||||
|
|
||||||
$url = $this->baseUrl . 'user/query';
|
//卡券作废
|
||||||
$res = $this->http($data, $url);
|
public function destroy(Request $request)
|
||||||
|
{
|
||||||
return $res;
|
$this->user = User::find(3);
|
||||||
if (isset($res['data'])) {
|
|
||||||
$jiemi = $this->jiemi($res['data']);
|
$redemptionCode = $request->redemptionCode;
|
||||||
dump($jiemi);
|
$data = $this->jiami($request->all());
|
||||||
}
|
|
||||||
|
$url = $this->baseUrl . 'user/destroy';
|
||||||
dump($this->getElapsedTime());
|
$res = $this->http($data, $url);
|
||||||
dump($this->getMemoryUsage());
|
|
||||||
|
dump($this->getElapsedTime());
|
||||||
dump($res);
|
dump($this->getMemoryUsage());
|
||||||
|
if (isset($res['data'])) {
|
||||||
}
|
$jiemi = $this->jiemi($res['data']);
|
||||||
|
dump($jiemi);
|
||||||
//卡券作废
|
}
|
||||||
public function destroy(Request $request)
|
dump($res);
|
||||||
{
|
|
||||||
$this->user = User::find(3);
|
}
|
||||||
|
|
||||||
$redemptionCode = $request->redemptionCode;
|
/**
|
||||||
$data = $this->jiami($request->all());
|
* Notes: 核销
|
||||||
|
* @Author: 玄尘
|
||||||
$url = $this->baseUrl . 'user/destroy';
|
* @Date : 2020/6/29 14:01
|
||||||
$res = $this->http($data, $url);
|
*/
|
||||||
|
public function checkcoupon(Request $request)
|
||||||
dump($this->getElapsedTime());
|
{
|
||||||
dump($this->getMemoryUsage());
|
$user_id = $request->user_id;
|
||||||
if (isset($res['data'])) {
|
|
||||||
$jiemi = $this->jiemi($res['data']);
|
$this->user = User::find($user_id);
|
||||||
dump($jiemi);
|
|
||||||
}
|
$data = $this->jiami([
|
||||||
dump($res);
|
'redemptionCode' => $request->redemptionCode,
|
||||||
|
'total' => $request->total,
|
||||||
}
|
'outletId' => $request->outletId,
|
||||||
|
'orderid' => $request->orderid,
|
||||||
/**
|
]);
|
||||||
* Notes: 核销
|
|
||||||
* @Author: 玄尘
|
$url = $this->baseUrl . 'user/freezecoupon';
|
||||||
* @Date : 2020/6/29 14:01
|
$res = $this->http($data, $url);
|
||||||
*/
|
|
||||||
public function checkcoupon(Request $request)
|
return $res;
|
||||||
{
|
|
||||||
$user_id = $request->user_id;
|
$redemptionCode = $request->redemptionCode;
|
||||||
|
$total = $request->total;
|
||||||
$this->user = User::find($user_id);
|
$outletId = $request->outletId;
|
||||||
|
$orderid = $request->orderid ?? '';
|
||||||
$data = $this->jiami([
|
$res = Coupon::Redemption($this->user, $redemptionCode, $total, $outletId, $orderid);
|
||||||
'redemptionCode' => $request->redemptionCode,
|
|
||||||
'total' => $request->total,
|
if (is_string($res)) {
|
||||||
'outletId' => $request->outletId,
|
return $this->error($res);
|
||||||
'orderid' => $request->orderid,
|
}
|
||||||
]);
|
|
||||||
|
return $this->success('核销成功');
|
||||||
$url = $this->baseUrl . 'user/freezecoupon';
|
}
|
||||||
$res = $this->http($data, $url);
|
|
||||||
|
public function http($data, $url)
|
||||||
return $res;
|
{
|
||||||
|
$client = new Client();
|
||||||
$redemptionCode = $request->redemptionCode;
|
$response = $client->request('POST', $url, ['form_params' => $data, 'http_errors' => false]);
|
||||||
$total = $request->total;
|
|
||||||
$outletId = $request->outletId;
|
$body = $response->getBody();
|
||||||
$orderid = $request->orderid ?? '';
|
$content = $body->getContents();
|
||||||
$res = Coupon::Redemption($this->user, $redemptionCode, $total, $outletId, $orderid);
|
$result = json_decode($content, true);
|
||||||
|
|
||||||
if (is_string($res)) {
|
return $result;
|
||||||
return $this->error($res);
|
}
|
||||||
}
|
|
||||||
|
public function jiami($ret)
|
||||||
return $this->success('核销成功');
|
{
|
||||||
}
|
$jsonData = json_encode($ret); //数据JSON化
|
||||||
|
$ascdata = $this->keyasc($jsonData); //加密
|
||||||
public function http($data, $url)
|
$addcode = sprintf("%08d", mt_rand(0, 99999999)); //随机code 验证签名用
|
||||||
{
|
$sign = $this->keysign($ascdata, $addcode);
|
||||||
$client = new Client();
|
|
||||||
$response = $client->request('POST', $url, ['form_params' => $data, 'http_errors' => false]);
|
$data = [
|
||||||
|
'server_id' => $this->user->server_id,
|
||||||
$body = $response->getBody();
|
'key' => $this->user->server_key,
|
||||||
$content = $body->getContents();
|
'addcode' => $addcode,
|
||||||
$result = json_decode($content, true);
|
'sign' => $sign,
|
||||||
|
'data' => $ascdata,
|
||||||
return $result;
|
];
|
||||||
}
|
|
||||||
|
return $data;
|
||||||
public function jiami($ret)
|
}
|
||||||
{
|
|
||||||
$jsonData = json_encode($ret); //数据JSON化
|
/**
|
||||||
$ascdata = $this->keyasc($jsonData); //加密
|
* 解密
|
||||||
$addcode = sprintf("%08d", mt_rand(0, 99999999)); //随机code 验证签名用
|
* @param <type> $value
|
||||||
$sign = $this->keysign($ascdata, $addcode);
|
* @return <type>
|
||||||
|
*/
|
||||||
$data = [
|
public function jiemi($value)
|
||||||
'server_id' => $this->user->server_id,
|
{
|
||||||
'key' => $this->user->server_key,
|
$iv = substr($this->user->des3key, 0, 8);
|
||||||
'addcode' => $addcode,
|
$ret = openssl_decrypt($value, 'DES - EDE3 - CBC', $this->user->des3key, 0, $iv);
|
||||||
'sign' => $sign,
|
if (false === $ret) {
|
||||||
'data' => $ascdata,
|
return openssl_error_string();
|
||||||
];
|
}
|
||||||
|
|
||||||
return $data;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getMemoryUsage($precision = 2)
|
||||||
* 解密
|
{
|
||||||
* @param <type> $value
|
$size = memory_get_usage(true);
|
||||||
* @return <type>
|
|
||||||
*/
|
$unit = ['b', 'kb', 'mb', 'gb', 'tb', 'pb'];
|
||||||
public function jiemi($value)
|
|
||||||
{
|
return round($size / pow(1024, ($i = floor(log($size, 1024)))), $precision) . ' ' . $unit[$i];
|
||||||
$iv = substr($this->user->des3key, 0, 8);
|
}
|
||||||
$ret = openssl_decrypt($value, 'DES - EDE3 - CBC', $this->user->des3key, 0, $iv);
|
|
||||||
if (false === $ret) {
|
public function getElapsedTime(int $decimals = 2)
|
||||||
return openssl_error_string();
|
{
|
||||||
}
|
return number_format(microtime(true) - request()->server('REQUEST_TIME_FLOAT'), $decimals) . ' s';
|
||||||
|
}
|
||||||
return $ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMemoryUsage($precision = 2)
|
|
||||||
{
|
|
||||||
$size = memory_get_usage(true);
|
|
||||||
|
|
||||||
$unit = ['b', 'kb', 'mb', 'gb', 'tb', 'pb'];
|
|
||||||
|
|
||||||
return round($size / pow(1024, ($i = floor(log($size, 1024)))), $precision) . ' ' . $unit[$i];
|
|
||||||
}
|
|
||||||
|
|
||||||
function getElapsedTime(int $decimals = 2)
|
|
||||||
{
|
|
||||||
return number_format(microtime(true) - request()->server('REQUEST_TIME_FLOAT'), $decimals) . ' s';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,68 +1,69 @@
|
|||||||
<?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;
|
use RuntimeException;
|
||||||
|
|
||||||
class ConponCallbackListener implements ShouldQueue
|
class ConponCallbackListener implements ShouldQueue
|
||||||
{
|
{
|
||||||
|
|
||||||
public $queue = 'LISTENER';
|
public $queue = 'LISTENER';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the event.
|
* Handle the event.
|
||||||
* @param RoomLoginDone $event
|
* @param RoomLoginDone $event
|
||||||
* @return void
|
* @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;
|
$user = $acticity_coupon->outlet->parent;
|
||||||
if ($user->callback) {
|
if ($user->callback) {
|
||||||
$client = new Client();
|
$client = new Client();
|
||||||
|
|
||||||
$response = $client->request('post', $user->callback, [
|
$response = $client->request('post', $user->callback, [
|
||||||
'timeout' => 30,
|
'timeout' => 30,
|
||||||
'query' => [
|
'query' => [
|
||||||
'code' => $acticity_coupon->code,
|
'code' => $acticity_coupon->code,
|
||||||
'status' => $acticity_coupon->status,
|
'status' => $acticity_coupon->status,
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'code' => $acticity_coupon->code,
|
'code' => $acticity_coupon->code,
|
||||||
'type' => $acticity_coupon->status == 2 ? 'Verification' : 'Destroy',
|
'type' => $acticity_coupon->status == 2 ? 'Verification' : 'Destroy',
|
||||||
'url' => $user->callback,
|
'url' => $user->callback,
|
||||||
];
|
];
|
||||||
|
|
||||||
$error = false;
|
$error = false;
|
||||||
|
|
||||||
if ($response->getStatusCode() == 200) {
|
if ($response->getStatusCode() == 200) {
|
||||||
$body = $response->getBody();
|
$body = $response->getBody();
|
||||||
$result = json_decode($body->getContents(), true);
|
$result = json_decode($body->getContents(), true);
|
||||||
|
|
||||||
$data['status'] = $result['code'] ?? '';
|
$data['status'] = $result['code'] ?? '';
|
||||||
$data['source'] = $result;
|
$data['source'] = $result;
|
||||||
$data['remark'] = $result['message'] ?? '';
|
$data['remark'] = $result['message'] ?? '';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$data['status'] = 0;
|
$data['status'] = 0;
|
||||||
$data['source'] = '';
|
$data['source'] = '';
|
||||||
$data['remark'] = '接口错误';
|
$data['remark'] = '接口错误';
|
||||||
$error = true;
|
$error = true;
|
||||||
}
|
}
|
||||||
ActivityCouponLog::create($data);
|
|
||||||
|
ActivityCouponLog::create($data);
|
||||||
if ($error) {
|
|
||||||
throw new RuntimeException($data['remark']);
|
if ($error) {
|
||||||
}
|
throw new RuntimeException($data['remark']);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,149 +1,136 @@
|
|||||||
<?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;
|
||||||
|
|
||||||
protected $dates = [
|
const TYPE_EXTEND = 1;
|
||||||
'start_at',
|
const TYPE_SCOPE = 2;
|
||||||
'end_at',
|
const TYPES = [
|
||||||
];
|
self::TYPE_EXTEND => '延期',
|
||||||
|
self::TYPE_SCOPE => '固定',
|
||||||
const TYPE_EXTEND = 1;
|
];
|
||||||
const TYPE_SCOPE = 2;
|
|
||||||
const TYPES = [
|
const STATUS_OPEN = 1;
|
||||||
self::TYPE_EXTEND => '延期',
|
const STATUS_CLOSE = 0;
|
||||||
self::TYPE_SCOPE => '固定',
|
const STATUS = [
|
||||||
];
|
self::STATUS_OPEN => '正常',
|
||||||
|
self::STATUS_CLOSE => '关闭',
|
||||||
const STATUS_OPEN = 1;
|
];
|
||||||
const STATUS_CLOSE = 0;
|
|
||||||
const STATUS = [
|
protected $dates = [
|
||||||
self::STATUS_OPEN => '正常',
|
'start_at',
|
||||||
self::STATUS_CLOSE => '关闭',
|
'end_at',
|
||||||
];
|
];
|
||||||
|
|
||||||
const CHANNEL_YSD = 1;
|
/**
|
||||||
const CHANNEL_UNION = 2;
|
* 默认加载的关联
|
||||||
const CHANNELS = [
|
* @var array
|
||||||
self::CHANNEL_YSD => '亿时代',
|
*/
|
||||||
self::CHANNEL_UNION => '银联',
|
protected $with = ['rule'];
|
||||||
];
|
|
||||||
|
protected static function boot(): void
|
||||||
/**
|
{
|
||||||
* 默认加载的关联
|
parent::boot();
|
||||||
* @var array
|
|
||||||
*/
|
self::creating(function ($model) {
|
||||||
protected $with = ['rule'];
|
$model->code = 'ysd' . date('Ym') . mt_rand(100, 999);
|
||||||
|
});
|
||||||
protected static function boot(): void
|
}
|
||||||
{
|
|
||||||
parent::boot();
|
//活动类型 固定期限 延期
|
||||||
|
public function getTypeTextAttribute()
|
||||||
self::creating(function ($model) {
|
{
|
||||||
$model->code = 'ysd' . date('Ym') . mt_rand(100, 999);
|
return self::TYPES[$this->type] ?? '未知';
|
||||||
});
|
}
|
||||||
}
|
|
||||||
|
//活动状态
|
||||||
//活动类型 固定期限 延期
|
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] ?? '未知';
|
}
|
||||||
}
|
|
||||||
|
//关联券表
|
||||||
//关联卡券规则 ysd-full100-10
|
public function coupons()
|
||||||
public function rule()
|
{
|
||||||
{
|
return $this->hasMany(ActivityCoupon::class);
|
||||||
return $this->belongsTo(ActivityRule::class, 'activity_rule_id');
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
//关联券表
|
* Notes: 关联可发券渠道
|
||||||
public function coupons()
|
* @Author: 玄尘
|
||||||
{
|
* @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
|
|
||||||
*/
|
/**
|
||||||
public function grants()
|
* Notes: 关联可核销渠道
|
||||||
{
|
* @Author: 玄尘
|
||||||
return $this->hasMany(ActivityGrant::class);
|
* @Date : 2020/8/21 11:09
|
||||||
|
*/
|
||||||
}
|
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 = '66406' . 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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -64,4 +64,26 @@ class ActivityCoupon extends Model
|
|||||||
return $this->canRedemption();
|
return $this->canRedemption();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 是否可以撤销
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/10/12 11:57
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function canReversal()
|
||||||
|
{
|
||||||
|
return $this->status == self::STATUS_USED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 撤销
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/10/12 13:56
|
||||||
|
*/
|
||||||
|
public function reversal()
|
||||||
|
{
|
||||||
|
$this->status = self::STATUS_INIT;
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ class Coupon extends Model
|
|||||||
case 4:
|
case 4:
|
||||||
return '已分润';
|
return '已分润';
|
||||||
break;
|
break;
|
||||||
|
case 5:
|
||||||
|
return '已撤销';
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return '未知状态';
|
return '未知状态';
|
||||||
break;
|
break;
|
||||||
@@ -88,6 +91,45 @@ class Coupon extends Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 撤销
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/10/12 13:56
|
||||||
|
*/
|
||||||
|
public function reversal()
|
||||||
|
{
|
||||||
|
$this->status = 5;
|
||||||
|
$this->remark = '撤销成功';
|
||||||
|
$this->save();
|
||||||
|
|
||||||
|
if ($this->profit > 0) {
|
||||||
|
return $this->user->account->rule('refreeze', -$this->profit, false, [
|
||||||
|
'coupon_id' => $this->id,
|
||||||
|
'redemptionCode' => $this->redemptionCode,
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
return '不需要操作';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 撤销分润
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/10/9 14:07
|
||||||
|
*/
|
||||||
|
public function reprofit()
|
||||||
|
{
|
||||||
|
if ($this->profit > 1) {
|
||||||
|
return $this->user->account->rule('refreeze', -$this->profit, false, [
|
||||||
|
'coupon_id' => $this->id,
|
||||||
|
'redemptionCode' => $this->redemptionCode,
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
return '不需要操作';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打款
|
* 打款
|
||||||
* @author 玄尘 2020-03-13
|
* @author 玄尘 2020-03-13
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ class Log extends Model
|
|||||||
Schema::create($this->table, function (Blueprint $table) {
|
Schema::create($this->table, function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('path', 255);
|
$table->string('path', 255);
|
||||||
$table->string('method', 15)->index();
|
$table->string('method', 15);
|
||||||
$table->text('in_source');
|
$table->text('in_source');
|
||||||
$table->string('type', 20)->index();
|
$table->string('type', 20);
|
||||||
$table->text('out_source')->nullable();
|
$table->text('out_source')->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
class PinganToken extends Model
|
class PinganToken extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $dates = [
|
protected $dates = [
|
||||||
'get_token_time',
|
'get_token_time',
|
||||||
];
|
];
|
||||||
|
|||||||
25
app/Models/UnionpayLog.php
Normal file
25
app/Models/UnionpayLog.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
class UnionpayLog extends Model
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'in_source' => 'array',
|
||||||
|
'out_source' => 'array',
|
||||||
|
];
|
||||||
|
|
||||||
|
const STATUS_SUCCESS = 1;
|
||||||
|
const STATUS_ERROR = 0;
|
||||||
|
const STATUS = [
|
||||||
|
self::STATUS_SUCCESS => '成功',
|
||||||
|
self::STATUS_ERROR => '失败',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function coupon()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Coupon::class, 'redemptionCode', 'mkt_code');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -16,14 +16,12 @@ class User extends Authenticatable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
*
|
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be hidden for arrays.
|
* The attributes that should be hidden for arrays.
|
||||||
*
|
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
@@ -91,7 +89,7 @@ class User extends Authenticatable
|
|||||||
/**
|
/**
|
||||||
* Notes: 密码加密
|
* Notes: 密码加密
|
||||||
* @Author: <C.Jason>
|
* @Author: <C.Jason>
|
||||||
* @Date: 2019/9/6 11:37
|
* @Date : 2019/9/6 11:37
|
||||||
* @param $password
|
* @param $password
|
||||||
*/
|
*/
|
||||||
protected function setPasswordAttribute($password)
|
protected function setPasswordAttribute($password)
|
||||||
@@ -129,12 +127,12 @@ class User extends Authenticatable
|
|||||||
public function getCouponCount($type, $date = '')
|
public function getCouponCount($type, $date = '')
|
||||||
{
|
{
|
||||||
return $this->coupons()
|
return $this->coupons()
|
||||||
->whereIn('status', [2])
|
->whereIn('status', [2])
|
||||||
->where('thirdPartyGoodsId', $type)
|
->where('thirdPartyGoodsId', $type)
|
||||||
->when($date, function ($q) {
|
->when($date, function ($q) {
|
||||||
$q->whereDate('created_at', now()->format('Y-m-d'));
|
$q->whereDate('created_at', now()->format('Y-m-d'));
|
||||||
})
|
})
|
||||||
->count();
|
->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ namespace App\Models;
|
|||||||
|
|
||||||
class UserCode extends Model
|
class UserCode extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'codes' => 'array',
|
'codes' => 'array',
|
||||||
'profit' => 'array',
|
'profit' => 'array',
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class UserInfo extends Model
|
|||||||
/**
|
/**
|
||||||
* Notes: 获取性别的文字显示
|
* Notes: 获取性别的文字显示
|
||||||
* @Author: <C.Jason>
|
* @Author: <C.Jason>
|
||||||
* @Date: 2019/9/12 09:46
|
* @Date : 2019/9/12 09:46
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getSexTextAttribute()
|
protected function getSexTextAttribute()
|
||||||
@@ -35,7 +35,7 @@ class UserInfo extends Model
|
|||||||
/**
|
/**
|
||||||
* Notes: 处理默认头像
|
* Notes: 处理默认头像
|
||||||
* @Author: <C.Jason>
|
* @Author: <C.Jason>
|
||||||
* @Date: 2019/9/12 13:44
|
* @Date : 2019/9/12 13:44
|
||||||
* @param $avatar
|
* @param $avatar
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ use App\Models\Traits\BelongsToUser;
|
|||||||
|
|
||||||
class UserPingan extends Model
|
class UserPingan extends Model
|
||||||
{
|
{
|
||||||
use BelongsToUser;
|
|
||||||
|
|
||||||
|
use BelongsToUser;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ namespace App\Models;
|
|||||||
|
|
||||||
class WoCouponLog extends Model
|
class WoCouponLog extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
public function coupon()
|
public function coupon()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(WoCoupon::class, 'wo_coupon_id', 'id');
|
return $this->belongsTo(WoCoupon::class, 'wo_coupon_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
9
bootstrap/cache/events.php
vendored
9
bootstrap/cache/events.php
vendored
@@ -1,9 +0,0 @@
|
|||||||
<?php return array (
|
|
||||||
'App\\Providers\\EventServiceProvider' =>
|
|
||||||
array (
|
|
||||||
'App\\Events\\ConponCallback' =>
|
|
||||||
array (
|
|
||||||
0 => 'App\\Listeners\\ConponCallbackListener',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
85
bootstrap/cache/packages.php
vendored
Normal file
85
bootstrap/cache/packages.php
vendored
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<?php return array (
|
||||||
|
'barryvdh/laravel-debugbar' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Barryvdh\\Debugbar\\ServiceProvider',
|
||||||
|
),
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'Debugbar' => 'Barryvdh\\Debugbar\\Facade',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'encore/laravel-admin' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Encore\\Admin\\AdminServiceProvider',
|
||||||
|
),
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'Admin' => 'Encore\\Admin\\Facades\\Admin',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'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',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'simplesoftwareio/simple-qrcode' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'SimpleSoftwareIO\\QrCode\\QrCodeServiceProvider',
|
||||||
|
),
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'QrCode' => 'SimpleSoftwareIO\\QrCode\\Facades\\QrCode',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
216
bootstrap/cache/services.php
vendored
Normal file
216
bootstrap/cache/services.php
vendored
Normal file
@@ -0,0 +1,216 @@
|
|||||||
|
<?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 => 'Barryvdh\\Debugbar\\ServiceProvider',
|
||||||
|
23 => 'Encore\\Admin\\AdminServiceProvider',
|
||||||
|
24 => 'Fideloper\\Proxy\\TrustedProxyServiceProvider',
|
||||||
|
25 => 'Intervention\\Image\\ImageServiceProvider',
|
||||||
|
26 => 'Encore\\WangEditor\\WangEditorServiceProvider',
|
||||||
|
27 => 'Laravel\\Tinker\\TinkerServiceProvider',
|
||||||
|
28 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
|
||||||
|
29 => 'Carbon\\Laravel\\ServiceProvider',
|
||||||
|
30 => 'SimpleSoftwareIO\\QrCode\\QrCodeServiceProvider',
|
||||||
|
31 => 'App\\Providers\\AppServiceProvider',
|
||||||
|
32 => 'App\\Providers\\AuthServiceProvider',
|
||||||
|
33 => 'App\\Providers\\EventServiceProvider',
|
||||||
|
34 => 'App\\Providers\\RouteServiceProvider',
|
||||||
|
35 => 'App\\Api\\ApiServiceProvider',
|
||||||
|
36 => '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 => 'Barryvdh\\Debugbar\\ServiceProvider',
|
||||||
|
11 => 'Encore\\Admin\\AdminServiceProvider',
|
||||||
|
12 => 'Fideloper\\Proxy\\TrustedProxyServiceProvider',
|
||||||
|
13 => 'Intervention\\Image\\ImageServiceProvider',
|
||||||
|
14 => 'Encore\\WangEditor\\WangEditorServiceProvider',
|
||||||
|
15 => 'Laravel\\Tinker\\TinkerServiceProvider',
|
||||||
|
16 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
|
||||||
|
17 => 'Carbon\\Laravel\\ServiceProvider',
|
||||||
|
18 => 'SimpleSoftwareIO\\QrCode\\QrCodeServiceProvider',
|
||||||
|
19 => 'App\\Providers\\AppServiceProvider',
|
||||||
|
20 => 'App\\Providers\\AuthServiceProvider',
|
||||||
|
21 => 'App\\Providers\\EventServiceProvider',
|
||||||
|
22 => 'App\\Providers\\RouteServiceProvider',
|
||||||
|
23 => 'App\\Api\\ApiServiceProvider',
|
||||||
|
24 => '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 (
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.2",
|
"php": "^7.2",
|
||||||
|
"barryvdh/laravel-debugbar": "^3.4",
|
||||||
"encore/laravel-admin": "^1.8",
|
"encore/laravel-admin": "^1.8",
|
||||||
"fideloper/proxy": "^4.0",
|
"fideloper/proxy": "^4.0",
|
||||||
"guzzlehttp/guzzle": "^7.0",
|
"guzzlehttp/guzzle": "^7.0",
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
"fzaninotto/faker": "^1.4",
|
"fzaninotto/faker": "^1.4",
|
||||||
"mockery/mockery": "^1.0",
|
"mockery/mockery": "^1.0",
|
||||||
"nunomaduro/collision": "^3.0",
|
"nunomaduro/collision": "^3.0",
|
||||||
|
"overtrue/laravel-query-logger": "^2.0",
|
||||||
"phpunit/phpunit": "^8.0"
|
"phpunit/phpunit": "^8.0"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
@@ -44,10 +46,13 @@
|
|||||||
"App\\": "app/",
|
"App\\": "app/",
|
||||||
"RuLong\\Bonus\\": "packages/bonus/src/",
|
"RuLong\\Bonus\\": "packages/bonus/src/",
|
||||||
"RuLong\\Identity\\": "packages/identity/src/",
|
"RuLong\\Identity\\": "packages/identity/src/",
|
||||||
"XuanChen\\Coupon\\": "packages/coupon/src/"
|
"XuanChen\\Coupon\\": "packages/coupon/src/",
|
||||||
|
"XuanChen\\UnionPay\\": "packages/unionpay/src/",
|
||||||
|
"XuanChen\\Sinopec\\": "packages/sinopec/src/"
|
||||||
},
|
},
|
||||||
"classmap": [
|
"classmap": [
|
||||||
"database/seeds",
|
"database/seeds",
|
||||||
|
"database/migrations",
|
||||||
"database/factories"
|
"database/factories"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
3578
composer.lock
generated
3578
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return [
|
|
||||||
'rules' => [
|
|
||||||
'pingan' => [
|
|
||||||
'pattern' => '/^\d{12}$/',
|
|
||||||
'model' => App\Facades\SelfCoupon\Action\PinganAction::class,
|
|
||||||
],
|
|
||||||
'ysd' => [
|
|
||||||
'pattern' => '/^YSD/',
|
|
||||||
'model' => App\Facades\SelfCoupon\Action\YsdAction::class,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'check_minutes' => 3,//统一门店同一金额 3 分钟内视为同一订单
|
|
||||||
];
|
|
||||||
@@ -36,36 +36,36 @@ return [
|
|||||||
|
|
||||||
'channels' => [
|
'channels' => [
|
||||||
'stack' => [
|
'stack' => [
|
||||||
'driver' => 'stack',
|
'driver' => 'stack',
|
||||||
'channels' => ['daily'],
|
'channels' => ['daily'],
|
||||||
'ignore_exceptions' => false,
|
'ignore_exceptions' => false,
|
||||||
],
|
],
|
||||||
|
|
||||||
'single' => [
|
'single' => [
|
||||||
'driver' => 'single',
|
'driver' => 'single',
|
||||||
'path' => storage_path('logs/laravel.log'),
|
'path' => storage_path('logs/laravel.log'),
|
||||||
'level' => 'debug',
|
'level' => 'debug',
|
||||||
],
|
],
|
||||||
|
|
||||||
'daily' => [
|
'daily' => [
|
||||||
'driver' => 'daily',
|
'driver' => 'daily',
|
||||||
'path' => storage_path('logs/laravel.log'),
|
'path' => storage_path('logs/laravel.log'),
|
||||||
'level' => 'debug',
|
'level' => 'debug',
|
||||||
'days' => 14,
|
'days' => 14,
|
||||||
],
|
],
|
||||||
|
|
||||||
'slack' => [
|
'slack' => [
|
||||||
'driver' => 'slack',
|
'driver' => 'slack',
|
||||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||||
'username' => 'Laravel Log',
|
'username' => 'Laravel Log',
|
||||||
'emoji' => ':boom:',
|
'emoji' => ':boom:',
|
||||||
'level' => 'critical',
|
'level' => 'critical',
|
||||||
],
|
],
|
||||||
|
|
||||||
'papertrail' => [
|
'papertrail' => [
|
||||||
'driver' => 'monolog',
|
'driver' => 'monolog',
|
||||||
'level' => 'debug',
|
'level' => 'debug',
|
||||||
'handler' => SyslogUdpHandler::class,
|
'handler' => SyslogUdpHandler::class,
|
||||||
'handler_with' => [
|
'handler_with' => [
|
||||||
'host' => env('PAPERTRAIL_URL'),
|
'host' => env('PAPERTRAIL_URL'),
|
||||||
'port' => env('PAPERTRAIL_PORT'),
|
'port' => env('PAPERTRAIL_PORT'),
|
||||||
@@ -73,28 +73,35 @@ return [
|
|||||||
],
|
],
|
||||||
|
|
||||||
'stderr' => [
|
'stderr' => [
|
||||||
'driver' => 'monolog',
|
'driver' => 'monolog',
|
||||||
'handler' => StreamHandler::class,
|
'handler' => StreamHandler::class,
|
||||||
'formatter' => env('LOG_STDERR_FORMATTER'),
|
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||||
'with' => [
|
'with' => [
|
||||||
'stream' => 'php://stderr',
|
'stream' => 'php://stderr',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'syslog' => [
|
'syslog' => [
|
||||||
'driver' => 'syslog',
|
'driver' => 'syslog',
|
||||||
'level' => 'debug',
|
'level' => 'debug',
|
||||||
],
|
],
|
||||||
|
|
||||||
'errorlog' => [
|
'errorlog' => [
|
||||||
'driver' => 'errorlog',
|
'driver' => 'errorlog',
|
||||||
'level' => 'debug',
|
'level' => 'debug',
|
||||||
],
|
],
|
||||||
|
|
||||||
'null' => [
|
'null' => [
|
||||||
'driver' => 'monolog',
|
'driver' => 'monolog',
|
||||||
'handler' => NullHandler::class,
|
'handler' => NullHandler::class,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'query' => [
|
||||||
|
'enabled' => env('LOG_QUERY', false),
|
||||||
|
|
||||||
|
// Only record queries that are slower than the following time
|
||||||
|
// Unit: milliseconds
|
||||||
|
'slower_than' => 0,
|
||||||
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -46,9 +46,4 @@ return [
|
|||||||
7 => '未激活',
|
7 => '未激活',
|
||||||
],
|
],
|
||||||
|
|
||||||
'froms' => [
|
|
||||||
'bsshop',//本时商城
|
|
||||||
'bslive',//本时生活
|
|
||||||
],
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
42
config/sinopec.php
Normal file
42
config/sinopec.php
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
/**
|
||||||
|
* 平安接口参数
|
||||||
|
*/
|
||||||
|
'this_type' => 'dev',
|
||||||
|
/**
|
||||||
|
* 测试环境参数
|
||||||
|
*/
|
||||||
|
'test' => [
|
||||||
|
'client_id' => 'P_YISHIDAI',
|
||||||
|
'grant_type' => 'client_credentials',
|
||||||
|
'client_secret' => 'zGg9e6J5',
|
||||||
|
'userName' => '18804518018',
|
||||||
|
'AES_CODE' => '61DA0376BEBCFE1F',
|
||||||
|
'tokenUri' => 'https://test-api.pingan.com.cn:20443/oauth/oauth2/access_token',
|
||||||
|
'Uri' => 'http://test-api.pingan.com.cn:20080/open/vassPartner/appsvr/property/api/new/',
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生产环境参数
|
||||||
|
*/
|
||||||
|
'dev' => [
|
||||||
|
'client_id' => 'P_YISHIDAI',
|
||||||
|
'grant_type' => 'client_credentials',
|
||||||
|
'client_secret' => 'F3j5J7bx',
|
||||||
|
'userName' => '13936166646',
|
||||||
|
'AES_CODE' => '108DD27AB83252DB',
|
||||||
|
'tokenUri' => 'http://api.pingan.com.cn/oauth/oauth2/access_token',
|
||||||
|
'Uri' => 'http://api.pingan.com.cn/open/vassPartner/appsvr/property/api/new/',
|
||||||
|
],
|
||||||
|
|
||||||
|
'coupon_status' => [
|
||||||
|
1 => '新建',
|
||||||
|
2 => '未生效',
|
||||||
|
3 => '生效',
|
||||||
|
4 => '失效',
|
||||||
|
5 => '过期',
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
339
config/unionpay.php
Normal file
339
config/unionpay.php
Normal file
@@ -0,0 +1,339 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
//分配的渠道号
|
||||||
|
'msg_sender' => '660134',
|
||||||
|
//打印在小票上,由活动标题、优惠金额、原始金额组合而成
|
||||||
|
'pos_receipt' => '本时生活,优惠生活',
|
||||||
|
//广告,用于打印在小票上
|
||||||
|
'pos_ad' => '',
|
||||||
|
//营销联盟广告,用于打印在小票上
|
||||||
|
'pos_mkt_ad' => '本时生活,优惠生活',
|
||||||
|
//银联渠道id
|
||||||
|
'agent_id' => '299',
|
||||||
|
//银联网点id
|
||||||
|
'outlet_id' => '2009300919918',
|
||||||
|
//用于银商与sp分润的金额(是佣金的一部分), 以分为单位
|
||||||
|
'serv_chg' => 0,
|
||||||
|
//佣金
|
||||||
|
'commission' => 0,
|
||||||
|
//证书
|
||||||
|
'check' => [
|
||||||
|
'self' => [
|
||||||
|
'private' => storage_path('cert/unionpay/self/private_rsa.pem'),
|
||||||
|
'public' => storage_path('cert/unionpay/self/public_rsa.pem'),
|
||||||
|
],
|
||||||
|
'unionpay' => [
|
||||||
|
'public' => storage_path('cert/unionpay/public_rsa.pem'),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'type' => [
|
||||||
|
'002025' => '查询',
|
||||||
|
'002100' => '交易',
|
||||||
|
'002101' => '冲正',
|
||||||
|
'002102' => '撤销',
|
||||||
|
],
|
||||||
|
'log_type' => [
|
||||||
|
'002025' => 'query',
|
||||||
|
'002100' => 'freezecoupon',
|
||||||
|
'002101' => 'reversal',
|
||||||
|
'002102' => 'annul',
|
||||||
|
],
|
||||||
|
//需要校验的数据
|
||||||
|
'validator' => [
|
||||||
|
'002025' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_ver",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"req_serial_no",
|
||||||
|
"mkt_code",
|
||||||
|
"amount",
|
||||||
|
"avl_amt",
|
||||||
|
],
|
||||||
|
'002100' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"msg_ver",
|
||||||
|
"req_serial_no",
|
||||||
|
"orig_req_serial_no",
|
||||||
|
"sett_date",
|
||||||
|
"txn_date",
|
||||||
|
"txn_time",
|
||||||
|
"orig_amt",
|
||||||
|
"discount_amt",
|
||||||
|
],
|
||||||
|
'002101' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"msg_ver",
|
||||||
|
"req_serial_no",
|
||||||
|
"orig_req_serial_no",
|
||||||
|
],
|
||||||
|
'002102' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"msg_ver",
|
||||||
|
"req_serial_no",
|
||||||
|
"orig_req_serial_no",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
//入库基础数据
|
||||||
|
'regular' => [
|
||||||
|
'002025' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
// "msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_ver",
|
||||||
|
"msg_sys_sn",//自己添加的基础数据
|
||||||
|
"req_serial_no",//自己添加的基础数据
|
||||||
|
"mkt_code",//自己添加的基础数据
|
||||||
|
],
|
||||||
|
'002100' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
// "msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"msg_ver",
|
||||||
|
"req_serial_no",//自己添加的基础数据
|
||||||
|
"orig_req_serial_no",//自己添加的基础数据
|
||||||
|
"sett_date",//自己添加的基础数据
|
||||||
|
],
|
||||||
|
'002101' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
// "msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"msg_ver",
|
||||||
|
"req_serial_no",//自己添加的基础数据
|
||||||
|
"orig_req_serial_no",//自己添加的基础数据
|
||||||
|
],
|
||||||
|
'002102' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
// "msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"msg_ver",
|
||||||
|
"req_serial_no",//自己添加的基础数据
|
||||||
|
"orig_req_serial_no",//自己添加的基础数据
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'fields' => [
|
||||||
|
//聚合营销优惠查询接口
|
||||||
|
'002025' => [
|
||||||
|
'in' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "报文流水号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"req_serial_no" => "查询流水号",
|
||||||
|
"shop_no" => "门店号",
|
||||||
|
"term_no" => "受理终端号",
|
||||||
|
"service_code" => "受理方式",
|
||||||
|
"voucher_no" => "受理凭证号",
|
||||||
|
"mkt_code" => "聚合营销码",
|
||||||
|
"mkt_mode" => "聚合营销类型",
|
||||||
|
"embedded_mchnt_no" => "发起渠道商户号",
|
||||||
|
"currency_code" => "货币代码",
|
||||||
|
"amount" => "消费金额",
|
||||||
|
"avl_amt" => "可优惠金额",
|
||||||
|
"term_sp_chnl_no" => "终端指定SP渠道号",
|
||||||
|
"func_code" => "功能码",
|
||||||
|
"times" => "次数",
|
||||||
|
"pay_mode" => "支付方式",
|
||||||
|
//用户附加信息
|
||||||
|
"user_ext_info" => [
|
||||||
|
"mobile_no" => "手机号",
|
||||||
|
"user_code" => "用户号",
|
||||||
|
"user_code_type" => "用户号类型",
|
||||||
|
"dev_id" => "设备id",
|
||||||
|
],
|
||||||
|
"sign" => "签名域",
|
||||||
|
],
|
||||||
|
'out' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "报文流水号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_rsp_code" => "响应码",
|
||||||
|
"msg_rsp_desc" => "响应码描述",
|
||||||
|
"discount" => "折扣金额",
|
||||||
|
"actual_amt" => "折后应收金额",
|
||||||
|
"pos_display" => "POS显示",
|
||||||
|
"pos_receipt" => "POS小票",
|
||||||
|
"pos_ad" => "POS广告",
|
||||||
|
"pos_mkt_ad" => "Pos_营销联盟广告",
|
||||||
|
"sign" => "签名域",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
//销账交易接口
|
||||||
|
'002100' => [
|
||||||
|
'in' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "消息关联号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"shop_no" => "门店号",
|
||||||
|
"term_no" => "终端号",
|
||||||
|
"req_serial_no" => "销券流水号",
|
||||||
|
"orig_req_serial_no" => "原查询流水号",
|
||||||
|
"enc_card_no" => "加密卡号",
|
||||||
|
"part_card_no" => "部分卡号",
|
||||||
|
"acq_term_sn" => "受理终端流水号",
|
||||||
|
"refer_no" => "检索参考号",
|
||||||
|
"sett_date" => "清算日期",
|
||||||
|
"txn_date" => "交易日期",
|
||||||
|
"txn_time" => "交易时间",
|
||||||
|
"orig_amt" => "原始金额",
|
||||||
|
"discount_amt" => "优惠的金额",
|
||||||
|
"pay_amt" => "支付金额",
|
||||||
|
"pay_mode" => "支付方式",
|
||||||
|
"order_no" => "订单号",
|
||||||
|
"trans_crrltn_no" => "交易关联流水号",
|
||||||
|
"equity_no" => "权益号",
|
||||||
|
"card_no" => "全卡号",
|
||||||
|
"sign" => "签名数据",
|
||||||
|
],
|
||||||
|
'out' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "消息关联号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"msg_rsp_code" => "响应码",
|
||||||
|
"msg_rsp_desc" => "响应码描述",
|
||||||
|
"orig_amt" => "原始金额",
|
||||||
|
"discount_amt" => "折扣金额",
|
||||||
|
"pay_amt" => "支付金额",
|
||||||
|
"serv_chg" => "服务费",
|
||||||
|
"commission" => "佣金",
|
||||||
|
"ad" => "广告",
|
||||||
|
"pos_receipt" => "POS优惠",
|
||||||
|
"coupon_no" => "凭证号",
|
||||||
|
"coupon_type" => "凭证类型",
|
||||||
|
"sp_biz_code" => "SP统计码",
|
||||||
|
"charge_code" => "计费码",
|
||||||
|
"pos_event_title" => "SP活动主题",
|
||||||
|
"sp_contact" => "SP联系电话",
|
||||||
|
"sp_name" => "SP名称",
|
||||||
|
"event_no" => "活动号",
|
||||||
|
"td_code" => "二维码",
|
||||||
|
"memo" => "附言",
|
||||||
|
"mkt_sp_chnl_no" => "营销渠道号",
|
||||||
|
"point_amt" => "积分抵扣金额",
|
||||||
|
"sign" => "签名数据",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
//销账冲正通知接口
|
||||||
|
'002101' => [
|
||||||
|
'in' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "消息关联号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"shop_no" => "门店号",
|
||||||
|
"term_no" => "终端号",
|
||||||
|
"req_serial_no" => "冲正流水号",
|
||||||
|
"orig_req_serial_no" => "原始销账流水号",
|
||||||
|
"trans_crrltn_no" => "交易关联流水号",
|
||||||
|
"sign" => "签名数据",
|
||||||
|
],
|
||||||
|
'out' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "消息关联号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"msg_rsp_code" => "响应码",
|
||||||
|
"msg_rsp_desc" => "响应码描述",
|
||||||
|
"sign" => "签名数据",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'002102' => [
|
||||||
|
'in' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "消息关联号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"shop_no" => "门店号",
|
||||||
|
"term_no" => "终端号",
|
||||||
|
"req_serial_no" => "撤销流水号",
|
||||||
|
"orig_req_serial_no" => "原始销账流水号",
|
||||||
|
"trans_crrltn_no" => "交易关联流水号",
|
||||||
|
"sign" => "签名数据",
|
||||||
|
],
|
||||||
|
'out' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "消息关联号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"msg_rsp_code" => "响应码",
|
||||||
|
"msg_rsp_desc" => "响应码描述",
|
||||||
|
"ad" => "广告",
|
||||||
|
"td_code" => "二维码",
|
||||||
|
"sign" => "签名数据",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
];
|
||||||
@@ -3,19 +3,19 @@
|
|||||||
return [
|
return [
|
||||||
'coupon_model' => \App\Models\Coupon::class,
|
'coupon_model' => \App\Models\Coupon::class,
|
||||||
'rules' => [
|
'rules' => [
|
||||||
'ysd' => [
|
'ysd' => [
|
||||||
// 'pattern' => '/^YSD\d{12}/',
|
|
||||||
'pattern' => '/^YSD/',
|
'pattern' => '/^YSD/',
|
||||||
'model' => \XuanChen\Coupon\Action\YsdAction::class,
|
'model' => \XuanChen\Coupon\Action\YsdAction::class,
|
||||||
],
|
],
|
||||||
'pingan' => [
|
'unionpay' => [
|
||||||
|
'pattern' => '/^66406/',
|
||||||
|
'model' => \XuanChen\Coupon\Action\YsdAction::class,
|
||||||
|
],
|
||||||
|
'pingan' => [
|
||||||
'pattern' => '/^\d{12}$/',
|
'pattern' => '/^\d{12}$/',
|
||||||
'model' => \XuanChen\Coupon\Action\PinganAction::class,
|
'model' => \XuanChen\Coupon\Action\PinganAction::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
'froms' => [
|
|
||||||
'bsshop',//本时商城
|
|
||||||
'bslive',//本时生活
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
8
packages/coupon/README.md
Normal file
8
packages/coupon/README.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# coupon 优惠券接口
|
||||||
|
## 接口地址:http://pac.ysd-bs.com/api/V1
|
||||||
|
|
||||||
|
|
||||||
|
### 发券地址:http://pac.ysd-bs.com/api/V1/user/grant
|
||||||
|
### 查询接口:http://pa.ysd-bs.com/api/V1/user/query
|
||||||
|
### 核销地址:http://pa.ysd-bs.com/api/V1/user/freezecoupon
|
||||||
|
### 作废地址:http://pa.ysd-bs.com/api/V1/user/destroy
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
"name": "xuanchen/coupon",
|
"name": "xuanchen/coupon",
|
||||||
"description": "卡券相关",
|
"description": "卡券相关",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"homepage": "https://gitee.com/xdeepu/coupon",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "玄尘",
|
"name": "玄尘",
|
||||||
|
|||||||
@@ -38,9 +38,6 @@ class Init
|
|||||||
//查询到的卡券规则和商品id 只有平安券才有
|
//查询到的卡券规则和商品id 只有平安券才有
|
||||||
public $queryData;
|
public $queryData;
|
||||||
|
|
||||||
//来源
|
|
||||||
public $from;
|
|
||||||
|
|
||||||
//设置渠道
|
//设置渠道
|
||||||
public function setUser($user)
|
public function setUser($user)
|
||||||
{
|
{
|
||||||
@@ -102,23 +99,14 @@ 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')
|
||||||
@@ -151,56 +139,38 @@ 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'))
|
||||||
->sum('full');
|
->count();
|
||||||
} 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'))
|
||||||
->sum('full');
|
->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
//金额判断
|
$count = floor($this->total / 100);
|
||||||
if ($check_count >= $this->total) {
|
|
||||||
return "核销失败,此订单您无法再使用优惠券";
|
if ($check_count > 0) {
|
||||||
|
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,10 +182,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,7 +22,6 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,13 +41,19 @@ class PinganAction extends Init implements CouponContracts
|
|||||||
}
|
}
|
||||||
|
|
||||||
//发券
|
//发券
|
||||||
function grant()
|
public function grant()
|
||||||
{
|
{
|
||||||
return '没这个接口';
|
return '没这个接口';
|
||||||
}
|
}
|
||||||
|
|
||||||
//作废
|
//作废
|
||||||
function destroy()
|
public function destroy()
|
||||||
|
{
|
||||||
|
return '没这个接口';
|
||||||
|
}
|
||||||
|
|
||||||
|
//撤销
|
||||||
|
public function reversal()
|
||||||
{
|
{
|
||||||
return '没这个接口';
|
return '没这个接口';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace XuanChen\Coupon\Action;
|
|||||||
use XuanChen\Coupon\Action\ysd\YsdDestroy;
|
use XuanChen\Coupon\Action\ysd\YsdDestroy;
|
||||||
use XuanChen\Coupon\Action\ysd\YsdGrant;
|
use XuanChen\Coupon\Action\ysd\YsdGrant;
|
||||||
use XuanChen\Coupon\Action\ysd\YsdQuery;
|
use XuanChen\Coupon\Action\ysd\YsdQuery;
|
||||||
|
use XuanChen\Coupon\Action\ysd\YsdReversal;
|
||||||
use XuanChen\Coupon\Action\ysd\YsdVerification;
|
use XuanChen\Coupon\Action\ysd\YsdVerification;
|
||||||
use XuanChen\Coupon\Contracts\CouponContracts;
|
use XuanChen\Coupon\Contracts\CouponContracts;
|
||||||
|
|
||||||
@@ -85,8 +86,20 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 撤销
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/10/12 11:55
|
||||||
|
* @return array|string
|
||||||
|
*/
|
||||||
|
public function reversal()
|
||||||
|
{
|
||||||
|
return $res = (new YsdReversal)->setCode($this->redemptionCode)
|
||||||
|
->setOutletId($this->outletId)
|
||||||
|
->start();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,205 +1,205 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace XuanChen\Coupon\Action\pingan;
|
namespace XuanChen\Coupon\Action\pingan;
|
||||||
|
|
||||||
use App\Models\PinganToken;
|
use App\Models\PinganToken;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use GuzzleHttp\Exception\RequestException;
|
use GuzzleHttp\Exception\RequestException;
|
||||||
use XuanChen\Coupon\Action\Init;
|
use XuanChen\Coupon\Action\Init;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 超市购物券
|
* 超市购物券
|
||||||
*/
|
*/
|
||||||
class PingAnInit extends Init
|
class PingAnInit extends Init
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $this_type;
|
protected $this_type;
|
||||||
|
|
||||||
protected $baseUri;
|
protected $baseUri;
|
||||||
|
|
||||||
protected $tokenUri;
|
protected $tokenUri;
|
||||||
|
|
||||||
protected $client_id;
|
protected $client_id;
|
||||||
|
|
||||||
protected $grant_type;
|
protected $grant_type;
|
||||||
|
|
||||||
protected $client_secret;
|
protected $client_secret;
|
||||||
|
|
||||||
protected $access_token;
|
protected $access_token;
|
||||||
|
|
||||||
protected $userName;
|
protected $userName;
|
||||||
|
|
||||||
protected $error;
|
protected $error;
|
||||||
|
|
||||||
protected $aes_code; //aes 密钥
|
protected $aes_code; //aes 密钥
|
||||||
|
|
||||||
protected $log;//日志
|
protected $log;//日志
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->this_type = config('pingan.this_type');
|
$this->this_type = config('pingan.this_type');
|
||||||
$pingan = config('pingan.' . $this->this_type);
|
$pingan = config('pingan.' . $this->this_type);
|
||||||
|
|
||||||
$this->baseUri = $pingan['Uri'];
|
$this->baseUri = $pingan['Uri'];
|
||||||
$this->tokenUri = $pingan['tokenUri'];
|
$this->tokenUri = $pingan['tokenUri'];
|
||||||
$this->client_id = $pingan['client_id'];
|
$this->client_id = $pingan['client_id'];
|
||||||
$this->grant_type = $pingan['grant_type'];
|
$this->grant_type = $pingan['grant_type'];
|
||||||
$this->userName = $pingan['userName'];
|
$this->userName = $pingan['userName'];
|
||||||
$this->client_secret = $pingan['client_secret'];
|
$this->client_secret = $pingan['client_secret'];
|
||||||
$this->aes_code = $pingan['AES_CODE'];
|
$this->aes_code = $pingan['AES_CODE'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取access_token
|
* 获取access_token
|
||||||
* @return void [type] [description]
|
* @return void [type] [description]
|
||||||
*/
|
*/
|
||||||
public function getToken()
|
public function getToken()
|
||||||
{
|
{
|
||||||
//从数据库里找token
|
//从数据库里找token
|
||||||
$token = PinganToken::where('type', $this->this_type)->orderBy('id', 'desc')->first();
|
$token = PinganToken::where('type', $this->this_type)->orderBy('id', 'desc')->first();
|
||||||
|
|
||||||
if ($token) {
|
if ($token) {
|
||||||
$access_token = $token->access_token;
|
$access_token = $token->access_token;
|
||||||
$expires_in = $token->expires_in;
|
$expires_in = $token->expires_in;
|
||||||
$get_token_time = $token->get_token_time;
|
$get_token_time = $token->get_token_time;
|
||||||
$diffMinutes = $get_token_time->diffInMinutes(now(), false);
|
$diffMinutes = $get_token_time->diffInMinutes(now(), false);
|
||||||
if ($diffMinutes < $expires_in) {
|
if ($diffMinutes < $expires_in) {
|
||||||
$this->access_token = $access_token;
|
$this->access_token = $access_token;
|
||||||
} else {
|
} else {
|
||||||
$this->getAjaxToken();
|
$this->getAjaxToken();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->getAjaxToken();
|
$this->getAjaxToken();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取毫秒级别的时间戳
|
* 获取毫秒级别的时间戳
|
||||||
*/
|
*/
|
||||||
public function getMsecTime()
|
public function getMsecTime()
|
||||||
{
|
{
|
||||||
[$msec, $sec] = explode(' ', microtime());
|
[$msec, $sec] = explode(' ', microtime());
|
||||||
$msectime = (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000);
|
$msectime = (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000);
|
||||||
$msectime = explode('.', $msectime);
|
$msectime = explode('.', $msectime);
|
||||||
|
|
||||||
return $msectime[0];
|
return $msectime[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求平台 access_token
|
* 请求平台 access_token
|
||||||
* @return void [type] [description]
|
* @return void [type] [description]
|
||||||
*/
|
*/
|
||||||
public function getAjaxToken()
|
public function getAjaxToken()
|
||||||
{
|
{
|
||||||
$params = [
|
$params = [
|
||||||
'client_id' => $this->client_id,
|
'client_id' => $this->client_id,
|
||||||
'grant_type' => $this->grant_type,
|
'grant_type' => $this->grant_type,
|
||||||
'client_secret' => $this->client_secret,
|
'client_secret' => $this->client_secret,
|
||||||
];
|
];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$log = $this->createLog($this->tokenUri, 'POST', $params, 'pingan');
|
$log = $this->createLog($this->tokenUri, 'POST', $params, 'pingan');
|
||||||
|
|
||||||
$client = new Client();
|
$client = new Client();
|
||||||
$response = $client->request('POST', $this->tokenUri, [
|
$response = $client->request('POST', $this->tokenUri, [
|
||||||
'form_params' => $params,
|
'form_params' => $params,
|
||||||
]);
|
]);
|
||||||
$body = $response->getBody();
|
$body = $response->getBody();
|
||||||
$content = $body->getContents();
|
$content = $body->getContents();
|
||||||
$result = json_decode($content, true);
|
$result = json_decode($content, true);
|
||||||
|
|
||||||
$this->updateLog($log, $result); //更新日志
|
$this->updateLog($log, $result); //更新日志
|
||||||
|
|
||||||
if ($result['ret'] > 0) {
|
if ($result['ret'] > 0) {
|
||||||
$this->error = $result['msg'];
|
$this->error = $result['msg'];
|
||||||
} else {
|
} else {
|
||||||
$data = $result['data'];
|
$data = $result['data'];
|
||||||
PinganToken::create([
|
PinganToken::create([
|
||||||
'type' => $this->this_type,
|
'type' => $this->this_type,
|
||||||
'access_token' => $data['access_token'],
|
'access_token' => $data['access_token'],
|
||||||
'expires_in' => $data['expires_in'],
|
'expires_in' => $data['expires_in'],
|
||||||
'get_token_time' => now(),
|
'get_token_time' => now(),
|
||||||
]);
|
]);
|
||||||
$this->access_token = $data['access_token'];
|
$this->access_token = $data['access_token'];
|
||||||
$this->error = '';
|
$this->error = '';
|
||||||
}
|
}
|
||||||
} catch (RequestException $e) {
|
} catch (RequestException $e) {
|
||||||
$this->error = $e->getMessage();
|
$this->error = $e->getMessage();
|
||||||
$this->updateLog($log, [$this->error]); //更新日志
|
$this->updateLog($log, [$this->error]); //更新日志
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用获取数据接口
|
* 通用获取数据接口
|
||||||
* @param [type] $url 请求地址
|
* @param [type] $url 请求地址
|
||||||
* @param array $query 传递参数
|
* @param array $query 传递参数
|
||||||
* @param array $json 需要传的json数据
|
* @param array $json 需要传的json数据
|
||||||
* @param string $method 方式
|
* @param string $method 方式
|
||||||
* @return array|mixed [type] [description]
|
* @return array|mixed [type] [description]
|
||||||
*/
|
*/
|
||||||
public function getPingAnData($url, $query = [], $json = [], $method = 'POST')
|
public function getPingAnData($url, $query = [], $json = [], $method = 'POST')
|
||||||
{
|
{
|
||||||
$this->getToken();
|
$this->getToken();
|
||||||
|
|
||||||
if ($this->error) {
|
if ($this->error) {
|
||||||
return $this->error;
|
return $this->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
$postData = [
|
$postData = [
|
||||||
'query' => array_merge([
|
'query' => array_merge([
|
||||||
'access_token' => $this->access_token,
|
'access_token' => $this->access_token,
|
||||||
'request_id' => $this->getMsecTime(),
|
'request_id' => $this->getMsecTime(),
|
||||||
'userName' => $this->userName,
|
'userName' => $this->userName,
|
||||||
], $query),
|
], $query),
|
||||||
'json' => $json,
|
'json' => $json,
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'Content-Type' => 'application/json;charset=utf-8',
|
'Content-Type' => 'application/json;charset=utf-8',
|
||||||
'accept' => 'application/json;charset=utf-8',
|
'accept' => 'application/json;charset=utf-8',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
$log = $this->createLog($url, $method, $postData, 'pingan'); //日志
|
$log = $this->createLog($url, $method, $postData, 'pingan'); //日志
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$client = new Client();
|
$client = new Client();
|
||||||
$response = $client->request($method, $url, $postData);
|
$response = $client->request($method, $url, $postData);
|
||||||
$body = $response->getBody();
|
$body = $response->getBody();
|
||||||
$content = $body->getContents();
|
$content = $body->getContents();
|
||||||
$result = json_decode($content, true);
|
$result = json_decode($content, true);
|
||||||
|
|
||||||
if ($result['ret'] > 0) {
|
if ($result['ret'] > 0) {
|
||||||
$retData = $result['msg'];
|
$retData = $result['msg'];
|
||||||
} else {
|
} else {
|
||||||
$retData = $result['data'];
|
$retData = $result['data'];
|
||||||
}
|
}
|
||||||
$this->updateLog($log, $retData);//更新日志
|
$this->updateLog($log, $retData);//更新日志
|
||||||
|
|
||||||
return $retData;
|
return $retData;
|
||||||
} catch (RequestException $e) {
|
} catch (RequestException $e) {
|
||||||
$this->updateLog($log, [$e->getMessage()]);//更新日志
|
$this->updateLog($log, [$e->getMessage()]);//更新日志
|
||||||
|
|
||||||
return ['ret' => '99999', $e->getMessage()];
|
return ['ret' => '99999', $e->getMessage()];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//加密
|
//加密
|
||||||
public function encrypt($str)
|
public function encrypt($str)
|
||||||
{
|
{
|
||||||
if (is_array($str)) {
|
if (is_array($str)) {
|
||||||
$str = json_encode($str);
|
$str = json_encode($str);
|
||||||
}
|
}
|
||||||
$data = openssl_encrypt($str, 'aes-128-ecb', $this->aes_code, OPENSSL_RAW_DATA);
|
$data = openssl_encrypt($str, 'aes-128-ecb', $this->aes_code, OPENSSL_RAW_DATA);
|
||||||
|
|
||||||
return base64_encode($data);
|
return base64_encode($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
//解密
|
//解密
|
||||||
public function decrypt($str)
|
public function decrypt($str)
|
||||||
{
|
{
|
||||||
$encrypted = base64_decode($str);
|
$encrypted = base64_decode($str);
|
||||||
|
|
||||||
return openssl_decrypt($encrypted, 'aes-128-ecb', $this->aes_code, OPENSSL_RAW_DATA);
|
return openssl_decrypt($encrypted, 'aes-128-ecb', $this->aes_code, OPENSSL_RAW_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,8 @@ 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;
|
||||||
}
|
}
|
||||||
@@ -91,7 +90,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();
|
||||||
@@ -120,7 +119,6 @@ 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'],
|
||||||
@@ -131,7 +129,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,7 +210,7 @@ class Verification extends PingAnInit
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->ticket = [
|
$this->ticket = [
|
||||||
'full' => $result[0],
|
'total' => $result[0],
|
||||||
'price' => $price,
|
'price' => $price,
|
||||||
'profit' => $code->profit,
|
'profit' => $code->profit,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ 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
|
||||||
@@ -14,7 +13,7 @@ class YsdGrant extends Init
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$activity = Activity::withCount('coupons')->where('code', $this->activityId)->first();
|
$activity = Activity::where('code', $this->activityId)->first();
|
||||||
if (!$activity) {
|
if (!$activity) {
|
||||||
return '发券失败,没有找到这个活动。';
|
return '发券失败,没有找到这个活动。';
|
||||||
}
|
}
|
||||||
@@ -22,14 +21,6 @@ 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) {
|
||||||
|
|||||||
69
packages/coupon/src/Action/ysd/YsdReversal.php
Normal file
69
packages/coupon/src/Action/ysd/YsdReversal.php
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\Coupon\Action\ysd;
|
||||||
|
|
||||||
|
use App\Events\ConponCallback;
|
||||||
|
use App\Models\ActivityCoupon;
|
||||||
|
use App\Models\Coupon;
|
||||||
|
use App\Models\User;
|
||||||
|
use XuanChen\Coupon\Action\Init;
|
||||||
|
|
||||||
|
class YsdReversal extends Init
|
||||||
|
{
|
||||||
|
|
||||||
|
public function start()
|
||||||
|
{
|
||||||
|
if ($this->redemptionCode) {
|
||||||
|
try {
|
||||||
|
if (!$this->outletId) {
|
||||||
|
throw new \Exception('缺少网点id');
|
||||||
|
}
|
||||||
|
|
||||||
|
$activityCoupon = ActivityCoupon::where('code', $this->redemptionCode)->first();
|
||||||
|
|
||||||
|
if (!$activityCoupon) {
|
||||||
|
throw new \Exception('未查询到卡券信息');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$activityCoupon->canReversal()) {
|
||||||
|
throw new \Exception('操作失败,卡券当前状态不能操作');
|
||||||
|
}
|
||||||
|
|
||||||
|
$outlet = User::where('outlet_id', $this->outletId)->first();
|
||||||
|
|
||||||
|
if (empty($outlet)) {
|
||||||
|
return '操作失败,未查询到此网点信息。';
|
||||||
|
}
|
||||||
|
|
||||||
|
$grants = $activityCoupon->activity->grants()->pluck('user_id');
|
||||||
|
if ($grants->isEmpty()) {
|
||||||
|
return '操作失败,此活动还没有配置可发券渠道,请联系相关人员进行配置。';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!in_array($outlet->parent_id, $grants->toArray())) {
|
||||||
|
return '操作失败,您没有权限作废此优惠券。';
|
||||||
|
}
|
||||||
|
|
||||||
|
$coupon = Coupon::where('redemptionCode', $this->redemptionCode)
|
||||||
|
->where('status', 2)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($activityCoupon && $coupon) {
|
||||||
|
//撤销
|
||||||
|
$activityCoupon->reversal();
|
||||||
|
//撤销
|
||||||
|
$coupon->reversal();
|
||||||
|
}
|
||||||
|
event(new ConponCallback($activityCoupon));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $e->getMessage();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return '未获取到券码。';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -36,12 +36,6 @@ 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();
|
||||||
@@ -50,6 +44,12 @@ 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 = [
|
||||||
'full' => $match[0],
|
'total' => $match[0],
|
||||||
'price' => $price,
|
'price' => $price,
|
||||||
'profit' => $code->profit,
|
'profit' => $code->profit,
|
||||||
];
|
];
|
||||||
@@ -171,7 +171,6 @@ 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'],
|
||||||
@@ -185,7 +184,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();
|
||||||
|
|||||||
@@ -1,153 +1,179 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace XuanChen\Coupon;
|
namespace XuanChen\Coupon;
|
||||||
|
|
||||||
use App\Models\Activity;
|
use App\Models\Activity;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自有卡券系统
|
* 自有卡券系统
|
||||||
*/
|
*/
|
||||||
class Coupon
|
class Coupon
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: 发券接口
|
* Notes: 发券接口
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2020/6/28 15:07
|
* @Date : 2020/6/28 15:07
|
||||||
* @param $activityId 活动编号
|
* @param $activityId 活动编号
|
||||||
* @param $outletId 网点编号
|
* @param $outletId 网点编号
|
||||||
* @param $mobile 手机号
|
* @param $mobile 手机号
|
||||||
*/
|
*/
|
||||||
public static function Grant($activityId, $outletId, $mobile)
|
public static function Grant($activityId, $outletId, $mobile)
|
||||||
{
|
{
|
||||||
$model = config('xuanchen_coupon.rules.ysd.model');
|
$model = config('xuanchen_coupon.rules.ysd.model');
|
||||||
|
|
||||||
return (new $model)->setActivityId($activityId)
|
return (new $model)->setActivityId($activityId)
|
||||||
->setOutletId($outletId)
|
->setOutletId($outletId)
|
||||||
->setMobile($mobile)
|
->setMobile($mobile)
|
||||||
->grant();
|
->grant();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: 查询接口
|
* Notes: 查询接口
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2020/7/21 11:58
|
* @Date : 2020/7/21 11:58
|
||||||
* @param $redemptionCode
|
* @param $redemptionCode
|
||||||
*/
|
*/
|
||||||
public static function Query($redemptionCode, $outletId)
|
public static function Query($redemptionCode, $outletId)
|
||||||
{
|
{
|
||||||
if (!$redemptionCode) {
|
if (!$redemptionCode) {
|
||||||
return '查询失败,未获取到券码';
|
return '查询失败,未获取到券码';
|
||||||
}
|
}
|
||||||
|
|
||||||
$model = self::getModelByCode($redemptionCode);
|
$model = self::getModelByCode($redemptionCode);
|
||||||
if (is_string($model)) {
|
if (is_string($model)) {
|
||||||
return $model;
|
return $model;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $model->setCode($redemptionCode)
|
return $model->setCode($redemptionCode)
|
||||||
->setOutletId($outletId)
|
->setOutletId($outletId)
|
||||||
->detail();
|
->detail();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: 卡券作废
|
* Notes: 卡券作废
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2020/9/2 16:54
|
* @Date : 2020/9/2 16:54
|
||||||
* @param $redemptionCode
|
* @param $redemptionCode
|
||||||
* @param $outletId
|
* @param $outletId
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function Destroy($redemptionCode, $outletId)
|
public static function Destroy($redemptionCode, $outletId)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$model = self::getModelByCode($redemptionCode);
|
$model = self::getModelByCode($redemptionCode);
|
||||||
if (is_string($model)) {
|
if (is_string($model)) {
|
||||||
return $model;
|
return $model;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $model->setCode($redemptionCode)
|
return $model->setCode($redemptionCode)
|
||||||
->setOutletId($outletId)
|
->setOutletId($outletId)
|
||||||
->destroy();
|
->destroy();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: 根据券码 获取class
|
* Notes: 根据券码 获取class
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2020/7/21 12:00
|
* @Date : 2020/7/21 12:00
|
||||||
* @param $code
|
* @param $code
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getModelByCode($code)
|
public static function getModelByCode($code)
|
||||||
{
|
{
|
||||||
$rules = config('xuanchen_coupon.rules');
|
$rules = config('xuanchen_coupon.rules');
|
||||||
if (!$rules) {
|
|
||||||
return '系统出错,未找到配置文件';
|
if (!$rules) {
|
||||||
}
|
throw new \Exception('系统出错,未找到配置文件');
|
||||||
|
}
|
||||||
$model = '';
|
|
||||||
foreach ($rules as $rule) {
|
$model = '';
|
||||||
if (preg_match($rule['pattern'], $code, $matches)) {
|
foreach ($rules as $rule) {
|
||||||
$model = $rule['model'];
|
if (is_array($rule['pattern']) && count($rule['pattern']) > 1) {
|
||||||
break;
|
foreach ($rule['pattern'] as $pattern) {
|
||||||
}
|
if (preg_match($pattern, $code, $matches)) {
|
||||||
}
|
$model = $rule['model'];
|
||||||
|
break;
|
||||||
if (!$model) {
|
}
|
||||||
throw new \Exception('卡券核销失败。未查到卡券所属');
|
}
|
||||||
}
|
} else {
|
||||||
|
if (preg_match($rule['pattern'], $code, $matches)) {
|
||||||
return new $model;
|
$model = $rule['model'];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Notes: description
|
}
|
||||||
* @Author: 玄尘
|
|
||||||
* @Date : 2020/8/21 13:33
|
if (!$model) {
|
||||||
* @param \App\Models\User $user 渠道
|
throw new \Exception('操作失败。未查到卡券所属');
|
||||||
* @param string $redemptionCode 要核销的券码
|
}
|
||||||
* @param float $total 订单金额
|
|
||||||
* @param string $outletId 网点id
|
return new $model;
|
||||||
* @param string $orderid 订单id
|
|
||||||
* @param string $from 来源
|
}
|
||||||
* @return string
|
|
||||||
*/
|
/**
|
||||||
public static function Redemption(
|
* Notes: description
|
||||||
User $user,
|
* @Author: 玄尘
|
||||||
string $redemptionCode,
|
* @Date : 2020/8/21 13:33
|
||||||
float $total,
|
* @param \App\Models\User $user 渠道
|
||||||
string $outletId,
|
* @param string $redemptionCode 要核销的券码
|
||||||
string $orderid = '',
|
* @param float $total 订单金额
|
||||||
string $from = ''
|
* @param string $outletId 网点id
|
||||||
)
|
* @param string $orderid 订单id
|
||||||
{
|
* @return string
|
||||||
|
*/
|
||||||
try {
|
public static function Redemption(User $user, string $redemptionCode, float $total, string $outletId, string $orderid = '')
|
||||||
$model = self::getModelByCode($redemptionCode);
|
{
|
||||||
if (is_string($model)) {
|
|
||||||
return $model;
|
try {
|
||||||
}
|
$model = self::getModelByCode($redemptionCode);
|
||||||
|
if (is_string($model)) {
|
||||||
return $model->setUser($user)
|
return $model;
|
||||||
->setCode($redemptionCode)
|
}
|
||||||
->setTotal($total)
|
|
||||||
->setOutletId($outletId)
|
return $model->setUser($user)
|
||||||
->setOrderId($orderid)
|
->setCode($redemptionCode)
|
||||||
->setFrom($from)
|
->setTotal($total)
|
||||||
->start();
|
->setOutletId($outletId)
|
||||||
|
->setOrderId($orderid)
|
||||||
} catch (\Exception $e) {
|
->start();
|
||||||
return $e->getMessage();
|
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 冲正 撤销 已经核销的改为未核销状态
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/10/12 11:54
|
||||||
|
* @param $redemptionCode
|
||||||
|
* @param $outletId
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function Reversal($redemptionCode, $outletId)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$model = self::getModelByCode($redemptionCode);
|
||||||
|
if (is_string($model)) {
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $model->setCode($redemptionCode)
|
||||||
|
->setOutletId($outletId)
|
||||||
|
->reversal();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace XuanChen\Coupon;
|
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
|
||||||
|
|
||||||
class CouponServiceProvider extends ServiceProvider
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register services.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function register()
|
|
||||||
{
|
|
||||||
dd(1);
|
|
||||||
if ($this->app->runningInConsole()) {
|
|
||||||
$this->publishes([__DIR__ . '/../config/xuanchen_coupon.php' => config_path('xuanchen_coupon.php')]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Bootstrap services.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function boot()
|
|
||||||
{
|
|
||||||
$this->mergeConfigFrom(__DIR__ . '/../config/xuanchen_coupon.php', 'xuanchen_coupon');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,47 +1,47 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace XuanChen\Coupon\Traits;
|
namespace XuanChen\Coupon\Traits;
|
||||||
|
|
||||||
use App\Models\Log as LogModel;
|
use App\Models\Log as LogModel;
|
||||||
|
|
||||||
trait Log
|
trait Log
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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')
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'path' => $url,
|
'path' => $url,
|
||||||
'method' => $method,
|
'method' => $method,
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'in_source' => $params,
|
'in_source' => $params,
|
||||||
];
|
];
|
||||||
|
|
||||||
$info = LogModel::create($data);
|
$info = LogModel::create($data);
|
||||||
|
|
||||||
return $info;
|
return $info;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: 更新日志
|
* Notes: 更新日志
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2020/6/30 10:29
|
* @Date : 2020/6/30 10:29
|
||||||
* @param $log
|
* @param $log
|
||||||
* @param $params
|
* @param $params
|
||||||
*/
|
*/
|
||||||
public static function updateLog($log, $params)
|
public static function updateLog($log, $params)
|
||||||
{
|
{
|
||||||
$log->out_source = $params;
|
$log->out_source = $params;
|
||||||
$log->save();
|
$log->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
27
packages/sinopec/composer.json
Normal file
27
packages/sinopec/composer.json
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"name": "xuanchen/sinopec",
|
||||||
|
"description": "中石化相关",
|
||||||
|
"license": "MIT",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "玄尘",
|
||||||
|
"email": "122383162@qq.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.1.3",
|
||||||
|
"laravel/framework": "*"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"XuanChen\\Sinopec": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"XuanChen\\Sinopec\\ServiceProvider"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
packages/sinopec/config/xuanchen_coupon.php
Normal file
15
packages/sinopec/config/xuanchen_coupon.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'coupon_model' => \App\Models\Coupon::class,
|
||||||
|
'rules' => [
|
||||||
|
'pingan' => [
|
||||||
|
'pattern' => '/^\d{12}$/',
|
||||||
|
'model' => \XuanChen\Coupon\Action\PinganAction::class,
|
||||||
|
],
|
||||||
|
'ysd' => [
|
||||||
|
'pattern' => '/^YSD/',
|
||||||
|
'model' => \XuanChen\Coupon\Action\SinopecAction::class,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
197
packages/sinopec/src/Action/Init.php
Normal file
197
packages/sinopec/src/Action/Init.php
Normal file
@@ -0,0 +1,197 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\Coupon\Action;
|
||||||
|
|
||||||
|
use App\Models\Coupon;
|
||||||
|
use App\Models\Log as LogModel;
|
||||||
|
|
||||||
|
class Init
|
||||||
|
{
|
||||||
|
|
||||||
|
//渠道
|
||||||
|
public $user;
|
||||||
|
|
||||||
|
//卡券编号
|
||||||
|
public $redemptionCode;
|
||||||
|
|
||||||
|
//订单金额
|
||||||
|
public $total;
|
||||||
|
|
||||||
|
//网点编号
|
||||||
|
public $outletId;
|
||||||
|
|
||||||
|
//活动id
|
||||||
|
public $activityId;
|
||||||
|
|
||||||
|
//手机号
|
||||||
|
public $mobile;
|
||||||
|
|
||||||
|
//核销的卡券 创建的核销记录
|
||||||
|
public $coupon;
|
||||||
|
|
||||||
|
//查询返回卡券信息
|
||||||
|
public $query_coupon;
|
||||||
|
|
||||||
|
//订单id
|
||||||
|
public $orderid;
|
||||||
|
|
||||||
|
//查询到的卡券规则和商品id 只有平安券才有
|
||||||
|
public $queryData;
|
||||||
|
|
||||||
|
//设置渠道
|
||||||
|
public function setUser($user)
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置渠道
|
||||||
|
public function setOrderId($orderid)
|
||||||
|
{
|
||||||
|
$this->orderid = $orderid;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置核销码
|
||||||
|
public function setCode($redemptionCode)
|
||||||
|
{
|
||||||
|
$this->redemptionCode = $redemptionCode;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置订单总额
|
||||||
|
public function setTotal($total)
|
||||||
|
{
|
||||||
|
$this->total = $total;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置网点id
|
||||||
|
public function setOutletId($outletId)
|
||||||
|
{
|
||||||
|
$this->outletId = $outletId;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置活动id
|
||||||
|
public function setActivityId($activityId)
|
||||||
|
{
|
||||||
|
$this->activityId = $activityId;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置手机号
|
||||||
|
public function setMobile($mobile)
|
||||||
|
{
|
||||||
|
$this->mobile = $mobile;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 插入日志
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/6/30 10:29
|
||||||
|
* @param $url
|
||||||
|
* @param $method
|
||||||
|
* @param $params
|
||||||
|
* @param string $type
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function createLog($url, $method, $params, $type = 'pingan')
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'path' => $url,
|
||||||
|
'method' => $method,
|
||||||
|
'type' => $type,
|
||||||
|
'in_source' => $params,
|
||||||
|
];
|
||||||
|
|
||||||
|
$info = LogModel::create($data);
|
||||||
|
|
||||||
|
return $info;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 更新日志
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/6/30 10:29
|
||||||
|
* @param $log
|
||||||
|
* @param $params
|
||||||
|
*/
|
||||||
|
public static function updateLog($log, $params)
|
||||||
|
{
|
||||||
|
$log->out_source = $params;
|
||||||
|
$log->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
//统一门店 相同金额 3分钟之内看作是一笔订单
|
||||||
|
public function CheckCount()
|
||||||
|
{
|
||||||
|
if ($this->queryData) {
|
||||||
|
if (isset($this->queryData['thirdPartyGoodsId']) && $this->queryData['thirdPartyGoodsId'] == 'YSD-full0-0') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->orderid) {
|
||||||
|
$check_count = Coupon::where('orderid', $this->orderid)
|
||||||
|
->where('outletId', $this->outletId)
|
||||||
|
->where('total', $this->total)
|
||||||
|
->where('status', 2)
|
||||||
|
->where('created_at', '>=', now()->subMinutes(3)->format('Y-m-d H:i:s'))
|
||||||
|
->count();
|
||||||
|
} else {
|
||||||
|
$check_count = Coupon::where('outletId', $this->outletId)
|
||||||
|
->where('total', $this->total)
|
||||||
|
->where('status', 2)
|
||||||
|
->where('created_at', '>=', now()->subMinutes(3)->format('Y-m-d H:i:s'))
|
||||||
|
->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
$count = floor($this->total / 100);
|
||||||
|
|
||||||
|
if ($check_count > 0) {
|
||||||
|
// if ($this->total < 100) {
|
||||||
|
// return '核销失败,订单金额少于100只能核销一张优惠券。';
|
||||||
|
// }
|
||||||
|
if ($check_count >= $count) {
|
||||||
|
return "核销失败,此订单您只能使用 {$count} 张优惠券";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 校验是否已经核销过
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/8/8 13:43
|
||||||
|
*/
|
||||||
|
public function HasCheck()
|
||||||
|
{
|
||||||
|
$info = Coupon::where('redemptionCode', $this->redemptionCode)
|
||||||
|
->where('outletId', $this->outletId)
|
||||||
|
->where('total', $this->total)
|
||||||
|
->where('status', 2)
|
||||||
|
->first();
|
||||||
|
if ($info) {
|
||||||
|
return '核销失败,此优惠券已被使用';
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
73
packages/sinopec/src/Action/SinopecAction.php
Normal file
73
packages/sinopec/src/Action/SinopecAction.php
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\Coupon\Action;
|
||||||
|
|
||||||
|
use XuanChen\Coupon\Action\sinopec\ZhyCreate;
|
||||||
|
use XuanChen\Coupon\Contracts\CouponContracts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SinopecAction 中石化控制器
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2020/9/23 15:14
|
||||||
|
* @package XuanChen\Coupon\Action
|
||||||
|
*/
|
||||||
|
class SinopecAction extends Init implements CouponContracts
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Notes: 创建营销活动
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2020/9/23 16:01
|
||||||
|
* @param array $data
|
||||||
|
*/
|
||||||
|
public function create(array $data)
|
||||||
|
{
|
||||||
|
$action = new ZhyCreate();
|
||||||
|
$action->data = $data;
|
||||||
|
|
||||||
|
return $action->start();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 发券接口
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2020/9/23 15:58
|
||||||
|
*/
|
||||||
|
function grant()
|
||||||
|
{
|
||||||
|
// TODO: Implement grant() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 查询接口
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2020/9/23 15:58
|
||||||
|
* @return mixed|void
|
||||||
|
*/
|
||||||
|
function detail()
|
||||||
|
{
|
||||||
|
// TODO: Implement detail() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 作废接口
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2020/9/23 15:59
|
||||||
|
*/
|
||||||
|
function destroy()
|
||||||
|
{
|
||||||
|
// TODO: Implement destroy() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 核销接口
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2020/9/23 16:00
|
||||||
|
* @return mixed|void
|
||||||
|
*/
|
||||||
|
function start()
|
||||||
|
{
|
||||||
|
// TODO: Implement start() method.
|
||||||
|
}
|
||||||
|
}
|
||||||
82
packages/sinopec/src/Action/sinopec/ZhyCreate.php
Normal file
82
packages/sinopec/src/Action/sinopec/ZhyCreate.php
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\Sinopec\Action\sinopec;
|
||||||
|
|
||||||
|
use XuanChen\Sinopec\Contracts\CheckCouponContracts;
|
||||||
|
|
||||||
|
class ZhyCreate implements CheckCouponContracts
|
||||||
|
{
|
||||||
|
|
||||||
|
public $data;
|
||||||
|
|
||||||
|
public function start()
|
||||||
|
{
|
||||||
|
|
||||||
|
try {
|
||||||
|
[
|
||||||
|
"cooperativeMerchant" => "",
|
||||||
|
"eletronAndRule" => [
|
||||||
|
[
|
||||||
|
"entryMethod" => "01",
|
||||||
|
"marketCode" => "20191213154203514",
|
||||||
|
"marketRuleNumber" => "001",
|
||||||
|
"perVoucherNumber" => "1",
|
||||||
|
"planVoucherNumber" => "10",
|
||||||
|
"queryCreateTime" => "2019-11-11 18:39:49",
|
||||||
|
"similarStack" => "Y",
|
||||||
|
"voucherEndTime" => "2019-12-15",
|
||||||
|
"voucher_ruleCode" => "$01-VC-1573468710381900",
|
||||||
|
"voucherRuleName" => "ceshi2",
|
||||||
|
"voucherSource" => "S01",
|
||||||
|
"voucherStartTime" => "2019-12-13",
|
||||||
|
"voucherStartTime_type" => "VOUCHER_START_TIME_TYPE_ABSOLUTE_EFFECTIVE_TIME",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
"limitFrequency" => "",
|
||||||
|
"mabIsRefund" => "",
|
||||||
|
"marketCode" => "20191213154203514",
|
||||||
|
"marketExEndTime" => "2019-12-15 00:00:00",
|
||||||
|
"marketExStartTime" => "2019-12-13 00:00:00",
|
||||||
|
"marketHierarchy" => "3311",
|
||||||
|
"marketName" => "行为推送活动-3",
|
||||||
|
"marketProvince" => "51",
|
||||||
|
"marketReleaseSys" => "VOUCHER_PUBLISH_TYPE_APPLET",
|
||||||
|
"marketStatus" => "MARKET_ACTIVITY_STATE_TAKE_EFFECT",
|
||||||
|
"promotionCalculation" => "PROMOTION_TYPE_MEMBER_BEHAVIOR",
|
||||||
|
"rule" => [
|
||||||
|
[
|
||||||
|
"cashValue" => "100",
|
||||||
|
"channel" => "C01,C02,C03,C05",
|
||||||
|
"fullType" => "",
|
||||||
|
"marketCode" => "20191213154203514",
|
||||||
|
"perVoucherNumber" => "1",
|
||||||
|
"planVoucherNumber" => "10",
|
||||||
|
"ruleCode" => "$01-VC-1573468710381900",
|
||||||
|
"ruleDetail" => "123123",
|
||||||
|
"ruleName" => "ceshi2",
|
||||||
|
"voucherType" => "C01",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
"tradLimit" => [
|
||||||
|
[
|
||||||
|
"endValue" => "",
|
||||||
|
"fixed" => "",
|
||||||
|
"marketCode" => "20191213154203514",
|
||||||
|
"marketRuleName" => "001",
|
||||||
|
"marketRuleNumber" => "001",
|
||||||
|
"memLevel" => "",
|
||||||
|
"operator" => "",
|
||||||
|
"startValue" => "",
|
||||||
|
"tradingUnit" => "",
|
||||||
|
"transactionType" => "",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
82
packages/sinopec/src/Action/sinopec/ZhyQuery.php
Normal file
82
packages/sinopec/src/Action/sinopec/ZhyQuery.php
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\Sinopec\Action\sinopec;
|
||||||
|
|
||||||
|
use XuanChen\Sinopec\Contracts\CheckCouponContracts;
|
||||||
|
|
||||||
|
class ZhyQuery implements CheckCouponContracts
|
||||||
|
{
|
||||||
|
|
||||||
|
public $data;
|
||||||
|
|
||||||
|
public function start()
|
||||||
|
{
|
||||||
|
|
||||||
|
try {
|
||||||
|
[
|
||||||
|
"cooperativeMerchant" => "",
|
||||||
|
"eletronAndRule" => [
|
||||||
|
[
|
||||||
|
"entryMethod" => "01",
|
||||||
|
"marketCode" => "20191213154203514",
|
||||||
|
"marketRuleNumber" => "001",
|
||||||
|
"perVoucherNumber" => "1",
|
||||||
|
"planVoucherNumber" => "10",
|
||||||
|
"queryCreateTime" => "2019-11-11 18=> 39=> 49",
|
||||||
|
"similarStack" => "Y",
|
||||||
|
"voucherEndTime" => "2019-12-15",
|
||||||
|
"voucher_ruleCode" => "$01-VC-1573468710381900",
|
||||||
|
"voucherRuleName" => "ceshi2",
|
||||||
|
"voucherSource" => "S01",
|
||||||
|
"voucherStartTime" => "2019-12-13",
|
||||||
|
"voucherStartTime_type" => "VOUCHER_START_TIME_TYPE_ABSOLUTE_EFFECTIVE_TIME",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
"limitFrequency" => "",
|
||||||
|
"mabIsRefund" => "",
|
||||||
|
"marketCode" => "20191213154203514",
|
||||||
|
"marketExEndTime" => "2019-12-15 00=> 00=> 00",
|
||||||
|
"marketExStartTime" => "2019-12-13 00=> 00=> 00",
|
||||||
|
"marketHierarchy" => "3311",
|
||||||
|
"marketName" => "行为推送活动-3",
|
||||||
|
"marketProvince" => "51",
|
||||||
|
"marketReleaseSys" => "VOUCHER_PUBLISH_TYPE_APPLET",
|
||||||
|
"marketStatus" => "MARKET_ACTIVITY_STATE_TAKE_EFFECT",
|
||||||
|
"promotionCalculation" => "PROMOTION_TYPE_MEMBER_BEHAVIOR",
|
||||||
|
"rule" => [
|
||||||
|
[
|
||||||
|
"cashValue" => "100",
|
||||||
|
"channel" => "C01,C02,C03,C05",
|
||||||
|
"fullType" => "",
|
||||||
|
"marketCode" => "20191213154203514",
|
||||||
|
"perVoucherNumber" => "1",
|
||||||
|
"planVoucherNumber" => "10",
|
||||||
|
"ruleCode" => "$01-VC-1573468710381900",
|
||||||
|
"ruleDetail" => "123123",
|
||||||
|
"ruleName" => "ceshi2",
|
||||||
|
"voucherType" => "C01",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
"tradLimit" => [
|
||||||
|
[
|
||||||
|
"endValue" => "",
|
||||||
|
"fixed" => "",
|
||||||
|
"marketCode" => "20191213154203514",
|
||||||
|
"marketRuleName" => "001",
|
||||||
|
"marketRuleNumber" => "001",
|
||||||
|
"memLevel" => "",
|
||||||
|
"operator" => "",
|
||||||
|
"startValue" => "",
|
||||||
|
"tradingUnit" => "",
|
||||||
|
"transactionType" => "",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
14
packages/sinopec/src/Contracts/CheckCouponContracts.php
Normal file
14
packages/sinopec/src/Contracts/CheckCouponContracts.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\Sinopec\Contracts;
|
||||||
|
|
||||||
|
interface CheckCouponContracts
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* start
|
||||||
|
* @return [type] [description]
|
||||||
|
*/
|
||||||
|
function start();
|
||||||
|
|
||||||
|
}
|
||||||
30
packages/sinopec/src/Contracts/CouponContracts.php
Normal file
30
packages/sinopec/src/Contracts/CouponContracts.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\Sinopec\Contracts;
|
||||||
|
|
||||||
|
interface CouponContracts
|
||||||
|
{
|
||||||
|
|
||||||
|
//发券接口
|
||||||
|
function grant();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 查询卡券详情
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/6/29 15:15
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
function detail();
|
||||||
|
|
||||||
|
//作废接口
|
||||||
|
function destroy();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 核销执行入口
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/6/29 14:49
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
function start();
|
||||||
|
|
||||||
|
}
|
||||||
31
packages/sinopec/src/ServiceProvider.php
Normal file
31
packages/sinopec/src/ServiceProvider.php
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\Sinopec;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
|
||||||
|
|
||||||
|
class ServiceProvider extends LaravelServiceProvider
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register services.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
if ($this->app->runningInConsole()) {
|
||||||
|
$this->publishes([__DIR__ . '/../config/sinopec.php' => config_path('sinopec.php')]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bootstrap services.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
$this->mergeConfigFrom(__DIR__ . '/../config/sinopec.php', 'sinopec');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
144
packages/sinopec/src/Sinopec.php
Normal file
144
packages/sinopec/src/Sinopec.php
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\Sinopec;
|
||||||
|
|
||||||
|
use App\Models\Activity;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 中石化接口
|
||||||
|
*/
|
||||||
|
class Sinopec
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 发券接口
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/6/28 15:07
|
||||||
|
* @param $activityId 活动编号
|
||||||
|
* @param $outletId 网点编号
|
||||||
|
* @param $mobile 手机号
|
||||||
|
*/
|
||||||
|
public static function Grant($activityId, $outletId, $mobile)
|
||||||
|
{
|
||||||
|
$model = config('xuanchen_coupon.rules.ysd.model');
|
||||||
|
|
||||||
|
return (new $model)->setActivityId($activityId)
|
||||||
|
->setOutletId($outletId)
|
||||||
|
->setMobile($mobile)
|
||||||
|
->grant();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 查询接口
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/7/21 11:58
|
||||||
|
* @param $redemptionCode
|
||||||
|
*/
|
||||||
|
public static function Query($redemptionCode, $outletId)
|
||||||
|
{
|
||||||
|
if (!$redemptionCode) {
|
||||||
|
return '查询失败,未获取到券码';
|
||||||
|
}
|
||||||
|
|
||||||
|
$model = self::getModelByCode($redemptionCode);
|
||||||
|
if (is_string($model)) {
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $model->setCode($redemptionCode)
|
||||||
|
->setOutletId($outletId)
|
||||||
|
->detail();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 卡券作废
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/9/2 16:54
|
||||||
|
* @param $redemptionCode
|
||||||
|
* @param $outletId
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function Destroy($redemptionCode, $outletId)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$model = self::getModelByCode($redemptionCode);
|
||||||
|
if (is_string($model)) {
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $model->setCode($redemptionCode)
|
||||||
|
->setOutletId($outletId)
|
||||||
|
->destroy();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 根据券码 获取class
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/7/21 12:00
|
||||||
|
* @param $code
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function getModelByCode($code)
|
||||||
|
{
|
||||||
|
$rules = config('xuanchen_coupon.rules');
|
||||||
|
if (!$rules) {
|
||||||
|
return '系统出错,未找到配置文件';
|
||||||
|
}
|
||||||
|
|
||||||
|
$model = '';
|
||||||
|
foreach ($rules as $rule) {
|
||||||
|
if (preg_match($rule['pattern'], $code, $matches)) {
|
||||||
|
$model = $rule['model'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$model) {
|
||||||
|
throw new \Exception('卡券核销失败。未查到卡券所属');
|
||||||
|
}
|
||||||
|
|
||||||
|
return new $model;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: description
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/8/21 13:33
|
||||||
|
* @param \App\Models\User $user 渠道
|
||||||
|
* @param string $redemptionCode 要核销的券码
|
||||||
|
* @param float $total 订单金额
|
||||||
|
* @param string $outletId 网点id
|
||||||
|
* @param string $orderid 订单id
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function Redemption(User $user, string $redemptionCode, float $total, string $outletId, string $orderid = '')
|
||||||
|
{
|
||||||
|
|
||||||
|
try {
|
||||||
|
$model = self::getModelByCode($redemptionCode);
|
||||||
|
if (is_string($model)) {
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $model->setUser($user)
|
||||||
|
->setCode($redemptionCode)
|
||||||
|
->setTotal($total)
|
||||||
|
->setOutletId($outletId)
|
||||||
|
->setOrderId($orderid)
|
||||||
|
->start();
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
47
packages/sinopec/src/Traits/Log.php
Normal file
47
packages/sinopec/src/Traits/Log.php
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\Sinopec\Traits;
|
||||||
|
|
||||||
|
use App\Models\Log as LogModel;
|
||||||
|
|
||||||
|
trait Log
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 插入日志
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/6/30 10:29
|
||||||
|
* @param $url
|
||||||
|
* @param $method
|
||||||
|
* @param $params
|
||||||
|
* @param string $type
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function createLog($url, $method, $params, $type = 'pingan')
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'path' => $url,
|
||||||
|
'method' => $method,
|
||||||
|
'type' => $type,
|
||||||
|
'in_source' => $params,
|
||||||
|
];
|
||||||
|
|
||||||
|
$info = LogModel::create($data);
|
||||||
|
|
||||||
|
return $info;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 更新日志
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/6/30 10:29
|
||||||
|
* @param $log
|
||||||
|
* @param $params
|
||||||
|
*/
|
||||||
|
public static function updateLog($log, $params)
|
||||||
|
{
|
||||||
|
$log->out_source = $params;
|
||||||
|
$log->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
79
packages/sinopec/src/Traits/SetParams.php
Normal file
79
packages/sinopec/src/Traits/SetParams.php
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\Sinopec\Traits;
|
||||||
|
|
||||||
|
trait SetParams
|
||||||
|
{
|
||||||
|
|
||||||
|
//渠道
|
||||||
|
public $user;
|
||||||
|
|
||||||
|
//卡券编号
|
||||||
|
public $redemptionCode;
|
||||||
|
|
||||||
|
//订单金额
|
||||||
|
public $total;
|
||||||
|
|
||||||
|
//网点编号
|
||||||
|
public $outletId;
|
||||||
|
|
||||||
|
//活动id
|
||||||
|
public $activityId;
|
||||||
|
|
||||||
|
//手机号
|
||||||
|
public $mobile;
|
||||||
|
|
||||||
|
//设置渠道
|
||||||
|
public function setUser($user)
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置核销码
|
||||||
|
public function setCode($redemptionCode)
|
||||||
|
{
|
||||||
|
$this->redemptionCode = $redemptionCode;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置订单总额
|
||||||
|
public function setTotal($total)
|
||||||
|
{
|
||||||
|
$this->total = $total;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置网点id
|
||||||
|
public function setOutletId($outletId)
|
||||||
|
{
|
||||||
|
$this->outletId = $outletId;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置活动id
|
||||||
|
public function setActivityId($activityId)
|
||||||
|
{
|
||||||
|
$this->activityId = $activityId;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置手机号
|
||||||
|
public function setMobile($mobile)
|
||||||
|
{
|
||||||
|
$this->mobile = $mobile;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
11
packages/unionpay/README.md
Normal file
11
packages/unionpay/README.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Unionpay 对接银联接口
|
||||||
|
|
||||||
|
002025 聚合营销优惠查询接口
|
||||||
|
|
||||||
|
002100 销账交易接口
|
||||||
|
|
||||||
|
002101 销账冲正通知接口
|
||||||
|
|
||||||
|
002102 销账撤销通知接口
|
||||||
|
|
||||||
|
接口地址:http://pac.ysd-bs.com/api/V1/unionpay/query
|
||||||
27
packages/unionpay/composer.json
Normal file
27
packages/unionpay/composer.json
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"name": "xuanchen/unionpay",
|
||||||
|
"description": "银联对接",
|
||||||
|
"license": "MIT",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "玄尘",
|
||||||
|
"email": "122383162@qq.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.1.3",
|
||||||
|
"laravel/framework": "*"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"XuanChen\\UnionPay": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"XuanChen\\UnionPay\\ServiceProvider"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
339
packages/unionpay/config/unionpay.php
Normal file
339
packages/unionpay/config/unionpay.php
Normal file
@@ -0,0 +1,339 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
//分配的渠道号
|
||||||
|
'msg_sender' => '660134',
|
||||||
|
//打印在小票上,由活动标题、优惠金额、原始金额组合而成
|
||||||
|
'pos_receipt' => '本时生活,优惠生活',
|
||||||
|
//广告,用于打印在小票上
|
||||||
|
'pos_ad' => '',
|
||||||
|
//营销联盟广告,用于打印在小票上
|
||||||
|
'pos_mkt_ad' => '本时生活,优惠生活',
|
||||||
|
//银联渠道id
|
||||||
|
'agent_id' => '299',
|
||||||
|
//银联网点id
|
||||||
|
'outlet_id' => '2009300919918',
|
||||||
|
//用于银商与sp分润的金额(是佣金的一部分), 以分为单位
|
||||||
|
'serv_chg' => 0,
|
||||||
|
//佣金
|
||||||
|
'commission' => 0,
|
||||||
|
//证书
|
||||||
|
'check' => [
|
||||||
|
'self' => [
|
||||||
|
'private' => storage_path('cert/unionpay/self/private_rsa.pem'),
|
||||||
|
'public' => storage_path('cert/unionpay/self/public_rsa.pem'),
|
||||||
|
],
|
||||||
|
'unionpay' => [
|
||||||
|
'public' => storage_path('cert/unionpay/public_rsa.pem'),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'type' => [
|
||||||
|
'002025' => '查询',
|
||||||
|
'002100' => '交易',
|
||||||
|
'002101' => '冲正',
|
||||||
|
'002102' => '撤销',
|
||||||
|
],
|
||||||
|
'log_type' => [
|
||||||
|
'002025' => 'query',
|
||||||
|
'002100' => 'freezecoupon',
|
||||||
|
'002101' => 'reversal',
|
||||||
|
'002102' => 'annul',
|
||||||
|
],
|
||||||
|
//需要校验的数据
|
||||||
|
'validator' => [
|
||||||
|
'002025' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_ver",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"req_serial_no",
|
||||||
|
"mkt_code",
|
||||||
|
"amount",
|
||||||
|
"avl_amt",
|
||||||
|
],
|
||||||
|
'002100' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"msg_ver",
|
||||||
|
"req_serial_no",
|
||||||
|
"orig_req_serial_no",
|
||||||
|
"sett_date",
|
||||||
|
"txn_date",
|
||||||
|
"txn_time",
|
||||||
|
"orig_amt",
|
||||||
|
"discount_amt",
|
||||||
|
],
|
||||||
|
'002101' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"msg_ver",
|
||||||
|
"req_serial_no",
|
||||||
|
"orig_req_serial_no",
|
||||||
|
],
|
||||||
|
'002102' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"msg_ver",
|
||||||
|
"req_serial_no",
|
||||||
|
"orig_req_serial_no",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
//入库基础数据
|
||||||
|
'regular' => [
|
||||||
|
'002025' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_ver",
|
||||||
|
"msg_sys_sn",//自己添加的基础数据
|
||||||
|
"req_serial_no",//自己添加的基础数据
|
||||||
|
"mkt_code",//自己添加的基础数据
|
||||||
|
],
|
||||||
|
'002100' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"msg_ver",
|
||||||
|
"req_serial_no",//自己添加的基础数据
|
||||||
|
"orig_req_serial_no",//自己添加的基础数据
|
||||||
|
"sett_date",//自己添加的基础数据
|
||||||
|
],
|
||||||
|
'002101' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"msg_ver",
|
||||||
|
"req_serial_no",//自己添加的基础数据
|
||||||
|
"orig_req_serial_no",//自己添加的基础数据
|
||||||
|
],
|
||||||
|
'002102' => [
|
||||||
|
"msg_type",
|
||||||
|
"msg_txn_code",
|
||||||
|
"msg_crrltn_id",
|
||||||
|
"msg_flg",
|
||||||
|
"msg_sender",
|
||||||
|
"msg_time",
|
||||||
|
"msg_sys_sn",
|
||||||
|
"msg_ver",
|
||||||
|
"req_serial_no",//自己添加的基础数据
|
||||||
|
"orig_req_serial_no",//自己添加的基础数据
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'fields' => [
|
||||||
|
//聚合营销优惠查询接口
|
||||||
|
'002025' => [
|
||||||
|
'in' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "报文流水号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"req_serial_no" => "查询流水号",
|
||||||
|
"shop_no" => "门店号",
|
||||||
|
"term_no" => "受理终端号",
|
||||||
|
"service_code" => "受理方式",
|
||||||
|
"voucher_no" => "受理凭证号",
|
||||||
|
"mkt_code" => "聚合营销码",
|
||||||
|
"mkt_mode" => "聚合营销类型",
|
||||||
|
"embedded_mchnt_no" => "发起渠道商户号",
|
||||||
|
"currency_code" => "货币代码",
|
||||||
|
"amount" => "消费金额",
|
||||||
|
"avl_amt" => "可优惠金额",
|
||||||
|
"term_sp_chnl_no" => "终端指定SP渠道号",
|
||||||
|
"func_code" => "功能码",
|
||||||
|
"times" => "次数",
|
||||||
|
"pay_mode" => "支付方式",
|
||||||
|
//用户附加信息
|
||||||
|
"user_ext_info" => [
|
||||||
|
"mobile_no" => "手机号",
|
||||||
|
"user_code" => "用户号",
|
||||||
|
"user_code_type" => "用户号类型",
|
||||||
|
"dev_id" => "设备id",
|
||||||
|
],
|
||||||
|
"sign" => "签名域",
|
||||||
|
],
|
||||||
|
'out' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "报文流水号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_rsp_code" => "响应码",
|
||||||
|
"msg_rsp_desc" => "响应码描述",
|
||||||
|
"discount" => "折扣金额",
|
||||||
|
"actual_amt" => "折后应收金额",
|
||||||
|
"pos_display" => "POS显示",
|
||||||
|
"pos_receipt" => "POS小票",
|
||||||
|
"pos_ad" => "POS广告",
|
||||||
|
"pos_mkt_ad" => "Pos_营销联盟广告",
|
||||||
|
"sign" => "签名域",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
//销账交易接口
|
||||||
|
'002100' => [
|
||||||
|
'in' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "消息关联号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"shop_no" => "门店号",
|
||||||
|
"term_no" => "终端号",
|
||||||
|
"req_serial_no" => "销券流水号",
|
||||||
|
"orig_req_serial_no" => "原查询流水号",
|
||||||
|
"enc_card_no" => "加密卡号",
|
||||||
|
"part_card_no" => "部分卡号",
|
||||||
|
"acq_term_sn" => "受理终端流水号",
|
||||||
|
"refer_no" => "检索参考号",
|
||||||
|
"sett_date" => "清算日期",
|
||||||
|
"txn_date" => "交易日期",
|
||||||
|
"txn_time" => "交易时间",
|
||||||
|
"orig_amt" => "原始金额",
|
||||||
|
"discount_amt" => "优惠的金额",
|
||||||
|
"pay_amt" => "支付金额",
|
||||||
|
"pay_mode" => "支付方式",
|
||||||
|
"order_no" => "订单号",
|
||||||
|
"trans_crrltn_no" => "交易关联流水号",
|
||||||
|
"equity_no" => "权益号",
|
||||||
|
"card_no" => "全卡号",
|
||||||
|
"sign" => "签名数据",
|
||||||
|
],
|
||||||
|
'out' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "消息关联号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"msg_rsp_code" => "响应码",
|
||||||
|
"msg_rsp_desc" => "响应码描述",
|
||||||
|
"orig_amt" => "原始金额",
|
||||||
|
"discount_amt" => "折扣金额",
|
||||||
|
"pay_amt" => "支付金额",
|
||||||
|
"serv_chg" => "服务费",
|
||||||
|
"commission" => "佣金",
|
||||||
|
"ad" => "广告",
|
||||||
|
"pos_receipt" => "POS优惠",
|
||||||
|
"coupon_no" => "凭证号",
|
||||||
|
"coupon_type" => "凭证类型",
|
||||||
|
"sp_biz_code" => "SP统计码",
|
||||||
|
"charge_code" => "计费码",
|
||||||
|
"pos_event_title" => "SP活动主题",
|
||||||
|
"sp_contact" => "SP联系电话",
|
||||||
|
"sp_name" => "SP名称",
|
||||||
|
"event_no" => "活动号",
|
||||||
|
"td_code" => "二维码",
|
||||||
|
"memo" => "附言",
|
||||||
|
"mkt_sp_chnl_no" => "营销渠道号",
|
||||||
|
"point_amt" => "积分抵扣金额",
|
||||||
|
"sign" => "签名数据",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
//销账冲正通知接口
|
||||||
|
'002101' => [
|
||||||
|
'in' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "消息关联号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"shop_no" => "门店号",
|
||||||
|
"term_no" => "终端号",
|
||||||
|
"req_serial_no" => "冲正流水号",
|
||||||
|
"orig_req_serial_no" => "原始销账流水号",
|
||||||
|
"trans_crrltn_no" => "交易关联流水号",
|
||||||
|
"sign" => "签名数据",
|
||||||
|
],
|
||||||
|
'out' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "消息关联号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"msg_rsp_code" => "响应码",
|
||||||
|
"msg_rsp_desc" => "响应码描述",
|
||||||
|
"sign" => "签名数据",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'002102' => [
|
||||||
|
'in' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "消息关联号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"shop_no" => "门店号",
|
||||||
|
"term_no" => "终端号",
|
||||||
|
"req_serial_no" => "撤销流水号",
|
||||||
|
"orig_req_serial_no" => "原始销账流水号",
|
||||||
|
"trans_crrltn_no" => "交易关联流水号",
|
||||||
|
"sign" => "签名数据",
|
||||||
|
],
|
||||||
|
'out' => [
|
||||||
|
"msg_type" => "报文类型",
|
||||||
|
"msg_txn_code" => "交易代码",
|
||||||
|
"msg_crrltn_id" => "消息关联号",
|
||||||
|
"msg_flg" => "报文请求应答标志",
|
||||||
|
"msg_sender" => "报文发送方",
|
||||||
|
"msg_time" => "报文日期",
|
||||||
|
"msg_sys_sn" => "平台流水号",
|
||||||
|
"msg_ver" => "报文版本号",
|
||||||
|
"msg_rsp_code" => "响应码",
|
||||||
|
"msg_rsp_desc" => "响应码描述",
|
||||||
|
"ad" => "广告",
|
||||||
|
"td_code" => "二维码",
|
||||||
|
"sign" => "签名数据",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
];
|
||||||
243
packages/unionpay/src/Action/Init.php
Normal file
243
packages/unionpay/src/Action/Init.php
Normal file
@@ -0,0 +1,243 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\UnionPay\Action;
|
||||||
|
|
||||||
|
use App\Exceptions\ApiException;
|
||||||
|
use App\Exceptions\ApiUnionpayException;
|
||||||
|
use App\Models\Log as LogModel;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class Init
|
||||||
|
{
|
||||||
|
|
||||||
|
//传入的参数
|
||||||
|
public $params;
|
||||||
|
|
||||||
|
//传入的签名
|
||||||
|
public $sign;
|
||||||
|
|
||||||
|
public $msg_type = '00';
|
||||||
|
|
||||||
|
public $msg_txn_code;
|
||||||
|
|
||||||
|
public $msg_sender;
|
||||||
|
|
||||||
|
public $msg_rsp_code = '0000';
|
||||||
|
|
||||||
|
public $msg_rsp_desc = '成功';
|
||||||
|
|
||||||
|
//入库的模型
|
||||||
|
public $model;
|
||||||
|
|
||||||
|
//返回的数据
|
||||||
|
public $outdata;
|
||||||
|
|
||||||
|
//网点id
|
||||||
|
public $outlet_id;
|
||||||
|
|
||||||
|
//渠道id
|
||||||
|
public $agent_id;
|
||||||
|
|
||||||
|
//日志
|
||||||
|
public $log;
|
||||||
|
|
||||||
|
//幂等数据
|
||||||
|
public $info;
|
||||||
|
|
||||||
|
//内存
|
||||||
|
public $mem;
|
||||||
|
|
||||||
|
//开始内存
|
||||||
|
public $startMemory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 验签
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/9/30 8:39
|
||||||
|
* @param false $self 是否是自己的证书
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function checkSign($out = true, $self = false)
|
||||||
|
{
|
||||||
|
$sign = $this->hexXbin($this->sign);
|
||||||
|
if (!$sign) {
|
||||||
|
throw new \Exception('签名错误');
|
||||||
|
}
|
||||||
|
$public_key = $this->getPublic($self);
|
||||||
|
|
||||||
|
$pub_key_id = openssl_get_publickey($public_key);
|
||||||
|
|
||||||
|
$signStr = $this->getSignString($out);
|
||||||
|
|
||||||
|
if ($pub_key_id) {
|
||||||
|
$result = (bool)openssl_verify($signStr, $sign, $pub_key_id);
|
||||||
|
openssl_free_key($pub_key_id);
|
||||||
|
} else {
|
||||||
|
throw new \Exception('私钥格式有误');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 校验sign
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/10/13 15:21
|
||||||
|
* @param $data
|
||||||
|
* @param false $types
|
||||||
|
* @return int|string
|
||||||
|
*/
|
||||||
|
public function hexXbin($sign, $types = false)
|
||||||
|
{
|
||||||
|
// 过滤非16进制字符
|
||||||
|
$checkStr = strspn($sign, '0123456789abcdefABCDEF');
|
||||||
|
//字符串长度不是偶数时pack来处理
|
||||||
|
if (strlen($checkStr) % 2) {
|
||||||
|
return pack("H*", $sign);
|
||||||
|
} else {
|
||||||
|
return hex2bin($sign);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 签名
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/10/9 15:52
|
||||||
|
* @param bool $self
|
||||||
|
* @return string
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public function getSign($out = true)
|
||||||
|
{
|
||||||
|
$signStr = $this->getSignString($out);
|
||||||
|
$private_key = $this->getPrivate();
|
||||||
|
|
||||||
|
$privKeyId = openssl_pkey_get_private($private_key);
|
||||||
|
if (!$privKeyId) {
|
||||||
|
throw new \Exception('私钥格式有误');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (openssl_sign($signStr, $signature, $privKeyId)) {
|
||||||
|
$signature = bin2hex($signature);
|
||||||
|
} else {
|
||||||
|
throw new \Exception('签名错误');
|
||||||
|
}
|
||||||
|
|
||||||
|
openssl_free_key($privKeyId);
|
||||||
|
|
||||||
|
return $signature;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 获取待签名字符串
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/9/30 9:38
|
||||||
|
* @param $out 是否是获取返回值的数据
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getSignString($out = false)
|
||||||
|
{
|
||||||
|
if ($out) {
|
||||||
|
$params = array_filter($this->outdata);
|
||||||
|
} else {
|
||||||
|
$params = array_filter($this->params);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($params)) {
|
||||||
|
throw new \Exception('缺少数据');
|
||||||
|
}
|
||||||
|
|
||||||
|
ksort($params);
|
||||||
|
|
||||||
|
//http_build_query 会自动urlencode 需要转换
|
||||||
|
return $this->str2utf8(urldecode(http_build_query($params)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取私钥
|
||||||
|
public function getPrivate()
|
||||||
|
{
|
||||||
|
$private = config('unionpay.check.self.private');
|
||||||
|
|
||||||
|
if (!file_exists($private)) {
|
||||||
|
throw new \Exception('缺少私钥文件');
|
||||||
|
}
|
||||||
|
|
||||||
|
return file_get_contents($private);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取公钥
|
||||||
|
public function getPublic($self = false)
|
||||||
|
{
|
||||||
|
$public = config('unionpay.check.unionpay.public');
|
||||||
|
|
||||||
|
if ($self) {
|
||||||
|
$public = config('unionpay.check.self.public');
|
||||||
|
}
|
||||||
|
|
||||||
|
return file_get_contents($public);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 插入日志
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/10/9 14:38
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function addLog()
|
||||||
|
{
|
||||||
|
$log_type = config('unionpay.log_type');
|
||||||
|
$data = [
|
||||||
|
'path' => request()->url(),
|
||||||
|
'method' => request()->method(),
|
||||||
|
'type' => $log_type[$this->msg_txn_code] ?? $this->msg_txn_code,
|
||||||
|
'in_source' => $this->params,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $this->log = LogModel::create($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 更新日志
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/10/9 14:46
|
||||||
|
*/
|
||||||
|
public function updateLog()
|
||||||
|
{
|
||||||
|
$this->log->out_source = $this->outdata;
|
||||||
|
$this->log->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将字符串编码转为 utf8
|
||||||
|
* @param $str
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function str2utf8($str)
|
||||||
|
{
|
||||||
|
$encode = mb_detect_encoding($str, ['ASCII', 'UTF-8', 'GB2312', 'GBK', 'BIG5']);
|
||||||
|
if ($encode != 'UTF-8') {
|
||||||
|
$str = $str ? $str : mb_convert_encoding($str, 'UTF-8', $encode);
|
||||||
|
}
|
||||||
|
$str = is_string($str) ? $str : '';
|
||||||
|
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
|
//输出数据
|
||||||
|
public function respond()
|
||||||
|
{
|
||||||
|
$rt = microtime(true) - LARAVEL_START;
|
||||||
|
|
||||||
|
$header = [
|
||||||
|
'rt' => round($rt * 1000, 2) . 'ms',
|
||||||
|
'qps' => round(1 / $rt, 1), 'company' => 'YSD',
|
||||||
|
'startMemory' => $this->startMemory,
|
||||||
|
'endMemory' => round(memory_get_usage() / 1024 / 1024, 2),
|
||||||
|
];
|
||||||
|
|
||||||
|
return \Response::json($this->outdata, 200, $header);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
54
packages/unionpay/src/Action/Query.php
Normal file
54
packages/unionpay/src/Action/Query.php
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\UnionPay\Action;
|
||||||
|
|
||||||
|
use XuanChen\Coupon\Coupon;
|
||||||
|
use XuanChen\UnionPay\Contracts\Contracts;
|
||||||
|
use XuanChen\UnionPay\UnionPay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class 查询
|
||||||
|
* @Author : 玄尘
|
||||||
|
* @Date : 2020/10/28 16:17
|
||||||
|
* @package XuanChen\UnionPay\Action
|
||||||
|
*/
|
||||||
|
class Query implements Contracts
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parent unionpay.
|
||||||
|
* @var UnionPay
|
||||||
|
*/
|
||||||
|
protected $unionpay;
|
||||||
|
|
||||||
|
public function __construct(UnionPay &$unionpay)
|
||||||
|
{
|
||||||
|
$this->unionpay = $unionpay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function start()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$res = Coupon::Query($this->unionpay->params['mkt_code'], $this->unionpay->outlet_id);
|
||||||
|
|
||||||
|
if (is_array($res)) {
|
||||||
|
$this->unionpay->outdata['pos_display'] = $res['name'];
|
||||||
|
$this->unionpay->outdata['discount'] = $res['price'] * 100;
|
||||||
|
$this->unionpay->outdata['actual_amt'] = (int)bcsub($this->unionpay->params['amount'], $res['price'] * 100);
|
||||||
|
} else {
|
||||||
|
$this->unionpay->outdata['msg_rsp_code'] = '9999';
|
||||||
|
$this->unionpay->outdata['msg_rsp_desc'] = $res;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->unionpay->outdata['msg_rsp_code'] = '9999';
|
||||||
|
$this->unionpay->outdata['msg_rsp_desc'] = $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function back()
|
||||||
|
{
|
||||||
|
return $this->unionpay->outdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
65
packages/unionpay/src/Action/Redemption.php
Normal file
65
packages/unionpay/src/Action/Redemption.php
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\UnionPay\Action;
|
||||||
|
|
||||||
|
use App\Models\ActivityCoupon;
|
||||||
|
use App\Models\UnionpayLog;
|
||||||
|
use App\Models\User;
|
||||||
|
use XuanChen\Coupon\Coupon;
|
||||||
|
use XuanChen\UnionPay\Contracts\Contracts;
|
||||||
|
use XuanChen\UnionPay\UnionPay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Redemption 核销
|
||||||
|
* @Author : 玄尘
|
||||||
|
* @Date : 2020/10/28 16:17
|
||||||
|
* @package XuanChen\UnionPay\Action
|
||||||
|
*/
|
||||||
|
class Redemption implements Contracts
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parent unionpay.
|
||||||
|
* @var UnionPay
|
||||||
|
*/
|
||||||
|
protected $unionpay;
|
||||||
|
|
||||||
|
public function __construct(UnionPay &$unionpay)
|
||||||
|
{
|
||||||
|
$this->unionpay = $unionpay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function start()
|
||||||
|
{
|
||||||
|
//查询聚合信息
|
||||||
|
$query = UnionpayLog::where('req_serial_no', $this->unionpay->params['orig_req_serial_no'])
|
||||||
|
->where('msg_txn_code', '002025')
|
||||||
|
->latest()
|
||||||
|
->first();
|
||||||
|
if (!$query) {
|
||||||
|
$this->unionpay->outdata['msg_rsp_code'] = '9999';
|
||||||
|
$this->unionpay->outdata['msg_rsp_desc'] = '销账失败,未查询到前置数据。';
|
||||||
|
} else {
|
||||||
|
$this->unionpay->outdata['orig_amt'] = (int)$query->in_source['amount']; //订单金额 原始金额
|
||||||
|
$this->unionpay->outdata['discount_amt'] = $query->out_source['discount']; //折扣金额
|
||||||
|
$this->unionpay->outdata['pay_amt'] = $query->out_source['actual_amt']; //折扣后金额
|
||||||
|
|
||||||
|
//获取银联渠道
|
||||||
|
$user = User::find($this->unionpay->agent_id);
|
||||||
|
|
||||||
|
$coupon = Coupon::Redemption($user, $query->mkt_code, $this->unionpay->params['orig_amt'] / 100, $this->unionpay->outlet_id, '');
|
||||||
|
if (!is_array($coupon)) {
|
||||||
|
$this->unionpay->outdata['msg_rsp_code'] = '9999';
|
||||||
|
$this->unionpay->outdata['msg_rsp_desc'] = $coupon;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function back()
|
||||||
|
{
|
||||||
|
return $this->unionpay->outdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
80
packages/unionpay/src/Action/Reversal.php
Normal file
80
packages/unionpay/src/Action/Reversal.php
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\UnionPay\Action;
|
||||||
|
|
||||||
|
use App\Models\UnionpayLog;
|
||||||
|
use XuanChen\Coupon\Coupon;
|
||||||
|
use App\Models\Coupon as CouponModel;
|
||||||
|
use XuanChen\UnionPay\Contracts\Contracts;
|
||||||
|
use XuanChen\UnionPay\UnionPay;
|
||||||
|
|
||||||
|
class Reversal implements Contracts
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parent unionpay.
|
||||||
|
* @var UnionPay
|
||||||
|
*/
|
||||||
|
protected $unionpay;
|
||||||
|
|
||||||
|
public function __construct(UnionPay &$unionpay)
|
||||||
|
{
|
||||||
|
$this->unionpay = $unionpay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function start()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
//查询聚合信息
|
||||||
|
$info = UnionpayLog::where('req_serial_no', $this->unionpay->params['orig_req_serial_no'])
|
||||||
|
->where('msg_txn_code', '002100')
|
||||||
|
->where('status', 1)
|
||||||
|
->latest()
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($info) {
|
||||||
|
$query = UnionpayLog::where('req_serial_no', $info->orig_req_serial_no)
|
||||||
|
->where('msg_txn_code', '002025')
|
||||||
|
->where('status', 1)
|
||||||
|
->latest()
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$coupon = CouponModel::where('redemptionCode', $query->mkt_code)
|
||||||
|
->where('status', 2)
|
||||||
|
->latest()
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($query && $coupon) {
|
||||||
|
//优惠券核销成功
|
||||||
|
if ($coupon->status == 2) {
|
||||||
|
$res = Coupon::Reversal($coupon->redemptionCode, $this->unionpay->outlet_id);
|
||||||
|
if ($res !== true) {
|
||||||
|
$this->unionpay->outdata['msg_rsp_code'] = '9999';
|
||||||
|
$this->unionpay->outdata['msg_rsp_desc'] = $res;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->unionpay->outdata['msg_rsp_code'] = '9999';
|
||||||
|
$this->unionpay->outdata['msg_rsp_desc'] = '优惠券状态不对';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->unionpay->outdata['msg_rsp_code'] = '9999';
|
||||||
|
$this->unionpay->outdata['msg_rsp_desc'] = '未查询到卡券信息。';
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$this->unionpay->outdata['msg_rsp_code'] = '9999';
|
||||||
|
$this->unionpay->outdata['msg_rsp_desc'] = '未查询到销账接口数据。';
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->unionpay->outdata['msg_rsp_code'] = '9999';
|
||||||
|
$this->unionpay->outdata['msg_rsp_desc'] = $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function back()
|
||||||
|
{
|
||||||
|
return $this->unionpay->outdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
16
packages/unionpay/src/Contracts/Contracts.php
Normal file
16
packages/unionpay/src/Contracts/Contracts.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\UnionPay\Contracts;
|
||||||
|
|
||||||
|
interface Contracts
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* start
|
||||||
|
* @return [type] [description]
|
||||||
|
*/
|
||||||
|
function start();
|
||||||
|
|
||||||
|
function back();
|
||||||
|
|
||||||
|
}
|
||||||
31
packages/unionpay/src/ServiceProvider.php
Normal file
31
packages/unionpay/src/ServiceProvider.php
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\UnionPay;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
|
||||||
|
|
||||||
|
class ServiceProvider extends LaravelServiceProvider
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register services.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
if ($this->app->runningInConsole()) {
|
||||||
|
$this->publishes([__DIR__ . '/../config/unionpay.php' => config_path('unionpay.php')]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bootstrap services.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
$this->mergeConfigFrom(__DIR__ . '/../config/unionpay.php', 'unionpay');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
256
packages/unionpay/src/UnionPay.php
Normal file
256
packages/unionpay/src/UnionPay.php
Normal file
@@ -0,0 +1,256 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\UnionPay;
|
||||||
|
|
||||||
|
use App\Models\UnionpayLog;
|
||||||
|
use App\Models\User;
|
||||||
|
use XuanChen\UnionPay\Action\Init;
|
||||||
|
use XuanChen\Coupon\Coupon;
|
||||||
|
use XuanChen\UnionPay\Action\Query;
|
||||||
|
use XuanChen\UnionPay\Action\Redemption;
|
||||||
|
use XuanChen\UnionPay\Action\Reversal;
|
||||||
|
use XuanChen\UnionPay\Action\Skyxu;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 银联入口
|
||||||
|
*/
|
||||||
|
class UnionPay extends Init
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UnionPay constructor.
|
||||||
|
* @param $params
|
||||||
|
* @param string $sign
|
||||||
|
*/
|
||||||
|
public function __construct($params, $sign = '')
|
||||||
|
{
|
||||||
|
$this->params = $params;
|
||||||
|
$this->sign = $sign;
|
||||||
|
$this->msg_txn_code = $params['msg_txn_code'] ?? '';
|
||||||
|
$this->msg_sender = config('unionpay.msg_sender');
|
||||||
|
$this->agent_id = config('unionpay.agent_id');
|
||||||
|
$this->outlet_id = config('unionpay.outlet_id');
|
||||||
|
$this->startMemory = round(memory_get_usage() / 1024 / 1024, 2);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 入口
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/10/9 9:33
|
||||||
|
*/
|
||||||
|
public function start()
|
||||||
|
{
|
||||||
|
//设置基础数据
|
||||||
|
$this->getOutBaseData();
|
||||||
|
|
||||||
|
try {
|
||||||
|
//校验数据
|
||||||
|
$this->checkInData();
|
||||||
|
//查询是否是幂等 就是重复查询
|
||||||
|
$this->idempotent();
|
||||||
|
//入库请求参数
|
||||||
|
$this->InputData();
|
||||||
|
//返回值
|
||||||
|
$this->out_data();
|
||||||
|
//更新数据
|
||||||
|
$this->updateOutData();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
|
$this->outdata['msg_rsp_code'] = '9999';
|
||||||
|
$this->outdata['msg_rsp_desc'] = $e->getMessage();
|
||||||
|
if (empty($this->model->out_source)) {
|
||||||
|
$this->updateOutData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//处理流程
|
||||||
|
public function out_data()
|
||||||
|
{
|
||||||
|
//是幂等
|
||||||
|
if ($this->info && !empty($this->info->out_source)) {
|
||||||
|
$this->outdata = $this->info->out_source;
|
||||||
|
} else {
|
||||||
|
if ($this->msg_rsp_code == '0000') {
|
||||||
|
switch ($this->msg_txn_code) {
|
||||||
|
case '002025'://聚合营销优惠查询接口
|
||||||
|
$action = new Query($this);
|
||||||
|
$action->start();
|
||||||
|
break;
|
||||||
|
case '002100'://销账交易接口
|
||||||
|
$action = new Redemption($this);
|
||||||
|
$action->start();
|
||||||
|
$this->outdata = $action->back();
|
||||||
|
break;
|
||||||
|
case '002101'://冲正
|
||||||
|
case '002102'://撤销
|
||||||
|
$action = new Reversal($this);
|
||||||
|
$action->start();
|
||||||
|
$this->outdata = $action->back();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$this->outdata['msg_rsp_code'] = $this->msg_rsp_code;
|
||||||
|
$this->outdata['msg_rsp_desc'] = $this->msg_rsp_desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 入库数据
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/9/30 8:46
|
||||||
|
*/
|
||||||
|
private function InputData()
|
||||||
|
{
|
||||||
|
//获取基础数据
|
||||||
|
$base = config('unionpay.regular')[$this->msg_txn_code];
|
||||||
|
$data = [];
|
||||||
|
//循环获取入库数据
|
||||||
|
foreach ($this->params as $key => $param) {
|
||||||
|
if (in_array($key, $base)) {
|
||||||
|
$data[$key] = $param;
|
||||||
|
} else {
|
||||||
|
$data['in_source'][$key] = $param;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->model = UnionpayLog::create($data);
|
||||||
|
|
||||||
|
if (empty($this->model)) {
|
||||||
|
throw new \Exception('数据入库失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 校验输入的数据
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/9/30 14:46
|
||||||
|
*/
|
||||||
|
public function checkInData()
|
||||||
|
{
|
||||||
|
//验签
|
||||||
|
// $res = $this->checkSign(false, false);
|
||||||
|
//
|
||||||
|
// if ($res !== true) {
|
||||||
|
// $this->msg_rsp_code = 9996;
|
||||||
|
// $this->msg_rsp_desc = '验签失败';
|
||||||
|
// }
|
||||||
|
|
||||||
|
if ($this->msg_txn_code && $this->msg_rsp_code == '0000') {
|
||||||
|
$rule_code = config('unionpay.validator')[$this->msg_txn_code];
|
||||||
|
$rule_msg = config('unionpay.fields')[$this->msg_txn_code]['in'];
|
||||||
|
|
||||||
|
foreach ($rule_code as $item) {
|
||||||
|
$rule[$item] = 'required';
|
||||||
|
$msg[$item . '.required'] = $rule_msg[$item] . '不能为空';
|
||||||
|
}
|
||||||
|
$validator = \Validator::make($this->params, $rule, $msg);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
$this->msg_rsp_code = 9996;
|
||||||
|
$this->msg_rsp_desc = $validator->errors()->first();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$this->msg_rsp_code = 9996;
|
||||||
|
$this->msg_rsp_desc = $this->msg_rsp_code == '0000' ? '平台流水号不能为空。' : $this->msg_rsp_desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 返回的基础数据
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/9/30 14:48
|
||||||
|
*/
|
||||||
|
public function getOutBaseData()
|
||||||
|
{
|
||||||
|
$basics = [
|
||||||
|
"msg_type" => $this->msg_type,
|
||||||
|
"msg_txn_code" => $this->msg_txn_code,
|
||||||
|
"msg_crrltn_id" => $this->params['msg_crrltn_id'],
|
||||||
|
"msg_flg" => 1,
|
||||||
|
"msg_sender" => $this->msg_sender,
|
||||||
|
"msg_time" => now()->format('YmdHis'),
|
||||||
|
"msg_sys_sn" => $this->params['msg_sys_sn'] ?? '',
|
||||||
|
"msg_rsp_code" => $this->msg_rsp_code,
|
||||||
|
"msg_rsp_desc" => $this->msg_rsp_desc,
|
||||||
|
];
|
||||||
|
|
||||||
|
switch ($this->msg_txn_code) {
|
||||||
|
//查询
|
||||||
|
case '002025':
|
||||||
|
$basics = array_merge($basics, [
|
||||||
|
"discount" => 0,
|
||||||
|
"actual_amt" => 0,
|
||||||
|
"pos_display" => "",
|
||||||
|
// "pos_receipt" => config('unionpay.pos_receipt'),
|
||||||
|
// "pos_ad" => config('unionpay.pos_ad'),
|
||||||
|
"pos_mkt_ad" => config('unionpay.pos_receipt'),
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
//销账
|
||||||
|
case '002100':
|
||||||
|
$basics = array_merge($basics, [
|
||||||
|
'msg_ver' => 0.1,
|
||||||
|
'orig_amt' => $this->params['orig_amt'],
|
||||||
|
'discount_amt' => $this->params['discount_amt'],
|
||||||
|
'pay_amt' => $this->params['pay_amt'],
|
||||||
|
'serv_chg' => config('unionpay.serv_chg'),
|
||||||
|
'commission' => config('unionpay.commission'),
|
||||||
|
'event_no' => '',//活动号 直接为空就可以
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
//冲正
|
||||||
|
case '002101':
|
||||||
|
//撤销
|
||||||
|
case '002102':
|
||||||
|
$basics = array_merge($basics, [
|
||||||
|
'msg_ver' => 0.1,
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->outdata = $basics;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 查询是否是幂等
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/10/10 13:25
|
||||||
|
*/
|
||||||
|
public function idempotent()
|
||||||
|
{
|
||||||
|
$this->info = UnionpayLog::where('req_serial_no', $this->params['req_serial_no'])
|
||||||
|
->where('msg_txn_code', $this->msg_txn_code)
|
||||||
|
->where('status', 1)
|
||||||
|
->latest()
|
||||||
|
->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
//更新返回值
|
||||||
|
public function updateOutData()
|
||||||
|
{
|
||||||
|
$this->outdata['sign'] = $this->getSign();
|
||||||
|
//如果有入库模型
|
||||||
|
if ($this->model) {
|
||||||
|
$this->model->out_source = $this->outdata;
|
||||||
|
if ($this->outdata['msg_rsp_code'] != '0000') {
|
||||||
|
$this->model->status = 0;
|
||||||
|
}
|
||||||
|
$this->model->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
6
storage/cert/unionpay/public_rsa.pem
Normal file
6
storage/cert/unionpay/public_rsa.pem
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
-----BEGIN PUBLIC KEY-----
|
||||||
|
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDqWyL8fkpHtCS0hN60Y8kchp/B
|
||||||
|
S4r6aXyu9VE9fW/z/JKL50V+dP1bZ7Dl0eJqWN+mEYMQ9D5DVA89fpqYXI3jc8Dl
|
||||||
|
yeKsjXOWpLV+a+MnmhPxO3IMP3+i+orSzJHF6kWHxgivloJVl7bq8xah2u/5BjUP
|
||||||
|
nBju+BlZK478uwU2rwIDAQAB
|
||||||
|
-----END PUBLIC KEY-----
|
||||||
15
storage/cert/unionpay/self/old/private_rsa.pem
Normal file
15
storage/cert/unionpay/self/old/private_rsa.pem
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIICXAIBAAKBgQC/1n0w5iwWPB4XuS+QX820prkO7iEFmXDh4OPTCT43HKV63Tk0
|
||||||
|
j1oEY7rzJizvQcGQRrxHrv7syeEjrzh6b/5flqRk2XYDOO4CNO1LNuhUsVn17sMH
|
||||||
|
4GQzrnZQDAnU1Jxlk9ttamNpkGyind071+B2azT8TdLwjGXe2e4x7M0AOwIDAQAB
|
||||||
|
AoGAaDCMKeS5CRJ5nZTcemMuC/GJDMzUboAZyPQliFa6zZ/nWEWSbjN1RnEL9kdD
|
||||||
|
nGZwRHXGiIBIwD4c4w6ldAojcsJB76pfdeok6gDlswk3McF2uMPUvn6Yc37nnkbz
|
||||||
|
crXI6wDy0aPX/MfcHq2UoX5GdDYVEnOBnictxWPBMZ6S4fECQQDkH8vfaO4wGKQ2
|
||||||
|
K1uiUHEIRv0qOUvGY/BKJtBcyE4wpHpMtlY8o2vGssvpTueBWXWp8XRShOLoo+J+
|
||||||
|
PXrBLvTVAkEA10eUTLIvTag2nKS1B3dCJaszYWAL2otf5F4EwEKmfkFNhk7qkVm+
|
||||||
|
Ain9h/RsKqBb9n3MeeqSqUvbSq8FzCTozwJBAM/OdzVIrNF7YPtHe+3cQVs875nr
|
||||||
|
H6/Vkiq6OMyMW03MRuxinSQX6jHS5hXeHt2h1KG+piwViW5K/CPrdUtNrxECQA3s
|
||||||
|
rFP1poegXL/vC2KLPTUQiMdAniOppi8wQaBp7zj1Yl1Ql22FX3vmWWbE0YZETw53
|
||||||
|
fpVYLdpTdMC052wX6xMCQEZHbKjv9odbN6vZAcz15RC0j21brEQQ3goXSxLtjkmQ
|
||||||
|
LkcLdiDZgqGiVjNXTnh81fVkoIh9CfTSZH0a7Zc/RvM=
|
||||||
|
-----END RSA PRIVATE KEY-----
|
||||||
6
storage/cert/unionpay/self/old/public_rsa.pem
Normal file
6
storage/cert/unionpay/self/old/public_rsa.pem
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
-----BEGIN PUBLIC KEY-----
|
||||||
|
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC/1n0w5iwWPB4XuS+QX820prkO
|
||||||
|
7iEFmXDh4OPTCT43HKV63Tk0j1oEY7rzJizvQcGQRrxHrv7syeEjrzh6b/5flqRk
|
||||||
|
2XYDOO4CNO1LNuhUsVn17sMH4GQzrnZQDAnU1Jxlk9ttamNpkGyind071+B2azT8
|
||||||
|
TdLwjGXe2e4x7M0AOwIDAQAB
|
||||||
|
-----END PUBLIC KEY-----
|
||||||
15
storage/cert/unionpay/self/private_rsa.pem
Normal file
15
storage/cert/unionpay/self/private_rsa.pem
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIICXAIBAAKBgQCbCoYOxjVu15ONuotlIBxiyMQP+Ch8TavHHVTDrY54mRPLq0dR
|
||||||
|
Xrlpj+Ziu8PY8kHfPdNbRlftVQUgnhfOP/2j2QbnTDAF4tUZ0B9YjvCgLMpGMOAZ
|
||||||
|
tuw+u+VwVILegUUO3Yh/T6nZ4kcMw5vj/N4vGdHcABV+BK7639+Xep1OlQIDAQAB
|
||||||
|
AoGAR1Z5RpUHAwBoYV9DQn2a8g0kwaBSqJdogc7KMNtL4cu1oxIlV5h5Qcw3mpiA
|
||||||
|
zfLyQlEFTks4q/hhypdTptAk2SblXh0yc7TU1xD984j+ZfWB7r+Nu0OyaWIBPih5
|
||||||
|
Mn7DynQ5q7dnwff5nmYqi49xUPVTKAGJKiYTkKyA5UwauEECQQDK+fw5Ybf96LvH
|
||||||
|
WsvspUJ/YhQMhcZ6PLINLeHuEJwxoygnDNK2UbBPFFb5ZjIh5PHh8EtkPANZY0uH
|
||||||
|
voP4gC8lAkEAw4reMtlMiJQlRmsMguahWQXIo6PPwclSqXK/aYzqjkPrwWQZdXa/
|
||||||
|
LcCd77D0qLvkDEUM2Kh9NsNayd3F+37+sQJAb0Lgs0ORa6krZXer2Kgt701/1+1s
|
||||||
|
gozKvNatxaVtOPhKhj1NM4tLrc1kb4lJabLptAPYD7Wl0FXRjTMtfAYn0QJAVmMO
|
||||||
|
QRag6iHQyehXEamEFIkql6iyCyG/BB8ukxnvMcSt7bUkTjGUykizPYZGwBip6gXD
|
||||||
|
ZCAjmUL64/23DqGPMQJBAIUUShpi307GBmC0AXyvkt36tPYvDMykF4qHivScbZF+
|
||||||
|
UJ2e5Y0lvR/+5bEgFcLk7phW5XxofcFWxO7BSbu2bGk=
|
||||||
|
-----END RSA PRIVATE KEY-----
|
||||||
6
storage/cert/unionpay/self/public_rsa.pem
Normal file
6
storage/cert/unionpay/self/public_rsa.pem
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
-----BEGIN PUBLIC KEY-----
|
||||||
|
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCbCoYOxjVu15ONuotlIBxiyMQP
|
||||||
|
+Ch8TavHHVTDrY54mRPLq0dRXrlpj+Ziu8PY8kHfPdNbRlftVQUgnhfOP/2j2Qbn
|
||||||
|
TDAF4tUZ0B9YjvCgLMpGMOAZtuw+u+VwVILegUUO3Yh/T6nZ4kcMw5vj/N4vGdHc
|
||||||
|
ABV+BK7639+Xep1OlQIDAQAB
|
||||||
|
-----END PUBLIC KEY-----
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
<div class="box grid-box">
|
|
||||||
<?php if(isset($title)): ?>
|
|
||||||
<div class="box-header with-border">
|
|
||||||
<h3 class="box-title"> <?php echo e($title, false); ?></h3>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if( $grid->showTools() || $grid->showExportBtn() || $grid->showCreateBtn() ): ?>
|
|
||||||
<div class="box-header with-border">
|
|
||||||
<div class="pull-right">
|
|
||||||
<?php echo $grid->renderColumnSelector(); ?>
|
|
||||||
|
|
||||||
<?php echo $grid->renderExportButton(); ?>
|
|
||||||
|
|
||||||
<?php echo $grid->renderCreateButton(); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<?php if( $grid->showTools() ): ?>
|
|
||||||
<div class="pull-left">
|
|
||||||
<?php echo $grid->renderHeaderTools(); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php echo $grid->renderFilter(); ?>
|
|
||||||
|
|
||||||
|
|
||||||
<?php echo $grid->renderHeader(); ?>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- /.box-header -->
|
|
||||||
<div class="box-body table-responsive no-padding">
|
|
||||||
<table class="table table-hover grid-table" id="<?php echo e($grid->tableID, false); ?>">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<?php $__currentLoopData = $grid->visibleColumns(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $column): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<th <?php echo $column->formatHtmlAttributes(); ?>><?php echo $column->getLabel(); ?><?php echo $column->renderHeader(); ?></th>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<?php if($grid->hasQuickCreate()): ?>
|
|
||||||
<?php echo $grid->renderQuickCreate(); ?>
|
|
||||||
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
|
|
||||||
<?php if($grid->rows()->isEmpty() && $grid->showDefineEmptyPage()): ?>
|
|
||||||
<?php echo $__env->make('admin::grid.empty-grid', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php $__currentLoopData = $grid->rows(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<tr <?php echo $row->getRowAttributes(); ?>>
|
|
||||||
<?php $__currentLoopData = $grid->visibleColumnNames(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $name): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<td <?php echo $row->getColumnAttributes($name); ?>>
|
|
||||||
<?php echo $row->column($name); ?>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</tbody>
|
|
||||||
|
|
||||||
<?php echo $grid->renderTotalRow(); ?>
|
|
||||||
|
|
||||||
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php echo $grid->renderFooter(); ?>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="box-footer clearfix">
|
|
||||||
<?php echo $grid->paginator(); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!-- /.box-body -->
|
|
||||||
</div>
|
|
||||||
<?php /**PATH /home/wwwroot/pingan/vendor/encore/laravel-admin/src/../resources/views/grid/table.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
<form <?php echo $attributes; ?>>
|
|
||||||
<div class="box-body fields-group">
|
|
||||||
|
|
||||||
<?php $__currentLoopData = $fields; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $field): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php echo $field->render(); ?>
|
|
||||||
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if($method != 'GET'): ?>
|
|
||||||
<input type="hidden" name="_token" value="<?php echo e(csrf_token(), false); ?>">
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<!-- /.box-body -->
|
|
||||||
<?php if(count($buttons) > 0): ?>
|
|
||||||
<div class="box-footer">
|
|
||||||
<div class="col-md-<?php echo e($width['label'], false); ?>"></div>
|
|
||||||
|
|
||||||
<div class="col-md-<?php echo e($width['field'], false); ?>">
|
|
||||||
<?php if(in_array('reset', $buttons)): ?>
|
|
||||||
<div class="btn-group pull-left">
|
|
||||||
<button type="reset" class="btn btn-warning pull-right"><?php echo e(trans('admin.reset'), false); ?></button>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if(in_array('submit', $buttons)): ?>
|
|
||||||
<div class="btn-group pull-right">
|
|
||||||
<button type="submit" class="btn btn-info pull-right"><?php echo e(trans('admin.submit'), false); ?></button>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</form>
|
|
||||||
<?php /**PATH /home/wwwroot/pingan/vendor/encore/laravel-admin/src/../resources/views/widgets/form.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
<div class="<?php echo e($viewClass['form-group'], false); ?> <?php echo ($errors->has($errorKey['start'].'start') || $errors->has($errorKey['end'].'end')) ? 'has-error' : ''; ?>">
|
|
||||||
|
|
||||||
<label for="<?php echo e($id['start'], false); ?>" class="<?php echo e($viewClass['label'], false); ?> control-label"><?php echo e($label, false); ?></label>
|
|
||||||
|
|
||||||
<div class="<?php echo e($viewClass['field'], false); ?>">
|
|
||||||
|
|
||||||
<?php echo $__env->make('admin::form.error', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
|
|
||||||
|
|
||||||
<div class="row" style="width: 370px">
|
|
||||||
<div class="col-lg-6">
|
|
||||||
<div class="input-group">
|
|
||||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|
||||||
<input type="text" name="<?php echo e($name['start'], false); ?>" value="<?php echo e(old($column['start'], $value['start'] ?? null), false); ?>" class="form-control <?php echo e($class['start'], false); ?>" style="width: 150px" <?php echo $attributes; ?> />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-lg-6">
|
|
||||||
<div class="input-group">
|
|
||||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|
||||||
<input type="text" name="<?php echo e($name['end'], false); ?>" value="<?php echo e(old($column['end'], $value['end'] ?? null), false); ?>" class="form-control <?php echo e($class['end'], false); ?>" style="width: 150px" <?php echo $attributes; ?> />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php echo $__env->make('admin::form.help-block', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php /**PATH /home/wwwroot/pingan/vendor/encore/laravel-admin/src/../resources/views/form/daterange.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
<!-- Main Header -->
|
|
||||||
<header class="main-header">
|
|
||||||
|
|
||||||
<!-- Logo -->
|
|
||||||
<a href="<?php echo e(admin_url('/'), false); ?>" class="logo">
|
|
||||||
<!-- mini logo for sidebar mini 50x50 pixels -->
|
|
||||||
<span class="logo-mini"><?php echo config('admin.logo-mini', config('admin.name')); ?></span>
|
|
||||||
<!-- logo for regular state and mobile devices -->
|
|
||||||
<span class="logo-lg"><?php echo config('admin.logo', config('admin.name')); ?></span>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<!-- Header Navbar -->
|
|
||||||
<nav class="navbar navbar-static-top" role="navigation">
|
|
||||||
<!-- Sidebar toggle button-->
|
|
||||||
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
|
|
||||||
<span class="sr-only">Toggle navigation</span>
|
|
||||||
</a>
|
|
||||||
<ul class="nav navbar-nav hidden-sm visible-lg-block">
|
|
||||||
<?php echo Admin::getNavbar()->render('left'); ?>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<!-- Navbar Right Menu -->
|
|
||||||
<div class="navbar-custom-menu">
|
|
||||||
<ul class="nav navbar-nav">
|
|
||||||
|
|
||||||
<?php echo Admin::getNavbar()->render(); ?>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- User Account Menu -->
|
|
||||||
<li class="dropdown user user-menu">
|
|
||||||
<!-- Menu Toggle Button -->
|
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
|
||||||
<!-- The user image in the navbar-->
|
|
||||||
<img src="<?php echo e(Admin::user()->avatar, false); ?>" class="user-image" alt="User Image">
|
|
||||||
<!-- hidden-xs hides the username on small devices so only the image appears. -->
|
|
||||||
<span class="hidden-xs"><?php echo e(Admin::user()->name, false); ?></span>
|
|
||||||
</a>
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
<!-- The user image in the menu -->
|
|
||||||
<li class="user-header">
|
|
||||||
<img src="<?php echo e(Admin::user()->avatar, false); ?>" class="img-circle" alt="User Image">
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<?php echo e(Admin::user()->name, false); ?>
|
|
||||||
|
|
||||||
<small>Member since admin <?php echo e(Admin::user()->created_at, false); ?></small>
|
|
||||||
</p>
|
|
||||||
</li>
|
|
||||||
<li class="user-footer">
|
|
||||||
<div class="pull-left">
|
|
||||||
<a href="<?php echo e(admin_url('auth/setting'), false); ?>" class="btn btn-default btn-flat"><?php echo e(trans('admin.setting'), false); ?></a>
|
|
||||||
</div>
|
|
||||||
<div class="pull-right">
|
|
||||||
<a href="<?php echo e(admin_url('auth/logout'), false); ?>" class="btn btn-default btn-flat"><?php echo e(trans('admin.logout'), false); ?></a>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<!-- Control Sidebar Toggle Button -->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</header><?php /**PATH /home/wwwroot/pingan/vendor/encore/laravel-admin/src/../resources/views/partials/header.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<div class="<?php echo e($viewClass['form-group'], false); ?> <?php echo !$errors->has($errorKey) ? '' : 'has-error'; ?>">
|
|
||||||
|
|
||||||
<label for="<?php echo e($id, false); ?>" class="<?php echo e($viewClass['label'], false); ?> control-label"><?php echo e($label, false); ?></label>
|
|
||||||
|
|
||||||
<div class="<?php echo e($viewClass['field'], false); ?>">
|
|
||||||
|
|
||||||
<?php echo $__env->make('admin::form.error', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
|
|
||||||
|
|
||||||
<textarea name="<?php echo e($name, false); ?>" class="form-control <?php echo e($class, false); ?>" rows="<?php echo e($rows, false); ?>" placeholder="<?php echo e($placeholder, false); ?>" <?php echo $attributes; ?> ><?php echo e(old($column, $value), false); ?></textarea>
|
|
||||||
|
|
||||||
<?php echo $__env->make('admin::form.help-block', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php /**PATH /home/wwwroot/pingan/vendor/encore/laravel-admin/src/../resources/views/form/textarea.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
|
|
||||||
<meta http-equiv="Pragma" content="no-cache" />
|
|
||||||
<meta http-equiv="Expires" content="0" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
||||||
|
|
||||||
<title><?php echo $__env->yieldContent('title', $app_title??config('app.name')); ?></title>
|
|
||||||
<link rel="stylesheet" href="<?php echo e(asset('css/mzui.min.css'), false); ?>">
|
|
||||||
<link rel="stylesheet" href="<?php echo e(asset('css/swiper.min.css'), false); ?>">
|
|
||||||
<link rel="stylesheet" href="<?php echo e(asset('css/style.css'), false); ?>?_<?php echo e(time(), false); ?>">
|
|
||||||
<?php echo $__env->yieldContent('css'); ?>
|
|
||||||
<?php echo $__env->yieldContent('js'); ?>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<?php echo $__env->yieldContent('footer'); ?>
|
|
||||||
<?php echo $__env->yieldContent('pop'); ?>
|
|
||||||
<?php echo $__env->yieldContent('content'); ?>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
<script type="text/javascript" src="/js/jquery-3.2.1.min.js"></script>
|
|
||||||
<script type="text/javascript" src="/js/mzui.min.js" ></script>
|
|
||||||
<script type="text/javascript" src="/js/layer/layer.min.js" ></script>
|
|
||||||
<script type="text/javascript" src="/js/cjango.js?v=<?php echo e(uniqid(), false); ?>"></script>
|
|
||||||
|
|
||||||
<?php echo $__env->yieldContent('script'); ?>
|
|
||||||
</html>
|
|
||||||
<?php /**PATH /home/wwwroot/pingan/resources/views/layouts/app.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<div class="<?php echo e($viewClass['form-group'], false); ?> <?php echo !$errors->has($errorKey) ? '' : 'has-error'; ?>">
|
|
||||||
|
|
||||||
<label for="<?php echo e($id, false); ?>" class="<?php echo e($viewClass['label'], false); ?> control-label"><?php echo e($label, false); ?></label>
|
|
||||||
|
|
||||||
<div class="<?php echo e($viewClass['field'], false); ?>">
|
|
||||||
|
|
||||||
<?php echo $__env->make('admin::form.error', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
|
|
||||||
|
|
||||||
<input type="hidden" name="<?php echo e($name, false); ?>"/>
|
|
||||||
|
|
||||||
<select class="form-control <?php echo e($class, false); ?>" style="width: 100%;" name="<?php echo e($name, false); ?>" <?php echo $attributes; ?> >
|
|
||||||
<?php if($groups): ?>
|
|
||||||
<?php $__currentLoopData = $groups; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $group): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<optgroup label="<?php echo e($group['label'], false); ?>">
|
|
||||||
<?php $__currentLoopData = $group['options']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $select => $option): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($select, false); ?>" <?php echo e($select == old($column, $value) ?'selected':'', false); ?>><?php echo e($option, false); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</optgroup>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php else: ?>
|
|
||||||
<option value=""></option>
|
|
||||||
<?php $__currentLoopData = $options; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $select => $option): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($select, false); ?>" <?php echo e($select == old($column, $value) ?'selected':'', false); ?>><?php echo e($option, false); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<?php echo $__env->make('admin::form.help-block', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php /**PATH /home/wwwroot/pingan/vendor/encore/laravel-admin/src/../resources/views/form/select.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?php $__currentLoopData = $html; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php echo $item; ?>
|
|
||||||
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php /**PATH /home/wwwroot/pingan/vendor/encore/laravel-admin/src/../resources/views/partials/html.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<div class="form-group">
|
|
||||||
<label><?php echo e($label, false); ?></label>
|
|
||||||
<input style="width: 100%" <?php echo $attributes; ?> />
|
|
||||||
<?php echo $__env->make('admin::actions.form.help-block', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
|
|
||||||
</div><?php /**PATH /home/wwwroot/pingan/vendor/encore/laravel-admin/src/../resources/views/actions/form/date.blade.php ENDPATH**/ ?>
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user