增加导入平安结算订单

This commit is contained in:
2022-02-10 15:10:55 +08:00
parent 5192cc2576
commit d46c6f55f1
12 changed files with 1185 additions and 3 deletions

View File

@@ -0,0 +1,115 @@
<?php
namespace App\Admin\Actions\Coupon;
use App\Admin\Imports\SettleCouponImport;
use Encore\Admin\Actions\Action;
use Encore\Admin\Admin;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Facades\Excel;
class SettleCoupon extends Action
{
public $name = '结算数据';
protected $selector = '.check-coupon';
public function handle(Request $request): \Encore\Admin\Actions\Response
{
try {
Excel::import(new SettleCouponImport(), request()->file('file'));
} catch (\Exception $exception) {
return $this->response()->swal()->error($exception->getMessage());
}
return $this->response()->swal()->success('上传成功')->refresh();
}
public function form()
{
$this->file('file', '请选择文件')
->options([
'showPreview' => false,
'allowedFileExtensions' => ['xlsx', 'xls', 'csv'],
'showUpload' => true,
])
->required();
}
public function html(): string
{
return <<<HTML
<a class="btn btn-sm btn-default import-action check-coupon">导入已结算数据</a>
HTML;
}
/**
* 上传等待
*
* @return string
*/
public function handleActionPromise(): string
{
$resolve = <<<SCRIPT
var actionResolverss = function (data) {
$('.modal-footer').show()
$('.tips').remove()
var response = data[0];
var target = data[1];
if (typeof response !== 'object') {
return $.admin.swal({type: 'error', title: 'Oops!'});
}
var then = function (then) {
if (then.action == 'refresh') {
$.admin.reload();
}
if (then.action == 'download') {
window.open(then.value, '_blank');
}
if (then.action == 'redirect') {
$.admin.redirect(then.value);
}
};
if (typeof response.html === 'string') {
target.html(response.html);
}
if (typeof response.swal === 'object') {
$.admin.swal(response.swal);
}
if (typeof response.toastr === 'object') {
$.admin.toastr[response.toastr.type](response.toastr.content, '', response.toastr.options);
}
if (response.then) {
then(response.then);
}
};
var actionCatcherss = function (request) {
$('.modal-footer').show()
$('.tips').remove()
if (request && typeof request.responseJSON === 'object') {
$.admin.toastr.error(request.responseJSON.message, '', {positionClass:"toast-bottom-center", timeOut: 10000}).css("width","500px")
}
};
SCRIPT;
Admin::script($resolve);
return <<<SCRIPT
$('.modal-footer').hide()
let html = `<div class='tips' style='color: red;font-size: 18px;'>导入时间取决于数据量,请耐心等待结果不要关闭窗口!<img src="data:image/gif;base64,R0lGODlhEAAQAPQAAP///1VVVfr6+np6eqysrFhYWG5ubuPj48TExGNjY6Ojo5iYmOzs7Lq6utjY2ISEhI6OjgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAAFUCAgjmRpnqUwFGwhKoRgqq2YFMaRGjWA8AbZiIBbjQQ8AmmFUJEQhQGJhaKOrCksgEla+KIkYvC6SJKQOISoNSYdeIk1ayA8ExTyeR3F749CACH5BAkKAAAALAAAAAAQABAAAAVoICCKR9KMaCoaxeCoqEAkRX3AwMHWxQIIjJSAZWgUEgzBwCBAEQpMwIDwY1FHgwJCtOW2UDWYIDyqNVVkUbYr6CK+o2eUMKgWrqKhj0FrEM8jQQALPFA3MAc8CQSAMA5ZBjgqDQmHIyEAIfkECQoAAAAsAAAAABAAEAAABWAgII4j85Ao2hRIKgrEUBQJLaSHMe8zgQo6Q8sxS7RIhILhBkgumCTZsXkACBC+0cwF2GoLLoFXREDcDlkAojBICRaFLDCOQtQKjmsQSubtDFU/NXcDBHwkaw1cKQ8MiyEAIfkECQoAAAAsAAAAABAAEAAABVIgII5kaZ6AIJQCMRTFQKiDQx4GrBfGa4uCnAEhQuRgPwCBtwK+kCNFgjh6QlFYgGO7baJ2CxIioSDpwqNggWCGDVVGphly3BkOpXDrKfNm/4AhACH5BAkKAAAALAAAAAAQABAAAAVgICCOZGmeqEAMRTEQwskYbV0Yx7kYSIzQhtgoBxCKBDQCIOcoLBimRiFhSABYU5gIgW01pLUBYkRItAYAqrlhYiwKjiWAcDMWY8QjsCf4DewiBzQ2N1AmKlgvgCiMjSQhACH5BAkKAAAALAAAAAAQABAAAAVfICCOZGmeqEgUxUAIpkA0AMKyxkEiSZEIsJqhYAg+boUFSTAkiBiNHks3sg1ILAfBiS10gyqCg0UaFBCkwy3RYKiIYMAC+RAxiQgYsJdAjw5DN2gILzEEZgVcKYuMJiEAOwAAAAAAAAAAAA=="><\/div>`
$('.modal-header').append(html)
process.then(actionResolverss).catch(actionCatcherss);
SCRIPT;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Admin\Controllers\Coupon;
use App\Admin\Actions\Coupon\SettleCoupon;
use App\Models\ActivityRule;
use App\Models\Coupon;
use App\Models\CouponPaCheck;
use App\Models\User;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Grid;
class PaCouponController extends AdminController
{
protected $title = '未找到数据';
/**
* Notes:
*
* @Author: <C.Jason>
* @Date : 2019/9/18 14:50
* @return Grid
*/
protected function grid(): Grid
{
$grid = new Grid(new CouponPaCheck());
$grid->disableCreateButton();
$grid->disableBatchActions();
$grid->disableActions();
$grid->model()->latest();
$grid->filter(function ($filter) {
$filter->column(1 / 2, function ($filter) {
$filter->equal('pa_order_id', '平安主订单号');
});
});
$grid->column('id', '#ID#');
$grid->column('pa_order_id', '平安主订单号');
$grid->disableExport(false);
$grid->export(function ($export) {
$export->filename($this->title.date("YmdHis"));
});
return $grid;
}
}

View File

@@ -0,0 +1,148 @@
<?php
namespace App\Admin\Controllers\Coupon;
use App\Admin\Actions\Coupon\SettleCoupon;
use App\Models\ActivityRule;
use App\Models\Coupon;
use App\Models\User;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Grid;
class SettleCouponController extends AdminController
{
protected $title = '平安核销全列表';
/**
* Notes:
*
* @Author: <C.Jason>
* @Date : 2019/9/18 14:50
* @return Grid
*/
protected function grid(): Grid
{
$grid = new Grid(new Coupon);
$grid->disableCreateButton();
$grid->disableBatchActions();
$grid->disableActions();
$grid->tools(function (Grid\Tools $tools) {
$tools->append(new SettleCoupon());//上传等待校验数据
});
$grid->model()
->where('type', 1)
->with(['outlet.province', 'outlet.city', 'outlet.district', 'user', 'user.info'])
->whereIn('status', [2])
->orderBy('id', 'desc');
$grid->filter(function ($filter) {
$filter->column(1 / 2, function ($filter) {
$filter->between('created_at', '核销时间')->datetime();
$users = User::whereHas('identity', function ($query) {
$query->where('identity_id', 1);
})->get()->pluck('nickname', 'id');
$filter->equal('user_id', '渠道')->select($users);
$filter->equal('thirdPartyGoodsId', '优惠政策')->select(ActivityRule::pluck('title', 'code'));
$filter->like('couponName', '优惠政策名');
});
$filter->column(1 / 2, function ($filter) {
$filter->like('redemptionCode', '卡券编号');
$filter->where(function ($query) {
$query->whereHas('outlet', function ($query) {
$query->whereHas('info', function ($query) {
$query->where('nickname', 'like', "%{$this->input}%");
});
});
}, '网点名称');
$filter->like('pa_order_id', '平安主订单号');
$filter->equal('is_settle', '是否结算')->select(Coupon::SETTLES);
});
});
$grid->column('id', '#ID#');
$grid->column('渠道')->display(function () {
return $this->user->nickname;
});
$grid->column('type', '类型')
->using(Coupon::TYPES)
->label([
'1' => 'info',
'2' => 'success',
]);
$grid->column('网点名称/编号')->display(function () {
return $this->outlet ? $this->outlet->nickname : $this->outletId;
});
$grid->column('redemptionCode', '卡券编号');
$grid->column('couponName', '优惠政策');
$grid->column('price', '核销金额');
$grid->column('total', '订单金额');
$grid->column('orderid', '订单id');
$grid->column('pa_order_id', '平安主订单号');
$grid->column('pa_sub_order_id', '平安子订单号')->hide();
$grid->column('is_settle', '是否结算')->bool();
$grid->column('资金通道结算')->display(function () {
$profit = $this->status == 2 ? $this->profit : '0.00';
return '<span style="color:red">'.$profit.'</span>';
});
$grid->column('startTime', '起始时间')->hide();
$grid->column('endTime', '到期时间')->hide();
$grid->column('created_at', '核销时间');
$grid->column('省')->display(function () {
return ($this->outlet && $this->outlet->province) ? $this->outlet->province->name : '';
});
$grid->column('市')->display(function () {
return ($this->outlet && $this->outlet->province) ? $this->outlet->city->name : '';
});
$grid->column('区')->display(function () {
return ($this->outlet && $this->outlet->province) ? $this->outlet->district->name : '';
});
$grid->footer(function ($query) {
$total = $query->count();
$success = $query->where('status', 2)->count();
$faield = $total - $success;
return '<label class="label label-success">全部:'.$total.'张</label>&nbsp;&nbsp;'
.'<label class="label label-success">成功:'.$success.'张</label>&nbsp;&nbsp;'
.'<label class="label label-success">失败:'.$faield.'张</label>&nbsp;&nbsp;'
.'<label class="label label-success">核销金额:'.$query->sum('price').'元</label>&nbsp;&nbsp;'
.'<label class="label label-success">资金通道结算:'.$query->sum('profit').'元</label>&nbsp;&nbsp;'
.'<label class="label label-success">打款金额:'.$query->where('is_profit', 1)
->sum('profit').'元</label>&nbsp;&nbsp;';
});
$grid->disableExport(false);
$grid->export(function ($export) {
$export->column('type', function ($value, $original) {
return strip_tags($value);
});
$export->column('redemptionCode', function ($value, $original) {
return $value."\t";
});
$export->column('orderid', function ($value, $original) {
return $value."\t";
});
$export->column('资金通道结算', function ($value, $original) {
return strip_tags($value);
});
$export->filename($this->title.date("YmdHis"));
});
return $grid;
}
}

View File

@@ -29,7 +29,7 @@ class IndexController extends AdminController
* @Date : 2019/9/18 14:50 * @Date : 2019/9/18 14:50
* @return Grid * @return Grid
*/ */
protected function grid() protected function grid(): Grid
{ {
$user = Auth::guard('admin')->user(); $user = Auth::guard('admin')->user();

View File

@@ -0,0 +1,83 @@
<?php
namespace App\Admin\Imports;
use App\Models\Coupon;
use App\Models\CouponPaCheck;
use Maatwebsite\Excel\Concerns\Importable;
use Maatwebsite\Excel\Concerns\SkipsErrors;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\WithBatchInserts;
use Maatwebsite\Excel\Concerns\WithChunkReading;
use Maatwebsite\Excel\Concerns\WithStartRow;
class SettleCouponImport implements ToModel, WithStartRow, WithChunkReading, WithBatchInserts
{
use Importable, SkipsErrors;
public $chunk = 5000;
/**
* @param array $row
* @return \Illuminate\Database\Eloquent\Model|null
* @throws \Exception
*/
public function model(array $row)
{
try {
$order_id = trim($row[0]);
$exists = Coupon::query()->where('pa_order_id', $order_id)->exists();
if (! $exists) {
CouponPaCheck::create([
'pa_order_id' => $order_id
]);
} else {
Coupon::query()->where('pa_order_id', $order_id)->update([
'is_settle' => 1
]);
}
} catch (\Exception $e) {
throw new \Exception($e->getMessage());
}
}
/**
* 从第几行开始处理数据 就是不处理标题
*
* @return int
*/
public function startRow(): int
{
return 2;
}
/**
* Notes: 批量导入1000条
*
* @Author: 玄尘
* @Date : 2020/11/23 13:40
* @return int
*/
public function chunkSize(): int
{
return $this->chunk;
}
/**
* Notes: 以1000条数据基准切割数据
*
* @Author: 玄尘
* @Date : 2020/11/23 13:41
* @return int
*/
public function batchSize(): int
{
return $this->chunk;
}
}

View File

@@ -37,6 +37,8 @@ Route::group([
*/ */
$router->resource('logs', 'Log\IndexController'); $router->resource('logs', 'Log\IndexController');
$router->resource('coupons', 'Coupon\IndexController'); //平安卡券 $router->resource('coupons', 'Coupon\IndexController'); //平安卡券
$router->resource('settle_coupons', 'Coupon\SettleCouponController'); //平安结算数据
$router->resource('pa_coupons', 'Coupon\PaCouponController'); //平安未找到数据
$router->resource('wos', 'Wo\IndexController'); //沃钱包业务 $router->resource('wos', 'Wo\IndexController'); //沃钱包业务
/** /**

View File

@@ -22,6 +22,13 @@ class Coupon extends Model
self::TYPE_YSD => '自有券', self::TYPE_YSD => '自有券',
]; ];
const SETTLE_YES = 1;
const SETTLE_NO = 0;
const SETTLES = [
self::SETTLE_YES => '是',
self::SETTLE_NO => '否',
];
//状态 //状态
public function getStatusTextAttribute() public function getStatusTextAttribute()
{ {

View File

@@ -0,0 +1,11 @@
<?php
namespace App\Models;
class CouponPaCheck extends Model
{
protected $casts = [
'pa_order_ids' => 'json'
];
}

View File

@@ -15,6 +15,7 @@
"guzzlehttp/guzzle": "^7.0.1", "guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.12", "laravel/framework": "^8.12",
"laravel/tinker": "^2.5", "laravel/tinker": "^2.5",
"maatwebsite/excel": "^3.1",
"predis/predis": "^1.1", "predis/predis": "^1.1",
"xuanchen/coupon": "^1.0", "xuanchen/coupon": "^1.0",
"xuanchen/unionpay": "^3.0.0" "xuanchen/unionpay": "^3.0.0"

530
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "6a778bf2628b2c4247fb62ae14490866", "content-hash": "ff9124fe13daf9df8300d62da36b73a9",
"packages": [ "packages": [
{ {
"name": "asm89/stack-cors", "name": "asm89/stack-cors",
@@ -860,6 +860,57 @@
], ],
"time": "2020-11-15T02:55:51+00:00" "time": "2020-11-15T02:55:51+00:00"
}, },
{
"name": "ezyang/htmlpurifier",
"version": "v4.14.0",
"source": {
"type": "git",
"url": "https://github.com/ezyang/htmlpurifier.git",
"reference": "12ab42bd6e742c70c0a52f7b82477fcd44e64b75"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/12ab42bd6e742c70c0a52f7b82477fcd44e64b75",
"reference": "12ab42bd6e742c70c0a52f7b82477fcd44e64b75",
"shasum": ""
},
"require": {
"php": ">=5.2"
},
"type": "library",
"autoload": {
"psr-0": {
"HTMLPurifier": "library/"
},
"files": [
"library/HTMLPurifier.composer.php"
],
"exclude-from-classmap": [
"/library/HTMLPurifier/Language/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1-or-later"
],
"authors": [
{
"name": "Edward Z. Yang",
"email": "admin@htmlpurifier.org",
"homepage": "http://ezyang.com"
}
],
"description": "Standards compliant HTML filter written in PHP",
"homepage": "http://htmlpurifier.org/",
"keywords": [
"html"
],
"support": {
"issues": "https://github.com/ezyang/htmlpurifier/issues",
"source": "https://github.com/ezyang/htmlpurifier/tree/v4.14.0"
},
"time": "2021-12-25T01:21:49+00:00"
},
{ {
"name": "fideloper/proxy", "name": "fideloper/proxy",
"version": "4.4.1", "version": "4.4.1",
@@ -1861,6 +1912,262 @@
], ],
"time": "2021-01-18T20:58:21+00:00" "time": "2021-01-18T20:58:21+00:00"
}, },
{
"name": "maatwebsite/excel",
"version": "3.1.36",
"source": {
"type": "git",
"url": "https://github.com/SpartnerNL/Laravel-Excel.git",
"reference": "eb31f30d72c51c3fb11644b636945accbe50404f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/SpartnerNL/Laravel-Excel/zipball/eb31f30d72c51c3fb11644b636945accbe50404f",
"reference": "eb31f30d72c51c3fb11644b636945accbe50404f",
"shasum": ""
},
"require": {
"ext-json": "*",
"illuminate/support": "5.8.*|^6.0|^7.0|^8.0|^9.0",
"php": "^7.0|^8.0",
"phpoffice/phpspreadsheet": "^1.18"
},
"require-dev": {
"orchestra/testbench": "^6.0|^7.0",
"predis/predis": "^1.1"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Maatwebsite\\Excel\\ExcelServiceProvider"
],
"aliases": {
"Excel": "Maatwebsite\\Excel\\Facades\\Excel"
}
}
},
"autoload": {
"psr-4": {
"Maatwebsite\\Excel\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Patrick Brouwers",
"email": "patrick@spartner.nl"
}
],
"description": "Supercharged Excel exports and imports in Laravel",
"keywords": [
"PHPExcel",
"batch",
"csv",
"excel",
"export",
"import",
"laravel",
"php",
"phpspreadsheet"
],
"support": {
"issues": "https://github.com/SpartnerNL/Laravel-Excel/issues",
"source": "https://github.com/SpartnerNL/Laravel-Excel/tree/3.1.36"
},
"funding": [
{
"url": "https://laravel-excel.com/commercial-support",
"type": "custom"
},
{
"url": "https://github.com/patrickbrouwers",
"type": "github"
}
],
"time": "2022-01-27T18:34:20+00:00"
},
{
"name": "maennchen/zipstream-php",
"version": "2.1.0",
"source": {
"type": "git",
"url": "https://github.com/maennchen/ZipStream-PHP.git",
"reference": "c4c5803cc1f93df3d2448478ef79394a5981cc58"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/c4c5803cc1f93df3d2448478ef79394a5981cc58",
"reference": "c4c5803cc1f93df3d2448478ef79394a5981cc58",
"shasum": ""
},
"require": {
"myclabs/php-enum": "^1.5",
"php": ">= 7.1",
"psr/http-message": "^1.0",
"symfony/polyfill-mbstring": "^1.0"
},
"require-dev": {
"ext-zip": "*",
"guzzlehttp/guzzle": ">= 6.3",
"mikey179/vfsstream": "^1.6",
"phpunit/phpunit": ">= 7.5"
},
"type": "library",
"autoload": {
"psr-4": {
"ZipStream\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paul Duncan",
"email": "pabs@pablotron.org"
},
{
"name": "Jonatan Männchen",
"email": "jonatan@maennchen.ch"
},
{
"name": "Jesse Donat",
"email": "donatj@gmail.com"
},
{
"name": "András Kolesár",
"email": "kolesar@kolesar.hu"
}
],
"description": "ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.",
"keywords": [
"stream",
"zip"
],
"support": {
"issues": "https://github.com/maennchen/ZipStream-PHP/issues",
"source": "https://github.com/maennchen/ZipStream-PHP/tree/master"
},
"funding": [
{
"url": "https://opencollective.com/zipstream",
"type": "open_collective"
}
],
"time": "2020-05-30T13:11:16+00:00"
},
{
"name": "markbaker/complex",
"version": "3.0.1",
"source": {
"type": "git",
"url": "https://github.com/MarkBaker/PHPComplex.git",
"reference": "ab8bc271e404909db09ff2d5ffa1e538085c0f22"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/ab8bc271e404909db09ff2d5ffa1e538085c0f22",
"reference": "ab8bc271e404909db09ff2d5ffa1e538085c0f22",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"phpcompatibility/php-compatibility": "^9.0",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.3",
"squizlabs/php_codesniffer": "^3.4"
},
"type": "library",
"autoload": {
"psr-4": {
"Complex\\": "classes/src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mark Baker",
"email": "mark@lange.demon.co.uk"
}
],
"description": "PHP Class for working with complex numbers",
"homepage": "https://github.com/MarkBaker/PHPComplex",
"keywords": [
"complex",
"mathematics"
],
"support": {
"issues": "https://github.com/MarkBaker/PHPComplex/issues",
"source": "https://github.com/MarkBaker/PHPComplex/tree/3.0.1"
},
"time": "2021-06-29T15:32:53+00:00"
},
{
"name": "markbaker/matrix",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/MarkBaker/PHPMatrix.git",
"reference": "c66aefcafb4f6c269510e9ac46b82619a904c576"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/c66aefcafb4f6c269510e9ac46b82619a904c576",
"reference": "c66aefcafb4f6c269510e9ac46b82619a904c576",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"phpcompatibility/php-compatibility": "^9.0",
"phpdocumentor/phpdocumentor": "2.*",
"phploc/phploc": "^4.0",
"phpmd/phpmd": "2.*",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.3",
"sebastian/phpcpd": "^4.0",
"squizlabs/php_codesniffer": "^3.4"
},
"type": "library",
"autoload": {
"psr-4": {
"Matrix\\": "classes/src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mark Baker",
"email": "mark@demon-angel.eu"
}
],
"description": "PHP Class for working with matrices",
"homepage": "https://github.com/MarkBaker/PHPMatrix",
"keywords": [
"mathematics",
"matrix",
"vector"
],
"support": {
"issues": "https://github.com/MarkBaker/PHPMatrix/issues",
"source": "https://github.com/MarkBaker/PHPMatrix/tree/3.0.0"
},
"time": "2021-07-01T19:01:15+00:00"
},
{ {
"name": "monolog/monolog", "name": "monolog/monolog",
"version": "2.2.0", "version": "2.2.0",
@@ -1959,6 +2266,66 @@
], ],
"time": "2020-12-14T13:15:25+00:00" "time": "2020-12-14T13:15:25+00:00"
}, },
{
"name": "myclabs/php-enum",
"version": "1.8.3",
"source": {
"type": "git",
"url": "https://github.com/myclabs/php-enum.git",
"reference": "b942d263c641ddb5190929ff840c68f78713e937"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/php-enum/zipball/b942d263c641ddb5190929ff840c68f78713e937",
"reference": "b942d263c641ddb5190929ff840c68f78713e937",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": "^7.3 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "1.*",
"vimeo/psalm": "^4.6.2"
},
"type": "library",
"autoload": {
"psr-4": {
"MyCLabs\\Enum\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP Enum contributors",
"homepage": "https://github.com/myclabs/php-enum/graphs/contributors"
}
],
"description": "PHP Enum implementation",
"homepage": "http://github.com/myclabs/php-enum",
"keywords": [
"enum"
],
"support": {
"issues": "https://github.com/myclabs/php-enum/issues",
"source": "https://github.com/myclabs/php-enum/tree/1.8.3"
},
"funding": [
{
"url": "https://github.com/mnapoli",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/myclabs/php-enum",
"type": "tidelift"
}
],
"time": "2021-07-05T08:18:36+00:00"
},
{ {
"name": "nesbot/carbon", "name": "nesbot/carbon",
"version": "2.44.0", "version": "2.44.0",
@@ -2179,6 +2546,110 @@
], ],
"time": "2020-11-07T02:01:34+00:00" "time": "2020-11-07T02:01:34+00:00"
}, },
{
"name": "phpoffice/phpspreadsheet",
"version": "1.21.0",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
"reference": "1a359d2ccbb89c05f5dffb32711a95f4afc67964"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/1a359d2ccbb89c05f5dffb32711a95f4afc67964",
"reference": "1a359d2ccbb89c05f5dffb32711a95f4afc67964",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-dom": "*",
"ext-fileinfo": "*",
"ext-gd": "*",
"ext-iconv": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-simplexml": "*",
"ext-xml": "*",
"ext-xmlreader": "*",
"ext-xmlwriter": "*",
"ext-zip": "*",
"ext-zlib": "*",
"ezyang/htmlpurifier": "^4.13",
"maennchen/zipstream-php": "^2.1",
"markbaker/complex": "^3.0",
"markbaker/matrix": "^3.0",
"php": "^7.3 || ^8.0",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/simple-cache": "^1.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
"dompdf/dompdf": "^1.0",
"friendsofphp/php-cs-fixer": "^3.2",
"jpgraph/jpgraph": "^4.0",
"mpdf/mpdf": "^8.0",
"phpcompatibility/php-compatibility": "^9.3",
"phpstan/phpstan": "^1.1",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^8.5 || ^9.0",
"squizlabs/php_codesniffer": "^3.6",
"tecnickcom/tcpdf": "^6.4"
},
"suggest": {
"dompdf/dompdf": "Option for rendering PDF with PDF Writer (doesn't yet support PHP8)",
"jpgraph/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers",
"mpdf/mpdf": "Option for rendering PDF with PDF Writer",
"tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer (doesn't yet support PHP8)"
},
"type": "library",
"autoload": {
"psr-4": {
"PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Maarten Balliauw",
"homepage": "https://blog.maartenballiauw.be"
},
{
"name": "Mark Baker",
"homepage": "https://markbakeruk.net"
},
{
"name": "Franck Lefevre",
"homepage": "https://rootslabs.net"
},
{
"name": "Erik Tilt"
},
{
"name": "Adrien Crivelli"
}
],
"description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
"homepage": "https://github.com/PHPOffice/PhpSpreadsheet",
"keywords": [
"OpenXML",
"excel",
"gnumeric",
"ods",
"php",
"spreadsheet",
"xls",
"xlsx"
],
"support": {
"issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.21.0"
},
"time": "2022-01-06T11:10:08+00:00"
},
{ {
"name": "phpoption/phpoption", "name": "phpoption/phpoption",
"version": "1.7.5", "version": "1.7.5",
@@ -2612,6 +3083,61 @@
], ],
"time": "2020-06-29T06:28:15+00:00" "time": "2020-06-29T06:28:15+00:00"
}, },
{
"name": "psr/http-factory",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"shasum": ""
},
"require": {
"php": ">=7.0.0",
"psr/http-message": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
"message",
"psr",
"psr-17",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-factory/tree/master"
},
"time": "2019-04-30T12:38:16+00:00"
},
{ {
"name": "psr/http-message", "name": "psr/http-message",
"version": "1.0.1", "version": "1.0.1",
@@ -8431,5 +8957,5 @@
"php": "^7.3|^8.0" "php": "^7.3|^8.0"
}, },
"platform-dev": [], "platform-dev": [],
"plugin-api-version": "2.1.0" "plugin-api-version": "2.2.0"
} }

202
config/excel.php Normal file
View File

@@ -0,0 +1,202 @@
<?php
use Maatwebsite\Excel\Excel;
return [
'exports' => [
/*
|--------------------------------------------------------------------------
| Chunk size
|--------------------------------------------------------------------------
|
| When using FromQuery, the query is automatically chunked.
| Here you can specify how big the chunk should be.
|
*/
'chunk_size' => 1000,
/*
|--------------------------------------------------------------------------
| Pre-calculate formulas during export
|--------------------------------------------------------------------------
*/
'pre_calculate_formulas' => false,
/*
|--------------------------------------------------------------------------
| CSV Settings
|--------------------------------------------------------------------------
|
| Configure e.g. delimiter, enclosure and line ending for CSV exports.
|
*/
'csv' => [
'delimiter' => ',',
'enclosure' => '"',
'line_ending' => PHP_EOL,
'use_bom' => false,
'include_separator_line' => false,
'excel_compatibility' => false,
],
],
'imports' => [
'read_only' => true,
'heading_row' => [
/*
|--------------------------------------------------------------------------
| Heading Row Formatter
|--------------------------------------------------------------------------
|
| Configure the heading row formatter.
| Available options: none|slug|custom
|
*/
'formatter' => 'slug',
],
/*
|--------------------------------------------------------------------------
| CSV Settings
|--------------------------------------------------------------------------
|
| Configure e.g. delimiter, enclosure and line ending for CSV imports.
|
*/
'csv' => [
'delimiter' => ',',
'enclosure' => '"',
'escape_character' => '\\',
'contiguous' => false,
'input_encoding' => 'UTF-8',
],
],
/*
|--------------------------------------------------------------------------
| Extension detector
|--------------------------------------------------------------------------
|
| Configure here which writer type should be used when
| the package needs to guess the correct type
| based on the extension alone.
|
*/
'extension_detector' => [
'xlsx' => Excel::XLSX,
'xlsm' => Excel::XLSX,
'xltx' => Excel::XLSX,
'xltm' => Excel::XLSX,
'xls' => Excel::XLS,
'xlt' => Excel::XLS,
'ods' => Excel::ODS,
'ots' => Excel::ODS,
'slk' => Excel::SLK,
'xml' => Excel::XML,
'gnumeric' => Excel::GNUMERIC,
'htm' => Excel::HTML,
'html' => Excel::HTML,
'csv' => Excel::CSV,
'tsv' => Excel::TSV,
/*
|--------------------------------------------------------------------------
| PDF Extension
|--------------------------------------------------------------------------
|
| Configure here which Pdf driver should be used by default.
| Available options: Excel::MPDF | Excel::TCPDF | Excel::DOMPDF
|
*/
'pdf' => Excel::DOMPDF,
],
'value_binder' => [
/*
|--------------------------------------------------------------------------
| Default Value Binder
|--------------------------------------------------------------------------
|
| PhpSpreadsheet offers a way to hook into the process of a value being
| written to a cell. In there some assumptions are made on how the
| value should be formatted. If you want to change those defaults,
| you can implement your own default value binder.
|
*/
'default' => Maatwebsite\Excel\DefaultValueBinder::class,
],
'transactions' => [
/*
|--------------------------------------------------------------------------
| Transaction Handler
|--------------------------------------------------------------------------
|
| By default the import is wrapped in a transaction. This is useful
| for when an import may fail and you want to retry it. With the
| transactions, the previous import gets rolled-back.
|
| You can disable the transaction handler by setting this to null.
| Or you can choose a custom made transaction handler here.
|
| Supported handlers: null|db
|
*/
'handler' => 'db',
],
'temporary_files' => [
/*
|--------------------------------------------------------------------------
| Local Temporary Path
|--------------------------------------------------------------------------
|
| When exporting and importing files, we use a temporary file, before
| storing reading or downloading. Here you can customize that path.
|
*/
'local_path' => sys_get_temp_dir(),
/*
|--------------------------------------------------------------------------
| Remote Temporary Disk
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup with queues in which you
| cannot rely on having a shared local temporary path, you might
| want to store the temporary file on a shared disk. During the
| queue executing, we'll retrieve the temporary file from that
| location instead. When left to null, it will always use
| the local path. This setting only has effect when using
| in conjunction with queued imports and exports.
|
*/
'remote_disk' => null,
'remote_prefix' => null,
/*
|--------------------------------------------------------------------------
| Force Resync
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup as above, it's possible
| for the clean up that occurs after entire queue has been run to only
| cleanup the server that the last AfterImportJob runs on. The rest of the server
| would still have the local temporary file stored on it. In this case your
| local storage limits can be exceeded and future imports won't be processed.
| To mitigate this you can set this config value to be true, so that after every
| queued chunk is processed the local temporary file is deleted on the server that
| processed it.
|
*/
'force_resync_remote' => null,
],
];

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCouponPaChecksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('coupon_pa_checks', function (Blueprint $table) {
$table->id();
$table->string('pa_order_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('coupon_pa_checks');
}
}