初始上传

This commit is contained in:
2026-04-04 17:27:12 +08:00
parent 4d80d28eb4
commit b7e11774ee
11191 changed files with 1588469 additions and 0 deletions

25
addon/cards/event/Install.php Executable file
View File

@@ -0,0 +1,25 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\cards\event;
/**
* 应用安装
*/
class Install
{
/**
* 执行安装
*/
public function handle()
{
return success();
}
}

View File

@@ -0,0 +1,44 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\cards\event;
/**
* 会员账户变化来源类型
*/
class MemberAccountFromType
{
public function handle($data)
{
$from_type = [
'point' => [
'cards' => [
'type_name' => '刮刮乐',
'type_url' => '',
],
],
'balance' => [
'cards' => [
'type_name' => '刮刮乐',
'type_url' => '',
],
]
];
if ($data == '') {
return $from_type;
} else {
return $from_type[$data] ?? [];
}
}
}

View File

@@ -0,0 +1,28 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\cards\event;
/**
* 活动类型
*/
class PromotionType
{
/**
* 活动类型
* @return array
*/
public function handle()
{
return ["name" => "刮刮乐", "type" => "cards"];
}
}

View File

@@ -0,0 +1,92 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\cards\event;
use think\facade\Db;
/**
* 活动展示
*/
class ShowPromotion
{
public $promotion_type = 'time_limit';
/**
* 活动展示
* @param array $params
* @return array
*/
public function handle($params = [])
{
$data = [
'shop' => [
[
//插件名称
'name' => 'cards',
//店铺端展示分类 shop:营销活动 member:互动营销
'show_type' => 'member',
//展示主题
'title' => '刮刮乐',
//展示介绍
'description' => '刮刮卡形式的抽奖',
//展示图标
'icon' => 'addon/cards/icon.png',
//跳转链接
'url' => 'cards://shop/cards/lists',
'summary' => $this->summary($params)
]
]
];
return $data;
}
/**
* 营销活动概况
* @param $params
* @return array
*/
private function summary($params)
{
if (empty($params)) {
return [];
}
if(isset($params['promotion_type']) && $params['promotion_type'] != $this->promotion_type){
return [];
}
//获取活动数量
if (isset($params[ 'count' ])) {
$count = model("promotion_games")->getCount([ [ 'site_id', '=', $params[ 'site_id' ] ], [ 'game_type', '=', 'cards' ] ]);
return [
'count' => $count
];
}
//获取活动概况,需要获取开始时间与结束时间
if (isset($params[ 'summary' ])) {
$list = model("promotion_games")->getList([
[ '', 'exp', Db::raw('not ( (`start_time` >= ' . $params[ 'end_time' ] . ') or (`end_time` <= ' . $params[ 'start_time' ] . '))') ],
[ 'game_type', '=', 'cards' ],
[ 'site_id', '=', $params[ 'site_id' ] ],
[ 'status', '<>', 2 ],
[ 'status', '<>', 3 ]
], 'game_name as promotion_name,game_id as promotion_id,start_time,end_time');
return !empty($list) ? [
'time_limit' => [
'count' => count($list),
'detail' => $list,
'color' => '#FF6666'
]
] : [];
}
}
}

25
addon/cards/event/UnInstall.php Executable file
View File

@@ -0,0 +1,25 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\cards\event;
/**
* 应用卸载
*/
class UnInstall
{
/**
* 执行卸载
*/
public function handle()
{
return success();
}
}