12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- declare(strict_types=0);
- namespace mcard;
- const AmountType = 1;
- const PeriodType = 2;
- const BothType = 3;
- const STATE_UNSTART = 1;
- const STATE_USING = 2;
- const STATE_OVER = 3;
- const MonthPachage = 1;
- const QuarterPackage = 2;
- const YearPackage = 3;
- require_once(BASE_HELPER_PATH . '/mcard/card.php');
- require_once(BASE_HELPER_PATH . '/mcard/user_mcards.php');
- require_once(BASE_HELPER_PATH . '/mcard/amount_card.php');
- require_once(BASE_HELPER_PATH . '/mcard/amount_period_card.php');
- require_once(BASE_HELPER_PATH . '/mcard/period_card.php');
- require_once(BASE_HELPER_PATH . '/bonus_helper.php');
- require_once(BASE_HELPER_PATH . '/goods_helper.php');
- use goods_helper;
- use bonus;
- function getConfig($type,$total_amount = 10000)
- {
- if($type == 'year') {
- return ['card_type' => BothType, 'total_amount' => $total_amount, 'discount' => 0.04, 'package_type' => 'year'];
- }
- else {
- return [];
- }
- }
- function isVip($member_id)
- {
- if($member_id <=0 ) return false;
- $user_cards = new user_mcards($member_id);
- return $user_cards->hasCards();
- }
- function canUseVip($goods_id)
- {
- global $config;
- $exclue_gids = $config['exclude_preferential_goods_ids'];
- if(empty($exclue_gids)) {
- return true;
- } else {
- return in_array(intval($goods_id),$exclue_gids) === false;
- }
- }
|