修改名称+增加查看数据脚本
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Admin\Controllers\Activity;
|
namespace App\Admin\Controllers\Activity;
|
||||||
|
|
||||||
|
use App\Admin\Renderable\Activity\Grants;
|
||||||
use App\Models\Activity;
|
use App\Models\Activity;
|
||||||
use App\Models\ActivityGrant;
|
use App\Models\ActivityGrant;
|
||||||
use App\Models\ActivityRule;
|
use App\Models\ActivityRule;
|
||||||
@@ -86,7 +87,6 @@ class IndexController extends AdminController
|
|||||||
$query->where('identity_id', 1);
|
$query->where('identity_id', 1);
|
||||||
})->get()->pluck('nickname', 'id');
|
})->get()->pluck('nickname', 'id');
|
||||||
|
|
||||||
$filter->equal('user_id', '渠道')->select($users);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$filter->column(1 / 2, function ($filter) {
|
$filter->column(1 / 2, function ($filter) {
|
||||||
@@ -100,10 +100,6 @@ class IndexController extends AdminController
|
|||||||
$grid->column('title', '活动名称');
|
$grid->column('title', '活动名称');
|
||||||
$grid->column('code', '活动编号');
|
$grid->column('code', '活动编号');
|
||||||
$grid->column('rule.code', '卡券规则');
|
$grid->column('rule.code', '卡券规则');
|
||||||
$grid->column('所属')->display(function () {
|
|
||||||
return $this->user_id ? $this->user->nickname : '系统';
|
|
||||||
});
|
|
||||||
|
|
||||||
$grid->column('类型')->display(function () {
|
$grid->column('类型')->display(function () {
|
||||||
return $this->type_text;
|
return $this->type_text;
|
||||||
});
|
});
|
||||||
@@ -111,6 +107,20 @@ class IndexController extends AdminController
|
|||||||
$grid->column('days', '延期(天)');
|
$grid->column('days', '延期(天)');
|
||||||
$grid->column('rule.full', '满足金额');
|
$grid->column('rule.full', '满足金额');
|
||||||
$grid->column('rule.take', '扣除金额');
|
$grid->column('rule.take', '扣除金额');
|
||||||
|
$grid->column('发券')
|
||||||
|
->display(function () {
|
||||||
|
return $this->grants->pluck('user_nickname');
|
||||||
|
})
|
||||||
|
->label()
|
||||||
|
->hide();
|
||||||
|
|
||||||
|
$grid->column('核券')
|
||||||
|
->display(function () {
|
||||||
|
return $this->verifications->pluck('user_nickname');
|
||||||
|
})
|
||||||
|
->label()
|
||||||
|
->hide();
|
||||||
|
|
||||||
$grid->column('开始时间')->display(function () {
|
$grid->column('开始时间')->display(function () {
|
||||||
return $this->type == Activity::TYPE_SCOPE ? $this->start_at->format('Y-m-d') : '---';
|
return $this->type == Activity::TYPE_SCOPE ? $this->start_at->format('Y-m-d') : '---';
|
||||||
});
|
});
|
||||||
|
|||||||
72
app/Admin/Controllers/TestController.php
Normal file
72
app/Admin/Controllers/TestController.php
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Coupon;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class TestController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$date = $request->date ?? date('Y-m-d');
|
||||||
|
$time = Carbon::parse($date);
|
||||||
|
|
||||||
|
$all = Coupon::where('status', 2)
|
||||||
|
->whereBetween('created_at', [
|
||||||
|
$time->startOfDay()->toDateTimeString(),
|
||||||
|
$time->endOfDay()->toDateTimeString(),
|
||||||
|
])
|
||||||
|
->count();
|
||||||
|
$self = Coupon::where('status', 2)
|
||||||
|
->where('type', Coupon::TYPE_YSD)
|
||||||
|
->whereBetween('created_at', [
|
||||||
|
$time->startOfDay()->toDateTimeString(),
|
||||||
|
$time->endOfDay()->toDateTimeString(),
|
||||||
|
])
|
||||||
|
->count();
|
||||||
|
$pingan = Coupon::where('status', 2)
|
||||||
|
->where('type', Coupon::TYPE_PINGAN)
|
||||||
|
->whereBetween('created_at', [
|
||||||
|
$time->startOfDay()->toDateTimeString(),
|
||||||
|
$time->endOfDay()->toDateTimeString(),
|
||||||
|
])
|
||||||
|
->count();
|
||||||
|
|
||||||
|
$error = Coupon::where('status', 3)
|
||||||
|
->whereBetween('created_at', [
|
||||||
|
$time->startOfDay()->toDateTimeString(),
|
||||||
|
$time->endOfDay()->toDateTimeString(),
|
||||||
|
])
|
||||||
|
->count();
|
||||||
|
|
||||||
|
$lists = DB::table('coupons')
|
||||||
|
->where('status', 2)
|
||||||
|
->whereBetween('created_at', [
|
||||||
|
$time->startOfDay()->toDateTimeString(),
|
||||||
|
$time->endOfDay()->toDateTimeString(),
|
||||||
|
])
|
||||||
|
->select('redemptionCode', DB::raw('COUNT(*) as code_count'))
|
||||||
|
->groupBy('redemptionCode')
|
||||||
|
->having('code_count', '>', 1)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
' 日期为:' . $time->format('Y-m-d'),
|
||||||
|
' 核销总数为:' . $all,
|
||||||
|
' 自有卡券总数为:' . $self,
|
||||||
|
' 平安卡券总数为:' . $pingan,
|
||||||
|
' 核销错误总数为:' . $error,
|
||||||
|
' 核销重复数据数为:' . $lists->count(),
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($data as $info) {
|
||||||
|
dump($info);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
26
app/Admin/Renderable/Activity/Grants.php
Normal file
26
app/Admin/Renderable/Activity/Grants.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Renderable\Activity;
|
||||||
|
|
||||||
|
use App\Models\Activity;
|
||||||
|
use Encore\Admin\Widgets\Table;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
|
||||||
|
class Grants implements Renderable
|
||||||
|
{
|
||||||
|
|
||||||
|
public function render($key = null)
|
||||||
|
{
|
||||||
|
$activity = Activity::find($key);
|
||||||
|
$items = $activity->grants->map(function ($info) {
|
||||||
|
return [
|
||||||
|
'id' => $info->id,
|
||||||
|
'nickname' => $info->user_nickname,
|
||||||
|
];
|
||||||
|
});
|
||||||
|
dd($items->toArray());
|
||||||
|
|
||||||
|
return new Table(['Id', '渠道'], $items->toArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -11,6 +11,8 @@ Route::group([
|
|||||||
], function (Router $router) {
|
], function (Router $router) {
|
||||||
|
|
||||||
$router->get('/', 'HomeController@index')->name('admin.home');
|
$router->get('/', 'HomeController@index')->name('admin.home');
|
||||||
|
$router->get('test', 'TestController@index')->name('test.index');
|
||||||
|
|
||||||
$router->post('uploads/editor', 'UploadController@editor')->name('uploads.editor');
|
$router->post('uploads/editor', 'UploadController@editor')->name('uploads.editor');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return [
|
|||||||
| login page.
|
| login page.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
'name' => '平安接口系统',
|
'name' => '平安券核销管理系统',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -22,7 +22,7 @@ return [
|
|||||||
| `img` tag, eg '<img src="http://logo-url" alt="Admin logo">'.
|
| `img` tag, eg '<img src="http://logo-url" alt="Admin logo">'.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
'logo' => '平安接口系统',
|
'logo' => '平安券核销管理系统',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -58,9 +58,9 @@ return [
|
|||||||
*/
|
*/
|
||||||
'route' => [
|
'route' => [
|
||||||
|
|
||||||
'prefix' => env('ADMIN_ROUTE_PREFIX', 'admin'),
|
'prefix' => env('ADMIN_ROUTE_PREFIX', 'admin'),
|
||||||
|
|
||||||
'namespace' => 'App\\Admin\\Controllers',
|
'namespace' => 'App\\Admin\\Controllers',
|
||||||
|
|
||||||
'middleware' => ['web', 'admin'],
|
'middleware' => ['web', 'admin'],
|
||||||
],
|
],
|
||||||
@@ -110,11 +110,11 @@ return [
|
|||||||
*/
|
*/
|
||||||
'auth' => [
|
'auth' => [
|
||||||
|
|
||||||
'controller' => App\Admin\Controllers\AuthController::class,
|
'controller' => App\Admin\Controllers\AuthController::class,
|
||||||
|
|
||||||
'guard' => 'admin',
|
'guard' => 'admin',
|
||||||
|
|
||||||
'guards' => [
|
'guards' => [
|
||||||
'admin' => [
|
'admin' => [
|
||||||
'driver' => 'session',
|
'driver' => 'session',
|
||||||
'provider' => 'admin',
|
'provider' => 'admin',
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'defaults' => [
|
'defaults' => [
|
||||||
'guard' => 'web',
|
'guard' => 'web',
|
||||||
'passwords' => 'users',
|
'passwords' => 'users',
|
||||||
],
|
],
|
||||||
@@ -35,8 +35,8 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'guards' => [
|
'guards' => [
|
||||||
'web' => [
|
'web' => [
|
||||||
'driver' => 'session',
|
'driver' => 'session',
|
||||||
'provider' => 'users',
|
'provider' => 'users',
|
||||||
],
|
],
|
||||||
@@ -69,7 +69,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'providers' => [
|
'providers' => [
|
||||||
'users' => [
|
'users' => [
|
||||||
'driver' => 'eloquent',
|
'driver' => 'eloquent',
|
||||||
'model' => App\Models\User::class,
|
'model' => App\Models\User::class,
|
||||||
@@ -96,7 +96,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'passwords' => [
|
'passwords' => [
|
||||||
'users' => [
|
'users' => [
|
||||||
'provider' => 'users',
|
'provider' => 'users',
|
||||||
'table' => 'password_resets',
|
'table' => 'password_resets',
|
||||||
|
|||||||
@@ -31,18 +31,18 @@ return [
|
|||||||
'connections' => [
|
'connections' => [
|
||||||
|
|
||||||
'pusher' => [
|
'pusher' => [
|
||||||
'driver' => 'pusher',
|
'driver' => 'pusher',
|
||||||
'key' => env('PUSHER_APP_KEY'),
|
'key' => env('PUSHER_APP_KEY'),
|
||||||
'secret' => env('PUSHER_APP_SECRET'),
|
'secret' => env('PUSHER_APP_SECRET'),
|
||||||
'app_id' => env('PUSHER_APP_ID'),
|
'app_id' => env('PUSHER_APP_ID'),
|
||||||
'options' => [
|
'options' => [
|
||||||
'cluster' => env('PUSHER_APP_CLUSTER'),
|
'cluster' => env('PUSHER_APP_CLUSTER'),
|
||||||
'useTLS' => true,
|
'useTLS' => true,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'redis' => [
|
'redis' => [
|
||||||
'driver' => 'redis',
|
'driver' => 'redis',
|
||||||
'connection' => 'default',
|
'connection' => 'default',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
@@ -42,46 +42,46 @@ return [
|
|||||||
],
|
],
|
||||||
|
|
||||||
'database' => [
|
'database' => [
|
||||||
'driver' => 'database',
|
'driver' => 'database',
|
||||||
'table' => 'cache',
|
'table' => 'cache',
|
||||||
'connection' => null,
|
'connection' => null,
|
||||||
],
|
],
|
||||||
|
|
||||||
'file' => [
|
'file' => [
|
||||||
'driver' => 'file',
|
'driver' => 'file',
|
||||||
'path' => storage_path('framework/cache/data'),
|
'path' => storage_path('framework/cache/data'),
|
||||||
],
|
],
|
||||||
|
|
||||||
'memcached' => [
|
'memcached' => [
|
||||||
'driver' => 'memcached',
|
'driver' => 'memcached',
|
||||||
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||||
'sasl' => [
|
'sasl' => [
|
||||||
env('MEMCACHED_USERNAME'),
|
env('MEMCACHED_USERNAME'),
|
||||||
env('MEMCACHED_PASSWORD'),
|
env('MEMCACHED_PASSWORD'),
|
||||||
],
|
],
|
||||||
'options' => [
|
'options' => [
|
||||||
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||||
],
|
],
|
||||||
'servers' => [
|
'servers' => [
|
||||||
[
|
[
|
||||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||||
'port' => env('MEMCACHED_PORT', 11211),
|
'port' => env('MEMCACHED_PORT', 11211),
|
||||||
'weight' => 100,
|
'weight' => 100,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'redis' => [
|
'redis' => [
|
||||||
'driver' => 'redis',
|
'driver' => 'redis',
|
||||||
'connection' => 'cache',
|
'connection' => 'cache',
|
||||||
],
|
],
|
||||||
|
|
||||||
'dynamodb' => [
|
'dynamodb' => [
|
||||||
'driver' => 'dynamodb',
|
'driver' => 'dynamodb',
|
||||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||||
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||||
],
|
],
|
||||||
|
|
||||||
@@ -98,6 +98,6 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
|
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache'),
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user