repo
stringlengths
7
63
file_url
stringlengths
81
284
file_path
stringlengths
5
200
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:02:33
2026-01-05 05:24:06
truncated
bool
2 classes
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/books/edit.blade.php
resources/views/books/edit.blade.php
@extends('layouts.simple') @section('body') <div class="container small"> <div class="my-s"> @include('entities.breadcrumbs', ['crumbs' => [ $book, $book->getUrl('/edit') => [ 'text' => trans('entities.books_edit'), 'icon' => 'edit', ] ]]) </div> <main class="content-wrap card auto-height"> <h1 class="list-heading">{{ trans('entities.books_edit') }}</h1> <form action="{{ $book->getUrl() }}" method="POST" enctype="multipart/form-data"> <input type="hidden" name="_method" value="PUT"> @include('books.parts.form', [ 'model' => $book, 'returnLocation' => $book->getUrl() ]) </form> </main> @if(userCan(\BookStack\Permissions\Permission::BookDelete, $book) && userCan(\BookStack\Permissions\Permission::BookCreateAll) && userCan(\BookStack\Permissions\Permission::BookshelfCreateAll)) @include('books.parts.convert-to-shelf', ['book' => $book]) @endif </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/books/permissions.blade.php
resources/views/books/permissions.blade.php
@extends('layouts.simple') @section('body') <div class="container"> <div class="my-s"> @include('entities.breadcrumbs', ['crumbs' => [ $book, $book->getUrl('/permissions') => [ 'text' => trans('entities.books_permissions'), 'icon' => 'lock', ] ]]) </div> <main class="card content-wrap auto-height"> @include('form.entity-permissions', ['model' => $book, 'title' => trans('entities.books_permissions')]) </main> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/books/sort.blade.php
resources/views/books/sort.blade.php
@extends('layouts.simple') @section('body') <div class="container"> <div class="my-s"> @include('entities.breadcrumbs', ['crumbs' => [ $book, $book->getUrl('/sort') => [ 'text' => trans('entities.books_sort'), 'icon' => 'sort', ] ]]) </div> <div class="grid left-focus gap-xl"> <div> <div component="book-sort" class="card content-wrap auto-height"> <h1 class="list-heading">{{ trans('entities.books_sort') }}</h1> <div class="flex-container-row gap-m wrap mb-m"> <p class="text-muted flex min-width-s mb-none">{{ trans('entities.books_sort_desc') }}</p> <div class="min-width-s"> @php $autoSortVal = intval(old('auto-sort') ?? $book->sort_rule_id ?? 0); @endphp <label for="auto-sort">{{ trans('entities.books_sort_auto_sort') }}</label> <select id="auto-sort" name="auto-sort" form="sort-form" class="{{ $errors->has('auto-sort') ? 'neg' : '' }}"> <option value="0" @if($autoSortVal === 0) selected @endif>-- {{ trans('common.none') }} -- </option> @foreach(\BookStack\Sorting\SortRule::allByName() as $rule) <option value="{{$rule->id}}" @if($autoSortVal === $rule->id) selected @endif > {{ $rule->name }} </option> @endforeach </select> </div> </div> <div refs="book-sort@sortContainer"> @include('books.parts.sort-box', ['book' => $book, 'bookChildren' => $bookChildren]) </div> <form id="sort-form" action="{{ $book->getUrl('/sort') }}" method="POST"> {{ csrf_field() }} <input type="hidden" name="_method" value="PUT"> <input refs="book-sort@input" type="hidden" name="sort-tree"> <div class="list text-right"> <a href="{{ $book->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a> <button class="button" type="submit">{{ trans('entities.books_sort_save') }}</button> </div> </form> </div> </div> <div> <main class="card content-wrap auto-height sticky-top-m"> <h2 class="list-heading">{{ trans('entities.books_sort_show_other') }}</h2> <p class="text-muted">{{ trans('entities.books_sort_show_other_desc') }}</p> @include('entities.selector', ['name' => 'books_list', 'selectorSize' => 'compact', 'entityTypes' => 'book', 'entityPermission' => 'update']) </main> </div> </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/books/delete.blade.php
resources/views/books/delete.blade.php
@extends('layouts.simple') @section('body') <div class="container small"> <div class="my-s"> @include('entities.breadcrumbs', ['crumbs' => [ $book, $book->getUrl('/delete') => [ 'text' => trans('entities.books_delete'), 'icon' => 'delete', ] ]]) </div> <div class="card content-wrap auto-height"> <h1 class="list-heading">{{ trans('entities.books_delete') }}</h1> <p>{{ trans('entities.books_delete_explain', ['bookName' => $book->name]) }}</p> <p class="text-neg"><strong>{{ trans('entities.books_delete_confirmation') }}</strong></p> <form action="{{$book->getUrl()}}" method="POST" class="text-right"> {!! csrf_field() !!} <input type="hidden" name="_method" value="DELETE"> <a href="{{$book->getUrl()}}" class="button outline">{{ trans('common.cancel') }}</a> <button type="submit" class="button">{{ trans('common.confirm') }}</button> </form> </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/books/references.blade.php
resources/views/books/references.blade.php
@extends('layouts.simple') @section('body') <div class="container small"> <div class="my-s"> @include('entities.breadcrumbs', ['crumbs' => [ $book, $book->getUrl('/references') => [ 'text' => trans('entities.references'), 'icon' => 'reference', ] ]]) </div> @include('entities.references', ['references' => $references]) </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/books/index.blade.php
resources/views/books/index.blade.php
@extends('layouts.tri') @section('body') @include('books.parts.list', ['books' => $books, 'view' => $view, 'listOptions' => $listOptions]) @stop @section('left') @if($recents) <div id="recents" class="mb-xl"> <h5>{{ trans('entities.recently_viewed') }}</h5> @include('entities.list', ['entities' => $recents, 'style' => 'compact']) </div> @endif <div id="popular" class="mb-xl"> <h5>{{ trans('entities.books_popular') }}</h5> @if(count($popular) > 0) @include('entities.list', ['entities' => $popular, 'style' => 'compact']) @else <p class="text-muted pb-l mb-none">{{ trans('entities.books_popular_empty') }}</p> @endif </div> <div id="new" class="mb-xl"> <h5>{{ trans('entities.books_new') }}</h5> @if(count($new) > 0) @include('entities.list', ['entities' => $new, 'style' => 'compact']) @else <p class="text-muted pb-l mb-none">{{ trans('entities.books_new_empty') }}</p> @endif </div> @stop @section('right') <div class="actions mb-xl"> <h5>{{ trans('common.actions') }}</h5> <div class="icon-list text-link"> @if(userCan(\BookStack\Permissions\Permission::BookCreateAll)) <a href="{{ url("/create-book") }}" data-shortcut="new" class="icon-list-item"> <span>@icon('add')</span> <span>{{ trans('entities.books_create') }}</span> </a> @endif @include('entities.view-toggle', ['view' => $view, 'type' => 'books']) <a href="{{ url('/tags') }}" class="icon-list-item"> <span>@icon('tag')</span> <span>{{ trans('entities.tags_view_tags') }}</span> </a> @if(userCan(\BookStack\Permissions\Permission::ContentImport)) <a href="{{ url('/import') }}" class="icon-list-item"> <span>@icon('upload')</span> <span>{{ trans('entities.import') }}</span> </a> @endif </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/books/copy.blade.php
resources/views/books/copy.blade.php
@extends('layouts.simple') @section('body') <div class="container small"> <div class="my-s"> @include('entities.breadcrumbs', ['crumbs' => [ $book, $book->getUrl('/copy') => [ 'text' => trans('entities.books_copy'), 'icon' => 'copy', ] ]]) </div> <div class="card content-wrap auto-height"> <h1 class="list-heading">{{ trans('entities.books_copy') }}</h1> <form action="{{ $book->getUrl('/copy') }}" method="POST"> {!! csrf_field() !!} <div class="form-group title-input"> <label for="name">{{ trans('common.name') }}</label> @include('form.text', ['name' => 'name']) </div> @include('entities.copy-considerations') <div class="form-group text-right"> <a href="{{ $book->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a> <button type="submit" class="button">{{ trans('entities.books_copy') }}</button> </div> </form> </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/books/create.blade.php
resources/views/books/create.blade.php
@extends('layouts.simple') @section('body') <div class="container small"> <div class="my-s"> @if (isset($bookshelf)) @include('entities.breadcrumbs', ['crumbs' => [ $bookshelf, $bookshelf->getUrl('/create-book') => [ 'text' => trans('entities.books_create'), 'icon' => 'add' ] ]]) @else @include('entities.breadcrumbs', ['crumbs' => [ '/books' => [ 'text' => trans('entities.books'), 'icon' => 'book' ], '/create-book' => [ 'text' => trans('entities.books_create'), 'icon' => 'add' ] ]]) @endif </div> <main class="content-wrap card"> <h1 class="list-heading">{{ trans('entities.books_create') }}</h1> <form action="{{ $bookshelf?->getUrl('/create-book') ?? url('/books') }}" method="POST" enctype="multipart/form-data"> @include('books.parts.form', [ 'returnLocation' => $bookshelf?->getUrl() ?? url('/books') ]) </form> </main> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/books/show.blade.php
resources/views/books/show.blade.php
@extends('layouts.tri') @section('container-attrs') component="entity-search" option:entity-search:entity-id="{{ $book->id }}" option:entity-search:entity-type="book" @stop @push('social-meta') <meta property="og:description" content="{{ Str::limit($book->description, 100, '...') }}"> @if($book->coverInfo()->exists()) <meta property="og:image" content="{{ $book->coverInfo()->getUrl() }}"> @endif @endpush @include('entities.body-tag-classes', ['entity' => $book]) @section('body') <div class="mb-s print-hidden"> @include('entities.breadcrumbs', ['crumbs' => [ $book, ]]) </div> <main class="content-wrap card"> <h1 class="break-text">{{$book->name}}</h1> <div refs="entity-search@contentView" class="book-content"> <div class="text-muted break-text">{!! $book->descriptionInfo()->getHtml() !!}</div> @if(count($bookChildren) > 0) <div class="entity-list book-contents"> @foreach($bookChildren as $childElement) @if($childElement->isA('chapter')) @include('chapters.parts.list-item', ['chapter' => $childElement]) @else @include('pages.parts.list-item', ['page' => $childElement]) @endif @endforeach </div> @else <div class="mt-xl"> <hr> <p class="text-muted italic mb-m mt-xl">{{ trans('entities.books_empty_contents') }}</p> <div class="icon-list block inline"> @if(userCan(\BookStack\Permissions\Permission::PageCreate, $book)) <a href="{{ $book->getUrl('/create-page') }}" class="icon-list-item text-page"> <span class="icon">@icon('page')</span> <span>{{ trans('entities.books_empty_create_page') }}</span> </a> @endif @if(userCan(\BookStack\Permissions\Permission::ChapterCreate, $book)) <a href="{{ $book->getUrl('/create-chapter') }}" class="icon-list-item text-chapter"> <span class="icon">@icon('chapter')</span> <span>{{ trans('entities.books_empty_add_chapter') }}</span> </a> @endif </div> </div> @endif </div> @include('entities.search-results') </main> @stop @section('right') <div class="mb-xl"> <h5>{{ trans('common.details') }}</h5> <div class="blended-links"> @include('entities.meta', ['entity' => $book, 'watchOptions' => $watchOptions]) @if($book->hasPermissions()) <div class="active-restriction"> @if(userCan(\BookStack\Permissions\Permission::RestrictionsManage, $book)) <a href="{{ $book->getUrl('/permissions') }}" class="entity-meta-item"> @icon('lock') <div>{{ trans('entities.books_permissions_active') }}</div> </a> @else <div class="entity-meta-item"> @icon('lock') <div>{{ trans('entities.books_permissions_active') }}</div> </div> @endif </div> @endif </div> </div> <div class="actions mb-xl"> <h5>{{ trans('common.actions') }}</h5> <div class="icon-list text-link"> @if(userCan(\BookStack\Permissions\Permission::PageCreate, $book)) <a href="{{ $book->getUrl('/create-page') }}" data-shortcut="new" class="icon-list-item"> <span>@icon('add')</span> <span>{{ trans('entities.pages_new') }}</span> </a> @endif @if(userCan(\BookStack\Permissions\Permission::ChapterCreate, $book)) <a href="{{ $book->getUrl('/create-chapter') }}" data-shortcut="new" class="icon-list-item"> <span>@icon('add')</span> <span>{{ trans('entities.chapters_new') }}</span> </a> @endif <hr class="primary-background"> @if(userCan(\BookStack\Permissions\Permission::BookUpdate, $book)) <a href="{{ $book->getUrl('/edit') }}" data-shortcut="edit" class="icon-list-item"> <span>@icon('edit')</span> <span>{{ trans('common.edit') }}</span> </a> <a href="{{ $book->getUrl('/sort') }}" data-shortcut="sort" class="icon-list-item"> <span>@icon('sort')</span> <span>{{ trans('common.sort') }}</span> </a> @endif @if(userCan(\BookStack\Permissions\Permission::BookCreateAll)) <a href="{{ $book->getUrl('/copy') }}" data-shortcut="copy" class="icon-list-item"> <span>@icon('copy')</span> <span>{{ trans('common.copy') }}</span> </a> @endif @if(userCan(\BookStack\Permissions\Permission::RestrictionsManage, $book)) <a href="{{ $book->getUrl('/permissions') }}" data-shortcut="permissions" class="icon-list-item"> <span>@icon('lock')</span> <span>{{ trans('entities.permissions') }}</span> </a> @endif @if(userCan(\BookStack\Permissions\Permission::BookDelete, $book)) <a href="{{ $book->getUrl('/delete') }}" data-shortcut="delete" class="icon-list-item"> <span>@icon('delete')</span> <span>{{ trans('common.delete') }}</span> </a> @endif <hr class="primary-background"> @if($watchOptions->canWatch() && !$watchOptions->isWatching()) @include('entities.watch-action', ['entity' => $book]) @endif @if(!user()->isGuest()) @include('entities.favourite-action', ['entity' => $book]) @endif @if(userCan(\BookStack\Permissions\Permission::ContentExport)) @include('entities.export-menu', ['entity' => $book]) @endif </div> </div> @stop @section('left') @include('entities.search-form', ['label' => trans('entities.books_search_this')]) @if($book->tags->count() > 0) <div class="mb-xl"> @include('entities.tag-list', ['entity' => $book]) </div> @endif @if(count($bookParentShelves) > 0) <div class="actions mb-xl"> <h5>{{ trans('entities.shelves') }}</h5> @include('entities.list', ['entities' => $bookParentShelves, 'style' => 'compact']) </div> @endif @if(count($activity) > 0) <div id="recent-activity" class="mb-xl"> <h5>{{ trans('entities.recent_activity') }}</h5> @include('common.activity-list', ['activity' => $activity]) </div> @endif @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/books/parts/convert-to-shelf.blade.php
resources/views/books/parts/convert-to-shelf.blade.php
<div class="content-wrap card auto-height"> <h2 class="list-heading">{{ trans('entities.convert_to_shelf') }}</h2> <p> {{ trans('entities.convert_to_shelf_contents_desc') }} <br><br> {{ trans('entities.convert_to_shelf_permissions_desc') }} </p> <div class="text-right"> <div component="dropdown" class="dropdown-container"> <button refs="dropdown@toggle" class="button outline" aria-haspopup="true" aria-expanded="false">{{ trans('entities.convert_book') }}</button> <ul refs="dropdown@menu" class="dropdown-menu" role="menu"> <li class="px-m py-s text-small text-muted"> {{ trans('entities.convert_book_confirm') }} <br> {{ trans('entities.convert_undo_warning') }} </li> <li> <form action="{{ $book->getUrl('/convert-to-shelf') }}" method="POST"> {!! csrf_field() !!} <button type="submit" class="text-link text-item">{{ trans('common.confirm') }}</button> </form> </li> </ul> </div> </div> </div>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/books/parts/sort-box.blade.php
resources/views/books/parts/sort-box.blade.php
<details class="sort-box" data-type="book" data-id="{{ $book->id }}" open> <summary> <h5 class="flex-container-row items-center justify-flex-start gap-xs"> <div class="text-book text-bigger caret-container"> @icon('caret-right') </div> <div class="entity-list-item no-hover py-s text-book px-none"> <span>@icon('book')</span> <span>{{ $book->name }}</span> </div> <div class="flex-container-row items-center text-book"> @if($book->sortRule) <span title="{{ trans('entities.books_sort_auto_sort_active', ['sortName' => $book->sortRule->name]) }}">@icon('auto-sort')</span> @endif </div> </h5> </summary> <div class="sort-box-options pb-sm"> <button type="button" data-sort="name" class="button outline small">{{ trans('entities.books_sort_name') }}</button> <button type="button" data-sort="created" class="button outline small">{{ trans('entities.books_sort_created') }}</button> <button type="button" data-sort="updated" class="button outline small">{{ trans('entities.books_sort_updated') }}</button> <button type="button" data-sort="chaptersFirst" class="button outline small">{{ trans('entities.books_sort_chapters_first') }}</button> <button type="button" data-sort="chaptersLast" class="button outline small">{{ trans('entities.books_sort_chapters_last') }}</button> </div> <ul class="sortable-page-list sort-list"> @foreach($bookChildren as $bookChild) <li class="text-{{ $bookChild->getType() }}" data-id="{{$bookChild->id}}" data-type="{{ $bookChild->getType() }}" data-name="{{ $bookChild->name }}" data-created="{{ $bookChild->created_at->timestamp }}" data-updated="{{ $bookChild->updated_at->timestamp }}" tabindex="-1"> <div class="flex-container-row items-center"> <div class="text-muted sort-list-handle px-s py-m">@icon('grip')</div> <div class="entity-list-item px-none no-hover"> <span>@icon($bookChild->getType()) </span> <div> {{ $bookChild->name }} <div> </div> </div> </div> @include('books.parts.sort-box-actions') </div> @if($bookChild->isA('chapter')) <ul class="sortable-page-sublist"> @foreach($bookChild->visible_pages as $page) <li class="text-page flex-container-row items-center" data-id="{{$page->id}}" data-type="page" data-name="{{ $page->name }}" data-created="{{ $page->created_at->timestamp }}" data-updated="{{ $page->updated_at->timestamp }}" tabindex="-1"> <div class="text-muted sort-list-handle px-s py-m">@icon('grip')</div> <div class="entity-list-item px-none no-hover"> <span>@icon('page')</span> <span>{{ $page->name }}</span> </div> @include('books.parts.sort-box-actions') </li> @endforeach </ul> @endif </li> @endforeach </ul> </details>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/books/parts/form.blade.php
resources/views/books/parts/form.blade.php
{{ csrf_field() }} <div class="form-group title-input"> <label for="name">{{ trans('common.name') }}</label> @include('form.text', ['name' => 'name', 'autofocus' => true]) </div> <div class="form-group description-input"> <label for="description_html">{{ trans('common.description') }}</label> @include('form.description-html-input') </div> <div class="form-group collapsible" component="collapsible" id="logo-control"> <button refs="collapsible@trigger" type="button" class="collapse-title text-link" aria-expanded="false"> <label>{{ trans('common.cover_image') }}</label> </button> <div refs="collapsible@content" class="collapse-content"> <p class="small">{{ trans('common.cover_image_description') }}</p> @include('form.image-picker', [ 'defaultImage' => url('/book_default_cover.png'), 'currentImage' => (($model ?? null)?->coverInfo()->getUrl(440, 250, null) ?? url('/book_default_cover.png')), 'name' => 'image', 'imageClass' => 'cover' ]) </div> </div> <div class="form-group collapsible" component="collapsible" id="tags-control"> <button refs="collapsible@trigger" type="button" class="collapse-title text-link" aria-expanded="false"> <label for="tag-manager">{{ trans('entities.book_tags') }}</label> </button> <div refs="collapsible@content" class="collapse-content"> @include('entities.tag-manager', ['entity' => $book ?? null]) </div> </div> <div class="form-group collapsible" component="collapsible" id="template-control"> <button refs="collapsible@trigger" type="button" class="collapse-title text-link" aria-expanded="false"> <label for="template-manager">{{ trans('entities.default_template') }}</label> </button> <div refs="collapsible@content" class="collapse-content"> @include('entities.template-selector', ['entity' => $book ?? null]) </div> </div> <div class="form-group text-right"> <a href="{{ $returnLocation }}" class="button outline">{{ trans('common.cancel') }}</a> <button type="submit" class="button">{{ trans('entities.books_save') }}</button> </div> @include('entities.selector-popup') @include('form.editor-translations')
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/books/parts/list.blade.php
resources/views/books/parts/list.blade.php
<main class="content-wrap mt-m card"> <div class="grid half v-center no-row-gap"> <h1 class="list-heading">{{ trans('entities.books') }}</h1> <div class="text-m-right my-m"> @include('common.sort', $listOptions->getSortControlData()) </div> </div> @if(count($books) > 0) @if($view === 'list') <div class="entity-list"> @foreach($books as $book) @include('books.parts.list-item', ['book' => $book]) @endforeach </div> @else <div class="grid third"> @foreach($books as $key => $book) @include('entities.grid-item', ['entity' => $book]) @endforeach </div> @endif <div> {!! $books->render() !!} </div> @else <p class="text-muted">{{ trans('entities.books_empty') }}</p> @if(userCan(\BookStack\Permissions\Permission::BookCreateAll)) <div class="icon-list block inline"> <a href="{{ url("/create-book") }}" class="icon-list-item text-book"> <span>@icon('add')</span> <span>{{ trans('entities.create_now') }}</span> </a> </div> @endif @endif </main>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/books/parts/list-item.blade.php
resources/views/books/parts/list-item.blade.php
@php /** * @var \BookStack\Entities\Models\Book $book */ @endphp <a href="{{ $book->getUrl() }}" class="book entity-list-item" data-entity-type="book" data-entity-id="{{$book->id}}"> <div class="entity-list-item-image bg-book" style="background-image: url('{{ $book->coverInfo()->getUrl() }}')"> @icon('book') </div> <div class="content"> <h4 class="entity-list-item-name break-text">{{ $book->name }}</h4> <div class="entity-item-snippet"> <p class="text-muted break-text mb-s text-limit-lines-1">{{ $book->descriptionInfo()->getPlain() }}</p> </div> </div> </a>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/books/parts/sort-box-actions.blade.php
resources/views/books/parts/sort-box-actions.blade.php
<div class="sort-box-actions flex-container-row items-center px-s gap-xxs"> <button type="button" data-move="up" class="icon-button p-xs text-bigger" title="{{ trans('entities.books_sort_move_up') }}">@icon('chevron-up')</button> <button type="button" data-move="down" class="icon-button p-xs text-bigger" title="{{ trans('entities.books_sort_move_down') }}">@icon('chevron-down')</button> <div class="dropdown-container" component="dropdown"> <button refs="dropdown@toggle" type="button" title="{{ trans('common.more') }}" class="icon-button p-xs text-bigger" aria-haspopup="true" aria-expanded="false"> @icon('more') </button> <div refs="dropdown@menu" class="dropdown-menu" role="menu"> <button type="button" class="text-item" data-move="prev_book">{{ trans('entities.books_sort_move_prev_book') }}</button> <button type="button" class="text-item" data-move="next_book">{{ trans('entities.books_sort_move_next_book') }}</button> <button type="button" class="text-item" data-move="prev_chapter">{{ trans('entities.books_sort_move_prev_chapter') }}</button> <button type="button" class="text-item" data-move="next_chapter">{{ trans('entities.books_sort_move_next_chapter') }}</button> <button type="button" class="text-item" data-move="book_start">{{ trans('entities.books_sort_move_book_start') }}</button> <button type="button" class="text-item" data-move="book_end">{{ trans('entities.books_sort_move_book_end') }}</button> <button type="button" class="text-item" data-move="before_chapter">{{ trans('entities.books_sort_move_before_chapter') }}</button> <button type="button" class="text-item" data-move="after_chapter">{{ trans('entities.books_sort_move_after_chapter') }}</button> </div> </div> </div>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/attachments/manager-list.blade.php
resources/views/attachments/manager-list.blade.php
<div component="sortable-list" option:sortable-list:handle-selector=".handle, a"> @foreach($attachments as $attachment) <div component="ajax-delete-row" option:ajax-delete-row:url="{{ url('/attachments/' . $attachment->id) }}" data-id="{{ $attachment->id }}" data-drag-content="{{ json_encode($attachment->editorContent()) }}" class="card drag-card"> <div class="handle">@icon('grip')</div> <div class="py-s"> <a href="{{ $attachment->getUrl() }}" target="_blank" rel="noopener">{{ $attachment->name }}</a> </div> <div class="flex-fill justify-flex-end"> <button component="event-emit-select" option:event-emit-select:name="insert" type="button" title="{{ trans('entities.attachments_insert_link') }}" class="drag-card-action text-center text-link">@icon('link')</button> @if(userCan(\BookStack\Permissions\Permission::AttachmentUpdate, $attachment)) <button component="event-emit-select" option:event-emit-select:name="edit" option:event-emit-select:id="{{ $attachment->id }}" type="button" title="{{ trans('common.edit') }}" class="drag-card-action text-center text-link">@icon('edit')</button> @endif @if(userCan(\BookStack\Permissions\Permission::AttachmentDelete, $attachment)) <div component="dropdown" class="flex-fill relative"> <button refs="dropdown@toggle" type="button" title="{{ trans('common.delete') }}" class="drag-card-action text-center text-neg">@icon('close')</button> <div refs="dropdown@menu" class="dropdown-menu"> <p class="text-neg small px-m mb-xs">{{ trans('entities.attachments_delete') }}</p> <button refs="ajax-delete-row@delete" type="button" class="text-link small delete text-item">{{ trans('common.confirm') }}</button> </div> </div> @endif </div> </div> @endforeach @if (count($attachments) === 0) <p class="small text-muted"> {{ trans('entities.attachments_no_files') }} </p> @endif </div>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/attachments/manager-link-form.blade.php
resources/views/attachments/manager-link-form.blade.php
{{-- @pageId --}} <div component="ajax-form" option:ajax-form:url="/attachments/link" option:ajax-form:method="post" option:ajax-form:response-container="#link-form-container" option:ajax-form:success-message="{{ trans('entities.attachments_link_attached') }}"> <input type="hidden" name="attachment_link_uploaded_to" value="{{ $pageId }}"> <p class="text-muted small">{{ trans('entities.attachments_explain_link') }}</p> <div class="form-group"> <label for="attachment_link_name">{{ trans('entities.attachments_link_name') }}</label> <input name="attachment_link_name" id="attachment_link_name" type="text" placeholder="{{ trans('entities.attachments_link_name') }}" value="{{ $attachment_link_name ?? '' }}"> @if($errors->has('attachment_link_name')) <div class="text-neg text-small">{{ $errors->first('attachment_link_name') }}</div> @endif </div> <div class="form-group"> <label for="attachment_link_url">{{ trans('entities.attachments_link_url') }}</label> <input name="attachment_link_url" id="attachment_link_url" type="text" placeholder="{{ trans('entities.attachments_link_url_hint') }}" value="{{ $attachment_link_url ?? '' }}"> @if($errors->has('attachment_link_url')) <div class="text-neg text-small">{{ $errors->first('attachment_link_url') }}</div> @endif </div> <button component="event-emit-select" option:event-emit-select:name="edit-back" type="button" class="button outline">{{ trans('common.cancel') }}</button> <button refs="ajax-form@submit" type="button" class="button">{{ trans('entities.attach') }}</button> </div>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/attachments/manager.blade.php
resources/views/attachments/manager.blade.php
<div style="display: block;" refs="editor-toolbox@tab-content" data-tab-content="files" component="attachments" option:attachments:page-id="{{ $page->id ?? 0 }}" class="toolbox-tab-content"> <h4>{{ trans('entities.attachments') }}</h4> <div component="dropzone" option:dropzone:url="{{ url('/attachments/upload?uploaded_to=' . $page->id) }}" option:dropzone:success-message="{{ trans('entities.attachments_file_uploaded') }}" option:dropzone:error-message="{{ trans('errors.attachment_upload_error') }}" option:dropzone:upload-limit="{{ config('app.upload_limit') }}" option:dropzone:upload-limit-message="{{ trans('errors.server_upload_limit') }}" option:dropzone:zone-text="{{ trans('entities.attachments_dropzone') }}" option:dropzone:file-accept="*" option:dropzone:allow-multiple="true" class="px-l files"> <div refs="attachments@list-container dropzone@drop-target" class="relative"> <p class="text-muted small">{{ trans('entities.attachments_explain') }} <span class="text-warn">{{ trans('entities.attachments_explain_instant_save') }}</span></p> <hr class="mb-s"> <div class="flex-container-row"> <button refs="dropzone@select-button" type="button" class="button outline small">{{ trans('entities.attachments_upload') }}</button> <button refs="attachments@attach-link-button" type="button" class="button outline small">{{ trans('entities.attachments_link') }}</button> </div> <div> <p class="text-muted text-small">{{ trans('entities.attachments_upload_drop') }}</p> </div> <div refs="dropzone@status-area" class="fixed top-right px-m py-m"></div> <hr> <div refs="attachments@list-panel"> @include('attachments.manager-list', ['attachments' => $page->attachments->all()]) </div> </div> </div> <div id="link-form-container" refs="attachments@links-container" hidden class="px-l"> @include('attachments.manager-link-form', ['pageId' => $page->id]) </div> <div id="edit-form-container" refs="attachments@edit-container" hidden class="px-l"></div> </div>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/attachments/list.blade.php
resources/views/attachments/list.blade.php
<div component="attachments-list"> @foreach($attachments as $attachment) <div class="attachment icon-list"> <div class="split-icon-list-item attachment-{{ $attachment->external ? 'link' : 'file' }}"> <a href="{{ $attachment->getUrl() }}" refs="attachments-list@link-type-{{ $attachment->external ? 'link' : 'file' }}" @if($attachment->external) target="_blank" @endif> <div class="icon">@icon($attachment->external ? 'export' : 'file')</div> <div class="label">{{ $attachment->name }}</div> </a> @if(!$attachment->external) <div component="dropdown" class="icon-list-item-dropdown"> <button refs="dropdown@toggle" type="button" class="icon-list-item-dropdown-toggle">@icon('caret-down')</button> <ul refs="dropdown@menu" class="dropdown-menu" role="menu"> <a href="{{ $attachment->getUrl(false) }}" class="icon-item"> @icon('download') <div>{{ trans('common.download') }}</div> </a> <a href="{{ $attachment->getUrl(true) }}" target="_blank" class="icon-item"> @icon('export') <div>{{ trans('common.open_in_tab') }}</div> </a> </ul> </div> @endif </div> </div> @endforeach </div>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/attachments/manager-edit-form.blade.php
resources/views/attachments/manager-edit-form.blade.php
<div component="ajax-form" option:ajax-form:url="/attachments/{{ $attachment->id }}" option:ajax-form:method="put" option:ajax-form:response-container="#edit-form-container" option:ajax-form:success-message="{{ trans('entities.attachments_updated_success') }}"> <h5>{{ trans('entities.attachments_edit_file') }}</h5> <div class="form-group"> <label for="attachment_edit_name">{{ trans('entities.attachments_edit_file_name') }}</label> <input type="text" id="attachment_edit_name" name="attachment_edit_name" value="{{ $attachment_edit_name ?? $attachment->name ?? '' }}" placeholder="{{ trans('entities.attachments_edit_file_name') }}"> @if($errors->has('attachment_edit_name')) <div class="text-neg text-small">{{ $errors->first('attachment_edit_name') }}</div> @endif </div> <div component="tabs" class="tab-container"> <div class="nav-tabs" role="tablist"> <button id="attachment-edit-file-tab" type="button" aria-controls="attachment-edit-file-panel" aria-selected="{{ $attachment->external ? 'false' : 'true' }}" role="tab">{{ trans('entities.attachments_upload') }}</button> <button id="attachment-edit-link-tab" type="button" aria-controls="attachment-edit-link-panel" aria-selected="{{ $attachment->external ? 'true' : 'false' }}" role="tab">{{ trans('entities.attachments_set_link') }}</button> </div> <div id="attachment-edit-file-panel" @if($attachment->external) hidden @endif tabindex="0" role="tabpanel" aria-labelledby="attachment-edit-file-tab" class="mb-m"> @include('form.simple-dropzone', [ 'placeholder' => trans('entities.attachments_edit_drop_upload'), 'url' => url('/attachments/upload/' . $attachment->id), 'successMessage' => trans('entities.attachments_file_updated'), ]) </div> <div id="attachment-edit-link-panel" @if(!$attachment->external) hidden @endif tabindex="0" role="tabpanel" aria-labelledby="attachment-edit-link-tab"> <div class="form-group"> <label for="attachment_edit_url">{{ trans('entities.attachments_link_url') }}</label> <input type="text" id="attachment_edit_url" name="attachment_edit_url" value="{{ $attachment_edit_url ?? ($attachment->external ? $attachment->path : '') }}" placeholder="{{ trans('entities.attachment_link') }}"> @if($errors->has('attachment_edit_url')) <div class="text-neg text-small">{{ $errors->first('attachment_edit_url') }}</div> @endif </div> </div> </div> <button component="event-emit-select" option:event-emit-select:name="edit-back" type="button" class="button outline">{{ trans('common.back') }}</button> <button refs="ajax-form@submit" type="button" class="button">{{ trans('common.save') }}</button> </div>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/chapters/move.blade.php
resources/views/chapters/move.blade.php
@extends('layouts.simple') @section('body') <div class="container small"> <div class="my-s"> @include('entities.breadcrumbs', ['crumbs' => [ $chapter->book, $chapter, $chapter->getUrl('/move') => [ 'text' => trans('entities.chapters_move'), 'icon' => 'folder', ] ]]) </div> <main class="card content-wrap"> <h1 class="list-heading">{{ trans('entities.chapters_move') }}</h1> <form action="{{ $chapter->getUrl('/move') }}" method="POST"> {!! csrf_field() !!} <input type="hidden" name="_method" value="PUT"> @include('entities.selector', ['name' => 'entity_selection', 'selectorSize' => 'large', 'entityTypes' => 'book', 'entityPermission' => 'chapter-create']) <div class="form-group text-right"> <a href="{{ $chapter->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a> <button type="submit" class="button">{{ trans('entities.chapters_move') }}</button> </div> </form> </main> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/chapters/edit.blade.php
resources/views/chapters/edit.blade.php
@extends('layouts.simple') @section('body') <div class="container small"> <div class="my-s"> @include('entities.breadcrumbs', ['crumbs' => [ $book, $chapter, $chapter->getUrl('/edit') => [ 'text' => trans('entities.chapters_edit'), 'icon' => 'edit' ] ]]) </div> <main class="content-wrap card auto-height"> <h1 class="list-heading">{{ trans('entities.chapters_edit') }}</h1> <form action="{{ $chapter->getUrl() }}" method="POST"> <input type="hidden" name="_method" value="PUT"> @include('chapters.parts.form', ['model' => $chapter]) </form> </main> @if(userCan(\BookStack\Permissions\Permission::ChapterDelete, $chapter) && userCan(\BookStack\Permissions\Permission::BookCreateAll)) @include('chapters.parts.convert-to-book') @endif </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/chapters/permissions.blade.php
resources/views/chapters/permissions.blade.php
@extends('layouts.simple') @section('body') <div class="container"> <div class="my-s"> @include('entities.breadcrumbs', ['crumbs' => [ $chapter->book, $chapter, $chapter->getUrl('/permissions') => [ 'text' => trans('entities.chapters_permissions'), 'icon' => 'lock', ] ]]) </div> <main class="card content-wrap auto-height"> @include('form.entity-permissions', ['model' => $chapter, 'title' => trans('entities.chapters_permissions')]) </main> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/chapters/delete.blade.php
resources/views/chapters/delete.blade.php
@extends('layouts.simple') @section('body') <div class="container small"> <div class="my-s"> @include('entities.breadcrumbs', ['crumbs' => [ $chapter->book, $chapter, $chapter->getUrl('/delete') => [ 'text' => trans('entities.chapters_delete'), 'icon' => 'delete', ] ]]) </div> <div class="card content-wrap auto-height"> <h1 class="list-heading">{{ trans('entities.chapters_delete') }}</h1> <p>{{ trans('entities.chapters_delete_explain', ['chapterName' => $chapter->name]) }}</p> <p class="text-neg"><strong>{{ trans('entities.chapters_delete_confirm') }}</strong></p> <form action="{{ $chapter->getUrl() }}" method="POST"> {!! csrf_field() !!} <input type="hidden" name="_method" value="DELETE"> <div class="text-right"> <a href="{{ $chapter->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a> <button type="submit" class="button">{{ trans('common.confirm') }}</button> </div> </form> </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/chapters/references.blade.php
resources/views/chapters/references.blade.php
@extends('layouts.simple') @section('body') <div class="container small"> <div class="my-s"> @include('entities.breadcrumbs', ['crumbs' => [ $chapter->book, $chapter, $chapter->getUrl('/references') => [ 'text' => trans('entities.references'), 'icon' => 'reference', ] ]]) </div> @include('entities.references', ['references' => $references]) </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/chapters/copy.blade.php
resources/views/chapters/copy.blade.php
@extends('layouts.simple') @section('body') <div class="container small"> <div class="my-s"> @include('entities.breadcrumbs', ['crumbs' => [ $chapter->book, $chapter, $chapter->getUrl('/copy') => [ 'text' => trans('entities.chapters_copy'), 'icon' => 'copy', ] ]]) </div> <div class="card content-wrap auto-height"> <h1 class="list-heading">{{ trans('entities.chapters_copy') }}</h1> <form action="{{ $chapter->getUrl('/copy') }}" method="POST"> {!! csrf_field() !!} <div class="form-group title-input"> <label for="name">{{ trans('common.name') }}</label> @include('form.text', ['name' => 'name']) </div> <div class="form-group" collapsible> <button type="button" class="collapse-title text-link" collapsible-trigger aria-expanded="false"> <label for="entity_selection">{{ trans('entities.pages_copy_desination') }}</label> </button> <div class="collapse-content" collapsible-content> @include('entities.selector', ['name' => 'entity_selection', 'selectorSize' => 'large', 'entityTypes' => 'book', 'entityPermission' => 'chapter-create']) </div> </div> @include('entities.copy-considerations') <div class="form-group text-right"> <a href="{{ $chapter->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a> <button type="submit" class="button">{{ trans('entities.chapters_copy') }}</button> </div> </form> </div> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/chapters/create.blade.php
resources/views/chapters/create.blade.php
@extends('layouts.simple') @section('body') <div class="container small"> <div class="my-s"> @include('entities.breadcrumbs', ['crumbs' => [ $book, $book->getUrl('create-chapter') => [ 'text' => trans('entities.chapters_create'), 'icon' => 'add', ] ]]) </div> <main class="content-wrap card"> <h1 class="list-heading">{{ trans('entities.chapters_create') }}</h1> <form action="{{ $book->getUrl('/create-chapter') }}" method="POST"> @include('chapters.parts.form') </form> </main> </div> @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/chapters/show.blade.php
resources/views/chapters/show.blade.php
@extends('layouts.tri') @section('container-attrs') component="entity-search" option:entity-search:entity-id="{{ $chapter->id }}" option:entity-search:entity-type="chapter" @stop @push('social-meta') <meta property="og:description" content="{{ Str::limit($chapter->description, 100, '...') }}"> @endpush @include('entities.body-tag-classes', ['entity' => $chapter]) @section('body') <div class="mb-m print-hidden"> @include('entities.breadcrumbs', ['crumbs' => [ $chapter->book, $chapter, ]]) </div> <main class="content-wrap card"> <h1 class="break-text">{{ $chapter->name }}</h1> <div refs="entity-search@contentView" class="chapter-content"> <div class="text-muted break-text">{!! $chapter->descriptionInfo()->getHtml() !!}</div> @if(count($pages) > 0) <div class="entity-list book-contents"> @foreach($pages as $page) @include('pages.parts.list-item', ['page' => $page]) @endforeach </div> @else <div class="mt-xl"> <hr> <p class="text-muted italic mb-m mt-xl">{{ trans('entities.chapters_empty') }}</p> <div class="icon-list block inline"> @if(userCan(\BookStack\Permissions\Permission::PageCreate, $chapter)) <a href="{{ $chapter->getUrl('/create-page') }}" class="icon-list-item text-page"> <span class="icon">@icon('page')</span> <span>{{ trans('entities.books_empty_create_page') }}</span> </a> @endif @if(userCan(\BookStack\Permissions\Permission::BookUpdate, $book)) <a href="{{ $book->getUrl('/sort') }}" class="icon-list-item text-book"> <span class="icon">@icon('book')</span> <span>{{ trans('entities.books_empty_sort_current_book') }}</span> </a> @endif </div> </div> @endif </div> @include('entities.search-results') </main> @include('entities.sibling-navigation', ['next' => $next, 'previous' => $previous]) @stop @section('right') <div class="mb-xl"> <h5>{{ trans('common.details') }}</h5> <div class="blended-links"> @include('entities.meta', ['entity' => $chapter, 'watchOptions' => $watchOptions]) @if($book->hasPermissions()) <div class="active-restriction"> @if(userCan(\BookStack\Permissions\Permission::RestrictionsManage, $book)) <a href="{{ $book->getUrl('/permissions') }}" class="entity-meta-item"> @icon('lock') <div>{{ trans('entities.books_permissions_active') }}</div> </a> @else <div class="entity-meta-item"> @icon('lock') <div>{{ trans('entities.books_permissions_active') }}</div> </div> @endif </div> @endif @if($chapter->hasPermissions()) <div class="active-restriction"> @if(userCan(\BookStack\Permissions\Permission::RestrictionsManage, $chapter)) <a href="{{ $chapter->getUrl('/permissions') }}" class="entity-meta-item"> @icon('lock') <div>{{ trans('entities.chapters_permissions_active') }}</div> </a> @else <div class="entity-meta-item"> @icon('lock') <div>{{ trans('entities.chapters_permissions_active') }}</div> </div> @endif </div> @endif </div> </div> <div class="actions mb-xl"> <h5>{{ trans('common.actions') }}</h5> <div class="icon-list text-link"> @if(userCan(\BookStack\Permissions\Permission::PageCreate, $chapter)) <a href="{{ $chapter->getUrl('/create-page') }}" data-shortcut="new" class="icon-list-item"> <span>@icon('add')</span> <span>{{ trans('entities.pages_new') }}</span> </a> @endif <hr class="primary-background"/> @if(userCan(\BookStack\Permissions\Permission::ChapterUpdate, $chapter)) <a href="{{ $chapter->getUrl('/edit') }}" data-shortcut="edit" class="icon-list-item"> <span>@icon('edit')</span> <span>{{ trans('common.edit') }}</span> </a> @endif @if(userCanOnAny(\BookStack\Permissions\Permission::Create, \BookStack\Entities\Models\Book::class) || userCan(\BookStack\Permissions\Permission::ChapterCreateAll) || userCan(\BookStack\Permissions\Permission::ChapterCreateOwn)) <a href="{{ $chapter->getUrl('/copy') }}" data-shortcut="copy" class="icon-list-item"> <span>@icon('copy')</span> <span>{{ trans('common.copy') }}</span> </a> @endif @if(userCan(\BookStack\Permissions\Permission::ChapterUpdate, $chapter) && userCan(\BookStack\Permissions\Permission::ChapterDelete, $chapter)) <a href="{{ $chapter->getUrl('/move') }}" data-shortcut="move" class="icon-list-item"> <span>@icon('folder')</span> <span>{{ trans('common.move') }}</span> </a> @endif @if(userCan(\BookStack\Permissions\Permission::RestrictionsManage, $chapter)) <a href="{{ $chapter->getUrl('/permissions') }}" data-shortcut="permissions" class="icon-list-item"> <span>@icon('lock')</span> <span>{{ trans('entities.permissions') }}</span> </a> @endif @if(userCan(\BookStack\Permissions\Permission::ChapterDelete, $chapter)) <a href="{{ $chapter->getUrl('/delete') }}" data-shortcut="delete" class="icon-list-item"> <span>@icon('delete')</span> <span>{{ trans('common.delete') }}</span> </a> @endif @if($chapter->book && userCan(\BookStack\Permissions\Permission::BookUpdate, $chapter->book)) <hr class="primary-background"/> <a href="{{ $chapter->book->getUrl('/sort') }}" data-shortcut="sort" class="icon-list-item"> <span>@icon('sort')</span> <span>{{ trans('entities.chapter_sort_book') }}</span> </a> @endif <hr class="primary-background"/> @if($watchOptions->canWatch() && !$watchOptions->isWatching()) @include('entities.watch-action', ['entity' => $chapter]) @endif @if(!user()->isGuest()) @include('entities.favourite-action', ['entity' => $chapter]) @endif @if(userCan(\BookStack\Permissions\Permission::ContentExport)) @include('entities.export-menu', ['entity' => $chapter]) @endif </div> </div> @stop @section('left') @include('entities.search-form', ['label' => trans('entities.chapters_search_this')]) @if($chapter->tags->count() > 0) <div class="mb-xl"> @include('entities.tag-list', ['entity' => $chapter]) </div> @endif @include('entities.book-tree', ['book' => $book, 'sidebarTree' => $sidebarTree]) @stop
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/chapters/parts/convert-to-book.blade.php
resources/views/chapters/parts/convert-to-book.blade.php
<div class="content-wrap card auto-height"> <h2 class="list-heading">{{ trans('entities.convert_to_book') }}</h2> <div class="grid half left-focus no-row-gap"> <p> {{ trans('entities.convert_to_book_desc') }} </p> <div class="text-m-right"> <div component="dropdown" class="dropdown-container"> <button refs="dropdown@toggle" class="button outline" aria-haspopup="true" aria-expanded="false"> {{ trans('entities.convert_chapter') }} </button> <ul refs="dropdown@menu" class="dropdown-menu" role="menu"> <li class="px-m py-s text-small text-muted"> {{ trans('entities.convert_chapter_confirm') }} <br> {{ trans('entities.convert_undo_warning') }} </li> <li> <form action="{{ $chapter->getUrl('/convert-to-book') }}" method="POST"> {!! csrf_field() !!} <button type="submit" class="text-link text-item">{{ trans('common.confirm') }}</button> </form> </li> </ul> </div> </div> </div> </div>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/chapters/parts/form.blade.php
resources/views/chapters/parts/form.blade.php
{{ csrf_field() }} <div class="form-group title-input"> <label for="name">{{ trans('common.name') }}</label> @include('form.text', ['name' => 'name', 'autofocus' => true]) </div> <div class="form-group description-input"> <label for="description_html">{{ trans('common.description') }}</label> @include('form.description-html-input') </div> <div class="form-group collapsible" component="collapsible" id="logo-control"> <button refs="collapsible@trigger" type="button" class="collapse-title text-link" aria-expanded="false"> <label for="tags">{{ trans('entities.chapter_tags') }}</label> </button> <div refs="collapsible@content" class="collapse-content"> @include('entities.tag-manager', ['entity' => $chapter ?? null]) </div> </div> <div class="form-group collapsible" component="collapsible" id="template-control"> <button refs="collapsible@trigger" type="button" class="collapse-title text-link" aria-expanded="false"> <label for="template-manager">{{ trans('entities.default_template') }}</label> </button> <div refs="collapsible@content" class="collapse-content"> @include('entities.template-selector', ['entity' => $chapter ?? null]) </div> </div> <div class="form-group text-right"> <a href="{{ isset($chapter) ? $chapter->getUrl() : $book->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a> <button type="submit" class="button">{{ trans('entities.chapters_save') }}</button> </div> @include('entities.selector-popup') @include('form.editor-translations')
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/chapters/parts/child-menu.blade.php
resources/views/chapters/parts/child-menu.blade.php
<div component="chapter-contents" class="chapter-child-menu"> <button type="button" refs="chapter-contents@toggle" aria-expanded="{{ $isOpen ? 'true' : 'false' }}" class="text-muted chapter-contents-toggle @if($isOpen) open @endif"> @icon('caret-right') @icon('page') <span>{{ trans_choice('entities.x_pages', $bookChild->visible_pages->count()) }}</span> </button> <ul refs="chapter-contents@list" class="chapter-contents-list sub-menu inset-list @if($isOpen) open @endif" @if($isOpen) style="display: block;" @endif role="menu"> @foreach($bookChild->visible_pages as $childPage) <li class="list-item-page {{ $childPage->isA('page') && $childPage->draft ? 'draft' : '' }}" role="presentation"> @include('entities.list-item-basic', ['entity' => $childPage, 'classes' => $current->matches($childPage)? 'selected' : '' ]) </li> @endforeach </ul> </div>
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
BookStackApp/BookStack
https://github.com/BookStackApp/BookStack/blob/e6b754fad029d6c35e139b907d04e6510775997b/resources/views/chapters/parts/list-item.blade.php
resources/views/chapters/parts/list-item.blade.php
{{--This view display child pages in a list if pre-loaded onto a 'visible_pages' property,--}} {{--To ensure that the pages have been loaded efficiently with permissions taken into account.--}} <a href="{{ $chapter->getUrl() }}" class="chapter entity-list-item @if($chapter->visible_pages->count() > 0) has-children @endif" data-entity-type="chapter" data-entity-id="{{$chapter->id}}"> <span class="icon text-chapter">@icon('chapter')</span> <div class="content"> <h4 class="entity-list-item-name break-text">{{ $chapter->name }}</h4> <div class="entity-item-snippet"> <p class="text-muted break-text">{{ $chapter->getExcerpt() }}</p> </div> </div> </a> @if ($chapter->visible_pages->count() > 0) <div class="chapter chapter-expansion"> <span class="icon text-chapter">@icon('page')</span> <div component="chapter-contents" class="content"> <button type="button" refs="chapter-contents@toggle" aria-expanded="false" class="text-muted chapter-contents-toggle">@icon('caret-right') <span>{{ trans_choice('entities.x_pages', $chapter->visible_pages->count()) }}</span></button> <div refs="chapter-contents@list" class="inset-list chapter-contents-list"> <div class="entity-list-item-children"> @include('entities.list', ['entities' => $chapter->visible_pages]) </div> </div> </div> </div> @endif
php
MIT
e6b754fad029d6c35e139b907d04e6510775997b
2026-01-04T15:02:34.418809Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/dcat_admin_ide_helper.php
dcat_admin_ide_helper.php
<?php /** * A helper file for Dcat Admin, to provide autocomplete information to your IDE * * This file should not be included in your code, only analyzed by your IDE! * * @author jqh <841324345@qq.com> */ namespace Dcat\Admin { use Illuminate\Support\Collection; /** * @property Grid\Column|Collection id * @property Grid\Column|Collection wholesale_price_cnf * @property Grid\Column|Collection other_ipu_cnf * @property Grid\Column|Collection api_hook * @property Grid\Column|Collection created_at * @property Grid\Column|Collection detail * @property Grid\Column|Collection name * @property Grid\Column|Collection type * @property Grid\Column|Collection updated_at * @property Grid\Column|Collection version * @property Grid\Column|Collection is_enabled * @property Grid\Column|Collection extension * @property Grid\Column|Collection icon * @property Grid\Column|Collection order * @property Grid\Column|Collection parent_id * @property Grid\Column|Collection uri * @property Grid\Column|Collection menu_id * @property Grid\Column|Collection permission_id * @property Grid\Column|Collection http_method * @property Grid\Column|Collection http_path * @property Grid\Column|Collection slug * @property Grid\Column|Collection role_id * @property Grid\Column|Collection user_id * @property Grid\Column|Collection value * @property Grid\Column|Collection avatar * @property Grid\Column|Collection password * @property Grid\Column|Collection remember_token * @property Grid\Column|Collection username * @property Grid\Column|Collection carmi * @property Grid\Column|Collection deleted_at * @property Grid\Column|Collection goods_id * @property Grid\Column|Collection status * @property Grid\Column|Collection coupon * @property Grid\Column|Collection discount * @property Grid\Column|Collection is_open * @property Grid\Column|Collection is_use * @property Grid\Column|Collection ret * @property Grid\Column|Collection coupons_id * @property Grid\Column|Collection tpl_content * @property Grid\Column|Collection tpl_name * @property Grid\Column|Collection tpl_token * @property Grid\Column|Collection connection * @property Grid\Column|Collection exception * @property Grid\Column|Collection failed_at * @property Grid\Column|Collection payload * @property Grid\Column|Collection queue * @property Grid\Column|Collection actual_price * @property Grid\Column|Collection buy_limit_num * @property Grid\Column|Collection buy_prompt * @property Grid\Column|Collection gd_name * @property Grid\Column|Collection group_id * @property Grid\Column|Collection in_stock * @property Grid\Column|Collection ord * @property Grid\Column|Collection picture * @property Grid\Column|Collection retail_price * @property Grid\Column|Collection sales_volume * @property Grid\Column|Collection gp_name * @property Grid\Column|Collection buy_amount * @property Grid\Column|Collection buy_ip * @property Grid\Column|Collection coupon_discount_price * @property Grid\Column|Collection coupon_id * @property Grid\Column|Collection email * @property Grid\Column|Collection goods_price * @property Grid\Column|Collection info * @property Grid\Column|Collection order_sn * @property Grid\Column|Collection pay_id * @property Grid\Column|Collection search_pwd * @property Grid\Column|Collection total_price * @property Grid\Column|Collection trade_no * @property Grid\Column|Collection wholesale_discount_price * @property Grid\Column|Collection merchant_id * @property Grid\Column|Collection merchant_key * @property Grid\Column|Collection merchant_pem * @property Grid\Column|Collection pay_check * @property Grid\Column|Collection pay_client * @property Grid\Column|Collection pay_handleroute * @property Grid\Column|Collection pay_method * @property Grid\Column|Collection pay_name * * @method Grid\Column|Collection id(string $label = null) * @method Grid\Column|Collection wholesale_price_cnf(string $label = null) * @method Grid\Column|Collection other_ipu_cnf(string $label = null) * @method Grid\Column|Collection api_hook(string $label = null) * @method Grid\Column|Collection created_at(string $label = null) * @method Grid\Column|Collection detail(string $label = null) * @method Grid\Column|Collection name(string $label = null) * @method Grid\Column|Collection type(string $label = null) * @method Grid\Column|Collection updated_at(string $label = null) * @method Grid\Column|Collection version(string $label = null) * @method Grid\Column|Collection is_enabled(string $label = null) * @method Grid\Column|Collection extension(string $label = null) * @method Grid\Column|Collection icon(string $label = null) * @method Grid\Column|Collection order(string $label = null) * @method Grid\Column|Collection parent_id(string $label = null) * @method Grid\Column|Collection uri(string $label = null) * @method Grid\Column|Collection menu_id(string $label = null) * @method Grid\Column|Collection permission_id(string $label = null) * @method Grid\Column|Collection http_method(string $label = null) * @method Grid\Column|Collection http_path(string $label = null) * @method Grid\Column|Collection slug(string $label = null) * @method Grid\Column|Collection role_id(string $label = null) * @method Grid\Column|Collection user_id(string $label = null) * @method Grid\Column|Collection value(string $label = null) * @method Grid\Column|Collection avatar(string $label = null) * @method Grid\Column|Collection password(string $label = null) * @method Grid\Column|Collection remember_token(string $label = null) * @method Grid\Column|Collection username(string $label = null) * @method Grid\Column|Collection carmi(string $label = null) * @method Grid\Column|Collection deleted_at(string $label = null) * @method Grid\Column|Collection goods_id(string $label = null) * @method Grid\Column|Collection status(string $label = null) * @method Grid\Column|Collection coupon(string $label = null) * @method Grid\Column|Collection discount(string $label = null) * @method Grid\Column|Collection is_open(string $label = null) * @method Grid\Column|Collection is_use(string $label = null) * @method Grid\Column|Collection ret(string $label = null) * @method Grid\Column|Collection coupons_id(string $label = null) * @method Grid\Column|Collection tpl_content(string $label = null) * @method Grid\Column|Collection tpl_name(string $label = null) * @method Grid\Column|Collection tpl_token(string $label = null) * @method Grid\Column|Collection connection(string $label = null) * @method Grid\Column|Collection exception(string $label = null) * @method Grid\Column|Collection failed_at(string $label = null) * @method Grid\Column|Collection payload(string $label = null) * @method Grid\Column|Collection queue(string $label = null) * @method Grid\Column|Collection actual_price(string $label = null) * @method Grid\Column|Collection buy_limit_num(string $label = null) * @method Grid\Column|Collection buy_prompt(string $label = null) * @method Grid\Column|Collection gd_name(string $label = null) * @method Grid\Column|Collection group_id(string $label = null) * @method Grid\Column|Collection in_stock(string $label = null) * @method Grid\Column|Collection ord(string $label = null) * @method Grid\Column|Collection picture(string $label = null) * @method Grid\Column|Collection retail_price(string $label = null) * @method Grid\Column|Collection sales_volume(string $label = null) * @method Grid\Column|Collection gp_name(string $label = null) * @method Grid\Column|Collection buy_amount(string $label = null) * @method Grid\Column|Collection buy_ip(string $label = null) * @method Grid\Column|Collection coupon_discount_price(string $label = null) * @method Grid\Column|Collection coupon_id(string $label = null) * @method Grid\Column|Collection email(string $label = null) * @method Grid\Column|Collection goods_price(string $label = null) * @method Grid\Column|Collection info(string $label = null) * @method Grid\Column|Collection order_sn(string $label = null) * @method Grid\Column|Collection pay_id(string $label = null) * @method Grid\Column|Collection search_pwd(string $label = null) * @method Grid\Column|Collection total_price(string $label = null) * @method Grid\Column|Collection trade_no(string $label = null) * @method Grid\Column|Collection wholesale_discount_price(string $label = null) * @method Grid\Column|Collection merchant_id(string $label = null) * @method Grid\Column|Collection merchant_key(string $label = null) * @method Grid\Column|Collection merchant_pem(string $label = null) * @method Grid\Column|Collection pay_check(string $label = null) * @method Grid\Column|Collection pay_client(string $label = null) * @method Grid\Column|Collection pay_handleroute(string $label = null) * @method Grid\Column|Collection pay_method(string $label = null) * @method Grid\Column|Collection pay_name(string $label = null) */ class Grid {} class MiniGrid extends Grid {} /** * @property Show\Field|Collection id * @property Show\Field|Collection wholesale_price_cnf * @property Show\Field|Collection other_ipu_cnf * @property Show\Field|Collection api_hook * @property Show\Field|Collection created_at * @property Show\Field|Collection detail * @property Show\Field|Collection name * @property Show\Field|Collection type * @property Show\Field|Collection updated_at * @property Show\Field|Collection version * @property Show\Field|Collection is_enabled * @property Show\Field|Collection extension * @property Show\Field|Collection icon * @property Show\Field|Collection order * @property Show\Field|Collection parent_id * @property Show\Field|Collection uri * @property Show\Field|Collection menu_id * @property Show\Field|Collection permission_id * @property Show\Field|Collection http_method * @property Show\Field|Collection http_path * @property Show\Field|Collection slug * @property Show\Field|Collection role_id * @property Show\Field|Collection user_id * @property Show\Field|Collection value * @property Show\Field|Collection avatar * @property Show\Field|Collection password * @property Show\Field|Collection remember_token * @property Show\Field|Collection username * @property Show\Field|Collection carmi * @property Show\Field|Collection deleted_at * @property Show\Field|Collection goods_id * @property Show\Field|Collection status * @property Show\Field|Collection coupon * @property Show\Field|Collection discount * @property Show\Field|Collection is_open * @property Show\Field|Collection is_use * @property Show\Field|Collection ret * @property Show\Field|Collection coupons_id * @property Show\Field|Collection tpl_content * @property Show\Field|Collection tpl_name * @property Show\Field|Collection tpl_token * @property Show\Field|Collection connection * @property Show\Field|Collection exception * @property Show\Field|Collection failed_at * @property Show\Field|Collection payload * @property Show\Field|Collection queue * @property Show\Field|Collection actual_price * @property Show\Field|Collection buy_limit_num * @property Show\Field|Collection buy_prompt * @property Show\Field|Collection gd_name * @property Show\Field|Collection group_id * @property Show\Field|Collection in_stock * @property Show\Field|Collection ord * @property Show\Field|Collection picture * @property Show\Field|Collection retail_price * @property Show\Field|Collection sales_volume * @property Show\Field|Collection gp_name * @property Show\Field|Collection buy_amount * @property Show\Field|Collection buy_ip * @property Show\Field|Collection coupon_discount_price * @property Show\Field|Collection coupon_id * @property Show\Field|Collection email * @property Show\Field|Collection goods_price * @property Show\Field|Collection info * @property Show\Field|Collection order_sn * @property Show\Field|Collection pay_id * @property Show\Field|Collection search_pwd * @property Show\Field|Collection total_price * @property Show\Field|Collection trade_no * @property Show\Field|Collection wholesale_discount_price * @property Show\Field|Collection merchant_id * @property Show\Field|Collection merchant_key * @property Show\Field|Collection merchant_pem * @property Show\Field|Collection pay_check * @property Show\Field|Collection pay_client * @property Show\Field|Collection pay_handleroute * @property Show\Field|Collection pay_method * @property Show\Field|Collection pay_name * * @method Show\Field|Collection id(string $label = null) * @method Show\Field|Collection wholesale_price_cnf(string $label = null) * @method Show\Field|Collection other_ipu_cnf(string $label = null) * @method Show\Field|Collection api_hook(string $label = null) * @method Show\Field|Collection created_at(string $label = null) * @method Show\Field|Collection detail(string $label = null) * @method Show\Field|Collection name(string $label = null) * @method Show\Field|Collection type(string $label = null) * @method Show\Field|Collection updated_at(string $label = null) * @method Show\Field|Collection version(string $label = null) * @method Show\Field|Collection is_enabled(string $label = null) * @method Show\Field|Collection extension(string $label = null) * @method Show\Field|Collection icon(string $label = null) * @method Show\Field|Collection order(string $label = null) * @method Show\Field|Collection parent_id(string $label = null) * @method Show\Field|Collection uri(string $label = null) * @method Show\Field|Collection menu_id(string $label = null) * @method Show\Field|Collection permission_id(string $label = null) * @method Show\Field|Collection http_method(string $label = null) * @method Show\Field|Collection http_path(string $label = null) * @method Show\Field|Collection slug(string $label = null) * @method Show\Field|Collection role_id(string $label = null) * @method Show\Field|Collection user_id(string $label = null) * @method Show\Field|Collection value(string $label = null) * @method Show\Field|Collection avatar(string $label = null) * @method Show\Field|Collection password(string $label = null) * @method Show\Field|Collection remember_token(string $label = null) * @method Show\Field|Collection username(string $label = null) * @method Show\Field|Collection carmi(string $label = null) * @method Show\Field|Collection deleted_at(string $label = null) * @method Show\Field|Collection goods_id(string $label = null) * @method Show\Field|Collection status(string $label = null) * @method Show\Field|Collection coupon(string $label = null) * @method Show\Field|Collection discount(string $label = null) * @method Show\Field|Collection is_open(string $label = null) * @method Show\Field|Collection is_use(string $label = null) * @method Show\Field|Collection ret(string $label = null) * @method Show\Field|Collection coupons_id(string $label = null) * @method Show\Field|Collection tpl_content(string $label = null) * @method Show\Field|Collection tpl_name(string $label = null) * @method Show\Field|Collection tpl_token(string $label = null) * @method Show\Field|Collection connection(string $label = null) * @method Show\Field|Collection exception(string $label = null) * @method Show\Field|Collection failed_at(string $label = null) * @method Show\Field|Collection payload(string $label = null) * @method Show\Field|Collection queue(string $label = null) * @method Show\Field|Collection actual_price(string $label = null) * @method Show\Field|Collection buy_limit_num(string $label = null) * @method Show\Field|Collection buy_prompt(string $label = null) * @method Show\Field|Collection gd_name(string $label = null) * @method Show\Field|Collection group_id(string $label = null) * @method Show\Field|Collection in_stock(string $label = null) * @method Show\Field|Collection ord(string $label = null) * @method Show\Field|Collection picture(string $label = null) * @method Show\Field|Collection retail_price(string $label = null) * @method Show\Field|Collection sales_volume(string $label = null) * @method Show\Field|Collection gp_name(string $label = null) * @method Show\Field|Collection buy_amount(string $label = null) * @method Show\Field|Collection buy_ip(string $label = null) * @method Show\Field|Collection coupon_discount_price(string $label = null) * @method Show\Field|Collection coupon_id(string $label = null) * @method Show\Field|Collection email(string $label = null) * @method Show\Field|Collection goods_price(string $label = null) * @method Show\Field|Collection info(string $label = null) * @method Show\Field|Collection order_sn(string $label = null) * @method Show\Field|Collection pay_id(string $label = null) * @method Show\Field|Collection search_pwd(string $label = null) * @method Show\Field|Collection total_price(string $label = null) * @method Show\Field|Collection trade_no(string $label = null) * @method Show\Field|Collection wholesale_discount_price(string $label = null) * @method Show\Field|Collection merchant_id(string $label = null) * @method Show\Field|Collection merchant_key(string $label = null) * @method Show\Field|Collection merchant_pem(string $label = null) * @method Show\Field|Collection pay_check(string $label = null) * @method Show\Field|Collection pay_client(string $label = null) * @method Show\Field|Collection pay_handleroute(string $label = null) * @method Show\Field|Collection pay_method(string $label = null) * @method Show\Field|Collection pay_name(string $label = null) */ class Show {} /** */ class Form {} } namespace Dcat\Admin\Grid { /** */ class Column {} /** */ class Filter {} } namespace Dcat\Admin\Show { /** */ class Field {} }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/server.php
server.php
<?php /** * Laravel - A PHP Framework For Web Artisans * * @package Laravel * @author Taylor Otwell <taylor@laravel.com> */ $uri = urldecode( parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) ); // This file allows us to emulate Apache's "mod_rewrite" functionality from the // built-in PHP web server. This provides a convenient way to test a Laravel // application without having installed a "real" web server software here. if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { return false; } require_once __DIR__.'/public/index.php';
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/User.php
app/User.php
<?php namespace App; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; class User extends Authenticatable { use Notifiable; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'name', 'email', 'password', ]; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; /** * The attributes that should be cast to native types. * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', ]; }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Jobs/ApiHook.php
app/Jobs/ApiHook.php
<?php namespace App\Jobs; use App\Models\Order; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; class ApiHook implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; /** * 任务最大尝试次数。 * * @var int */ public $tries = 2; /** * 任务运行的超时时间。 * * @var int */ public $timeout = 30; /** * @var Order */ private $order; /** * 商品服务层. * @var \App\Service\PayService */ private $goodsService; /** * Create a new job instance. * * @return void */ public function __construct(Order $order) { $this->order = $order; $this->goodsService = app('Service\GoodsService'); } /** * Execute the job. * * @return void */ public function handle() { $goodInfo = $this->goodsService->detail($this->order->goods_id); // 判断是否有配置支付回调 if(empty($goodInfo->api_hook)){ return; } $postdata = [ 'title' => $this->order->title, 'order_sn' => $this->order->order_sn, 'email' => $this->order->email, 'actual_price' => $this->order->actual_price, 'order_info' => $this->order->info, 'good_id' => $goodInfo->id, 'gd_name' => $goodInfo->gd_name ]; $opts = [ 'http' => [ 'method' => 'POST', 'header' => 'Content-type: application/json', 'content' => json_encode($postdata,JSON_UNESCAPED_UNICODE) ] ]; $context = stream_context_create($opts); file_get_contents($goodInfo->api_hook, false, $context); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Jobs/ServerJiang.php
app/Jobs/ServerJiang.php
<?php namespace App\Jobs; use App\Models\Order; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; class ServerJiang implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; /** * 任务最大尝试次数。 * * @var int */ public $tries = 2; /** * 任务运行的超时时间。 * * @var int */ public $timeout = 30; /** * @var Order */ private $order; /** * Create a new job instance. * * @return void */ public function __construct(Order $order) { $this->order = $order; } /** * Execute the job. * * @return void */ public function handle() { $postdata = http_build_query([ 'text' => __('dujiaoka.prompt.new_order_push') . ":{$this->order['ord_title']}", 'desp' => " - ". __('order.fields.title') .":{$this->order->title} - ". __('order.fields.order_sn') .":{$this->order->order_sn} - ". __('order.fields.email') .":{$this->order->email} - ". __('order.fields.actual_price') .":{$this->order->actual_price} " ]); $opts = [ 'http' => [ 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata ] ]; $context = stream_context_create($opts); $apiToken = dujiaoka_config_get('server_jiang_token'); file_get_contents('https://sctapi.ftqq.com/' . $apiToken . '.send', false, $context); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Jobs/WorkWeiXinPush.php
app/Jobs/WorkWeiXinPush.php
<?php namespace App\Jobs; use App\Models\Order; use GuzzleHttp\Client; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; class WorkWeiXinPush implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; /** * 任务最大尝试次数。 * * @var int */ public $tries = 1; /** * 任务运行的超时时间。 * * @var int */ public $timeout = 30; /** * @var Order */ private $order; /** * 商品服务层. * @var \App\Service\PayService */ private $goodsService; /** * Create a new job instance. * * @return void */ public function __construct(Order $order) { $this->order = $order; $this->goodsService = app('Service\GoodsService'); } /** * Execute the job. * * @return void */ public function handle() { $goodInfo = $this->goodsService->detail($this->order->goods_id); $client = new Client(); $apiUrl = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key='. dujiaoka_config_get('qywxbot_key'); $params = [ "msgtype"=>"markdown", "markdown"=>[ "content"=>__('dujiaoka.prompt.new_order_push').'(<font color="warning">'.$this->order->actual_price."</font>元)\n" .'>'.__('order.fields.order_id') .': <font color="comment">'.$this->order->id."</font>\n" .'>'.__('order.fields.order_sn') .': <font color="comment">'.$this->order->order_sn."</font>\n" .'>'.__('order.fields.pay_id') .': <font color="comment">'.$this->order->pay->pay_name."</font>\n" .'>'.__('order.fields.title') .': <font color="comment">'.$this->order->title."</font>\n" .'>'.__('order.fields.actual_price') .': <font color="comment">'.$this->order->actual_price."</font>\n" .'>'.__('order.fields.email') .': <font color="comment">'.$this->order->email."</font>\n" .'>'.__('goods.fields.gd_name') .': <font color="comment">'.$goodInfo->gd_name."</font>\n" .'>'.__('goods.fields.in_stock') .': <font color="comment">'.$goodInfo->in_stock."</font>\n" .'>'.__('order.fields.order_created') .': <font color="comment">'.$this->order->created_at."</font>" ] ]; $client->post($apiUrl,['json' => $params, 'verify' => false]); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Jobs/TelegramPush.php
app/Jobs/TelegramPush.php
<?php namespace App\Jobs; use App\Models\Order; use GuzzleHttp\Client; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; class TelegramPush implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; /** * 任务最大尝试次数。 * * @var int */ public $tries = 2; /** * 任务运行的超时时间。 * * @var int */ public $timeout = 30; /** * @var Order */ private $order; /** * 商品服务层. * @var \App\Service\PayService */ private $goodsService; /** * Create a new job instance. * * @return void */ public function __construct(Order $order) { $this->order = $order; $this->goodsService = app('Service\GoodsService'); } /** * Execute the job. * * @return void */ public function handle() { $goodInfo = $this->goodsService->detail($this->order->goods_id); $formatText = '*'. __('dujiaoka.prompt.new_order_push').'('.$this->order->actual_price.'元)*%0A' . __('order.fields.order_id') .': `'.$this->order->id.'`%0A' . __('order.fields.order_sn') .': `'.$this->order->order_sn.'`%0A' . __('order.fields.pay_id') .': `'.$this->order->pay->pay_name.'`%0A' . __('order.fields.title') .': '.$this->order->title.'%0A' . __('order.fields.actual_price') .': '.$this->order->actual_price.'%0A' . __('order.fields.email') .': `'.$this->order->email.'`%0A' . __('goods.fields.gd_name') .': `'.$goodInfo->gd_name.'`%0A' . __('goods.fields.in_stock') .': `'.$goodInfo->in_stock.'`%0A' . __('order.fields.order_created') .': '.$this->order->created_at; $client = new Client([ 'timeout' => 30, 'proxy'=> '' ]); $apiUrl = 'https://api.telegram.org/bot' . dujiaoka_config_get('telegram_bot_token') . '/sendMessage?chat_id=' . dujiaoka_config_get('telegram_userid') . '&parse_mode=Markdown&text='.$formatText; $client->post($apiUrl); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Jobs/BarkPush.php
app/Jobs/BarkPush.php
<?php namespace App\Jobs; use App\Models\Order; use GuzzleHttp\Client; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; use App\Models\BaseModel; class BarkPush implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; /** * 任务最大尝试次数。 * * @var int */ public $tries = 2; /** * 任务运行的超时时间。 * * @var int */ public $timeout = 30; /** * @var Order */ private $order; /** * 商品服务层. * @var \App\Service\PayService */ private $goodsService; /** * Create a new job instance. * * @return void */ public function __construct(Order $order) { $this->order = $order; $this->goodsService = app('Service\GoodsService'); } /** * Execute the job. * * @return void */ public function handle() { $goodInfo = $this->goodsService->detail($this->order->goods_id); $client = new Client(); $apiUrl = dujiaoka_config_get('bark_server') .'/'. dujiaoka_config_get('bark_token'); $params = [ "title" => __('dujiaoka.prompt.new_order_push').'('.$this->order->actual_price.'元)', "body" => __('order.fields.order_id') .': '.$this->order->id."\n" . __('order.fields.order_sn') .': '.$this->order->order_sn."\n" . __('order.fields.pay_id') .': '.$this->order->pay->pay_name."\n" . __('order.fields.title') .': '.$this->order->title."\n" . __('order.fields.actual_price') .': '.$this->order->actual_price."\n" . __('order.fields.email') .': '.$this->order->email."\n" . __('goods.fields.gd_name') .': '.$goodInfo->gd_name."\n" . __('goods.fields.in_stock') .': '.$goodInfo->in_stock."\n" . __('order.fields.order_created') .': '.$this->order->created_at, "icon"=>url('assets/common/images/default.jpg'), "level"=>"timeSensitive", "group"=>dujiaoka_config_get('text_logo', '独角数卡') ]; if (dujiaoka_config_get('is_open_bark_push_url', 0) == BaseModel::STATUS_OPEN) { $params["url"] = url('detail-order-sn/'.$this->order->order_sn); } $client->post($apiUrl,['form_params' => $params, 'verify' => false]); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Jobs/MailSend.php
app/Jobs/MailSend.php
<?php namespace App\Jobs; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Mail\MailServiceProvider; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\Mail; class MailSend implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; /** * 任务最大尝试次数。 * * @var int */ public $tries = 2; /** * 任务运行的超时时间。 * * @var int */ public $timeout = 30; private $to; private $content; private $title; /** * Create a new job instance. * * @return void */ public function __construct(string $to, string $title, string $content) { $this->to = $to; $this->title = $title; $this->content = $content; } /** * Execute the job. * * @return void */ public function handle() { $body = $this->content; $title = $this->title; $sysConfig = cache('system-setting'); $mailConfig = [ 'driver' => $sysConfig['driver'] ?? 'smtp', 'host' => $sysConfig['host'] ?? '', 'port' => $sysConfig['port'] ?? '465', 'username' => $sysConfig['username'] ?? '', 'from' => [ 'address' => $sysConfig['from_address'] ?? '', 'name' => $sysConfig['from_name'] ?? '独角发卡' ], 'password' => $sysConfig['password'] ?? '', 'encryption' => $sysConfig['encryption'] ?? '' ]; $to = $this->to; // 覆盖 mail 配置 config([ 'mail' => array_merge(config('mail'), $mailConfig) ]); // 重新注册驱动 (new MailServiceProvider(app()))->register(); Mail::send(['html' => 'email.mail'], ['body' => $body], function ($message) use ($to, $title){ $message->to($to)->subject($title); }); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Jobs/CouponBack.php
app/Jobs/CouponBack.php
<?php namespace App\Jobs; use App\Models\Order; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; class CouponBack implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; /** * 任务最大尝试次数。 * * @var int */ public $tries = 3; /** * 任务可以执行的最大秒数 (超时时间)。 * * @var int */ public $timeout = 20; private $order; /** * Create a new job instance. * * @return void */ public function __construct(Order $order) { $this->order = $order; } /** * Execute the job. * * @return void */ public function handle() { // 如果订单有使用优惠码 if ($this->order->coupon_id) { // 优惠码次数+1 app('Service\CouponService')->retIncrByID($this->order->coupon_id); // 设置订单优惠码已回退 app('Service\OrderService')->couponIsBack($this->order->order_sn); } } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Jobs/OrderExpired.php
app/Jobs/OrderExpired.php
<?php namespace App\Jobs; use App\Models\Order; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; class OrderExpired implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; /** * 任务最大尝试次数。 * * @var int */ public $tries = 3; /** * 任务可以执行的最大秒数 (超时时间)。 * * @var int */ public $timeout = 20; /** * 订单号 * @var string */ private $orderSN; /** * Create a new job instance. * * @return void */ public function __construct(string $orderSN) { $this->orderSN = $orderSN; } /** * Execute the job. * * @return void */ public function handle() { // 如果x分钟后还没支付就算过期 $order = app('Service\OrderService')->detailOrderSN($this->orderSN); if ($order && $order->status == Order::STATUS_WAIT_PAY) { app('Service\OrderService')->expiredOrderSN($this->orderSN); // 回退优惠券 CouponBack::dispatch($order); } } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Exceptions/Handler.php
app/Exceptions/Handler.php
<?php namespace App\Exceptions; use Exception; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; class Handler extends ExceptionHandler { /** * A list of the exception types that are not reported. * * @var array */ protected $dontReport = [ // ]; /** * A list of the inputs that are never flashed for validation exceptions. * * @var array */ protected $dontFlash = [ 'password', 'password_confirmation', ]; /** * Report or log an exception. * * @param \Exception $exception * @return void * * @throws \Exception */ public function report(Exception $exception) { parent::report($exception); } /** * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request * @param \Exception $exception * @return \Symfony\Component\HttpFoundation\Response * * @throws \Exception */ public function render($request, Exception $exception) { if ($exception instanceof AppException) { $layout = dujiaoka_config_get('template', 'layui'); $tplPath = $layout . '/errors/error'; return view($tplPath, ['title' => __('dujiaoka.error_title'), 'content' => $exception->getMessage(), 'url' => ""]); } return parent::render($request, $exception); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Exceptions/AppException.php
app/Exceptions/AppException.php
<?php namespace App\Exceptions; class AppException extends \Exception { public function __construct($message = "", $code = 0, \Throwable $previous = null) { parent::__construct($message, $code, $previous); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Exceptions/RuleValidationException.php
app/Exceptions/RuleValidationException.php
<?php namespace App\Exceptions; class RuleValidationException extends \Exception { public function __construct($message = "", $code = 400, \Throwable $previous = null) { parent::__construct($message, $code, $previous); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Helpers/functions.php
app/Helpers/functions.php
<?php /** * The file was created by Assimon. * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ use App\Exceptions\AppException; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Storage; if (! function_exists('replace_mail_tpl')) { /** * 替换邮件模板 * * @param array $mailtpl 模板 * @param array $data 内容 * @return array|false|mixed * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ function replace_mail_tpl($mailtpl = [], $data = []) { if (!$mailtpl) { return false; } if ($data) { foreach ($data as $key => $val) { $title = str_replace('{' . $key . '}', $val, isset($title) ? $title : $mailtpl['tpl_name']); $content = str_replace('{' . $key . '}', $val, isset($content) ? $content : $mailtpl['tpl_content']); } return ['tpl_name' => $title, 'tpl_content' => $content]; } return $mailtpl; } } if (! function_exists('dujiaoka_config_get')) { /** * 系统配置获取 * * @param string $key 要获取的key * @param $default 默认 * @return mixed|null * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ function dujiaoka_config_get(string $key, $default = null) { $sysConfig = Cache::get('system-setting'); return $sysConfig[$key] ?? $default; } } if (! function_exists('format_wholesale_price')) { /** * 格式化批发价 * * @param string $wholesalePriceArr 批发价配置 * @return array|null * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ function format_wholesale_price(string $wholesalePriceArr): ?array { $waitArr = explode(PHP_EOL, $wholesalePriceArr); $formatData = []; foreach ($waitArr as $key => $val) { if ($val != "") { $explodeFormat = explode('=', delete_html_code($val)); if (count($explodeFormat) != 2) { return null; } $formatData[$key]['number'] = $explodeFormat[0]; $formatData[$key]['price'] = $explodeFormat[1]; } } sort($formatData); return $formatData; } } if (! function_exists('delete_html_code')) { /** * 去除html内容 * @param string $str 需要去掉的字符串 * @return string */ function delete_html_code(string $str): string { $str = trim($str); //清除字符串两边的空格 $str = preg_replace("/\t/", "", $str); //使用正则表达式替换内容,如:空格,换行,并将替换为空。 $str = preg_replace("/\r\n/", "", $str); $str = preg_replace("/\r/", "", $str); $str = preg_replace("/\n/", "", $str); $str = preg_replace("/ /", "", $str); $str = preg_replace("/ /", "", $str); //匹配html中的空格 return trim($str); //返回字符串 } } if (! function_exists('format_charge_input')) { /** * 格式化代充框 * * @param string $charge * @return array|null * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ function format_charge_input(string $charge): ?array { $inputArr = explode(PHP_EOL, $charge); $formatData = []; foreach ($inputArr as $key => $val) { if ($val != "") { $explodeFormat = explode('=', delete_html_code($val)); if (count($explodeFormat) < 3) { return null; } $formatData[$key]['field'] = $explodeFormat[0]; $formatData[$key]['desc'] = $explodeFormat[1]; $formatData[$key]['rule'] = filter_var($explodeFormat[2], FILTER_VALIDATE_BOOLEAN); if(count($explodeFormat) > 3){ $formatData[$key]['placeholder'] = $explodeFormat[3]; }else{ $formatData[$key]['placeholder'] = $formatData[$key]['desc']; } } } return $formatData; } } if (! function_exists('site_url')) { /** * 获取顶级域名 带协议 * @return string */ function site_url() { $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; $domainName = $_SERVER['HTTP_HOST'] . '/'; return $protocol . $domainName; } } if (! function_exists('md5_signquery')) { function md5_signquery(array $parameter, string $signKey) { ksort($parameter); //重新排序$data数组 reset($parameter); //内部指针指向数组中的第一个元素 $sign = ''; $urls = ''; foreach ($parameter as $key => $val) { if ($val == '') continue; if ($key != 'sign') { if ($sign != '') { $sign .= "&"; $urls .= "&"; } $sign .= "$key=$val"; //拼接为url参数形式 $urls .= "$key=" . urlencode($val); //拼接为url参数形式 } } $sign = md5($sign . $signKey);//密码追加进入开始MD5签名 $query = $urls . '&sign=' . $sign; //创建订单所需的参数 return $query; } } if (! function_exists('signquery_string')) { function signquery_string(array $data) { ksort($data); //排序post参数 reset($data); //内部指针指向数组中的第一个元素 $sign = ''; //加密字符串初始化 foreach ($data as $key => $val) { if ($val == '' || $key == 'sign') continue; //跳过这些不签名 if ($sign) $sign .= '&'; //第一个字符串签名不加& 其他加&连接起来参数 $sign .= "$key=$val"; //拼接为url参数形式 } return $sign; } } if (!function_exists('picture_ulr')) { /** * 生成前台图片链接 不存在使用默认图 * @param string $file 图片地址 * @param false $getHost 是否只获取图片前缀域名 * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\Routing\UrlGenerator|string */ function picture_ulr($file, $getHost = false) { if ($getHost) return Storage::disk('admin')->url(''); return $file ? Storage::disk('admin')->url($file) : url('assets/common/images/default.jpg'); } } if (!function_exists('assoc_unique')) { function assoc_unique($arr, $key) { $tmp_arr = array(); foreach ($arr as $k => $v) { if (in_array($v[$key], $tmp_arr)) {//搜索$v[$key]是否在$tmp_arr数组中存在,若存在返回true unset($arr[$k]); } else { $tmp_arr[] = $v[$key]; } } sort($arr); //sort函数对数组进行排序 return $arr; } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Kernel.php
app/Http/Kernel.php
<?php namespace App\Http; use App\Http\Middleware\DujiaoBoot; use App\Http\Middleware\InstallCheck; use App\Http\Middleware\PayGateWay; use Illuminate\Foundation\Http\Kernel as HttpKernel; class Kernel extends HttpKernel { /** * The application's global HTTP middleware stack. * * These middleware are run during every request to your application. * * @var array */ protected $middleware = [ \App\Http\Middleware\TrustProxies::class, \App\Http\Middleware\CheckForMaintenanceMode::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, \App\Http\Middleware\DujiaoSystem::class, ]; /** * The application's route middleware groups. * * @var array */ protected $middlewareGroups = [ 'web' => [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, // \Illuminate\Session\Middleware\AuthenticateSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, ], 'api' => [ 'throttle:60,1', \Illuminate\Routing\Middleware\SubstituteBindings::class, ], ]; /** * The application's route middleware. * * These middleware may be assigned to groups or used individually. * * @var array */ protected $routeMiddleware = [ 'auth' => \App\Http\Middleware\Authenticate::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 'can' => \Illuminate\Auth\Middleware\Authorize::class, 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 'dujiaoka.boot' => DujiaoBoot::class, 'dujiaoka.pay_gate_way' => PayGateWay::class, 'install.check' => InstallCheck::class, ]; /** * The priority-sorted list of middleware. * * This forces non-global middleware to always be in the given order. * * @var array */ protected $middlewarePriority = [ \Illuminate\Session\Middleware\StartSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\Authenticate::class, \Illuminate\Routing\Middleware\ThrottleRequests::class, \Illuminate\Session\Middleware\AuthenticateSession::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, \Illuminate\Auth\Middleware\Authorize::class, ]; }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Controllers/PayController.php
app/Http/Controllers/PayController.php
<?php namespace App\Http\Controllers; use App\Exceptions\RuleValidationException; use App\Models\Order; use App\Service\OrderProcessService; class PayController extends BaseController { /** * 支付网关 * @var \App\Models\Pay */ protected $payGateway; /** * 订单 * @var \App\Models\Order */ protected $order; /** * 订单服务层 * @var \App\Service\OrderService */ protected $orderService; /** * 支付服务层 * @var \App\Service\PayService */ protected $payService; /** * 订单处理层. * @var OrderProcessService */ protected $orderProcessService; public function __construct() { $this->orderService = app('Service\OrderService'); $this->payService = app('Service\PayService'); $this->orderProcessService = app('Service\OrderProcessService'); } /** * 订单检测 * * @param string $orderSN * @throws RuleValidationException * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function checkOrder(string $orderSN) { // 订单 $this->order = $this->orderService->detailOrderSN($orderSN); if (!$this->order) { throw new RuleValidationException(__('dujiaoka.prompt.order_does_not_exist')); } // 订单过期 if ($this->order->status == Order::STATUS_EXPIRED) { throw new RuleValidationException(__('dujiaoka.prompt.order_is_expired')); } // 已经支付了 if ($this->order->status > Order::STATUS_WAIT_PAY) { throw new RuleValidationException(__('dujiaoka.prompt.order_already_paid')); } } /** * 加载支付网关 * * @param string $orderSN 订单号 * @param string $payCheck 支付标识 * @throws RuleValidationException * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function loadGateWay(string $orderSN, string $payCheck) { $this->checkOrder($orderSN); // 支付配置 $this->payGateway = $this->payService->detailByCheck($payCheck); if (!$this->payGateway) { throw new RuleValidationException(__('dujiaoka.prompt.pay_gateway_does_not_exist')); } // 临时保存支付方式 $this->order->pay_id = $this->payGateway->id; $this->order->save(); } /** * 网关处理. * * @param string $handle 跳转方法 * @param string $payway 支付标识 * @param string $orderSN 订单. * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function redirectGateway(string $handle,string $payway, string $orderSN) { try { $this->checkOrder($orderSN); $bccomp = bccomp($this->order->actual_price, 0.00, 2); // 如果订单金额为0 代表无需支付,直接成功 if ($bccomp == 0) { $this->orderProcessService->completedOrder($this->order->order_sn, 0.00); return redirect(url('detail-order-sn', ['orderSN' => $this->order->order_sn])); } return redirect(url(urldecode($handle), ['payway' => $payway, 'orderSN' => $orderSN])); } catch (RuleValidationException $exception) { return $this->err($exception->getMessage()); } } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Controllers/Controller.php
app/Http/Controllers/Controller.php
<?php namespace App\Http\Controllers; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Routing\Controller as BaseController; class Controller extends BaseController { use AuthorizesRequests, DispatchesJobs, ValidatesRequests; }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Controllers/BaseController.php
app/Http/Controllers/BaseController.php
<?php /** * The file was created by Assimon. * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ namespace App\Http\Controllers; class BaseController extends Controller { /** * 渲染模板 * * @param string $tpl 模板名称 * @param array $data 数据 * @param array $pageTitle 页面标题 * * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ protected function render(string $tpl, $data = [], string $pageTitle = '') { $layout = dujiaoka_config_get('template', 'unicorn'); $tplPath = $layout . '/' .$tpl; return view($tplPath, $data)->with('page_title', $pageTitle); } /** * 错误提示 * * @param string $content 提示内容 * @param string $jumpUri 跳转url * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ protected function err(string $content, $jumpUri = '') { $layout = dujiaoka_config_get('template', 'unicorn'); $tplPath = $layout . '/errors/error'; return view($tplPath, ['title' => __('dujiaoka.error_title'), 'content' => $content, 'url' => $jumpUri]) ->with('page_title', __('dujiaoka.error_title')); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Controllers/Home/OrderController.php
app/Http/Controllers/Home/OrderController.php
<?php namespace App\Http\Controllers\Home; use App\Exceptions\RuleValidationException; use App\Http\Controllers\BaseController; use App\Models\Order; use App\Service\OrderProcessService; use Illuminate\Http\Request; use Illuminate\Support\Facades\Cookie; use Illuminate\Support\Facades\DB; /** * 订单控制器 * * Class OrderController * @package App\Http\Controllers\Home * @author: Assimon * @email: Ashang@utf8.hk * @blog: https://utf8.hk * Date: 2021/5/30 */ class OrderController extends BaseController { /** * 订单服务层 * @var \App\Service\OrderService */ private $orderService; /** * 订单处理层. * @var OrderProcessService */ private $orderProcessService; public function __construct() { $this->orderService = app('Service\OrderService'); $this->orderProcessService = app('Service\OrderProcessService'); } /** * 创建订单 * * @param Request $request * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View * @throws \Illuminate\Validation\ValidationException * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function createOrder(Request $request) { DB::beginTransaction(); try { $this->orderService->validatorCreateOrder($request); $goods = $this->orderService->validatorGoods($request); $this->orderService->validatorLoopCarmis($request); // 设置商品 $this->orderProcessService->setGoods($goods); // 优惠码 $coupon = $this->orderService->validatorCoupon($request); // 设置优惠码 $this->orderProcessService->setCoupon($coupon); $otherIpt = $this->orderService->validatorChargeInput($goods, $request); $this->orderProcessService->setOtherIpt($otherIpt); // 数量 $this->orderProcessService->setBuyAmount($request->input('by_amount')); // 支付方式 $this->orderProcessService->setPayID($request->input('payway')); // 下单邮箱 $this->orderProcessService->setEmail($request->input('email')); // ip地址 $this->orderProcessService->setBuyIP($request->getClientIp()); // 查询密码 $this->orderProcessService->setSearchPwd($request->input('search_pwd', '')); // 创建订单 $order = $this->orderProcessService->createOrder(); DB::commit(); // 设置订单cookie $this->queueCookie($order->order_sn); return redirect(url('/bill', ['orderSN' => $order->order_sn])); } catch (RuleValidationException $exception) { DB::rollBack(); return $this->err($exception->getMessage()); } } /** * 设置订单cookie. * @param string $orderSN 订单号. */ private function queueCookie(string $orderSN) : void { // 设置订单cookie $cookies = Cookie::get('dujiaoka_orders'); if (empty($cookies)) { Cookie::queue('dujiaoka_orders', json_encode([$orderSN])); } else { $cookies = json_decode($cookies, true); array_push($cookies, $orderSN); Cookie::queue('dujiaoka_orders', json_encode($cookies)); } } /** * 结账 * * @param string $orderSN * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function bill(string $orderSN) { $order = $this->orderService->detailOrderSN($orderSN); if (empty($order)) { return $this->err(__('dujiaoka.prompt.order_does_not_exist')); } if ($order->status == Order::STATUS_EXPIRED) { return $this->err(__('dujiaoka.prompt.order_is_expired')); } return $this->render('static_pages/bill', $order, __('dujiaoka.page-title.bill')); } /** * 订单状态监测 * * @param string $orderSN 订单号 * @return \Illuminate\Http\JsonResponse * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function checkOrderStatus(string $orderSN) { $order = $this->orderService->detailOrderSN($orderSN); // 订单不存在或者已经过期 if (!$order || $order->status == Order::STATUS_EXPIRED) { return response()->json(['msg' => 'expired', 'code' => 400001]); } // 订单已经支付 if ($order->status == Order::STATUS_WAIT_PAY) { return response()->json(['msg' => 'wait....', 'code' => 400000]); } // 成功 if ($order->status > Order::STATUS_WAIT_PAY) { return response()->json(['msg' => 'success', 'code' => 200]); } } /** * 通过订单号展示订单详情 * * @param string $orderSN 订单号. * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function detailOrderSN(string $orderSN) { $order = $this->orderService->detailOrderSN($orderSN); // 订单不存在或者已经过期 if (!$order) { return $this->err(__('dujiaoka.prompt.order_does_not_exist')); } return $this->render('static_pages/orderinfo', ['orders' => [$order]], __('dujiaoka.page-title.order-detail')); } /** * 订单号查询 * * @param Request $request * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function searchOrderBySN(Request $request) { return $this->detailOrderSN($request->input('order_sn')); } /** * 通过邮箱查询 * * @param Request $request * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function searchOrderByEmail(Request $request) { if ( !$request->has('email') || ( dujiaoka_config_get('is_open_search_pwd', \App\Models\BaseModel::STATUS_CLOSE) == \App\Models\BaseModel::STATUS_OPEN && !$request->has('search_pwd') ) ) { return $this->err(__('dujiaoka.prompt.server_illegal_request')); } $orders = $this->orderService->withEmailAndPassword($request->input('email'), $request->input('search_pwd','')); if (!$orders) { return $this->err(__('dujiaoka.prompt.no_related_order_found')); } return $this->render('static_pages/orderinfo', ['orders' => $orders], __('dujiaoka.page-title.order-detail')); } /** * 通过浏览器缓存查询 * @param Request $request * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function searchOrderByBrowser(Request $request) { $cookies = Cookie::get('dujiaoka_orders'); if (empty($cookies)) { return $this->err(__('dujiaoka.prompt.no_related_order_found_for_cache')); } $orderSNS = json_decode($cookies, true); $orders = $this->orderService->byOrderSNS($orderSNS); return $this->render('static_pages/orderinfo', ['orders' => $orders], __('dujiaoka.page-title.order-detail')); } /** * 订单查询页 * * @param Request $request * @return mixed * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function orderSearch(Request $request) { return $this->render('static_pages/searchOrder', [], __('dujiaoka.page-title.order-search')); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Controllers/Home/HomeController.php
app/Http/Controllers/Home/HomeController.php
<?php namespace App\Http\Controllers\Home; use App\Exceptions\RuleValidationException; use App\Http\Controllers\BaseController; use App\Models\Pay; use Germey\Geetest\Geetest; use Illuminate\Database\DatabaseServiceProvider; use Illuminate\Database\QueryException; use Illuminate\Encryption\Encrypter; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Redis; class HomeController extends BaseController { /** * 商品服务层. * @var \App\Service\PayService */ private $goodsService; /** * 支付服务层 * @var \App\Service\PayService */ private $payService; public function __construct() { $this->goodsService = app('Service\GoodsService'); $this->payService = app('Service\PayService'); } /** * 首页. * * @param Request $request * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function index(Request $request) { $goods = $this->goodsService->withGroup(); return $this->render('static_pages/home', ['data' => $goods], __('dujiaoka.page-title.home')); } /** * 商品详情 * * @param int $id * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function buy(int $id) { try { $goods = $this->goodsService->detail($id); $this->goodsService->validatorGoodsStatus($goods); // 有没有优惠码可以展示 if (count($goods->coupon)) { $goods->open_coupon = 1; } $formatGoods = $this->goodsService->format($goods); // 加载支付方式. $client = Pay::PAY_CLIENT_PC; if (app('Jenssegers\Agent')->isMobile()) { $client = Pay::PAY_CLIENT_MOBILE; } $formatGoods->payways = $this->payService->pays($client); return $this->render('static_pages/buy', $formatGoods, $formatGoods->gd_name); } catch (RuleValidationException $ruleValidationException) { return $this->err($ruleValidationException->getMessage()); } } /** * 极验行为验证 * * @param Request $request * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function geetest(Request $request) { $data = [ 'user_id' => @Auth::user()?@Auth::user()->id:'UnLoginUser', 'client_type' => 'web', 'ip_address' => \Illuminate\Support\Facades\Request::ip() ]; $status = Geetest::preProcess($data); session()->put('gtserver', $status); session()->put('user_id', $data['user_id']); return Geetest::getResponseStr(); } /** * 安装页面 * * @param Request $request * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function install(Request $request) { return view('common/install'); } /** * 执行安装 * * @param Request $request * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function doInstall(Request $request) { try { $dbConfig = config('database'); $mysqlDB = [ 'host' => $request->input('db_host'), 'port' => $request->input('db_port'), 'database' => $request->input('db_database'), 'username' => $request->input('db_username'), 'password' => $request->input('db_password'), ]; $dbConfig['connections']['mysql'] = array_merge($dbConfig['connections']['mysql'], $mysqlDB); // Redis $redisDB = [ 'host' => $request->input('redis_host'), 'password' => $request->input('redis_password', 'null'), 'port' => $request->input('redis_port'), ]; $dbConfig['redis']['default'] = array_merge($dbConfig['redis']['default'], $redisDB); config(['database' => $dbConfig]); DB::purge(); // db测试 DB::connection()->select('select 1 limit 1'); // redis测试 Redis::set('dujiaoka_com', 'ok'); Redis::get('dujiaoka_com'); // 获得文件模板 $envExamplePath = base_path() . DIRECTORY_SEPARATOR . '.env.example'; $envPath = base_path() . DIRECTORY_SEPARATOR . '.env'; $installLock = base_path() . DIRECTORY_SEPARATOR . 'install.lock'; $installSql = database_path() . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR . 'install.sql'; $envTemp = file_get_contents($envExamplePath); $postData = $request->all(); // 临时写入key $postData['app_key'] = 'base64:' . base64_encode( Encrypter::generateKey(config('app.cipher')) ); foreach ($postData as $key => $item) { $envTemp = str_replace('{' . $key . '}', $item, $envTemp); } // 写入配置 file_put_contents($envPath, $envTemp); // 导入sql DB::unprepared(file_get_contents($installSql)); // 写入安装锁 file_put_contents($installLock, 'install ok'); return 'success'; } catch (\RedisException $exception) { return 'Redis配置错误 :' . $exception->getMessage(); } catch (QueryException $exception) { return '数据库配置错误 :' . $exception->getMessage(); } catch (\Exception $exception) { return $exception->getMessage(); } } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Controllers/Pay/WepayController.php
app/Http/Controllers/Pay/WepayController.php
<?php namespace App\Http\Controllers\Pay; use App\Exceptions\RuleValidationException; use App\Http\Controllers\PayController; use Yansongda\Pay\Pay; class WepayController extends PayController { public function gateway(string $payway, string $orderSN) { try { // 加载网关 $this->loadGateWay($orderSN, $payway); $config = [ 'app_id' => $this->payGateway->merchant_id, 'mch_id' => $this->payGateway->merchant_key, 'key' => $this->payGateway->merchant_pem, 'notify_url' => url($this->payGateway->pay_handleroute . '/notify_url'), 'return_url' => url('detail-order-sn', ['orderSN' => $this->order->order_sn]), 'http' => [ // optional 'timeout' => 10.0, 'connect_timeout' => 10.0, ], ]; $order = [ 'out_trade_no' => $this->order->order_sn, 'total_fee' => bcmul($this->order->actual_price, 100, 0), 'body' => $this->order->order_sn ]; switch ($payway){ case 'wescan': try{ $result = Pay::wechat($config)->scan($order)->toArray(); $result['qr_code'] = $result['code_url']; $result['payname'] =$this->payGateway->pay_name; $result['actual_price'] = (float)$this->order->actual_price; $result['orderid'] = $this->order->order_sn; return $this->render('static_pages/qrpay', $result, __('dujiaoka.scan_qrcode_to_pay')); } catch (\Exception $e) { throw new RuleValidationException(__('dujiaoka.prompt.abnormal_payment_channel') . $e->getMessage()); } break; } } catch (RuleValidationException $exception) { return $this->err($exception->getMessage()); } } /** * 异步通知 */ public function notifyUrl() { $xml = file_get_contents('php://input'); $arr = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true); $oid = $arr['out_trade_no']; $order = $this->orderService->detailOrderSN($oid); if (!$order) { return 'error'; } $payGateway = $this->payService->detail($order->pay_id); if (!$payGateway) { return 'error'; } if($payGateway->pay_handleroute != '/pay/wepay'){ return 'error'; } $config = [ 'app_id' => $payGateway->merchant_id, 'mch_id' => $payGateway->merchant_key, 'key' => $payGateway->merchant_pem, ]; $pay = Pay::wechat($config); try{ // 验证签名 $result = $pay->verify(); $total_fee = bcdiv($result->total_fee, 100, 2); $this->orderProcessService->completedOrder($result->out_trade_no, $total_fee, $result->transaction_id); return 'success'; } catch (\Exception $exception) { return 'fail'; } } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Controllers/Pay/PaypalPayController.php
app/Http/Controllers/Pay/PaypalPayController.php
<?php namespace App\Http\Controllers\Pay; use AmrShawky\LaravelCurrency\Facade\Currency; use App\Exceptions\RuleValidationException; use App\Http\Controllers\PayController; use Illuminate\Http\Request; use Illuminate\Support\Facades\Log; use PayPal\Api\Amount; use PayPal\Api\Details; use PayPal\Api\Item; use PayPal\Api\ItemList; use PayPal\Api\Payer; use PayPal\Api\Payment; use PayPal\Api\PaymentExecution; use PayPal\Api\RedirectUrls; use PayPal\Api\Transaction; use PayPal\Auth\OAuthTokenCredential; use PayPal\Exception\PayPalConnectionException; use PayPal\Rest\ApiContext; class PaypalPayController extends PayController { const Currency = 'USD'; //货币单位 public function gateway(string $payway, string $orderSN) { try { // 加载网关 $this->loadGateWay($orderSN, $payway); $paypal = new ApiContext( new OAuthTokenCredential( $this->payGateway->merchant_key, $this->payGateway->merchant_pem ) ); $paypal->setConfig(['mode' => 'live']); $product = $this->order->title; // 得到汇率 $total = Currency::convert() ->from('CNY') ->to('USD') ->amount($this->order->actual_price) ->round(2) ->get(); $shipping = 0; $description = $this->order->title; $payer = new Payer(); $payer->setPaymentMethod('paypal'); $item = new Item(); $item->setName($product)->setCurrency(self::Currency)->setQuantity(1)->setPrice($total); $itemList = new ItemList(); $itemList->setItems([$item]); $details = new Details(); $details->setShipping($shipping)->setSubtotal($total); $amount = new Amount(); $amount->setCurrency(self::Currency)->setTotal($total)->setDetails($details); $transaction = new Transaction(); $transaction->setAmount($amount)->setItemList($itemList)->setDescription($description)->setInvoiceNumber($this->order->order_sn); $redirectUrls = new RedirectUrls(); $redirectUrls->setReturnUrl(route('paypal-return', ['success' => 'ok', 'orderSN' => $this->order->order_sn]))->setCancelUrl(route('paypal-return', ['success' => 'no', 'orderSN' => $this->order->order_sn])); $payment = new Payment(); $payment->setIntent('sale')->setPayer($payer)->setRedirectUrls($redirectUrls)->setTransactions([$transaction]); $payment->create($paypal); $approvalUrl = $payment->getApprovalLink(); return redirect($approvalUrl); } catch (PayPalConnectionException $payPalConnectionException) { return $this->err($payPalConnectionException->getMessage()); } catch (RuleValidationException $exception) { return $this->err($exception->getMessage()); } } /** *paypal 同步回调 */ public function returnUrl(Request $request) { $success = $request->input('success'); $paymentId = $request->input('paymentId'); $payerID = $request->input('PayerID'); $orderSN = $request->input('orderSN'); if ($success == 'no' || empty($paymentId) || empty($payerID)) { // 取消支付 redirect(url('detail-order-sn', ['orderSN' => $payerID])); } $order = $this->orderService->detailOrderSN($orderSN); if (!$order) { return 'error'; } $payGateway = $this->payService->detail($order->pay_id); if (!$payGateway) { return 'error'; } if($payGateway->pay_handleroute != '/pay/paypal'){ return 'error'; } $paypal = new ApiContext( new OAuthTokenCredential( $payGateway->merchant_key, $payGateway->merchant_pem ) ); $paypal->setConfig(['mode' => 'live']); $payment = Payment::get($paymentId, $paypal); $execute = new PaymentExecution(); $execute->setPayerId($payerID); try { $payment->execute($execute, $paypal); $this->orderProcessService->completedOrder($orderSN, $order->actual_price, $paymentId); Log::info("paypal支付成功", ['支付成功,支付ID【' . $paymentId . '】,支付人ID【' . $payerID . '】']); } catch (\Exception $e) { Log::error("paypal支付失败", ['支付失败,支付ID【' . $paymentId . '】,支付人ID【' . $payerID . '】']); } return redirect(url('detail-order-sn', ['orderSN' => $orderSN])); } /** * 异步通知 * TODO: 暂未实现,但是好像只实现同步回调即可。这个可以放在后面实现 */ public function notifyUrl(Request $request) { //获取回调结果 $json_data = $this->get_JsonData(); if(!empty($json_data)){ Log::debug("paypal notify info:\r\n" . json_encode($json_data)); }else{ Log::debug("paypal notify fail:参加为空"); } } private function get_JsonData() { $json = file_get_contents('php://input'); if ($json) { $json = str_replace("'", '', $json); $json = json_decode($json,true); } return $json; } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Controllers/Pay/StripeController.php
app/Http/Controllers/Pay/StripeController.php
<?php namespace App\Http\Controllers\Pay; use App\Exceptions\RuleValidationException; use App\Http\Controllers\PayController; use Illuminate\Http\Request; use GuzzleHttp\Client; use Illuminate\Support\Facades\Redis; use URL; class StripeController extends PayController { public function gateway(string $payway, string $orderSN) { // 加载网关 $this->loadGateWay($orderSN, $payway); //构造要请求的参数数组,无需改动 switch ($payway) { case 'wx': case 'alipay': default: try { \Stripe\Stripe::setApiKey($this->payGateway->merchant_id); $amount = bcmul($this->order->actual_price, 100, 2); $price = $this->order->actual_price; $usd = bcmul($this->getUsdCurrency($this->order->actual_price), 100, 2); $orderid = $this->order->order_sn; $pk = $this->payGateway->merchant_id; $return_url = site_url() . $this->payGateway->pay_handleroute . '/return_url/?orderid=' . $this->order->order_sn; $html = "<html class=\"js cssanimations\"> <head lang=\"en\"> <meta charset=\"UTF-8\"> <title>收银台</title> <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"> <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"> <meta name=\"format-detection\" content=\"telephone=no\"> <meta name=\"renderer\" content=\"webkit\"> <meta http-equiv=\"Cache-Control\" content=\"no-siteapp\"> <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/amazeui@2.7.2/dist/css/amazeui.min.css\"> <script src=\"https://cdn.jsdelivr.net/npm/jquery@2.1.4/dist/jquery.min.js\"></script> <script src=\"https://cdn.jsdelivr.net/npm/jquery.qrcode@1.0.3/jquery.qrcode.min.js\"></script> <script src=\"https://cdn.jsdelivr.net/npm/amazeui@2.7.2/dist/js/amazeui.min.js\"></script> <script src=\"https://js.stripe.com/v3/\"></script> <style> @media only screen and (min-width: 641px) { .am-offcanvas { display: block; position: static; background: none; } .am-offcanvas-bar { position: static; width: auto; background: none; -webkit-transform: translate3d(0, 0, 0); -ms-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } .am-offcanvas-bar:after { content: none; } } @media only screen and (max-width: 640px) { .am-offcanvas-bar .am-nav > li > a { color: #ccc; border-radius: 0; border-top: 1px solid rgba(0, 0, 0, .3); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05) } .am-offcanvas-bar .am-nav > li > a:hover { background: #404040; color: #fff } .am-offcanvas-bar .am-nav > li.am-nav-header { color: #777; background: #404040; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05); text-shadow: 0 1px 0 rgba(0, 0, 0, .5); border-top: 1px solid rgba(0, 0, 0, .3); font-weight: 400; font-size: 75% } .am-offcanvas-bar .am-nav > li.am-active > a { background: #1a1a1a; color: #fff; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .3) } .am-offcanvas-bar .am-nav > li + li { margin-top: 0; } } .my-head { margin-top: 40px; text-align: center; } .am-tab-panel { text-align: center; margin-top: 50px; margin-bottom: 50px; } .my-footer { border-top: 1px solid #eeeeee; padding: 10px 0; margin-top: 10px; text-align: center; } .panel-title { display: inline; font-weight: bold; } .display-table { display: table; } .display-tr { display: table-row; } .display-td { display: table-cell; vertical-align: middle; width: 61%; } .StripeElement { box-sizing: border-box; height: 40px; padding: 10px 12px; border: 1px solid transparent; border-radius: 4px; background-color: white; box-shadow: 0 1px 3px 0 #e6ebf1; -webkit-transition: box-shadow 150ms ease; transition: box-shadow 150ms ease; } .StripeElement--focus { box-shadow: 0 1px 3px 0 #cfd7df; } .StripeElement--invalid { border-color: #fa755a; } .StripeElement--webkit-autofill { background-color: #fefde5 !important; } .form-row { width: 70%; float: left; } .wrapper { width: 670px; margin: 0 auto; } label { font-weight: 500; font-size: 14px; display: block; margin-bottom: 8px; } .button { border: none; border-radius: 4px; outline: none; text-decoration: none; color: #fff; background: #32325d; white-space: nowrap; display: inline-block; height: 40px; line-height: 40px; padding: 0 14px; box-shadow: 0 4px 6px rgba(50, 50, 93, .11), 0 1px 3px rgba(0, 0, 0, .08); border-radius: 4px; font-size: 16px; font-weight: 600; letter-spacing: 0.025em; text-decoration: none; -webkit-transition: all 150ms ease; transition: all 150ms ease; margin-top: 10px; } </style> </head> <body> <header class=\"am-g my-head\"> <div class=\"am-u-sm-12 am-article\"> <h1 class=\"am-article-title\">收银台</h1> </div> </header> <hr class=\"am-article-divider\"> <div class=\"am-container\"> <h2>付款信息 <div class=\"am-topbar-right\">¥{$price}</div> </h2> <p><small>订单编号:$orderid</small></p> <div class=\"am-tabs\" data-am-tabs=\"\"> <ul class=\"am-tabs-nav am-nav am-nav-tabs\"> <li class=\"am-active\"><a href=\"#alipay\">Alipay 支付宝</a></li> <li class=\"request-wechat-pay\"><a href=\"#wcpay\">微信支付</a></li> <li class=\"request-card-pay\"><a href=\"#cardpay\">银行卡支付</a></li> </ul> <div class=\"am-tabs-bd am-tabs-bd-ofv\" style=\"touch-action: pan-y; user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\"> <div class=\"am-tab-panel am-active\" id=\"alipay\"> <a class=\"am-btn am-btn-lg am-btn-warning am-btn-primary\" id=\"alipaybtn\" href=\"#\">进入支付宝付款</a> <p></p> </div> <div class=\"am-tab-panel am-fade\" id=\"wcpay\"> <div class=\"text-align:center; margin:0 auto; width:60%\"> <div class=\"wcpay-qrcode\" style=\"text-align: center; \" data-requested=\"0\"> 正在加载中... </div> </div> </div> <div class=\"am-tab-panel am-fade\" id=\"cardpay\"> <div class=\"text-align:center; margin:0 auto; width:60%\"> <div class=\"wrapper cardpay_content\" style=\"max-width:500px\"> <div class=\"am-alert am-alert-danger\" style=\"display:none\">支付失败,请更换卡片或检查输入信息</div> <form action=\"/pay/stripe/charge\" method=\"post\" id=\"payment-form\"> <div class=\"form-row\"> <label for=\"card-element\"> <p class='am-alert am-alert-secondary'>借记卡或信用卡</p> </label> <div id=\"card-element\"> <!-- A Stripe Element will be inserted here. --> </div> <!-- Used to display form errors. --> <div id=\"card-errors\" role=\"alert\"></div> </div> <div class=\"form-row\"> <button class=\"button\">支付</button> </div> </form> </div> </div> </div> </div> </div> </div> </div> <script> var stripe = Stripe('$pk'); var source = ''; // Create a Stripe client. // Create an instance of Elements. var elements = stripe.elements(); // Custom styling can be passed to options when creating an Element. // (Note that this demo uses a wider set of styles than the guide below.) var style = { base: { color: '#32325d', fontFamily: '\"Helvetica Neue\", Helvetica, sans-serif', fontSmoothing: 'antialiased', fontSize: '16px', '::placeholder': { color: '#aab7c4' } }, invalid: { color: '#fa755a', iconColor: '#fa755a' } }; // Create an instance of the card Element. var card = elements.create('card', {style: style}); // Add an instance of the card Element into the `card-element` <div>. card.mount('#card-element'); // Handle real-time validation errors from the card Element. card.on('change', function (event) { var displayError = document.getElementById('card-errors'); if (event.error) { displayError.textContent = event.error.message; } else { displayError.textContent = ''; } }); // Handle form submission. var form = document.getElementById('payment-form'); form.addEventListener('submit', function (event) { event.preventDefault(); $(\".button\").attr(\"disabled\",\"true\"); $(\".button\").html(\"请稍后\"); stripe.createToken(card).then(function (result) { if (result.error) { // Inform the user if there was an error. var errorElement = document.getElementById('card-errors'); errorElement.textContent = result.error.message; } else { // Send the token to your server. stripeTokenHandler(result.token); } }); }); // Submit the form with the token ID. function stripeTokenHandler(token) { // Insert the token ID into the form so it gets submitted to the server var form = document.getElementById('payment-form'); var hiddenInput = document.createElement('input'); var hiddenInput1 = document.createElement('input'); hiddenInput.setAttribute('type', 'hidden'); hiddenInput.setAttribute('name', 'stripeToken'); hiddenInput.setAttribute('value', token.id); hiddenInput1.setAttribute('type', 'hidden'); hiddenInput1.setAttribute('name', 'orderid'); hiddenInput1.setAttribute('value', '$orderid'); form.appendChild(hiddenInput); form.appendChild(hiddenInput1); // Submit the form //form.submit(); $.ajax({ url: '/pay/stripe/charge/?orderid=$orderid&stripeToken=' + token.id, type: 'GET', success: function (result) { if (result == \"success\") { $(\".cardpay_content\").html(\"\"); $(\".cardpay_content\").html(\"<p class='am-alert am-alert-success'>支付成功,正在跳转页面</p>\"); window.setTimeout(function () { location.href = \"/detail-order-sn/$orderid\" }, 800); } else { $(\".am-alert\").show(); $(\".button\").removeAttr(\"disabled\"); $(\".button\").html(\"支付\"); setTimeout(\" $('.am-alert').hide();\", 3000); } } }); } (function () { stripe.createSource({ type: 'alipay', amount: $amount, currency: 'cny', // 这里你需要渲染出一些用户的信息,不然后期没法知道是谁在付钱 owner: { name: '$orderid', }, redirect: { return_url: '$return_url', }, }).then(function (result) { $(\"#alipaybtn\").attr(\"href\", result.source.redirect.url); }); })(); function paymentcheck() { $.ajax({ url: '/pay/stripe/check/?orderid=$orderid&source=' + source, type: 'GET', success: function (result) { if (result == \"success\") { $(\".wcpay-qrcode\").html(\"\"); $(\".wcpay-qrcode\").html(\"<p class='am-alert am-alert-success'>支付成功,正在跳转页面</p>\"); window.setTimeout(function () { location.href = \"/detail-order-sn/$orderid\" }, 800); } else { setTimeout(\"paymentcheck()\", 1000); } } }); } $(\".request-wechat-pay\").click(function () { if ($(\".wcpay-qrcode\").data(\"requested\") == 0) { stripe.createSource({ type: 'wechat', amount: $usd, currency: 'usd', owner: { name: '$orderid' }, }).then(function (result) { if (result.source.id) { $(\".wcpay-qrcode\").html(\"<p class='am-alert am-alert-success'>打开微信 - 扫一扫</p>\"); $(\".wcpay-qrcode\").qrcode(result.source.wechat.qr_code_url); $(\".wcpay-qrcode\").data(\"requested\", 1); $(\".wcpay-qrcode\").data(\"sid\", result.source.id); $(\".wcpay-qrcode\").data(\"scs\", result.source.client_secret); source = result.source.id; setTimeout(\"paymentcheck()\", 3000); } else { alert(\"微信支付加载失败\"); $(\".wcpay-qrcode\").html(\"<p class='am-alert am-alert-danger'>加载失败,请刷新页面。</p>\"); } // handle result.error or result.source }); } }); </script> </body> </html>"; return $html; } catch (\Exception $e) { throw new RuleValidationException(__('dujiaoka.prompt.abnormal_payment_channel') . $e->getMessage()); } break; } } public function returnUrl(Request $request) { $data = $request->all(); $cacheord = $this->orderService->detailOrderSN($data['orderid']); if (!$cacheord) { return redirect(url('detail-order-sn', ['orderSN' => $data['orderid']])); } $payGateway = $this->payService->detail($cacheord->pay_id); \Stripe\Stripe::setApiKey($payGateway -> merchant_pem); $source_object = \Stripe\Source::retrieve($data['source']); //die($source_object); if ($source_object->status == 'chargeable') { \Stripe\Charge::create([ 'amount' => $source_object->amount, 'currency' => $source_object->currency, 'source' => $data['source'], ]); if ($source_object->owner->name == $data['orderid']) { $this->orderProcessService->completedOrder($data['orderid'], $source_object->amount / 100, $source_object->id); } } return redirect(url('detail-order-sn', ['orderSN' => $data['orderid']])); } public function check(Request $request) { $data = $request->all(); $cacheord = $this->orderService->detailOrderSN($data['orderid']); if (!$cacheord) { //可能已异步回调成功,跳转 return 'fail'; } else { $payGateway = $this->payService->detail($cacheord->pay_id); \Stripe\Stripe::setApiKey($payGateway -> merchant_pem); $source_object = \Stripe\Source::retrieve($data['source']); if ($source_object->status == 'chargeable') { \Stripe\Charge::create([ 'amount' => $source_object->amount, 'currency' => $source_object->currency, 'source' => $data['source'], ]); } if ($source_object->status == 'consumed' && $source_object->owner->name == $data['orderid']) { $this->orderProcessService->completedOrder($data['orderid'], $cacheord->actual_price, $source_object->id); return 'success'; } else { return 'fail'; } } } public function charge(Request $request) { $data = $request->all(); $cacheord = $this->orderService->detailOrderSN($data['orderid']); if (!$cacheord) { //可能已异步回调成功,跳转 return 'fail'; } else { try { $payGateway = $this->payService->detail($cacheord->pay_id); \Stripe\Stripe::setApiKey($payGateway -> merchant_pem); $result = \Stripe\Charge::create([ 'amount' => bcmul($this->getUsdCurrency($cacheord->actual_price), 100,0), 'currency' => 'usd', 'source' => $data['stripeToken'], ]); if ($result->status == 'succeeded') { $this->orderProcessService->completedOrder($data['orderid'], $cacheord->actual_price, $data['stripeToken']); return 'success'; } return $result; } catch (\Exception $e) { return $e->getMessage(); } } } /** * 根据RMB获取美元 * @param $cny * @return float|int * @throws \Exception */ public function getUsdCurrency($cny) { $client = new Client(); $res = $client->get('https://m.cmbchina.com/api/rate/fx-rate'); $fxrate = json_decode($res->getBody(), true); $data = $fxrate['body']['data']; if (!isset($data)) { throw new \Exception('汇率接口异常'); } $dfFxrate = 0.13; foreach ($data as $item) { if ($item['ccyNbr'] == "美元") { $dfFxrate = bcdiv(100, $item['rtcOfr'], 2); break; } } return bcmul($cny , $dfFxrate , 2); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Controllers/Pay/MapayController.php
app/Http/Controllers/Pay/MapayController.php
<?php namespace App\Http\Controllers\Pay; use App\Exceptions\RuleValidationException; use App\Http\Controllers\PayController; use Illuminate\Http\Request; class MapayController extends PayController { public function gateway(string $payway, string $orderSN) { try { // 加载网关 $this->loadGateWay($orderSN, $payway); //构造要请求的参数数组,无需改动 $parameter = array( "id" => (int)$this->payGateway->merchant_id,//平台ID号 "price" => (float)$this->order->actual_price,//原价 "pay_id" => $this->order->order_sn, //可以是用户ID,站内商户订单号,用户名 "param" => $this->payGateway->pay_check,//自定义参数 "act" => 0,//是否开启认证版的免挂机功能 "outTime" => 120,//二维码超时设置 "page" => 1,//付款页面展示方式 'return_url' => url('detail-order-sn', ['orderSN' => $this->order->order_sn]), 'notify_url' => url($this->payGateway->pay_handleroute . '/notify_url'), "pay_type" => 0,//支付宝使用官方接口 "chart" => 'utf-8'//字符编码方式 //其他业务参数根据在线开发文档,添加参数.文档地址:https://codepay.fateqq.com/apiword/ //如"参数名"=>"参数值" ); switch ($payway){ case 'mqq': $parameter['type'] = 2; break; case 'mzfb': $parameter['type'] = 1; break; case 'mwx': default: $parameter['type'] = 3; break; } $quri = md5_signquery($parameter, $this->payGateway->merchant_pem); $payurl = $this->payGateway->merchant_key . $quri; //支付页面 return redirect()->away($payurl); } catch (RuleValidationException $exception) { return $this->err($exception->getMessage()); } } public function notifyUrl(Request $request) { $data = $request->post(); $order = $this->orderService->detailOrderSN($data['pay_id']); if (!$order) { return 'fail'; } $payGateway = $this->payService->detail($order->pay_id); if (!$payGateway) { return 'fail'; } if($payGateway->pay_handleroute != '/pay/mapay'){ return 'fail'; } $query = signquery_string($data); if (!$data['pay_no'] || md5($query . $payGateway->merchant_pem ) != $data['sign']) { //不合法的数据 return 'fail'; //返回失败 继续补单 } else { //合法的数据 //业务处理 $this->orderProcessService->completedOrder($data['pay_id'], $data['money'], $data['pay_id']); return 'success'; } } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Controllers/Pay/EpusdtController.php
app/Http/Controllers/Pay/EpusdtController.php
<?php /** * The file was created by Assimon. * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ namespace App\Http\Controllers\Pay; use App\Exceptions\RuleValidationException; use App\Http\Controllers\PayController; use GuzzleHttp\Client; use GuzzleHttp\Exception\GuzzleException; use Illuminate\Http\Request; class EpusdtController extends PayController { public function gateway(string $payway, string $orderSN) { try { // 加载网关 $this->loadGateWay($orderSN, $payway); //构造要请求的参数数组,无需改动 $parameter = [ "amount" => (float)$this->order->actual_price,//原价 "order_id" => $this->order->order_sn, //可以是用户ID,站内商户订单号,用户名 'redirect_url' => route('epusdt-return', ['order_id' => $this->order->order_sn]), 'notify_url' => url($this->payGateway->pay_handleroute . '/notify_url'), ]; $parameter['signature'] = $this->epusdtSign($parameter, $this->payGateway->merchant_id); $client = new Client([ 'headers' => [ 'Content-Type' => 'application/json' ] ]); $response = $client->post($this->payGateway->merchant_pem, ['body' => json_encode($parameter)]); $body = json_decode($response->getBody()->getContents(), true); if (!isset($body['status_code']) || $body['status_code'] != 200) { return $this->err(__('dujiaoka.prompt.abnormal_payment_channel') . $body['message']); } return redirect()->away($body['data']['payment_url']); } catch (RuleValidationException $exception) { } catch (GuzzleException $exception) { return $this->err($exception->getMessage()); } } private function epusdtSign(array $parameter, string $signKey) { ksort($parameter); reset($parameter); //内部指针指向数组中的第一个元素 $sign = ''; $urls = ''; foreach ($parameter as $key => $val) { if ($val == '') continue; if ($key != 'signature') { if ($sign != '') { $sign .= "&"; $urls .= "&"; } $sign .= "$key=$val"; //拼接为url参数形式 $urls .= "$key=" . urlencode($val); //拼接为url参数形式 } } $sign = md5($sign . $signKey);//密码追加进入开始MD5签名 return $sign; } public function notifyUrl(Request $request) { $data = $request->all(); $order = $this->orderService->detailOrderSN($data['order_id']); if (!$order) { return 'fail'; } $payGateway = $this->payService->detail($order->pay_id); if (!$payGateway) { return 'fail'; } if($payGateway->pay_handleroute != 'pay/epusdt'){ return 'fail'; } $signature = $this->epusdtSign($data, $payGateway->merchant_id); if ($data['signature'] != $signature) { //不合法的数据 return 'fail'; //返回失败 继续补单 } else { //合法的数据 //业务处理 $this->orderProcessService->completedOrder($data['order_id'], $data['amount'], $data['trade_id']); return 'ok'; } } public function returnUrl(Request $request) { $oid = $request->get('order_id'); // 异步通知还没到就跳转了,所以这里休眠2秒 sleep(2); return redirect(url('detail-order-sn', ['orderSN' => $oid])); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Controllers/Pay/YipayController.php
app/Http/Controllers/Pay/YipayController.php
<?php namespace App\Http\Controllers\Pay; use App\Exceptions\RuleValidationException; use App\Http\Controllers\PayController; use Illuminate\Http\Request; class YipayController extends PayController { public function gateway(string $payway, string $orderSN) { try { // 加载网关 $this->loadGateWay($orderSN, $payway); //组装支付参数 $parameter = [ 'pid' => $this->payGateway->merchant_id, 'type' => $payway, 'out_trade_no' => $this->order->order_sn, 'return_url' => route('yipay-return', ['order_id' => $this->order->order_sn]), 'notify_url' => url($this->payGateway->pay_handleroute . '/notify_url'), 'name' => $this->order->order_sn, 'money' => (float)$this->order->actual_price, 'sign' => $this->payGateway->merchant_pem, 'sign_type' =>'MD5' ]; ksort($parameter); //重新排序$data数组 reset($parameter); //内部指针指向数组中的第一个元素 $sign = ''; foreach ($parameter as $key => $val) { if ($key == "sign" || $key == "sign_type" || $val == "") continue; if ($key != 'sign') { if ($sign != '') { $sign .= "&"; } $sign .= "$key=$val"; //拼接为url参数形式 } } $sign = md5($sign . $this->payGateway->merchant_pem);//密码追加进入开始MD5签名 $parameter['sign'] = $sign; //待请求参数数组 $sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='" . $this->payGateway->merchant_key . "' method='get'>"; foreach($parameter as $key => $val) { $sHtml.= "<input type='hidden' name='".$key."' value='".$val."'/>"; } //submit按钮控件请不要含有name属性 $sHtml = $sHtml."<input type='submit' value=''></form>"; $sHtml = $sHtml."<script>document.forms['alipaysubmit'].submit();</script>"; return $sHtml; } catch (RuleValidationException $exception) { return $this->err($exception->getMessage()); } } public function notifyUrl(Request $request) { $data = $request->all(); $order = $this->orderService->detailOrderSN($data['out_trade_no']); if (!$order) { return 'fail'; } $payGateway = $this->payService->detail($order->pay_id); if (!$payGateway) { return 'fail'; } if($payGateway->pay_handleroute != '/pay/yipay'){ return 'fail'; } ksort($data); //重新排序$data数组 reset($data); //内部指针指向数组中的第一个元素 $sign = ''; foreach ($data as $key => $val) { if ($key == "sign" || $key == "sign_type" || $val == "") continue; if ($key != 'sign') { if ($sign != '') { $sign .= "&"; } $sign .= "$key=$val"; //拼接为url参数形式 } } if (!$data['trade_no'] || md5($sign . $payGateway->merchant_pem) != $data['sign']) { //不合法的数据 return 'fail'; //返回失败 继续补单 } else { //合法的数据 //业务处理 $this->orderProcessService->completedOrder($data['out_trade_no'], $data['money'], $data['trade_no']); return 'success'; } } public function returnUrl(Request $request) { $oid = $request->get('order_id'); // 有些易支付太垃了,异步通知还没到就跳转了,导致订单显示待支付,其实已经支付了,所以这里休眠2秒 sleep(2); return redirect(url('detail-order-sn', ['orderSN' => $oid])); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Controllers/Pay/VpayController.php
app/Http/Controllers/Pay/VpayController.php
<?php /** * VpayController.php * V免签 * Author iLay1678 * Created on 2020/5/1 11:59 */ namespace App\Http\Controllers\Pay; use App\Exceptions\RuleValidationException; use App\Http\Controllers\PayController; use Illuminate\Http\Request; class VpayController extends PayController { public function gateway(string $payway, string $orderSN) { try { // 加载网关 $this->loadGateWay($orderSN, $payway); //构造要请求的参数数组,无需改动 $parameter = array( "payId" => date('YmdHis') . rand(1, 65535),//平台ID号 "price" => (float)$this->order->actual_price,//原价 'param' => $this->order->order_sn, 'returnUrl' => route('vpay-return', ['order_id' => $this->order->order_sn]), 'notifyUrl' => url($this->payGateway->pay_handleroute . '/notify_url'), "isHtml" => 1, ); switch ($payway) { case 'vzfb': $parameter['type'] = 2; break; case 'vwx': default: $parameter['type'] = 1; break; } $parameter['sign'] = md5($parameter['payId'] . $parameter['param'] . $parameter['type'] . $parameter['price'] . $this->payGateway->merchant_id); $payurl = $this->payGateway->merchant_pem . 'createOrder?' . http_build_query($parameter); //支付页面 return redirect()->away($payurl); } catch (RuleValidationException $exception) { return $this->err($exception->getMessage()); } } public function notifyUrl(Request $request) { $data = $request->all(); $order = $this->orderService->detailOrderSN($data['param']); if (!$order) { return 'fail'; } $payGateway = $this->payService->detail($order->pay_id); if($payGateway->pay_handleroute != 'pay/vpay'){ return 'fail'; } if (!$payGateway) { return 'fail'; } $key = $payGateway->merchant_id;//通讯密钥 $payId = $data['payId'];//商户订单号 $param = $data['param'];//创建订单的时候传入的参数 $type = $data['type'];//支付方式 :微信支付为1 支付宝支付为2 $price = $data['price'];//订单金额 $reallyPrice = $data['reallyPrice'];//实际支付金额 $sign = $data['sign'];//校验签名,计算方式 = md5(payId + param + type + price + reallyPrice + 通讯密钥) //开始校验签名 $_sign = md5($payId . $param . $type . $price . $reallyPrice . $key); if ($_sign != $sign) { //不合法的数据 return 'fail'; //返回失败 继续补单 } else { //合法的数据 //业务处理 $this->orderProcessService->completedOrder($param, $price, $payId); return 'success'; } } public function returnUrl(Request $request) { $oid = $request->get('order_id'); // 异步通知还没到就跳转了,所以这里休眠2秒 sleep(2); return redirect(url('detail-order-sn', ['orderSN' => $oid])); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Controllers/Pay/CoinbaseController.php
app/Http/Controllers/Pay/CoinbaseController.php
<?php namespace App\Http\Controllers\Pay; use App\Exceptions\RuleValidationException; use App\Http\Controllers\PayController; use Illuminate\Http\Request; class CoinbaseController extends PayController { public function gateway(string $payway, string $orderSN) { try { // 加载网关 $this->loadGateWay($orderSN, $payway); //构造要请求的参数数组,无需改动 switch ($payway) { case 'coinbase': default: try { $createOrderUrl="https://api.commerce.coinbase.com/charges"; $price_amount = sprintf('%.2f', (float)$this->order->actual_price);// 只取小数点后两位 $fees = (double)$this->payGateway->merchant_id;//手续费费率 比如 0.05 if($fees>0.00) { $price_amount =(double)$price_amount * (1.00+$fees);// 价格 * (1 + 0.05) } $redirect_url = url('detail-order-sn', ['orderSN' => $this->order->order_sn]); //同步地址 $cancel_url = url('detail-order-sn', ['orderSN' => $this->order->order_sn]); //同步地址 $config = [ 'name'=>$this->order->title, 'description'=>$this->order->title.'需付款'.$price_amount.'元', 'pricing_type' => 'fixed_price', 'local_price' => [ 'amount' => $price_amount, 'currency' => 'CNY' ], 'metadata' => [ 'customer_id' => $this->order->order_sn, 'customer_name' => $this->order->title ], 'redirect_url' =>$redirect_url, 'cancel_url'=> $cancel_url ]; $header = array(); $header[] = 'Content-Type:application/json'; $header[] = 'X-CC-Api-Key:'.$this->payGateway->merchant_key; //APP key $header[] = 'X-CC-Version: 2018-03-22'; $ch = curl_init(); //使用curl请求 curl_setopt($ch, CURLOPT_URL, $createOrderUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($config)); $coinbase_json = curl_exec($ch); curl_close($ch); $coinbase_date=json_decode($coinbase_json,true); if(is_array($coinbase_date)) { $payment_url = $coinbase_date['data']['hosted_url']; } else { return 'fail|Coinbase支付接口请求失败'; } return redirect()->away($payment_url); } catch (\Exception $e) { throw new RuleValidationException(__('dujiaoka.prompt.abnormal_payment_channel') . $e->getMessage()); } break; } } catch (RuleValidationException $exception) { return $this->err($exception->getMessage()); } } public function notifyUrl(Request $request) { $payload = file_get_contents( 'php://input' ); $sig = $_SERVER['HTTP_X_CC_WEBHOOK_SIGNATURE']; $data = json_decode( $payload, true ); $event_data = $data['event']['data']; $order = $this->orderService->detailOrderSN($event_data['metadata']['customer_id']);// if (!$order) { return 'fail'; } $payGateway = $this->payService->detail($order->pay_id); if (!$payGateway) { return 'fail'; } if($payGateway->pay_handleroute != 'pay/coinbase'){ return 'fail'; } $secret = $payGateway->merchant_pem;//共享密钥 $sig2 = hash_hmac( 'sha256', $payload, $secret ); $result_str=array("confirmed","resolved");//返回的结果字符串数组 if (!empty( $payload ) && ($sig === $sig2)) { foreach ($event_data['payments'] as $payment) { //if ((strtolower($payment['status']) === 'confirmed')||(strtolower($payment['status']) === 'resolved')) { if(in_array(strtolower($payment['status']),$result_str)){ $return_pay_amount = $payment['value']['local']['amount']; $return_currency=$payment['value']['local']['currency']; $return_status=strtolower($payment['status']); } } if($return_currency !== 'CNY') { return 'error|Notify: Wrong currency:'.$return_currency; } $bccomp = bccomp($order->actual_price, $return_pay_amount, 2); //如果订单金额 大于 实际支付金额 返回1,抛出异常 if ($bccomp == 1) { throw new \Exception(__('Coinbase付款金额不足')); } $return_merchant_order_id = $event_data['metadata']['customer_id'];//卡网订单号 $tradeid = $event_data['code'];//Coinbase订单号 //if($return_status === 'confirmed'||$return_status === 'resolved') if(in_array(strtolower($payment['status']),$result_str)) { $this->orderProcessService->completedOrder($return_merchant_order_id, $order->actual_price, $tradeid);// 卡网订单号,订单金额(不能传入支付金额,否则抛出订单金额不一致异常),收款平台订单号 return "{\"status\": 200}"; } else { //不合法的数据 return 'fail'; //返回失败 继续补单 } } else { //不合法的数据 return 'fail|wrong sig'; //返回失败 继续补单 } } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Controllers/Pay/PayjsController.php
app/Http/Controllers/Pay/PayjsController.php
<?php namespace App\Http\Controllers\Pay; use App\Exceptions\RuleValidationException; use App\Http\Controllers\PayController; use Illuminate\Http\Request; use Xhat\Payjs\Facades\Payjs; class PayjsController extends PayController { public function gateway(string $payway, string $orderSN) { try { // 加载网关 $this->loadGateWay($orderSN, $payway); // 构造订单基础信息 $data = [ 'body' => $this->order->order_sn, // 订单标题 'total_fee' => bcmul($this->order->actual_price, 100, 0), // 订单金额 'out_trade_no' => $this->order->order_sn, // 订单号 'notify_url' => url($this->payGateway->pay_handleroute . '/notify_url'), ]; config(['payjs.mchid' => $this->payGateway->merchant_id, 'payjs.key' => $this->payGateway->merchant_pem]); switch ($payway){ case 'payjswescan': try{ $payres = Payjs::native($data); if ($payres['return_code'] != 1) { throw new RuleValidationException($payres['return_msg']); } $result['payname'] = $this->payGateway->pay_name; $result['actual_price'] = (float)$this->order->actual_price; $result['orderid'] = $this->order->order_sn; $result['qr_code'] = $payres['code_url']; return $this->render('static_pages/qrpay', $result, __('dujiaoka.scan_qrcode_to_pay')); } catch (\Exception $e) { throw new RuleValidationException(__('dujiaoka.prompt.abnormal_payment_channel') . $e->getMessage()); } break; } } catch (RuleValidationException $exception) { return $this->err($exception->getMessage()); } } public function notifyUrl(Request $request) { $orderSN = $request->input('out_trade_no'); $order = $this->orderService->detailOrderSN($orderSN); if (!$order) { return 'error'; } $payGateway = $this->payService->detail($order->pay_id); if (!$payGateway) { return 'error'; } if($payGateway->pay_handleroute != '/pay/payjs'){ return 'fail'; } config(['payjs.mchid' => $payGateway->merchant_id, 'payjs.key' => $payGateway->merchant_pem]); $notify_info = Payjs::notify(); $totalFee = bcdiv($notify_info['total_fee'], 100, 2); $this->orderProcessService->completedOrder($notify_info['out_trade_no'], $totalFee, $notify_info['payjs_order_id']); return 'success'; } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Controllers/Pay/AlipayController.php
app/Http/Controllers/Pay/AlipayController.php
<?php namespace App\Http\Controllers\Pay; use App\Exceptions\RuleValidationException; use App\Http\Controllers\PayController; use Illuminate\Http\Request; use Yansongda\Pay\Pay; class AlipayController extends PayController { /** * 支付宝支付网关 * * @param string $payway * @param string $orderSN */ public function gateway(string $payway, string $orderSN) { try { // 加载网关 $this->loadGateWay($orderSN, $payway); $config = [ 'app_id' => $this->payGateway->merchant_id, 'ali_public_key' => $this->payGateway->merchant_key, 'private_key' => $this->payGateway->merchant_pem, 'notify_url' => url($this->payGateway->pay_handleroute . '/notify_url'), 'return_url' => url('detail-order-sn', ['orderSN' => $this->order->order_sn]), 'http' => [ // optional 'timeout' => 10.0, 'connect_timeout' => 10.0, ], ]; $order = [ 'out_trade_no' => $this->order->order_sn, 'total_amount' => (float)$this->order->actual_price, 'subject' => $this->order->order_sn ]; switch ($payway){ case 'zfbf2f': case 'alipayscan': try{ $result = Pay::alipay($config)->scan($order)->toArray(); $result['payname'] = $this->order->order_sn; $result['actual_price'] = (float)$this->order->actual_price; $result['orderid'] = $this->order->order_sn; $result['jump_payuri'] = $result['qr_code']; return $this->render('static_pages/qrpay', $result, __('dujiaoka.scan_qrcode_to_pay')); } catch (\Exception $e) { return $this->err(__('dujiaoka.prompt.abnormal_payment_channel') . $e->getMessage()); } case 'aliweb': try{ $result = Pay::alipay($config)->web($order); return $result; } catch (\Exception $e) { return $this->err(__('dujiaoka.prompt.abnormal_payment_channel') . $e->getMessage()); } case 'aliwap': try{ $result = Pay::alipay($config)->wap($order); return $result; } catch (\Exception $e) { return $this->err(__('dujiaoka.prompt.abnormal_payment_channel') . $e->getMessage()); } } } catch (RuleValidationException $exception) { return $this->err($exception->getMessage()); } } /** * 异步通知 */ public function notifyUrl(Request $request) { $orderSN = $request->input('out_trade_no'); $order = $this->orderService->detailOrderSN($orderSN); if (!$order) { return 'error'; } $payGateway = $this->payService->detail($order->pay_id); if (!$payGateway) { return 'error'; } if($payGateway->pay_handleroute != '/pay/alipay'){ return 'fail'; } $config = [ 'app_id' => $payGateway->merchant_id, 'ali_public_key' => $payGateway->merchant_key, 'private_key' => $payGateway->merchant_pem, ]; $pay = Pay::alipay($config); try{ // 验证签名 $result = $pay->verify(); if ($result->trade_status == 'TRADE_SUCCESS' || $result->trade_status == 'TRADE_FINISHED') { $this->orderProcessService->completedOrder($result->out_trade_no, $result->total_amount, $result->trade_no); } return 'success'; } catch (\Exception $exception) { return 'fail'; } } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Controllers/Pay/PaysapiController.php
app/Http/Controllers/Pay/PaysapiController.php
<?php namespace App\Http\Controllers\Pay; use App\Exceptions\RuleValidationException; use App\Http\Controllers\PayController; use Illuminate\Http\Request; class PaysapiController extends PayController { const PAY_URI = 'https://pay.bearsoftware.net.cn/'; public function gateway(string $payway, string $orderSN) { try { // 加载网关 $this->loadGateWay($orderSN, $payway); //从网页传入price:支付价格, istype:支付渠道:1-支付宝;2-微信支付 $price = (float)$this->order->actual_price; $orderuid = $this->order->email; //此处传入您网站用户的用户名,方便在paysapi后台查看是谁付的款,强烈建议加上。可忽略。 //校验传入的表单,确保价格为正常价格(整数,1位小数,2位小数都可以),支付渠道只能是1或者2,orderuid长度不要超过33个中英文字。 //此处就在您服务器生成新订单,并把创建的订单号传入到下面的orderid中。 $goodsname = $this->order->order_sn; $orderid = $this->order->order_sn; //每次有任何参数变化,订单号就变一个吧。 $uid = $this->payGateway->merchant_id; //"此处填写PaysApi的uid"; $token = $this->payGateway->merchant_pem; //"此处填写PaysApi的Token"; $return_url = route('paysapi-return', ['order_id' => $this->order->order_sn]); $notify_url = url($this->payGateway->pay_handleroute . '/notify_url'); switch ($payway){ case 'pszfb': $istype = 1; break; case 'pswx': default: $istype = 2; break; } $key = md5($goodsname. $istype . $notify_url . $orderid . $orderuid . $price . $return_url . $token . $uid); //经常遇到有研发问为啥key值返回错误,大多数原因:1.参数的排列顺序不对;2.上面的参数少传了,但是这里的key值又带进去计算了,导致服务端key算出来和你的不一样。 $html = " <html><head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"> <title>loading pay...</title> <style type=\"text/css\"> body {margin:0;padding:0;} p {position:absolute; left:50%;top:50%; width:330px;height:30px; margin:-35px 0 0 -160px; padding:20px;font:bold 14px/30px \"宋体\", Arial; text-indent:22px;border:1px solid #c5d0dc;} #waiting {font-family:Arial;} </style> <script> function open_without_referrer(link){ document.body.appendChild(document.createElement('iframe')).src='javascript:\"<script>top.location.replace(\''+link+'\')<\/script>\"'; } </script> </head> <body style=\"\"> <form id=\"alipaysubmit\" name=\"alipaysubmit\" action=\"".self::PAY_URI."\" method=\"post\"> <input type=\"hidden\" name=\"goodsname\" value=\"".$goodsname."\"> <input type=\"hidden\" name=\"istype\" value=\"".$istype."\"> <input type=\"hidden\" name=\"key\" value=\"".$key."\"> <input type=\"hidden\" name=\"notify_url\" value=\"".$notify_url."\"> <input type=\"hidden\" name=\"orderid\" value=\"".$orderid."\"> <input type=\"hidden\" name=\"orderuid\" value=\"".$orderuid."\"> <input type=\"hidden\" name=\"price\" value=\"".$price."\"> <input type=\"hidden\" name=\"return_url\" value=\"".$return_url."\"> <input type=\"hidden\" name=\"uid\" value=\"".$uid."\"> <input type=\"submit\" value=\"正在跳转\"> </form><script>document.forms['alipaysubmit'].submit();</script></body></html> "; return $html; } catch (RuleValidationException $exception) { return $this->err($exception->getMessage()); } } public function notifyUrl(Request $request) { $data = $request->post(); $order = $this->orderService->detailOrderSN($data['orderid']); if (!$order) { return 'error'; } $payGateway = $this->payService->detail($order->pay_id); if (!$payGateway) { return 'error'; } if($payGateway->pay_handleroute != '/pay/paysapi'){ return 'error'; } $temps = md5($data['orderid'] . $data['orderuid'] . $data['paysapi_id'] . $data['price'] . $data['realprice'] . $payGateway->merchant_pem); if ($temps != $data['key']){ return 'fail'; }else{ //校验key成功,是自己人。执行自己的业务逻辑:加余额,订单付款成功,装备购买成功等等。 //业务处理 $this->orderProcessService->completedOrder($data['orderid'], $data['price'], $data['paysapi_id']); return 'success'; } } public function returnUrl(Request $request) { $oid = $request->input('order_id'); sleep(1); return redirect(url('detail-order-sn', ['orderSN' => $oid])); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Controllers/Pay/TokenPayController.php
app/Http/Controllers/Pay/TokenPayController.php
<?php /** * The file was created by LightCountry. * * @author https://github.com/LightCountry * @copyright https://github.com/LightCountry * @link https://github.com/LightCountry/TokenPay */ namespace App\Http\Controllers\Pay; use App\Exceptions\RuleValidationException; use App\Http\Controllers\PayController; use GuzzleHttp\Client; use GuzzleHttp\Exception\GuzzleException; use Illuminate\Http\Request; class TokenPayController extends PayController { public function gateway(string $payway, string $orderSN) { try { // 加载网关 $this->loadGateWay($orderSN, $payway); //构造要请求的参数数组,无需改动 $parameter = [ "ActualAmount" => (float)$this->order->actual_price,//原价 "OutOrderId" => $this->order->order_sn, "OrderUserKey" => $this->order->email, "Currency" => $this->payGateway->merchant_id, 'RedirectUrl' => route('tokenpay-return', ['order_id' => $this->order->order_sn]), 'NotifyUrl' => url($this->payGateway->pay_handleroute . '/notify_url'), ]; $parameter['Signature'] = $this->VerifySign($parameter, $this->payGateway->merchant_key); $client = new Client([ 'headers' => [ 'Content-Type' => 'application/json' ] ]); $response = $client->post($this->payGateway->merchant_pem.'/CreateOrder', ['body' => json_encode($parameter)]); $body = json_decode($response->getBody()->getContents(), true); if (!isset($body['success']) || $body['success'] != true) { return $this->err(__('dujiaoka.prompt.abnormal_payment_channel') . $body['message']); } return redirect()->away($body['data']); } catch (RuleValidationException $exception) { } catch (GuzzleException $exception) { return $this->err($exception->getMessage()); } } private function VerifySign(array $parameter, string $signKey) { ksort($parameter); reset($parameter); //内部指针指向数组中的第一个元素 $sign = ''; $urls = ''; foreach ($parameter as $key => $val) { if ($key != 'Signature') { if ($sign != '') { $sign .= "&"; $urls .= "&"; } $sign .= "$key=$val"; //拼接为url参数形式 $urls .= "$key=" . urlencode($val); //拼接为url参数形式 } } $sign = md5($sign . $signKey);//密码追加进入开始MD5签名 return $sign; } public function notifyUrl(Request $request) { $data = $request->all(); $order = $this->orderService->detailOrderSN($data['OutOrderId']); if (!$order) { return 'fail'; } $payGateway = $this->payService->detail($order->pay_id); if (!$payGateway) { return 'fail'; } if($payGateway->pay_handleroute != 'pay/tokenpay'){ return 'fail'; } //合法的数据 $signature = $this->VerifySign($data, $payGateway->merchant_key); if ($data['Signature'] != $signature) { //不合法的数据 return 'fail'; //返回失败 继续补单 } else { //合法的数据 //业务处理 $this->orderProcessService->completedOrder($data['OutOrderId'], $data['ActualAmount'], $data['Id']); return 'ok'; } } public function returnUrl(Request $request) { $oid = $request->get('order_id'); // 异步通知还没到就跳转了,所以这里休眠2秒 sleep(2); return redirect(url('detail-order-sn', ['orderSN' => $oid])); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Middleware/InstallCheck.php
app/Http/Middleware/InstallCheck.php
<?php namespace App\Http\Middleware; use Closure; class InstallCheck { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { // 安装检查 $installLock = base_path() . DIRECTORY_SEPARATOR . 'install.lock'; if (file_exists($installLock)) { return redirect(url('/')); } return $next($request); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Middleware/DujiaoSystem.php
app/Http/Middleware/DujiaoSystem.php
<?php namespace App\Http\Middleware; use App\Providers\AppServiceProvider; use Closure; class DujiaoSystem { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { // 检测https if ($request->getScheme() == 'https') { $httpsConfig = [ 'https' => true ]; config([ 'admin' => array_merge(config('admin'), $httpsConfig) ]); (new AppServiceProvider(app()))->register(); } return $next($request); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Middleware/PayGateWay.php
app/Http/Middleware/PayGateWay.php
<?php namespace App\Http\Middleware; use Closure; class PayGateWay { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { return $next($request); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Middleware/Authenticate.php
app/Http/Middleware/Authenticate.php
<?php namespace App\Http\Middleware; use Illuminate\Auth\Middleware\Authenticate as Middleware; class Authenticate extends Middleware { /** * Get the path the user should be redirected to when they are not authenticated. * * @param \Illuminate\Http\Request $request * @return string|null */ protected function redirectTo($request) { if (! $request->expectsJson()) { return route('login'); } } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Middleware/RedirectIfAuthenticated.php
app/Http/Middleware/RedirectIfAuthenticated.php
<?php namespace App\Http\Middleware; use App\Providers\RouteServiceProvider; use Closure; use Illuminate\Support\Facades\Auth; class RedirectIfAuthenticated { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string|null $guard * @return mixed */ public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->check()) { return redirect(RouteServiceProvider::HOME); } return $next($request); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Middleware/TrustProxies.php
app/Http/Middleware/TrustProxies.php
<?php namespace App\Http\Middleware; use Fideloper\Proxy\TrustProxies as Middleware; use Illuminate\Http\Request; class TrustProxies extends Middleware { /** * The trusted proxies for this application. * * @var array|string */ protected $proxies; /** * The headers that should be used to detect proxies. * * @var int */ protected $headers = Request::HEADER_X_FORWARDED_ALL; }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Middleware/TrimStrings.php
app/Http/Middleware/TrimStrings.php
<?php namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware; class TrimStrings extends Middleware { /** * The names of the attributes that should not be trimmed. * * @var array */ protected $except = [ 'password', 'password_confirmation', ]; }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Middleware/DujiaoBoot.php
app/Http/Middleware/DujiaoBoot.php
<?php namespace App\Http\Middleware; use App\Models\BaseModel; use Closure; use Germey\Geetest\GeetestServiceProvider; class DujiaoBoot { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { // 安装检查 $installLock = base_path() . DIRECTORY_SEPARATOR . 'install.lock'; if (!file_exists($installLock)) { return redirect(url('install')); } // 浏览器检测 $userAgent = $request->header('user-agent'); $nowUri = site_url() . $request->path(); $tplPath = 'common/notencent'; if ( (strpos($userAgent, 'QQ/') || strpos($userAgent, 'MicroMessenger') !== false) && dujiaoka_config_get('is_open_anti_red', BaseModel::STATUS_OPEN) == BaseModel::STATUS_OPEN ) { return response()->view($tplPath, ['nowUri' => $nowUri]); } // 语言检测 $lang = dujiaoka_config_get('language', 'zh_CN'); app()->setLocale($lang); // 极验 $geetest = dujiaoka_config_get('is_open_geetest', BaseModel::STATUS_CLOSE); if ($geetest == BaseModel::STATUS_OPEN) { $geetestConfig = [ 'key' => dujiaoka_config_get('geetest_key'), 'id' => dujiaoka_config_get('geetest_id'), 'lang' => $lang ]; // 覆盖 配置 config([ 'geetest' => array_merge(config('mail'), $geetestConfig) ]); // 重新注册服务 (new GeetestServiceProvider(app()))->register(); } return $next($request); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Middleware/CheckForMaintenanceMode.php
app/Http/Middleware/CheckForMaintenanceMode.php
<?php namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware; class CheckForMaintenanceMode extends Middleware { /** * The URIs that should be reachable while maintenance mode is enabled. * * @var array */ protected $except = [ // ]; }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Middleware/EncryptCookies.php
app/Http/Middleware/EncryptCookies.php
<?php namespace App\Http\Middleware; use Illuminate\Cookie\Middleware\EncryptCookies as Middleware; class EncryptCookies extends Middleware { /** * The names of the cookies that should not be encrypted. * * @var array */ protected $except = [ // ]; }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Http/Middleware/VerifyCsrfToken.php
app/Http/Middleware/VerifyCsrfToken.php
<?php namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware; class VerifyCsrfToken extends Middleware { /** * Indicates whether the XSRF-TOKEN cookie should be set on the response. * * @var bool */ protected $addHttpCookie = true; /** * The URIs that should be excluded from CSRF verification. * * @var array */ protected $except = [ 'pay/*', ]; }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Listeners/GoodsGroupDeleted.php
app/Listeners/GoodsGroupDeleted.php
<?php namespace App\Listeners; use App\Models\Goods; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Queue\InteractsWithQueue; use App\Events\GoodsGroupDeleted as GoodsGroupDeletedEvent; class GoodsGroupDeleted { /** * Create the event listener. * * @return void */ public function __construct() { // } /** * Handle the event. * * @param GoodsGroupDeletedEvent $event * @return void */ public function handle(GoodsGroupDeletedEvent $event) { Goods::query()->where('group_id', $event->goodsGroup->id)->delete(); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Listeners/GoodsDeleted.php
app/Listeners/GoodsDeleted.php
<?php namespace App\Listeners; use App\Models\Carmis; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Queue\InteractsWithQueue; use App\Events\GoodsDeleted as GoodsDeletedEvent; class GoodsDeleted { /** * Create the event listener. * * @return void */ public function __construct() { // } /** * Handle the event. * * @param object $event * @return void */ public function handle(GoodsDeletedEvent $event) { Carmis::query()->where('goods_id', $event->goods->id)->delete(); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Listeners/OrderUpdated.php
app/Listeners/OrderUpdated.php
<?php namespace App\Listeners; use App\Jobs\MailSend; use App\Models\Emailtpl; use App\Models\Order; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Queue\InteractsWithQueue; use App\Events\OrderUpdated as OrderUpdatedEvent; class OrderUpdated { /** * Create the event listener. * * @return void */ public function __construct() { // } /** * Handle the event. * * @param object $event * @return void */ public function handle(OrderUpdatedEvent $event) { $sysCache = cache('system-setting'); // 当代充商品状态,将会对顾客进行订单内容推送 $order = [ 'created_at' => date('Y-m-d H:i'), 'ord_title' => $event->order->title, 'webname' => $sysCache['text_logo'] ?? '独角数卡', 'weburl' => config('app.url'), 'order_id' => $event->order->order_sn, 'ord_price' => $event->order->actual_price, 'ord_info' => str_replace(PHP_EOL, '<br/>', $event->order->info) ]; $to = $event->order->email; // 邮件 if ($event->order->type == Order::MANUAL_PROCESSING) { switch ($event->order->status) { case Order::STATUS_PENDING: $mailtpl = Emailtpl::query()->where('tpl_token', 'pending_order')->first()->toArray(); self::sendMailToOrderStatus($mailtpl, $order, $to); break; case Order::STATUS_COMPLETED: $mailtpl = Emailtpl::query()->where('tpl_token', 'completed_order')->first()->toArray(); self::sendMailToOrderStatus($mailtpl, $order, $to); break; case Order::STATUS_FAILURE: $mailtpl = Emailtpl::query()->where('tpl_token', 'failed_order')->first()->toArray(); self::sendMailToOrderStatus($mailtpl, $order, $to); break; } } } /** * 邮件发送 * * @param array $mailtpl 模板 * @param array $order 内容 * @param string $to 接受者 * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ private static function sendMailToOrderStatus(array $mailtpl, array $order, string $to) :void { $info = replace_mail_tpl($mailtpl, $order); MailSend::dispatch($to, $info['tpl_name'], $info['tpl_content']); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Rules/SearchPwd.php
app/Rules/SearchPwd.php
<?php namespace App\Rules; use App\Models\BaseModel; use Illuminate\Contracts\Validation\Rule; class SearchPwd implements Rule { /** * Create a new rule instance. * * @return void */ public function __construct() { // } /** * Determine if the validation rule passes. * * @param string $attribute * @param mixed $value * @return bool */ public function passes($attribute, $value) { if (dujiaoka_config_get('is_open_search_pwd') == BaseModel::STATUS_OPEN && empty($value)) { return false; } return true; } /** * Get the validation error message. * * @return string */ public function message() { return __('dujiaoka.prompt.search_password_can_not_be_empty'); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Rules/VerifyImg.php
app/Rules/VerifyImg.php
<?php namespace App\Rules; use App\Models\BaseModel; use Illuminate\Contracts\Validation\Rule; class VerifyImg implements Rule { /** * Create a new rule instance. * * @return void */ public function __construct() { // } /** * Determine if the validation rule passes. * * @param string $attribute * @param mixed $value * @return bool */ public function passes($attribute, $value) { if (dujiaoka_config_get('is_open_img_code') == BaseModel::STATUS_OPEN && !captcha_check($value)) { return false; } return true; } /** * Get the validation error message. * * @return string */ public function message() { return __('dujiaoka.prompt.image_verify_code_error'); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Admin/routes.php
app/Admin/routes.php
<?php use Illuminate\Routing\Router; use Illuminate\Support\Facades\Route; use Dcat\Admin\Admin; Admin::routes(); Route::group([ 'prefix' => config('admin.route.prefix'), 'namespace' => config('admin.route.namespace'), 'middleware' => config('admin.route.middleware'), ], function (Router $router) { $router->get('/', 'HomeController@index'); $router->resource('goods', 'GoodsController'); $router->resource('goods-group', 'GoodsGroupController'); $router->resource('carmis', 'CarmisController'); $router->resource('coupon', 'CouponController'); $router->resource('emailtpl', 'EmailtplController'); $router->resource('pay', 'PayController'); $router->resource('order', 'OrderController'); $router->get('import-carmis', 'CarmisController@importCarmis'); $router->get('system-setting', 'SystemSettingController@systemSetting'); $router->get('email-test', 'EmailTestController@emailTest'); });
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Admin/bootstrap.php
app/Admin/bootstrap.php
<?php use Dcat\Admin\Admin; use Dcat\Admin\Grid; use Dcat\Admin\Form; use Dcat\Admin\Grid\Filter; use Dcat\Admin\Show; /** * Dcat-admin - admin builder based on Laravel. * @author jqh <https://github.com/jqhph> * * Bootstraper for Admin. * * Here you can remove builtin form field: * * extend custom field: * Dcat\Admin\Form::extend('php', PHPEditor::class); * Dcat\Admin\Grid\Column::extend('php', PHPEditor::class); * Dcat\Admin\Grid\Filter::extend('php', PHPEditor::class); * * Or require js and css assets: * Admin::css('/packages/prettydocs/css/styles.css'); * Admin::js('/packages/prettydocs/js/main.js'); * */
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Admin/Controllers/CarmisController.php
app/Admin/Controllers/CarmisController.php
<?php namespace App\Admin\Controllers; use App\Admin\Actions\Post\BatchRestore; use App\Admin\Actions\Post\Restore; use App\Admin\Forms\ImportCarmis; use App\Admin\Repositories\Carmis; use App\Models\Goods; use Dcat\Admin\Form; use Dcat\Admin\Grid; use Dcat\Admin\Layout\Content; use Dcat\Admin\Show; use Dcat\Admin\Http\Controllers\AdminController; use App\Models\Carmis as CarmisModel; use Dcat\Admin\Widgets\Card; class CarmisController extends AdminController { /** * Make a grid builder. * * @return Grid */ protected function grid() { return Grid::make(new Carmis(['goods']), function (Grid $grid) { $grid->model()->orderBy('id', 'DESC'); $grid->column('id')->sortable(); $grid->column('goods.gd_name', admin_trans('carmis.fields.goods_id')); $grid->column('status')->select(CarmisModel::getStatusMap()); $grid->column('is_loop')->display(function($v){return $v==1?admin_trans('carmis.fields.yes'):"";}); $grid->column('carmi')->limit(20); $grid->column('created_at'); $grid->column('updated_at')->sortable(); $grid->filter(function (Grid\Filter $filter) { $filter->equal('id'); $filter->equal('goods_id')->select( Goods::query()->where('type', Goods::AUTOMATIC_DELIVERY)->pluck('gd_name', 'id') ); $filter->equal('status')->select(CarmisModel::getStatusMap()); $filter->scope(admin_trans('dujiaoka.trashed'))->onlyTrashed(); }); $grid->actions(function (Grid\Displayers\Actions $actions) { if (request('_scope_') == admin_trans('dujiaoka.trashed')) { $actions->append(new Restore(CarmisModel::class)); } }); $grid->batchActions(function (Grid\Tools\BatchActions $batch) { if (request('_scope_') == admin_trans('dujiaoka.trashed')) { $batch->add(new BatchRestore(CarmisModel::class)); } }); $grid->export()->titles(['goods.gd_name' => admin_trans('carmis.fields.goods_id'), 'carmi' => admin_trans('carmis.fields.carmi'), 'created_at' => admin_trans('admin.created_at')]); }); } /** * Make a show builder. * * @param mixed $id * * @return Show */ protected function detail($id) { return Show::make($id, new Carmis(['goods']), function (Show $show) { $show->field('id'); $show->field('goods.gd_name', admin_trans('carmis.fields.goods_id')); $show->field('status')->as(function ($type) { if ($type == CarmisModel::STATUS_UNSOLD) { return admin_trans('carmis.fields.status_unsold'); } else { return admin_trans('carmis.fields.status_sold'); } }); $show->field('is_loop')->as(function ($v) {return $v==1?admin_trans('carmis.fields.yes'):"";}); $show->field('carmi'); $show->field('created_at'); $show->field('updated_at'); }); } /** * Make a form builder. * * @return Form */ protected function form() { return Form::make(new Carmis(), function (Form $form) { $form->display('id'); $form->select('goods_id')->options( Goods::query()->where('type', Goods::AUTOMATIC_DELIVERY)->pluck('gd_name', 'id') )->required(); $form->radio('status') ->options(CarmisModel::getStatusMap()) ->default(CarmisModel::STATUS_UNSOLD); $form->switch('is_loop')->default(false); $form->textarea('carmi')->required(); $form->display('created_at'); $form->display('updated_at'); }); } /** * 导入卡密 * * @param Content $content * @return Content * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function importCarmis(Content $content) { return $content ->title(admin_trans('carmis.fields.import_carmis')) ->body(new Card(new ImportCarmis())); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Admin/Controllers/GoodsController.php
app/Admin/Controllers/GoodsController.php
<?php namespace App\Admin\Controllers; use App\Admin\Actions\Post\BatchRestore; use App\Admin\Actions\Post\Restore; use App\Admin\Repositories\Goods; use App\Models\Carmis; use App\Models\Coupon; use App\Models\GoodsGroup as GoodsGroupModel; use Dcat\Admin\Admin; use Dcat\Admin\Form; use Dcat\Admin\Grid; use Dcat\Admin\Show; use Dcat\Admin\Http\Controllers\AdminController; use App\Models\Goods as GoodsModel; class GoodsController extends AdminController { /** * Make a grid builder. * * @return Grid */ protected function grid() { return Grid::make(new Goods(['group', 'coupon']), function (Grid $grid) { $grid->model()->orderBy('id', 'DESC'); $grid->column('id')->sortable(); $grid->column('picture')->image('', 100, 100); $grid->column('gd_name'); $grid->column('gd_description'); $grid->column('gd_keywords'); $grid->column('group.gp_name', admin_trans('goods.fields.group_id')); $grid->column('type') ->using(GoodsModel::getGoodsTypeMap()) ->label([ GoodsModel::AUTOMATIC_DELIVERY => Admin::color()->success(), GoodsModel::MANUAL_PROCESSING => Admin::color()->info(), ]); $grid->column('retail_price'); $grid->column('actual_price')->sortable(); $grid->column('in_stock')->display(function () { // 如果为自动发货,则加载库存卡密 if ($this->type == GoodsModel::AUTOMATIC_DELIVERY) { return Carmis::query()->where('goods_id', $this->id) ->where('status', Carmis::STATUS_UNSOLD) ->count(); } else { return $this->in_stock; } }); $grid->column('sales_volume'); $grid->column('ord')->editable()->sortable(); $grid->column('is_open')->switch(); $grid->column('created_at')->sortable(); $grid->column('updated_at'); $grid->filter(function (Grid\Filter $filter) { $filter->equal('id'); $filter->like('gd_name'); $filter->equal('type')->select(GoodsModel::getGoodsTypeMap()); $filter->equal('group_id')->select(GoodsGroupModel::query()->pluck('gp_name', 'id')); $filter->scope(admin_trans('dujiaoka.trashed'))->onlyTrashed(); $filter->equal('coupon.coupons_id', admin_trans('goods.fields.coupon_id'))->select( Coupon::query()->pluck('coupon', 'id') ); }); $grid->actions(function (Grid\Displayers\Actions $actions) { if (request('_scope_') == admin_trans('dujiaoka.trashed')) { $actions->append(new Restore(GoodsModel::class)); } }); $grid->batchActions(function (Grid\Tools\BatchActions $batch) { if (request('_scope_') == admin_trans('dujiaoka.trashed')) { $batch->add(new BatchRestore(GoodsModel::class)); } }); }); } /** * Make a show builder. * * @param mixed $id * * @return Show */ protected function detail($id) { return Show::make($id, new Goods(), function (Show $show) { $show->id('id'); $show->field('gd_name'); $show->field('gd_description'); $show->field('gd_keywords'); $show->field('picture')->image(); $show->field('retail_price'); $show->field('actual_price'); $show->field('in_stock'); $show->field('ord'); $show->field('sales_volume'); $show->field('type')->as(function ($type) { if ($type == GoodsModel::AUTOMATIC_DELIVERY) { return admin_trans('goods.fields.automatic_delivery'); } else { return admin_trans('goods.fields.manual_processing'); } }); $show->field('is_open')->as(function ($isOpen) { if ($isOpen == GoodsGroupModel::STATUS_OPEN) { return admin_trans('dujiaoka.status_open'); } else { return admin_trans('dujiaoka.status_close'); } }); $show->wholesale_price_cnf()->unescape()->as(function ($wholesalePriceCnf) { return "<textarea class=\"form-control field_wholesale_price_cnf _normal_\" rows=\"10\" cols=\"30\">" . $wholesalePriceCnf . "</textarea>"; }); $show->other_ipu_cnf()->unescape()->as(function ($otherIpuCnf) { return "<textarea class=\"form-control field_wholesale_price_cnf _normal_\" rows=\"10\" cols=\"30\">" . $otherIpuCnf . "</textarea>"; }); $show->api_hook()->unescape()->as(function ($apiHook) { return "<textarea class=\"form-control field_wholesale_price_cnf _normal_\" rows=\"10\" cols=\"30\">" . $apiHook . "</textarea>"; });; }); } /** * Make a form builder. * * @return Form */ protected function form() { return Form::make(new Goods(), function (Form $form) { $form->display('id'); $form->text('gd_name')->required(); $form->text('gd_description')->required(); $form->text('gd_keywords')->required(); $form->select('group_id')->options( GoodsGroupModel::query()->pluck('gp_name', 'id') )->required(); $form->image('picture')->autoUpload()->uniqueName()->help(admin_trans('goods.helps.picture')); $form->radio('type')->options(GoodsModel::getGoodsTypeMap())->default(GoodsModel::AUTOMATIC_DELIVERY)->required(); $form->currency('retail_price')->default(0)->help(admin_trans('goods.helps.retail_price')); $form->currency('actual_price')->default(0)->required(); $form->number('in_stock')->help(admin_trans('goods.helps.in_stock')); $form->number('sales_volume'); $form->number('buy_limit_num')->help(admin_trans('goods.helps.buy_limit_num')); $form->editor('buy_prompt'); $form->editor('description'); $form->textarea('other_ipu_cnf')->help(admin_trans('goods.helps.other_ipu_cnf')); $form->textarea('wholesale_price_cnf')->help(admin_trans('goods.helps.wholesale_price_cnf')); $form->textarea('api_hook'); $form->number('ord')->default(1)->help(admin_trans('dujiaoka.ord')); $form->switch('is_open')->default(GoodsModel::STATUS_OPEN); }); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Admin/Controllers/PayController.php
app/Admin/Controllers/PayController.php
<?php namespace App\Admin\Controllers; use App\Admin\Actions\Post\BatchRestore; use App\Admin\Actions\Post\Restore; use App\Admin\Repositories\Pay; use Dcat\Admin\Form; use Dcat\Admin\Grid; use Dcat\Admin\Show; use Dcat\Admin\Http\Controllers\AdminController; use App\Models\Pay as PayModel; class PayController extends AdminController { /** * Make a grid builder. * * @return Grid */ protected function grid() { return Grid::make(new Pay(), function (Grid $grid) { $grid->column('id')->sortable(); $grid->column('pay_name'); $grid->column('pay_check'); $grid->column('pay_method')->select(PayModel::getMethodMap()); $grid->column('merchant_id')->limit(20); $grid->column('merchant_key')->limit(20); $grid->column('merchant_pem')->limit(20); $grid->column('pay_client')->select(PayModel::getClientMap()); $grid->column('pay_handleroute'); $grid->column('is_open')->switch(); $grid->column('created_at'); $grid->column('updated_at')->sortable(); $grid->disableDeleteButton(); $grid->filter(function (Grid\Filter $filter) { $filter->equal('id'); $filter->equal('pay_check'); $filter->like('pay_name'); $filter->scope(admin_trans('dujiaoka.trashed'))->onlyTrashed(); }); $grid->actions(function (Grid\Displayers\Actions $actions) { if (request('_scope_') == admin_trans('dujiaoka.trashed')) { $actions->append(new Restore(PayModel::class)); } }); $grid->batchActions(function (Grid\Tools\BatchActions $batch) { if (request('_scope_') == admin_trans('dujiaoka.trashed')) { $batch->add(new BatchRestore(PayModel::class)); } }); }); } /** * Make a show builder. * * @param mixed $id * * @return Show */ protected function detail($id) { return Show::make($id, new Pay(), function (Show $show) { $show->field('id'); $show->field('pay_name'); $show->field('merchant_id'); $show->field('merchant_key'); $show->field('merchant_pem'); $show->field('pay_check'); $show->field('pay_client')->as(function ($payClient) { if ($payClient == PayModel::PAY_CLIENT_PC) { return admin_trans('pay.fields.pay_client_pc'); } else { return admin_trans('pay.fields.pay_client_mobile'); } }); $show->field('pay_handleroute'); $show->field('pay_method')->as(function ($payMethod) { if ($payMethod == PayModel::METHOD_JUMP) { return admin_trans('pay.fields.method_jump'); } else { return admin_trans('pay.fields.method_scan'); } }); $show->field('is_open')->as(function ($isOpen) { if ($isOpen == PayModel::STATUS_OPEN) { return admin_trans('dujiaoka.status_open'); } else { return admin_trans('dujiaoka.status_close'); } }); $show->field('created_at'); $show->field('updated_at'); }); } /** * Make a form builder. * * @return Form */ protected function form() { return Form::make(new Pay(), function (Form $form) { $form->display('id'); $form->text('pay_name')->required(); $form->text('merchant_id')->required(); $form->textarea('merchant_key'); $form->textarea('merchant_pem')->required(); $form->text('pay_check')->required(); $form->radio('pay_client') ->options(PayModel::getClientMap()) ->default(PayModel::PAY_CLIENT_PC) ->required(); $form->radio('pay_method') ->options(PayModel::getMethodMap()) ->default(PayModel::METHOD_JUMP) ->required(); $form->text('pay_handleroute')->required(); $form->switch('is_open')->default(PayModel::STATUS_OPEN); $form->display('created_at'); $form->display('updated_at'); $form->disableDeleteButton(); }); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Admin/Controllers/SystemSettingController.php
app/Admin/Controllers/SystemSettingController.php
<?php /** * The file was created by Assimon. * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ namespace App\Admin\Controllers; use App\Admin\Forms\SystemSetting; use Dcat\Admin\Http\Controllers\AdminController; use Dcat\Admin\Layout\Content; use Dcat\Admin\Widgets\Card; class SystemSettingController extends AdminController { /** * 系统设置 * * @param Content $content * @return Content * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function systemSetting(Content $content) { return $content ->title(admin_trans('menu.titles.system_setting')) ->body(new Card(new SystemSetting())); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Admin/Controllers/OrderController.php
app/Admin/Controllers/OrderController.php
<?php namespace App\Admin\Controllers; use App\Admin\Actions\Post\BatchRestore; use App\Admin\Actions\Post\Restore; use App\Admin\Repositories\Order; use App\Models\Coupon; use App\Models\Goods; use App\Models\Pay; use Dcat\Admin\Admin; use Dcat\Admin\Form; use Dcat\Admin\Grid; use Dcat\Admin\Show; use Dcat\Admin\Http\Controllers\AdminController; use App\Models\Order as OrderModel; class OrderController extends AdminController { /** * Make a grid builder. * * @return Grid */ protected function grid() { return Grid::make(new Order(['goods', 'coupon', 'pay']), function (Grid $grid) { $grid->model()->orderBy('id', 'DESC'); $grid->column('id')->sortable(); $grid->column('order_sn')->copyable(); $grid->column('title'); $grid->column('type')->using(OrderModel::getTypeMap()) ->label([ OrderModel::AUTOMATIC_DELIVERY => Admin::color()->success(), OrderModel::MANUAL_PROCESSING => Admin::color()->info(), ]); $grid->column('email')->copyable(); $grid->column('goods.gd_name', admin_trans('order.fields.goods_id')); $grid->column('goods_price'); $grid->column('buy_amount'); $grid->column('total_price'); $grid->column('coupon.coupon', admin_trans('order.fields.coupon_id')); $grid->column('coupon_discount_price'); $grid->column('wholesale_discount_price'); $grid->column('actual_price'); $grid->column('pay.pay_name', admin_trans('order.fields.pay_id')); $grid->column('buy_ip'); $grid->column('search_pwd')->copyable(); $grid->column('trade_no')->copyable(); $grid->column('status') ->select(OrderModel::getStatusMap()); $grid->column('created_at'); $grid->column('updated_at')->sortable(); $grid->disableCreateButton(); $grid->filter(function (Grid\Filter $filter) { $filter->equal('order_sn'); $filter->like('title'); $filter->equal('status')->select(OrderModel::getStatusMap()); $filter->equal('email'); $filter->equal('trade_no'); $filter->equal('type')->select(OrderModel::getTypeMap()); $filter->equal('goods_id')->select(Goods::query()->pluck('gd_name', 'id')); $filter->equal('coupon_id')->select(Coupon::query()->pluck('coupon', 'id')); $filter->equal('pay_id')->select(Pay::query()->pluck('pay_name', 'id')); $filter->whereBetween('created_at', function ($q) { $start = $this->input['start'] ?? null; $end = $this->input['end'] ?? null; $q->where('created_at', '>=', $start) ->where('created_at', '<=', $end); })->datetime(); $filter->scope(admin_trans('dujiaoka.trashed'))->onlyTrashed(); }); $grid->actions(function (Grid\Displayers\Actions $actions) { if (request('_scope_') == admin_trans('dujiaoka.trashed')) { $actions->append(new Restore(OrderModel::class)); } }); $grid->batchActions(function (Grid\Tools\BatchActions $batch) { if (request('_scope_') == admin_trans('dujiaoka.trashed')) { $batch->add(new BatchRestore(OrderModel::class)); } }); }); } /** * Make a show builder. * * @param mixed $id * * @return Show */ protected function detail($id) { return Show::make($id, new Order(['goods', 'coupon', 'pay']), function (Show $show) { $show->field('id'); $show->field('order_sn'); $show->field('title'); $show->field('email'); $show->field('goods.gd_name', admin_trans('order.fields.goods_id')); $show->field('goods_price'); $show->field('buy_amount'); $show->field('coupon.coupon', admin_trans('order.fields.coupon_id')); $show->field('coupon_discount_price'); $show->field('wholesale_discount_price'); $show->field('total_price'); $show->field('actual_price'); $show->field('buy_ip'); $show->field('info')->unescape()->as(function ($info) { return "<textarea class=\"form-control field_wholesale_price_cnf _normal_\" rows=\"10\" cols=\"30\">" . $info . "</textarea>"; }); $show->field('pay.pay_name', admin_trans('order.fields.pay_id')); $show->field('status')->using(OrderModel::getStatusMap()); $show->field('search_pwd'); $show->field('trade_no'); $show->field('type')->using(OrderModel::getTypeMap()); $show->field('created_at'); $show->field('updated_at'); $show->disableEditButton(); }); } /** * Make a form builder. * * @return Form */ protected function form() { return Form::make(new Order(['goods', 'coupon', 'pay']), function (Form $form) { $form->display('id'); $form->display('order_sn'); $form->text('title'); $form->display('goods.gd_name', admin_trans('order.fields.goods_id')); $form->display('goods_price'); $form->display('buy_amount'); $form->display('coupon.coupon', admin_trans('order.fields.coupon_id')); $form->display('coupon_discount_price'); $form->display('wholesale_discount_price'); $form->display('total_price'); $form->display('actual_price'); $form->display('email'); $form->textarea('info'); $form->display('buy_ip'); $form->display('pay.pay_name', admin_trans('order.fields.pay_id')); $form->radio('status')->options(OrderModel::getStatusMap()); $form->text('search_pwd'); $form->display('trade_no'); $form->radio('type')->options(OrderModel::getTypeMap()); $form->display('created_at'); $form->display('updated_at'); }); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Admin/Controllers/GoodsGroupController.php
app/Admin/Controllers/GoodsGroupController.php
<?php namespace App\Admin\Controllers; use App\Admin\Actions\Post\BatchRestore; use App\Admin\Actions\Post\Restore; use App\Admin\Repositories\GoodsGroup; use Dcat\Admin\Form; use Dcat\Admin\Grid; use Dcat\Admin\Show; use Dcat\Admin\Http\Controllers\AdminController; use App\Models\GoodsGroup as GoodsGroupModel; class GoodsGroupController extends AdminController { /** * Make a grid builder. * * @return Grid */ protected function grid() { return Grid::make(new GoodsGroup(), function (Grid $grid) { $grid->model()->orderBy('id', 'DESC'); $grid->column('id')->sortable(); $grid->column('gp_name')->editable(); $grid->column('is_open')->switch(); $grid->column('ord')->editable(); $grid->column('created_at'); $grid->column('updated_at')->sortable(); $grid->disableViewButton(); $grid->filter(function (Grid\Filter $filter) { $filter->equal('id'); $filter->scope(admin_trans('dujiaoka.trashed'))->onlyTrashed(); }); $grid->actions(function (Grid\Displayers\Actions $actions) { if (request('_scope_') == admin_trans('dujiaoka.trashed')) { $actions->append(new Restore(GoodsGroupModel::class)); } }); $grid->batchActions(function (Grid\Tools\BatchActions $batch) { if (request('_scope_') == admin_trans('dujiaoka.trashed')) { $batch->add(new BatchRestore(GoodsGroupModel::class)); } }); }); } /** * Make a show builder. * * @param mixed $id * * @return Show */ protected function detail($id) { return Show::make($id, new GoodsGroup(), function (Show $show) { $show->field('id'); $show->field('gp_name'); $show->field('is_open')->as(function ($isOpen) { if ($isOpen == GoodsGroupModel::STATUS_OPEN) { return admin_trans('dujiaoka.status_open'); } else { return admin_trans('dujiaoka.status_close'); } }); $show->field('ord'); $show->field('created_at'); $show->field('updated_at'); }); } /** * Make a form builder. * * @return Form */ protected function form() { return Form::make(new GoodsGroup(), function (Form $form) { $form->display('id'); $form->text('gp_name'); $form->switch('is_open')->default(GoodsGroupModel::STATUS_OPEN); $form->number('ord')->default(1)->help(admin_trans('dujiaoka.ord')); $form->display('created_at'); $form->display('updated_at'); $form->disableViewButton(); $form->footer(function ($footer) { // 去掉`查看`checkbox $footer->disableViewCheck(); }); }); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Admin/Controllers/CouponController.php
app/Admin/Controllers/CouponController.php
<?php namespace App\Admin\Controllers; use App\Admin\Actions\Post\BatchRestore; use App\Admin\Actions\Post\Restore; use App\Admin\Repositories\Coupon; use App\Models\Goods; use Dcat\Admin\Admin; use Dcat\Admin\Form; use Dcat\Admin\Grid; use Dcat\Admin\Show; use Dcat\Admin\Http\Controllers\AdminController; use App\Models\Coupon as CouponModel; class CouponController extends AdminController { /** * Make a grid builder. * * @return Grid */ protected function grid() { return Grid::make(new Coupon(['goods']), function (Grid $grid) { $grid->model()->orderBy('id', 'DESC'); $grid->column('id')->sortable(); $grid->column('discount'); $grid->column('is_use')->select(CouponModel::getStatusUseMap()); $grid->column('is_open')->switch(); $grid->column('coupon')->copyable(); $grid->column('ret'); $grid->column('created_at'); $grid->column('updated_at')->sortable(); $grid->actions(function (Grid\Displayers\Actions $actions) { if (request('_scope_') == admin_trans('dujiaoka.trashed')) { $actions->append(new Restore(CouponModel::class)); } }); $grid->batchActions(function (Grid\Tools\BatchActions $batch) { if (request('_scope_') == admin_trans('dujiaoka.trashed')) { $batch->add(new BatchRestore(CouponModel::class)); } }); $grid->filter(function (Grid\Filter $filter) { $filter->equal('id'); $filter->equal('goods.goods_id', admin_trans('coupon.fields.goods_id'))->select( Goods::query()->pluck('gd_name', 'id') ); $filter->scope(admin_trans('dujiaoka.trashed'))->onlyTrashed(); }); }); } /** * Make a show builder. * * @param mixed $id * * @return Show */ protected function detail($id) { return Show::make($id, new Coupon(), function (Show $show) { $show->field('id'); $show->field('discount'); $show->field('is_use')->as(function ($isUse) { if ($isUse == CouponModel::STATUS_UNUSED) { return admin_trans('coupon.fields.status_unused'); } else { return admin_trans('coupon.fields.status_use'); } }); $show->field('is_open')->as(function ($isOPen) { if ($isOPen == CouponModel::STATUS_OPEN) { return admin_trans('dujiaoka.status_open'); } else { return admin_trans('dujiaoka.status_close'); } }); $show->field('coupon'); $show->field('ret'); $show->field('created_at'); $show->field('updated_at'); }); } /** * Make a form builder. * * @return Form */ protected function form() { return Form::make(Coupon::with('goods'), function (Form $form) { $form->display('id'); $form->multipleSelect('goods', admin_trans('coupon.fields.goods_id')) ->options(Goods::all()->pluck('gd_name', 'id')) ->customFormat(function ($v) { if (! $v) { return []; } // 从数据库中查出的二维数组中转化成ID return array_column($v, 'id'); }); $form->currency('discount')->default(0)->required(); $form->text('coupon')->required(); $form->number('ret')->default(1); $form->radio('is_use')->options(CouponModel::getStatusUseMap())->default(CouponModel::STATUS_UNUSED); $form->switch('is_open')->default(CouponModel::STATUS_OPEN); $form->display('created_at'); $form->display('updated_at'); }); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Admin/Controllers/AuthController.php
app/Admin/Controllers/AuthController.php
<?php namespace App\Admin\Controllers; use Dcat\Admin\Http\Controllers\AuthController as BaseAuthController; class AuthController extends BaseAuthController { }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Admin/Controllers/HomeController.php
app/Admin/Controllers/HomeController.php
<?php namespace App\Admin\Controllers; use App\Admin\Charts\DashBoard; use App\Admin\Charts\PayoutRateCard; use App\Admin\Charts\PopularGoodsCard; use App\Admin\Charts\SalesCard; use App\Admin\Charts\SuccessOrderCard; use App\Http\Controllers\Controller; use Dcat\Admin\Layout\Column; use Dcat\Admin\Layout\Content; use Dcat\Admin\Layout\Row; class HomeController extends Controller { public function index(Content $content) { return $content ->header(admin_trans('dujiaoka.dashboard')) ->description(admin_trans('dujiaoka.dashboard_description')) ->body(function (Row $row) { $row->column(6, function (Column $column) { $column->row(self::title()); $column->row(new DashBoard()); }); $row->column(6, function (Column $column) { $column->row(function (Row $row) { $row->column(6, new SuccessOrderCard()); $row->column(6, new PayoutRateCard()); }); $column->row(new SalesCard()); }); }); } public static function title() { return view('admin.dashboard.title'); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Admin/Controllers/EmailTestController.php
app/Admin/Controllers/EmailTestController.php
<?php /** * The file was created by Assimon. * * @author ZhangYiQiu<me@zhangyiqiu.net> * @copyright ZhangYiQiu<me@zhangyiqiu.net> * @link http://zhangyiqiu.net/ */ namespace App\Admin\Controllers; use App\Admin\Forms\EmailTest; use Dcat\Admin\Http\Controllers\AdminController; use Dcat\Admin\Layout\Content; use Dcat\Admin\Widgets\Card; class EmailTestController extends AdminController { /** * 系统设置 * * @param Content $content * @return Content * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function emailTest(Content $content) { return $content ->title(admin_trans('menu.titles.email_test')) ->body(new Card(new EmailTest())); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Admin/Controllers/EmailtplController.php
app/Admin/Controllers/EmailtplController.php
<?php namespace App\Admin\Controllers; use App\Admin\Actions\Post\BatchRestore; use App\Admin\Actions\Post\Restore; use App\Admin\Repositories\Emailtpl; use Dcat\Admin\Form; use Dcat\Admin\Grid; use Dcat\Admin\Show; use Dcat\Admin\Http\Controllers\AdminController; use App\Models\Emailtpl as EmailTplModel; class EmailtplController extends AdminController { /** * Make a grid builder. * * @return Grid */ protected function grid() { return Grid::make(new Emailtpl(), function (Grid $grid) { $grid->column('id')->sortable(); $grid->column('tpl_name'); $grid->column('tpl_token'); $grid->column('created_at'); $grid->column('updated_at')->sortable(); $grid->disableViewButton(); $grid->disableDeleteButton(); $grid->filter(function (Grid\Filter $filter) { $filter->equal('id'); $filter->like('tpl_name'); $filter->like('tpl_token'); }); $grid->actions(function (Grid\Displayers\Actions $actions) { if (request('_scope_') == admin_trans('dujiaoka.trashed')) { $actions->append(new Restore(EmailTplModel::class)); } }); $grid->batchActions(function (Grid\Tools\BatchActions $batch) { if (request('_scope_') == admin_trans('dujiaoka.trashed')) { $batch->add(new BatchRestore(EmailTplModel::class)); } }); }); } /** * Make a show builder. * * @param mixed $id * * @return Show */ protected function detail($id) { return Show::make($id, new Emailtpl(), function (Show $show) { $show->field('id'); $show->field('tpl_name'); $show->field('tpl_content'); $show->field('tpl_token'); $show->field('created_at'); $show->field('updated_at'); }); } /** * Make a form builder. * * @return Form */ protected function form() { return Form::make(new Emailtpl(), function (Form $form) { $form->display('id'); $form->text('tpl_name')->required(); $form->editor('tpl_content')->required(); if ($form->isCreating()) { $form->text('tpl_token')->required(); } else { $form->text('tpl_token')->disable(); } $form->display('created_at'); $form->display('updated_at'); $form->disableViewButton(); $form->disableDeleteButton(); $form->footer(function ($footer) { // 去掉`查看`checkbox $footer->disableViewCheck(); }); }); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Admin/Actions/Post/Restore.php
app/Admin/Actions/Post/Restore.php
<?php /** * The file was created by Assimon. * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ namespace App\Admin\Actions\Post; use Dcat\Admin\Grid\RowAction; use Illuminate\Http\Request; class Restore extends RowAction { protected $title; protected $model; // 注意构造方法的参数必须要有默认值 public function __construct(string $model = null) { $this->title = admin_trans('dujiaoka.restore'); $this->model = $model; } public function handle(Request $request) { $key = $this->getKey(); $model = $request->get('model'); $model::withTrashed()->findOrFail($key)->restore(); return $this->response()->success(admin_trans('dujiaoka.restored'))->refresh(); } public function confirm() { return [admin_trans('dujiaoka.are_you_restore_sure')]; } public function parameters() { return [ 'model' => $this->model, ]; } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Admin/Actions/Post/BatchRestore.php
app/Admin/Actions/Post/BatchRestore.php
<?php /** * The file was created by Assimon. * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ namespace App\Admin\Actions\Post; use Dcat\Admin\Grid\BatchAction; use Illuminate\Http\Request; class BatchRestore extends BatchAction { protected $title; protected $model; // 注意构造方法的参数必须要有默认值 public function __construct(string $model = null) { $this->title = admin_trans('dujiaoka.restore'); $this->model = $model; } public function handle(Request $request) { $model = $request->get('model'); foreach ((array) $this->getKey() as $key) { $model::withTrashed()->findOrFail($key)->restore(); } return $this->response()->success(admin_trans('dujiaoka.restored'))->refresh(); } public function confirm() { return [admin_trans('dujiaoka.are_you_restore_sure')]; } public function parameters() { return [ 'model' => $this->model, ]; } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Admin/Charts/PayoutRateCard.php
app/Admin/Charts/PayoutRateCard.php
<?php /** * The file was created by Assimon. * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ namespace App\Admin\Charts; use App\Models\Order; use Dcat\Admin\Admin; use Dcat\Admin\Widgets\Metrics\Donut; use Illuminate\Http\Request; use Illuminate\Support\Carbon; class PayoutRateCard extends Donut { protected $labels; /** * 初始化卡片内容 */ protected function init() { parent::init(); $this->labels = [admin_trans('dujiaoka.payment_successful_number'), admin_trans('dujiaoka.unpaid_number')]; $color = Admin::color(); $colors = [$color->primary(), $color->alpha('blue2', 0.5)]; $this->title(admin_trans('dujiaoka.payment_chart')); $this->chartLabels($this->labels); // 设置图表颜色 $this->chartColors($colors); $this->dropdown([ 'seven' => admin_trans('dujiaoka.last_seven_days'), 'today' => admin_trans('dujiaoka.last_today'), 'month' => admin_trans('dujiaoka.last_month'), 'year' => admin_trans('dujiaoka.last_year'), ]); } /** * 处理请求 * * @param Request $request * * @return mixed|void */ public function handle(Request $request) { $endTime = Carbon::now(); switch ($request->get('option')) { case 'seven': $startTime = Carbon::now()->subDays(7); break; case 'month': $startTime = Carbon::now()->subDays(30); break; case 'year': $startTime = Carbon::now()->subDays(365); break; case 'today': $startTime = Carbon::today(); break; default: $startTime = Carbon::now()->subDays(7); } // 成功的数量 $success = Order::query() ->where('created_at', '>=', $startTime) ->where('created_at', '<=', $endTime) ->where('status', '>', Order::STATUS_WAIT_PAY) ->count(); // 待支付的数量 $unpaid = Order::query() ->where('created_at', '>=', $startTime) ->where('created_at', '<=', $endTime) ->where('status', '<=', Order::STATUS_WAIT_PAY) ->count(); $this->withContent($success, $unpaid); // 图表数据 $this->withChart([$success, $unpaid]); } /** * 设置图表数据. * * @param array $data * * @return $this */ public function withChart(array $data) { return $this->chart([ 'series' => $data ]); } /** * 设置卡片头部内容. * * @param mixed $success * @param mixed $unpaid * * @return $this */ protected function withContent($success, $unpaid) { $blue = Admin::color()->alpha('blue2', 0.5); $style = 'margin-bottom: 8px'; $labelWidth = 120; return $this->content( <<<HTML <div class="d-flex pl-1 pr-1 pt-1" style="{$style}"> <div style="width: {$labelWidth}px"> <i class="fa fa-circle text-primary"></i> {$this->labels[0]} </div> <div>{$success}</div> </div> <div class="d-flex pl-1 pr-1" style="{$style}"> <div style="width: {$labelWidth}px"> <i class="fa fa-circle" style="color: $blue"></i> {$this->labels[1]} </div> <div>{$unpaid}</div> </div> HTML ); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Admin/Charts/DashBoard.php
app/Admin/Charts/DashBoard.php
<?php /** * The file was created by Assimon. * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ namespace App\Admin\Charts; use App\Models\Order; use Dcat\Admin\Widgets\Metrics\RadialBar; use Illuminate\Http\Request; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\DB; class DashBoard extends RadialBar { /** * 初始化卡片内容 */ protected function init() { parent::init(); $this->title(admin_trans('dujiaoka.sales_data')); $this->height(400); $this->chartHeight(300); $this->chartLabels(admin_trans('dujiaoka.order_success_rate')); $this->dropdown([ 'today' => admin_trans('dujiaoka.last_today'), 'seven' => admin_trans('dujiaoka.last_seven_days'), 'month' => admin_trans('dujiaoka.last_month'), 'year' => admin_trans('dujiaoka.last_year'), ]); } /** * 处理请求 * * @param Request $request * * @return mixed|void */ public function handle(Request $request) { $endTime = Carbon::now(); switch ($request->get('option')) { case 'seven': $startTime = Carbon::now()->subDays(7); break; case 'month': $startTime = Carbon::now()->subDays(30); break; case 'year': $startTime = Carbon::now()->subDays(365); break; case 'today': default: $startTime = Carbon::today(); } // 分组查询 $orderGroup = Order::query() ->where('created_at', '>=', $startTime) ->where('created_at', '<=', $endTime) ->select('status', DB::raw('count(id) as num')) ->groupBy('status') ->pluck('num', 'status') ->toArray(); $pending = $orderGroup[Order::STATUS_PENDING] ?? 0; $processing = $orderGroup[Order::STATUS_PROCESSING] ?? 0; $completed = $orderGroup[Order::STATUS_COMPLETED] ?? 0; $failure = $orderGroup[Order::STATUS_FAILURE] ?? 0; $abnormal = $orderGroup[Order::STATUS_ABNORMAL] ?? 0; $orderCount = array_sum($orderGroup); if ($orderCount == 0) { $successRate = 0; } else { $rate = bcdiv($completed, $orderCount, 2); $successRate = bcmul($rate, 100); } // 订单数 $this->withOrderCount($orderCount); // 卡片底部 $this->withFooter($pending, $processing, $completed, $failure, $abnormal); // 图表数据 $this->withChart($successRate); } /** * 订单总数 * * @param $count * @return DashBoard * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function withOrderCount($count) { $title = admin_trans('dujiaoka.order_count_number'); return $this->content( <<<HTML <div class="d-flex flex-column flex-wrap text-center"> <h1 class="font-lg-2 mt-2 mb-0">{$count}</h1> <small>{$title}</small> </div> HTML ); } /** * 成交率. * * @param int $data * * @return $this */ public function withChart(int $data) { return $this->chart([ 'series' => [$data], ]); } /** * @param $pending * @param $processing * @param $completed * @param $failure * @param $abnormal * @return DashBoard * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ public function withFooter($pending, $processing, $completed, $failure, $abnormal) { $statusPendingTitle = admin_trans('dujiaoka.status_pending_number'); $statusProcessingNumber = admin_trans('dujiaoka.status_processing_number'); $statusCompletedNumber = admin_trans('dujiaoka.status_completed_number'); $statusFailureNumber = admin_trans('dujiaoka.status_failure_number'); $statusAbnormalNumber = admin_trans('dujiaoka.status_abnormal_number'); return $this->footer( <<<HTML <div class="d-flex justify-content-between p-1" style="padding-top: 0!important;"> <div class="text-center"> <p>{$statusPendingTitle}</p> <span class="font-lg-1">{$pending}</span> </div> <div class="text-center"> <p>{$statusProcessingNumber}</p> <span class="font-lg-1">{$processing}</span> </div> <div class="text-center"> <p>{$statusCompletedNumber}</p> <span class="font-lg-1">{$completed}</span> </div> <div class="text-center"> <p>{$statusFailureNumber}</p> <span class="font-lg-1">{$failure}</span> </div> <div class="text-center"> <p>{$statusAbnormalNumber}</p> <span class="font-lg-1">{$abnormal}</span> </div> </div> HTML ); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Admin/Charts/SuccessOrderCard.php
app/Admin/Charts/SuccessOrderCard.php
<?php /** * The file was created by Assimon. * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ namespace App\Admin\Charts; use App\Models\Order; use Dcat\Admin\Widgets\Metrics\Line; use Illuminate\Http\Request; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\DB; class SuccessOrderCard extends Line { /** * 初始化卡片内容 * * @return void */ protected function init() { parent::init(); $this->title(admin_trans('dujiaoka.status_completed_number')); $this->dropdown([ 'seven' => admin_trans('dujiaoka.last_seven_days'), 'today' => admin_trans('dujiaoka.last_today'), 'month' => admin_trans('dujiaoka.last_month'), ]); } /** * 处理请求 * * @param Request $request * * @return mixed|void */ public function handle(Request $request) { $endTime = Carbon::now(); switch ($request->get('option')) { case 'seven': $startTime = Carbon::now()->subDays(7); break; case 'month': $startTime = Carbon::now()->subDays(30); break; case 'today': $startTime = Carbon::today(); break; default: $startTime = Carbon::now()->subDays(7); } // 分组查询 $orderGroup = Order::query() ->where('created_at', '>=', $startTime) ->where('created_at', '<=', $endTime) ->where('status', Order::STATUS_COMPLETED) ->select(DB::raw('DATE(created_at) as date'), DB::raw('count(id) as num')) ->groupBy('date') ->pluck('num') ->toArray(); $successCount = array_sum($orderGroup); // 卡片内容 $this->withContent($successCount); // 图表数据 $this->withChart($orderGroup); } /** * 设置图表数据. * * @param array $data * * @return $this */ public function withChart(array $data) { return $this->chart([ 'series' => [ [ 'name' => $this->title, 'data' => $data, ], ], ]); } /** * 设置卡片内容. * * @param string $content * * @return $this */ public function withContent($content) { return $this->content( <<<HTML <div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px"> <h2 class="ml-1 font-lg-1">{$content}</h2> <span class="mb-0 mr-1 text-80">{$this->title}</span> </div> HTML ); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false
assimon/dujiaoka
https://github.com/assimon/dujiaoka/blob/8bb5701ecfc1d2a45cf4bef119e3e4496170002d/app/Admin/Charts/SalesCard.php
app/Admin/Charts/SalesCard.php
<?php /** * The file was created by Assimon. * * @author assimon<ashang@utf8.hk> * @copyright assimon<ashang@utf8.hk> * @link http://utf8.hk/ */ namespace App\Admin\Charts; use App\Models\Order; use Dcat\Admin\Admin; use Dcat\Admin\Widgets\Metrics\Bar; use Illuminate\Http\Request; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\DB; class SalesCard extends Bar { /** * 初始化卡片内容 */ protected function init() { parent::init(); $color = Admin::color(); $dark35 = $color->dark35(); // 卡片内容宽度 $this->contentWidth(5, 7); // 标题 $this->title(admin_trans('dujiaoka.sales_chart')); // 设置下拉选项 $this->dropdown([ 'seven' => admin_trans('dujiaoka.last_seven_days'), 'today' => admin_trans('dujiaoka.last_today'), 'month' => admin_trans('dujiaoka.last_month'), ]); // 设置图表颜色 $this->chartColors([ $dark35, $color->primary(), ]); } /** * 处理请求 * * @param Request $request * * @return mixed|void */ public function handle(Request $request) { $endTime = Carbon::now(); switch ($request->get('option')) { case 'seven': $startTime = Carbon::now()->subDays(7); break; case 'month': $startTime = Carbon::now()->subDays(30); break; case 'today': $startTime = Carbon::today(); break; default: $startTime = Carbon::now()->subDays(7); } // 分组查询 $orderGroup = Order::query() ->where('created_at', '>=', $startTime) ->where('created_at', '<=', $endTime) ->where('status', '>', Order::STATUS_PENDING) ->select(DB::raw('DATE(created_at) as date'), DB::raw('sum(actual_price) as actual_price')) ->groupBy('date') ->pluck('actual_price') ->toArray(); $totalPrice = array_sum($orderGroup); $this->withContent($totalPrice, '', '', $startTime, $endTime); $this->withChart([ [ 'name' => admin_trans('dujiaoka.sales_chart'), 'data' => $orderGroup, ] ]); } /** * 设置图表数据. * * @param array $data * * @return $this */ public function withChart(array $data) { return $this->chart([ 'series' => $data, ]); } /** * 设置卡片内容. * * @param string $title * @param string $value * @param string $style * * @return $this */ public function withContent($title, $value, $style = 'success', $startTime, $endTime) { $minHeight = '183px'; $uri = admin_route('order.index', [ 'created_at[start]' => $startTime->format('Y-m-d H:i:s'), 'created_at[end]' => $endTime->format('Y-m-d H:i:s') ]); return $this->content( <<<HTML <div class="d-flex p-1 flex-column justify-content-between" style="padding-top: 0;width: 100%;height: 100%;min-height: {$minHeight}"> <div class="text-left"> <h1 class="font-lg-2 mt-2 mb-0">{$title}¥</h1> <h5 class="font-medium-2" style="margin-top: 10px;"> <span class="text-{$style}">{$value} </span> </h5> </div> <a href="{$uri}" class="btn btn-primary shadow waves-effect waves-light">View Details <i class="feather icon-chevrons-right"></i></a> </div> HTML ); } }
php
MIT
8bb5701ecfc1d2a45cf4bef119e3e4496170002d
2026-01-04T15:03:57.345282Z
false