Compare commits
2 Commits
a7719d7038
...
889e09cdd1
| Author | SHA1 | Date | |
|---|---|---|---|
| 889e09cdd1 | |||
| 538306bb4f |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,3 +8,4 @@
|
|||||||
/storage/framework
|
/storage/framework
|
||||||
/storage/debugbar/
|
/storage/debugbar/
|
||||||
/bootstrap/cache
|
/bootstrap/cache
|
||||||
|
./composer.lock
|
||||||
|
|||||||
@@ -24,8 +24,11 @@ class CouponController extends AdminController
|
|||||||
$filter->column(1 / 2, function ($filter) {
|
$filter->column(1 / 2, function ($filter) {
|
||||||
$filter->equal('status', '状态')->select(ActivityCoupon::STATUS);
|
$filter->equal('status', '状态')->select(ActivityCoupon::STATUS);
|
||||||
$filter->between('used_at', '核销时间')->datetime();
|
$filter->between('used_at', '核销时间')->datetime();
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
|
||||||
|
|
||||||
|
>>>>>>> a7719d7038809738262e66c70e301947845f680d
|
||||||
$filter->where(function ($query) {
|
$filter->where(function ($query) {
|
||||||
$query->whereHas('outlet', function ($query) {
|
$query->whereHas('outlet', function ($query) {
|
||||||
$query->whereHas('info', function ($query) {
|
$query->whereHas('info', function ($query) {
|
||||||
@@ -54,7 +57,11 @@ class CouponController extends AdminController
|
|||||||
})
|
})
|
||||||
->get()
|
->get()
|
||||||
->pluck('nickname', 'id');
|
->pluck('nickname', 'id');
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
|
=======
|
||||||
|
|
||||||
|
>>>>>>> a7719d7038809738262e66c70e301947845f680d
|
||||||
$filter->where(function ($query) {
|
$filter->where(function ($query) {
|
||||||
$query->whereHas('outlet', function ($query) {
|
$query->whereHas('outlet', function ($query) {
|
||||||
$query->whereHas('parent', function ($query) {
|
$query->whereHas('parent', function ($query) {
|
||||||
|
|||||||
@@ -55,6 +55,27 @@ class IndexController extends AdminController
|
|||||||
Activity::CHANNEL_YSD => 'info',
|
Activity::CHANNEL_YSD => 'info',
|
||||||
Activity::CHANNEL_UNION => 'success',
|
Activity::CHANNEL_UNION => 'success',
|
||||||
]);
|
]);
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
|
$grid->column('days', '延期(天)');
|
||||||
|
$grid->column('rule.full', '满足金额');
|
||||||
|
$grid->column('rule.take', '扣除金额');
|
||||||
|
$grid->column('发券渠道')
|
||||||
|
->display(function () {
|
||||||
|
return $this->grants->pluck('user_nickname');
|
||||||
|
})
|
||||||
|
->label()
|
||||||
|
->width(350)
|
||||||
|
->hide();
|
||||||
|
|
||||||
|
$grid->column('核券渠道')
|
||||||
|
->display(function () {
|
||||||
|
return $this->verifications->pluck('user_nickname');
|
||||||
|
})
|
||||||
|
->label()
|
||||||
|
->width(350)
|
||||||
|
->hide();
|
||||||
|
=======
|
||||||
$grid->column('days', '延期(天)');
|
$grid->column('days', '延期(天)');
|
||||||
$grid->column('rule.full', '满足金额');
|
$grid->column('rule.full', '满足金额');
|
||||||
$grid->column('rule.take', '扣除金额');
|
$grid->column('rule.take', '扣除金额');
|
||||||
@@ -64,6 +85,7 @@ class IndexController extends AdminController
|
|||||||
$grid->column('核券渠道')->display(function ($title, $column) {
|
$grid->column('核券渠道')->display(function ($title, $column) {
|
||||||
return '查看';
|
return '查看';
|
||||||
})->modal(Verifications::class);
|
})->modal(Verifications::class);
|
||||||
|
>>>>>>> a7719d7038809738262e66c70e301947845f680d
|
||||||
|
|
||||||
$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') : '---';
|
||||||
@@ -113,6 +135,10 @@ class IndexController extends AdminController
|
|||||||
->when(Activity::TYPE_SCOPE, function (Form $form) {
|
->when(Activity::TYPE_SCOPE, function (Form $form) {
|
||||||
$form->dateRange('start_at', 'end_at', '有效时间');
|
$form->dateRange('start_at', 'end_at', '有效时间');
|
||||||
})
|
})
|
||||||
|
<<<<<<< HEAD
|
||||||
|
->help('当月券,领取的月底到期')
|
||||||
|
=======
|
||||||
|
>>>>>>> a7719d7038809738262e66c70e301947845f680d
|
||||||
->required();
|
->required();
|
||||||
|
|
||||||
$form->radio('channel', '核销途径')
|
$form->radio('channel', '核销途径')
|
||||||
@@ -120,6 +146,11 @@ class IndexController extends AdminController
|
|||||||
->default(Activity::CHANNEL_YSD)
|
->default(Activity::CHANNEL_YSD)
|
||||||
->help('券码核销的途径:亿时代是自己核销,银联是银联pos核销')
|
->help('券码核销的途径:亿时代是自己核销,银联是银联pos核销')
|
||||||
->required();
|
->required();
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
|
$form->number('day_times','每天可用次数')->default(0)->help('每天可用次数,0未不限制');
|
||||||
|
=======
|
||||||
|
>>>>>>> a7719d7038809738262e66c70e301947845f680d
|
||||||
|
|
||||||
$form->switch('status', '状态')->default(1);
|
$form->switch('status', '状态')->default(1);
|
||||||
$form->switch('need_check', '多次校验')
|
$form->switch('need_check', '多次校验')
|
||||||
|
|||||||
@@ -20,9 +20,11 @@ class Activity extends Model
|
|||||||
|
|
||||||
const TYPE_EXTEND = 1;
|
const TYPE_EXTEND = 1;
|
||||||
const TYPE_SCOPE = 2;
|
const TYPE_SCOPE = 2;
|
||||||
|
const TYPE_MONTH = 3;
|
||||||
const TYPES = [
|
const TYPES = [
|
||||||
self::TYPE_EXTEND => '延期',
|
self::TYPE_EXTEND => '延期',
|
||||||
self::TYPE_SCOPE => '固定',
|
self::TYPE_SCOPE => '固定',
|
||||||
|
self::TYPE_MONTH => '当月',
|
||||||
];
|
];
|
||||||
|
|
||||||
const STATUS_OPEN = 1;
|
const STATUS_OPEN = 1;
|
||||||
@@ -201,6 +203,9 @@ class Activity extends Model
|
|||||||
if ($this->type == SELF::TYPE_EXTEND) {
|
if ($this->type == SELF::TYPE_EXTEND) {
|
||||||
$start_at = now();
|
$start_at = now();
|
||||||
$end_at = now()->addDays($this->days);
|
$end_at = now()->addDays($this->days);
|
||||||
|
} elseif ($this->type == self::TYPE_MONTH) {
|
||||||
|
$start_at = now();
|
||||||
|
$end_at = now()->endOfMonth();
|
||||||
} else {
|
} else {
|
||||||
$start_at = $this->start_at->startOfDay();
|
$start_at = $this->start_at->startOfDay();
|
||||||
$end_at = $this->end_at->endOfDay();
|
$end_at = $this->end_at->endOfDay();
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class ActivityCoupon extends Model
|
|||||||
* @Date : 2020/6/30 9:40
|
* @Date : 2020/6/30 9:40
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getStatusTextAttribute()
|
public function getStatusTextAttribute(): string
|
||||||
{
|
{
|
||||||
return self::STATUS[$this->status] ?? '未知';
|
return self::STATUS[$this->status] ?? '未知';
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ class ActivityCoupon extends Model
|
|||||||
* @Date : 2020/6/30 9:41
|
* @Date : 2020/6/30 9:41
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function canRedemption()
|
public function canRedemption(): bool
|
||||||
{
|
{
|
||||||
return $this->status == ActivityCoupon::STATUS_INIT;
|
return $this->status == ActivityCoupon::STATUS_INIT;
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ class ActivityCoupon extends Model
|
|||||||
* @Date : 2020/6/30 9:41
|
* @Date : 2020/6/30 9:41
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function canDestroy()
|
public function canDestroy(): bool
|
||||||
{
|
{
|
||||||
return $this->canRedemption();
|
return $this->canRedemption();
|
||||||
}
|
}
|
||||||
@@ -70,7 +70,7 @@ class ActivityCoupon extends Model
|
|||||||
* @Date : 2020/10/12 11:57
|
* @Date : 2020/10/12 11:57
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function canReversal()
|
public function canReversal(): bool
|
||||||
{
|
{
|
||||||
return $this->status == self::STATUS_USED;
|
return $this->status == self::STATUS_USED;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Models;
|
|||||||
|
|
||||||
use App\Models\Traits\BelongsToOutlet;
|
use App\Models\Traits\BelongsToOutlet;
|
||||||
use App\Models\Traits\BelongsToUser;
|
use App\Models\Traits\BelongsToUser;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
|
|
||||||
class Coupon extends Model
|
class Coupon extends Model
|
||||||
{
|
{
|
||||||
@@ -30,7 +31,7 @@ class Coupon extends Model
|
|||||||
];
|
];
|
||||||
|
|
||||||
//状态
|
//状态
|
||||||
public function getStatusTextAttribute()
|
public function getStatusTextAttribute(): string
|
||||||
{
|
{
|
||||||
switch ($this->status) {
|
switch ($this->status) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -54,7 +55,7 @@ class Coupon extends Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getProfitTextAttribute()
|
public function getProfitTextAttribute(): string
|
||||||
{
|
{
|
||||||
switch ($this->is_profit) {
|
switch ($this->is_profit) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -75,7 +76,7 @@ class Coupon extends Model
|
|||||||
* @return bool [type] [description]
|
* @return bool [type] [description]
|
||||||
* @author 玄尘 2020-03-13
|
* @author 玄尘 2020-03-13
|
||||||
*/
|
*/
|
||||||
public function canProfit()
|
public function canProfit(): bool
|
||||||
{
|
{
|
||||||
return ($this->is_profit === 0 && $this->status == 2);
|
return ($this->is_profit === 0 && $this->status == 2);
|
||||||
}
|
}
|
||||||
@@ -183,4 +184,12 @@ class Coupon extends Model
|
|||||||
return $this->created_at->format('Y-m-d');
|
return $this->created_at->format('Y-m-d');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 关联自有券
|
||||||
|
*/
|
||||||
|
public function activityCoupon(): HasOne
|
||||||
|
{
|
||||||
|
return $this->hasOne(ActivityCoupon::class, 'code', 'redemptionCode');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
108
composer.lock
generated
108
composer.lock
generated
@@ -4,7 +4,11 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
|
<<<<<<< HEAD
|
||||||
|
"content-hash": "1fde4d1d7b4ed4a586277a4f6a0f0d95",
|
||||||
|
=======
|
||||||
"content-hash": "4afa3c4ba7aca22c3ee390667768e41a",
|
"content-hash": "4afa3c4ba7aca22c3ee390667768e41a",
|
||||||
|
>>>>>>> a7719d7038809738262e66c70e301947845f680d
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "asm89/stack-cors",
|
"name": "asm89/stack-cors",
|
||||||
@@ -7332,6 +7336,86 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "xuanchen/petro-ysd",
|
"name": "xuanchen/petro-ysd",
|
||||||
|
<<<<<<< HEAD
|
||||||
|
"version": "dev-main",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/xuanchen120/petroYsd.git",
|
||||||
|
"reference": "ac79759dc5b1e03a9d4d1fe09c2ea184aa3e3d7c"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/xuanchen120/petroYsd/zipball/ac79759dc5b1e03a9d4d1fe09c2ea184aa3e3d7c",
|
||||||
|
"reference": "ac79759dc5b1e03a9d4d1fe09c2ea184aa3e3d7c",
|
||||||
|
"shasum": "",
|
||||||
|
"mirrors": [
|
||||||
|
{
|
||||||
|
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||||
|
"preferred": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"guzzlehttp/guzzle": "^7.0.0",
|
||||||
|
"illuminate/support": "^7.0|^8.0",
|
||||||
|
"laravel/framework": "*",
|
||||||
|
"php": ">=7.1.3",
|
||||||
|
"pimple/pimple": "^3.0"
|
||||||
|
},
|
||||||
|
"default-branch": true,
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"XuanChen\\PetroYsd\\ServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {
|
||||||
|
"Petro": "XuanChen\\PetroYsd"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"XuanChen\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "玄尘",
|
||||||
|
"email": "122383162@qq.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "优惠券",
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/xuanchen120/petroYsd/issues",
|
||||||
|
"source": "https://github.com/xuanchen120/petroYsd/tree/main"
|
||||||
|
},
|
||||||
|
"time": "2022-05-20T07:16:51+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "xuanchen/unionpay",
|
||||||
|
"version": "3.4.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/xuanchen120/unionpay.git",
|
||||||
|
"reference": "a2eabfc7786e9087a16bcf65f7a707a6967aa456"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/xuanchen120/unionpay/zipball/a2eabfc7786e9087a16bcf65f7a707a6967aa456",
|
||||||
|
"reference": "a2eabfc7786e9087a16bcf65f7a707a6967aa456",
|
||||||
|
"shasum": "",
|
||||||
|
"mirrors": [
|
||||||
|
{
|
||||||
|
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||||
|
"preferred": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
=======
|
||||||
"version": "1.2",
|
"version": "1.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -7343,6 +7427,7 @@
|
|||||||
"url": "https://api.github.com/repos/xuanchen120/petroYsd/zipball/f38e2f38a331741a165b70bbaa0f9ad1cea8673e",
|
"url": "https://api.github.com/repos/xuanchen120/petroYsd/zipball/f38e2f38a331741a165b70bbaa0f9ad1cea8673e",
|
||||||
"reference": "f38e2f38a331741a165b70bbaa0f9ad1cea8673e",
|
"reference": "f38e2f38a331741a165b70bbaa0f9ad1cea8673e",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
|
>>>>>>> a7719d7038809738262e66c70e301947845f680d
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"guzzlehttp/guzzle": "^7.0.0",
|
"guzzlehttp/guzzle": "^7.0.0",
|
||||||
@@ -10130,6 +10215,17 @@
|
|||||||
"time": "2020-09-28T06:39:44+00:00"
|
"time": "2020-09-28T06:39:44+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
|
"name": "theseer/tokenizer",
|
||||||
|
"version": "1.2.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/theseer/tokenizer.git",
|
||||||
|
"reference": "34a41e998c2183e22995f158c581e7b5e755ab9e"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
=======
|
||||||
"name": "spatie/laravel-package-tools",
|
"name": "spatie/laravel-package-tools",
|
||||||
"version": "1.11.3",
|
"version": "1.11.3",
|
||||||
"source": {
|
"source": {
|
||||||
@@ -10198,6 +10294,7 @@
|
|||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
|
>>>>>>> a7719d7038809738262e66c70e301947845f680d
|
||||||
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e",
|
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e",
|
||||||
"reference": "34a41e998c2183e22995f158c581e7b5e755ab9e",
|
"reference": "34a41e998c2183e22995f158c581e7b5e755ab9e",
|
||||||
"shasum": "",
|
"shasum": "",
|
||||||
@@ -10243,6 +10340,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2021-07-28T10:34:58+00:00"
|
"time": "2021-07-28T10:34:58+00:00"
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "wulfheart/pretty_routes",
|
"name": "wulfheart/pretty_routes",
|
||||||
@@ -10312,16 +10411,23 @@
|
|||||||
"source": "https://github.com/Wulfheart/pretty-routes/tree/0.3.0"
|
"source": "https://github.com/Wulfheart/pretty-routes/tree/0.3.0"
|
||||||
},
|
},
|
||||||
"time": "2021-05-03T09:19:08+00:00"
|
"time": "2021-05-03T09:19:08+00:00"
|
||||||
|
>>>>>>> a7719d7038809738262e66c70e301947845f680d
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"stability-flags": [],
|
"stability-flags": {
|
||||||
|
"xuanchen/petro-ysd": 20
|
||||||
|
},
|
||||||
"prefer-stable": true,
|
"prefer-stable": true,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": {
|
"platform": {
|
||||||
"php": "^7.3|^8.0"
|
"php": "^7.3|^8.0"
|
||||||
},
|
},
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
|
<<<<<<< HEAD
|
||||||
|
"plugin-api-version": "2.0.0"
|
||||||
|
=======
|
||||||
"plugin-api-version": "2.2.0"
|
"plugin-api-version": "2.2.0"
|
||||||
|
>>>>>>> a7719d7038809738262e66c70e301947845f680d
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddDayTimesToActivitiesTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('activities', function (Blueprint $table) {
|
||||||
|
$table->integer('day_times')->default(0)->comment('每天可用次数');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('activities', function (Blueprint $table) {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user