1
0
Fork 0

rank export

master
panliang 2023-12-05 16:49:02 +08:00
parent 085eb92ca1
commit a7c6260e78
20 changed files with 825 additions and 20 deletions

View File

@ -31,7 +31,7 @@ class BannerController extends AdminController
]))
->columns([
amisMake()->TableColumn()->name('id')->label(__('banner.id')),
amisMake()->TableColumn()->name('place_id')->label(__('banner.place_id')),
amisMake()->TableColumn()->name('place.name')->label(__('banner.place_id')),
amisMake()->TableColumn()->name('title')->label(__('banner.title')),
amisMake()->Image()->name('picture')->label(__('banner.picture'))->width(30),
amisMake()

View File

@ -13,17 +13,36 @@ class CateRankController extends AdminController
protected $snOptions;
public function index()
{
if ($this->actionOfGetData()) {
$options = $this->getSnOptions();
if (!request()->has('sn') && count($options) > 0) {
request()->offsetSet('sn', $options[0]);
}
return $this->response()->success($this->service->list());
}
if ($this->actionOfExport()) {
return $this->export();
}
return $this->response()->success($this->list());
}
public function list(): Page
{
$options = $this->getSnOptions();
$crud = $this->baseCRUD()
->filterTogglable(false)
->columnsTogglable(false)
->headerToolbar([])
->headerToolbar([
$this->exportAction()
])
->footerToolbar([])
->loadDataOnce()
->initFetch(false)
->filter($this->baseFilter()->actions()->body([
amisMake()->SelectControl()->name('sn')->label(__('user_rank.sn'))->options($this->getSnOptions())->size('md'),
amisMake()->SelectControl()->name('sn')->label(__('user_rank.sn'))->options($options)->value(count($options) > 0 ? $options[0] : '')->size('md'),
amisMake()->Component()->setType('submit')->label(__('admin.search'))->level('primary'),
]))
->columns([
@ -43,4 +62,47 @@ class CateRankController extends AdminController
return $this->snOptions;
}
protected function exportAction($disableSelectedItem = false)
{
$event = fn($script) => ['click' => ['actions' => [['actionType' => 'custom', 'script' => $script]]]];
$downloadPath = '/' . admin_url('_download_export', true);
$exportPath = $this->getExportPath();
$doAction = <<<JS
doAction([
{ actionType: "ajax", args: { api: { url: url.toString(), method: "get" } } },
{
actionType: "custom",
expression: "\${event.data.responseResult.responseStatus === 0}",
script: "window.open('{$downloadPath}?path='+event.data.responseResult.responseData.path)"
}
])
JS;
return amisMake()->VanillaAction()
->label(__('admin.export.title'))
->set('icon', 'fa-solid fa-download')
->align('right')
->onEvent($event(
<<<JS
let url = new URL("{$exportPath}", window.location.origin)
let param = window.location.href.split('?')[1]
if (param) {
url = url + '&' + param
}
{$doAction}
JS
));
}
protected function export()
{
$sn = request('sn', data_get($this->getSnOptions(), 0));
// 默认在 storage/app/ 下
$path = __('user_rank.cate_rank') . '-' . $sn . '.xlsx';
// 此处使用 laravel-excel 导出,可自行修改
(new \App\Exports\CateRank)->store($path, 'local');
return $this->response()->success(compact('path'));
}
}

View File

@ -49,7 +49,7 @@ class PartyUserController extends AdminController
public function form($edit): Form
{
return $this->baseForm()->title('')->body([
// amisMake()->SelectControl()->name('cate_id')->label(__('party_user.cate_id'))->options($this->getCateOptions()),
amisMake()->SelectControl()->name('cate_id')->label(__('party_user.cate_id'))->options($this->getCateOptions()),
amisMake()->TextControl()->name('name')->label(__('party_user.name'))->required(),
amisMake()->ImageControl()->name('avatar')->label(__('party_user.avatar')),
amisMake()->TextControl()->name('username')->label(__('party_user.username'))->required(),

View File

@ -6,6 +6,7 @@ use App\Admin\Services\UserRankService;
use App\Models\UserRank;
use Slowlyo\OwlAdmin\Controllers\AdminController;
use Slowlyo\OwlAdmin\Renderers\Page;
use Maatwebsite\Excel\Facades\Excel;
/**
* 党员排名
@ -16,17 +17,36 @@ class UserRankController extends AdminController
protected $snOptions;
public function index()
{
if ($this->actionOfGetData()) {
$options = $this->getSnOptions();
if (!request()->has('sn') && count($options) > 0) {
request()->offsetSet('sn', $options[0]);
}
return $this->response()->success($this->service->list());
}
if ($this->actionOfExport()) {
return $this->export();
}
return $this->response()->success($this->list());
}
public function list(): Page
{
$options = $this->getSnOptions();
$crud = $this->baseCRUD()
->filterTogglable(false)
->columnsTogglable(false)
->loadDataOnce(true)
->footerToolbar([])
->headerToolbar([])
->initFetch(false)
->headerToolbar([
$this->exportAction(),
])
->filter($this->baseFilter()->actions()->body([
amisMake()->SelectControl()->name('sn')->label(__('user_rank.sn'))->options($this->getSnOptions())->size('md'),
amisMake()->SelectControl()->name('sn')->label(__('user_rank.sn'))->options($options)->value(count($options) > 0 ? $options[0] : '')->size('md'),
amisMake()->Component()->setType('submit')->label(__('admin.search'))->level('primary'),
]))
->columns([
@ -47,4 +67,47 @@ class UserRankController extends AdminController
return $this->snOptions;
}
protected function exportAction($disableSelectedItem = false)
{
$event = fn($script) => ['click' => ['actions' => [['actionType' => 'custom', 'script' => $script]]]];
$downloadPath = '/' . admin_url('_download_export', true);
$exportPath = $this->getExportPath();
$doAction = <<<JS
doAction([
{ actionType: "ajax", args: { api: { url: url.toString(), method: "get" } } },
{
actionType: "custom",
expression: "\${event.data.responseResult.responseStatus === 0}",
script: "window.open('{$downloadPath}?path='+event.data.responseResult.responseData.path)"
}
])
JS;
return amisMake()->VanillaAction()
->label(__('admin.export.title'))
->set('icon', 'fa-solid fa-download')
->align('right')
->onEvent($event(
<<<JS
let url = new URL("{$exportPath}", window.location.origin)
let param = window.location.href.split('?')[1]
if (param) {
url = url + '&' + param
}
{$doAction}
JS
));
}
protected function export()
{
$sn = request('sn', data_get($this->getSnOptions(), 0));
// 默认在 storage/app/ 下
$path = __('user_rank.user_rank') . '-' . $sn . '.xlsx';
// 此处使用 laravel-excel 导出,可自行修改
(new \App\Exports\UserRank)->store($path, 'local');
return $this->response()->success(compact('path'));
}
}

View File

@ -6,6 +6,7 @@ use App\Admin\Services\UserScoreService;
use App\Enums\CheckStatus;
use App\Exceptions\BaseException;
use App\Models\PartyUser;
use App\Models\PartyCate;
use App\Models\UserScore;
use Illuminate\Http\Request;
use Slowlyo\OwlAdmin\Controllers\AdminController;
@ -20,6 +21,8 @@ class UserScoreController extends AdminController
protected $userOptions;
protected $cateOptions;
public function list(): Page
{
$crud = $this->baseCRUD()
@ -30,6 +33,7 @@ class UserScoreController extends AdminController
])
->filter($this->baseFilter()->actions([])->body([
amisMake()->SelectControl()->name('type_id')->label(__('user_score.type_id'))->options($this->getTypeOptions())->clearable()->size('md'),
amisMake()->SelectControl()->name('cate_id')->label(__('user_score.cate_id'))->options($this->getCateOptions())->clearable()->searchable()->size('md'),
amisMake()->SelectControl()->name('user_id')->label(__('user_score.user_id'))->options($this->getUserOptions())->clearable()->searchable()->size('md'),
amisMake()->TextControl()->name('title')->label(__('user_score.title'))->clearable()->size('md'),
amisMake()->SelectControl()->name('check_status')->label(__('user_score.check_status'))->options(CheckStatus::options())->clearable()->size('md'),
@ -39,6 +43,7 @@ class UserScoreController extends AdminController
->columns([
amisMake()->TableColumn()->name('id')->label(__('user_score.id')),
amisMake()->TableColumn()->name('type.name')->label(__('user_score.type_id')),
amisMake()->TableColumn()->name('cate.name')->label(__('user_score.cate_id')),
amisMake()->TableColumn()->name('user.name')->label(__('user_score.user_id')),
amisMake()->TableColumn()->name('title')->label(__('user_score.title')),
amisMake()->TableColumn()->name('check_status_text')->label(__('user_score.check_status')),
@ -111,6 +116,7 @@ class UserScoreController extends AdminController
return $this->baseDetail()->title('')->body([
amisMake()->TextControl()->name('id')->label(__('user_score.id'))->static(),
amisMake()->TextControl()->name('type.name')->label(__('user_score.type_id'))->static(),
amisMake()->TextControl()->name('cate.name')->label(__('user_score.cate_id'))->static(),
amisMake()->TextControl()->name('user.name')->label(__('user_score.user_id'))->static(),
amisMake()->TextControl()->name('title')->label(__('user_score.title'))->static(),
amisMake()->TextareaControl()->name('content')->label(__('user_score.content'))->static(),
@ -153,4 +159,13 @@ class UserScoreController extends AdminController
return $this->userOptions;
}
public function getCateOptions()
{
if (!$this->cateOptions) {
$this->cateOptions = PartyCate::select(['id as value', 'name as label'])->get();
}
return $this->cateOptions;
}
}

View File

@ -12,7 +12,7 @@ use Slowlyo\OwlAdmin\Admin;
class UserScoreService extends BaseService
{
protected array $withRelationships = ['user', 'type', 'checkUser'];
protected array $withRelationships = ['user', 'type', 'cate', 'checkUser'];
protected string $modelName = UserScore::class;

View File

@ -5,6 +5,7 @@ namespace App\Console\Commands;
use App\Models\UserScore;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use App\Models\CateRank as CateRankModel;
class CateRank extends Command
{
@ -33,6 +34,7 @@ class CateRank extends Command
$end = $time->copy()->endOfQuarter();
$sn = $time->year . '-' . $time->quarter;
$list = [];
CateRankModel::where('sn', $sn)->delete();
$scoreList = UserScore::query()
->whereBetween('created_at', [$start, $end])
->select('cate_id', DB::raw('sum(`score`) as `score`'))
@ -47,6 +49,6 @@ class CateRank extends Command
'updated_at' => $now,
];
}
\App\Models\CateRank::insert($list);
CateRankModel::insert($list);
}
}

View File

@ -5,6 +5,7 @@ namespace App\Console\Commands;
use App\Models\UserScore;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use App\Models\UserRank as UserRankModel;
class UserRank extends Command
{
@ -34,6 +35,8 @@ class UserRank extends Command
$sn = $time->year . '-' . $time->quarter;
$list = [];
UserRankModel::where('sn', $sn)->delete();
$scoreList = UserScore::with(['user'])
->whereBetween('created_at', [$start, $end])
->select('user_id', DB::raw('sum(`score`) as `score`'))
@ -49,6 +52,6 @@ class UserRank extends Command
'updated_at' => $now,
];
}
\App\Models\UserRank::insert($list);
UserRankModel::insert($list);
}
}

View File

@ -0,0 +1,39 @@
<?php
namespace App\Exports;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\Exportable;
use App\Admin\Services\CateRankService;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
class CateRank implements FromQuery, WithHeadings, WithMapping
{
use Exportable;
protected $index = 0;
public function query()
{
return CateRankService::make()->listQuery();
}
public function headings(): array
{
return [
__('user_rank.cate_id'),
__('user_rank.sort'),
__('user_rank.score'),
];
}
public function map($item): array
{
return [
$item->cate?->name,
++$this->index,
$item->score,
];
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace App\Exports;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\Exportable;
use App\Admin\Services\UserRankService;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
class UserRank implements FromQuery, WithHeadings, WithMapping
{
use Exportable;
protected $index = 0;
public function query()
{
return UserRankService::make()->listQuery();
}
public function headings(): array
{
return [
__('user_rank.cate_id'),
__('user_rank.user_id'),
__('user_rank.sort'),
__('user_rank.score'),
];
}
public function map($item): array
{
return [
$item->cate?->name,
$item->user?->name,
++$this->index,
$item->score,
];
}
}

View File

@ -13,4 +13,14 @@ class ArticleFilter extends ModelFilter
* @var array
*/
public $relations = [];
public function category($id)
{
$this->where('category_id', $id);
}
public function title($title)
{
$this->whereLike('title', $title);
}
}

View File

@ -13,4 +13,14 @@ class BannerFilter extends ModelFilter
* @var array
*/
public $relations = [];
public function place($id)
{
$this->where('place_id', $id);
}
public function title($title)
{
$this->whereLike('title', $title);
}
}

View File

@ -23,6 +23,6 @@ class CateRank extends Model
public function scopeSort($q)
{
return $q->orderBy('sn')->orderBy('score', 'desc');
$q->orderBy('sn')->orderBy('score', 'desc');
}
}

View File

@ -28,6 +28,6 @@ class UserRank extends Model
public function scopeSort($q)
{
return $q->orderBy('score', 'desc');
$q->orderBy('score', 'desc');
}
}

View File

@ -67,6 +67,6 @@ class UserScore extends Model
public function scopeSort($q)
{
return $this->orderBy('check_status')->latest('created_at');
$this->orderBy('check_status')->latest('created_at');
}
}

View File

@ -10,6 +10,7 @@
"laravel/framework": "^10.10",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8",
"maatwebsite/excel": "^3.1",
"slowlyo/owl-admin": "^2.8",
"tucker-eric/eloquentfilter": "^3.2"
},

