forked from modstart/ModStartCMS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
20,800 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
namespace Module\Member\Core; | ||
|
||
use ModStart\Core\Util\NumberUtil; | ||
use ModStart\Form\Form; | ||
use Module\Voucher\Biz\AbstractVoucherBiz; | ||
use Module\Voucher\Type\VoucherType; | ||
|
||
class MemberVipVoucherBiz extends AbstractVoucherBiz | ||
{ | ||
const NAME = 'MemberVip'; | ||
|
||
public function name() | ||
{ | ||
return self::NAME; | ||
} | ||
|
||
public function title() | ||
{ | ||
return '会员VIP'; | ||
} | ||
|
||
public function adminRenderForm(Form $form) | ||
{ | ||
$form->radio('type', '类型') | ||
->options(VoucherType::only([VoucherType::DISCOUNT])) | ||
->when('=', VoucherType::DISCOUNT, function (Form $form) { | ||
$form->number('typeDiscount', '折扣')->help('0-100,80表示打八折'); | ||
}) | ||
->required() | ||
->defaultValue(VoucherType::DISCOUNT); | ||
} | ||
|
||
public function itemUsable($voucherItemData, $memberUserId, $data = []) | ||
{ | ||
$vipId = $data['vipId']; | ||
if (empty($vipId)) { | ||
return false; | ||
} | ||
switch ($voucherItemData['_voucher']['type']) { | ||
case VoucherType::DISCOUNT: | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
public function processComputeItems($memberUserId, $usingVoucherItemDataList, $data = [], $param = []) | ||
{ | ||
$data['usedVoucherItems'] = $usingVoucherItemDataList; | ||
// 折扣券 | ||
foreach ($this->filterVoucherItems($usingVoucherItemDataList, VoucherType::DISCOUNT) as $item) { | ||
$discount = $item['_voucher']['typeDiscount']; | ||
$data['price'] = NumberUtil::discountDecimal($data['price'], $discount); | ||
} | ||
return $data; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
module/Member/Migrate/2024_07_05_000000_modify_member_vip_order_param.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
|
||
class ModifyMemberVipOrderParam extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('member_vip_order', function (Blueprint $table) { | ||
$table->string('param', 100)->nullable()->comment('参数'); | ||
}); | ||
|
||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
|
||
namespace Module\Member\Model; | ||
|
||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class MemberVipOrder extends Model | ||
{ | ||
protected $table = 'member_vip_order'; | ||
} |
Oops, something went wrong.