559
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "cdbf04d84ade4b862d07a92f43293855",
"content-hash": "90a1a02161a82784cc071d76e84b662d",
"packages": [
{
"name": "brick/math",
@ -68,6 +68,93 @@
],
"time": "2022-08-10T22:54:19+00:00"
},
{
"name": "composer/semver",
"version": "3.4.0",
"source": {
"type": "git",
"url": "https://github.com/composer/semver.git",
"reference": "35e8d0af4486141bc745f23a29cc2091eb624a32"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/semver/zipball/35e8d0af4486141bc745f23a29cc2091eb624a32",
"reference": "35e8d0af4486141bc745f23a29cc2091eb624a32",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^5.3.2 || ^7.0 || ^8.0"
},
"require-dev": {
"phpstan/phpstan": "^1.4",
"symfony/phpunit-bridge": "^4.2 || ^5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.x-dev"
}
},
"autoload": {
"psr-4": {
"Composer\\Semver\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nils Adermann",
"email": "naderman@naderman.de",
"homepage": "http://www.naderman.de"
},
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
},
{
"name": "Rob Bast",
"email": "rob.bast@gmail.com",
"homepage": "http://robbast.nl"
}
],
"description": "Semver library that offers utilities, version constraint parsing and validation.",
"keywords": [
"semantic",
"semver",
"validation",
"versioning"
],
"support": {
"irc": "ircs://irc.libera.chat:6697/composer",
"issues": "https://github.com/composer/semver/issues",
"source": "https://github.com/composer/semver/tree/3.4.0"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://github.com/composer",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2023-08-31T09:50:34+00:00"
},
{
"name": "dflydev/dot-access-data",
"version": "v3.0.1",
@ -519,6 +606,73 @@
],
"time": "2023-01-14T14:17:03+00:00"
},
{
"name": "ezyang/htmlpurifier",
"version": "v4.16.0",
"source": {
"type": "git",
"url": "https://github.com/ezyang/htmlpurifier.git",
"reference": "523407fb06eb9e5f3d59889b3978d5bfe94299c8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/523407fb06eb9e5f3d59889b3978d5bfe94299c8",
"reference": "523407fb06eb9e5f3d59889b3978d5bfe94299c8",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0"
},
"require-dev": {
"cerdic/css-tidy": "^1.7 || ^2.0",
"simpletest/simpletest": "dev-master"
},
"suggest": {
"cerdic/css-tidy": "If you want to use the filter 'Filter.ExtractStyleBlocks'.",
"ext-bcmath": "Used for unit conversion and imagecrash protection",
"ext-iconv": "Converts text to and from non-UTF-8 encodings",
"ext-tidy": "Used for pretty-printing HTML"
},
"type": "library",
"autoload": {
"files": [
"library/HTMLPurifier.composer.php"
],
"psr-0": {
"HTMLPurifier": "library/"
},
"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.16.0"
},
"time": "2022-09-18T07:06:19+00:00"
},
{
"name": "fruitcake/php-cors",
"version": "v1.2.0",
@ -1991,6 +2145,298 @@
],
"time": "2023-08-03T07:14:11+00:00"
},
{
"name": "maatwebsite/excel",
"version": "3.1.50",
"source": {
"type": "git",
"url": "https://github.com/SpartnerNL/Laravel-Excel.git",
"reference": "d79e66391aa306983bb7e234503f5605c3e33348"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/SpartnerNL/Laravel-Excel/zipball/d79e66391aa306983bb7e234503f5605c3e33348",
"reference": "d79e66391aa306983bb7e234503f5605c3e33348",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"composer/semver": "^3.3",
"ext-json": "*",
"illuminate/support": "5.8.*||^6.0||^7.0||^8.0||^9.0||^10.0",
"php": "^7.0||^8.0",
"phpoffice/phpspreadsheet": "^1.18",
"psr/simple-cache": "^1.0||^2.0||^3.0"
},
"require-dev": {
"orchestra/testbench": "^6.0||^7.0||^8.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.50"
},
"funding": [
{
"url": "https://laravel-excel.com/commercial-support",
"type": "custom"
},
{
"url": "https://github.com/patrickbrouwers",
"type": "github"
}
],
"time": "2023-11-06T11:29:48+00:00"
},
{
"name": "maennchen/zipstream-php",
"version": "3.1.0",
"source": {
"type": "git",
"url": "https://github.com/maennchen/ZipStream-PHP.git",
"reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/b8174494eda667f7d13876b4a7bfef0f62a7c0d1",
"reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"ext-mbstring": "*",
"ext-zlib": "*",
"php-64bit": "^8.1"
},
"require-dev": {
"ext-zip": "*",
"friendsofphp/php-cs-fixer": "^3.16",
"guzzlehttp/guzzle": "^7.5",
"mikey179/vfsstream": "^1.6",
"php-coveralls/php-coveralls": "^2.5",
"phpunit/phpunit": "^10.0",
"vimeo/psalm": "^5.0"
},
"suggest": {
"guzzlehttp/psr7": "^2.4",
"psr/http-message": "^2.0"
},
"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/3.1.0"
},
"funding": [
{
"url": "https://github.com/maennchen",
"type": "github"
},
{
"url": "https://opencollective.com/zipstream",
"type": "open_collective"
}
],
"time": "2023-06-21T14:59:35+00:00"
},
{
"name": "markbaker/complex",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/MarkBaker/PHPComplex.git",
"reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/95c56caa1cf5c766ad6d65b6344b807c1e8405b9",
"reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^7.2 || ^8.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
"phpcompatibility/php-compatibility": "^9.3",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
"squizlabs/php_codesniffer": "^3.7"
},
"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.2"
},
"time": "2022-12-06T16:21:08+00:00"
},
{
"name": "markbaker/matrix",
"version": "3.0.1",
"source": {
"type": "git",
"url": "https://github.com/MarkBaker/PHPMatrix.git",
"reference": "728434227fe21be27ff6d86621a1b13107a2562c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/728434227fe21be27ff6d86621a1b13107a2562c",
"reference": "728434227fe21be27ff6d86621a1b13107a2562c",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
"phpcompatibility/php-compatibility": "^9.3",
"phpdocumentor/phpdocumentor": "2.*",
"phploc/phploc": "^4.0",
"phpmd/phpmd": "2.*",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
"sebastian/phpcpd": "^4.0",
"squizlabs/php_codesniffer": "^3.7"
},
"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.1"
},
"time": "2022-12-02T22:17:43+00:00"
},
{
"name": "monolog/monolog",
"version": "3.4.0",
@ -2525,6 +2971,117 @@
],
"time": "2023-02-08T01:06:31+00:00"
},
{
"name": "phpoffice/phpspreadsheet",
"version": "1.29.0",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
"reference": "fde2ccf55eaef7e86021ff1acce26479160a0fa0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/fde2ccf55eaef7e86021ff1acce26479160a0fa0",
"reference": "fde2ccf55eaef7e86021ff1acce26479160a0fa0",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"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.15",
"maennchen/zipstream-php": "^2.1 || ^3.0",
"markbaker/complex": "^3.0",
"markbaker/matrix": "^3.0",
"php": "^7.4 || ^8.0",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/simple-cache": "^1.0 || ^2.0 || ^3.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-main",
"dompdf/dompdf": "^1.0 || ^2.0",
"friendsofphp/php-cs-fixer": "^3.2",
"mitoteam/jpgraph": "^10.3",
"mpdf/mpdf": "^8.1.1",
"phpcompatibility/php-compatibility": "^9.3",
"phpstan/phpstan": "^1.1",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^8.5 || ^9.0 || ^10.0",
"squizlabs/php_codesniffer": "^3.7",
"tecnickcom/tcpdf": "^6.5"
},
"suggest": {
"dompdf/dompdf": "Option for rendering PDF with PDF Writer",
"ext-intl": "PHP Internationalization Functions",
"mitoteam/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"
},
"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.29.0"
},
"time": "2023-06-14T22:48:31+00:00"
},
{
"name": "phpoption/phpoption",
"version": "1.9.1",

View File

@ -21,7 +21,7 @@ class PartyUserFactory extends Factory
{
$faker = $this->faker;
do {
$username = $faker->userName;
$username = $faker->userName();
} while (PartyUser::where('username', $username)->exists());
return [
'username' => $username,

View File

@ -18,10 +18,10 @@ class PartyUserSeeder extends Seeder
*/
public function run(): void
{
// PartyCate::truncate();
// PartyUser::truncate();
// (new PartyCateFactory())->count(20)->create();
// (new PartyUserFactory())->count(100)->create();
PartyCate::truncate();
PartyUser::truncate();
(new PartyCateFactory())->count(20)->create();
(new PartyUserFactory())->count(100)->create();
UserScore::truncate();
UserScore::factory()->count(100)->create();

View File

@ -4,6 +4,8 @@ return [
'id' => 'ID',
'created_at' => '创建时间',
'updated_at' => '更新时间',
'user_rank' => '个人排名',
'cate_rank' => '支部排名',
'sn' => '期数',
'user_id' => '党员',