初始上传

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

View File

@@ -0,0 +1,28 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\pintuan\event;
use addon\pintuan\model\Pintuan;
/**
* 关闭活动
*/
class ClosePintuan
{
public function handle($params)
{
$pintuan = new Pintuan();
$res = $pintuan->cronClosePintuan($params['relate_id']);
return $res;
}
}

View File

@@ -0,0 +1,28 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\pintuan\event;
use addon\pintuan\model\PintuanGroup;
/**
* 关闭活动
*/
class ClosePintuanGroup
{
public function handle($params)
{
$pintuan = new PintuanGroup();
$res = $pintuan->cronClosePintuanGroup($params['relate_id']);
return $res;
}
}

View File

@@ -0,0 +1,43 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\pintuan\event;
use addon\pintuan\model\Pintuan;
/**
* 营销活动商品分类id
*/
class GoodsListCategoryIds
{
/**
* 商品营销活动信息
* @param $param
* @return array
*/
public function handle($param)
{
if (empty($param[ 'promotion' ]) || $param[ 'promotion' ] != 'pintuan') return [];
$condition[] = [
['pp.site_id', '=', $param[ 'site_id' ]],
['pp.status', '=', 1],
['g.is_delete','=',0],
['g.goods_state','=',1],
];
$model = new Pintuan();
$res = $model->getGoodsCategoryIds($condition);
return $res;
}
}

View File

@@ -0,0 +1,63 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\pintuan\event;
use addon\pintuan\model\Pintuan;
/**
* 商品营销活动信息
*/
class GoodsListPromotion
{
/**
* 商品营销活动信息
* @param $param
* @return array
*/
public function handle($param)
{
if (empty($param[ 'promotion' ]) || $param[ 'promotion' ] != 'pintuan') return [];
$condition[] = [
['pp.site_id', '=', $param[ 'site_id' ]],
['pp.status', '=', 1],
['g.is_delete','=',0],
['g.goods_state','=',1]
];
if ($param[ 'promotion_name' ]) {
$condition[] = ['pp.pintuan_name', 'like', '%' . $param[ 'promotion_name' ] . '%'];
}
if(!empty($param['goods_name'])){
$condition[] = ['g.goods_name', 'like', '%'.$param['goods_name'].'%'];
}
if (!empty($param['select_type']) && $param['select_type'] == 'selected' && isset($param['goods_ids'])) {
$condition[] = [ 'g.goods_id', 'in', $param['goods_ids'] ];
}
if (!empty($param['category_id'])) {
$condition[] = [ 'g.category_id', 'like', '%,' . $param['category_id'] . ',%' ];
}
if (!empty($param['label_id'])) {
$condition[] = [ 'g.label_id', '=', $param['label_id'] ];
}
if (!empty($param['goods_class'])) {
$condition[] = [ 'g.goods_class', '=', $param['goods_class'] ];
}
$model = new Pintuan();
$list = $model->getPintuanGoodsPageList($condition, $param[ 'page' ], $param[ 'page_size' ], 'pp.pintuan_id desc');
$list['condition'] = $condition;
return $list;
}
}

View File

@@ -0,0 +1,69 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\pintuan\event;
use addon\pintuan\model\Pintuan;
use app\model\goods\Goods as GoodsModel;
/**
* 商品营销活动信息
*/
class GoodsPromotion
{
/**
* 商品营销活动信息
* @param $param
* @return array
*/
public function handle($param)
{
if (isset($param[ 'goods_sku_detail' ])) {
$goods_info = $param[ 'goods_sku_detail' ];
if (!empty($goods_info[ 'promotion_addon' ])) {
$promotion_addon = json_decode($goods_info[ 'promotion_addon' ], true);
if (!empty($promotion_addon[ 'pintuan' ])) {
return [
'promotion_type' => 'pintuan',
'promotion_name' => '拼团',
'pintuan_id' => $promotion_addon[ 'pintuan' ]
];
}
}
} else {
if (empty($param[ 'goods_id' ])) return [];
$goods_model = new GoodsModel();
$goods_info = $goods_model->getGoodsInfo([ [ 'goods_id', '=', $param[ 'goods_id' ] ] ], 'promotion_addon')[ 'data' ];
if (!empty($goods_info[ 'promotion_addon' ])) {
$promotion_addon = json_decode($goods_info[ 'promotion_addon' ], true);
if (!empty($promotion_addon[ 'pintuan' ])) {
$pintuan_model = new Pintuan();
$condition = [
[ 'ppg.pintuan_id', '=', $promotion_addon[ 'pintuan' ] ],
[ 'pp.status', '=', 1 ],
[ 'g.goods_state', '=', 1 ],
[ 'g.is_delete', '=', 0 ]
];
$field = 'ppg.id,ppg.pintuan_id,ppg.goods_id,ppg.sku_id,ppg.pintuan_price,ppg.promotion_price,pp.pintuan_name';
$goods_detail = $pintuan_model->getPintuanGoodsDetail($condition, $field)[ 'data' ];
if (!empty($goods_detail)) {
$goods_detail[ 'promotion_type' ] = 'pintuan';
$goods_detail[ 'promotion_name' ] = '拼团';
return $goods_detail;
}
}
}
return [];
}
}
}

View File

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

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

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

View File

@@ -0,0 +1,27 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\pintuan\event;
use addon\pintuan\model\Pintuan;
class MessagePintuanComplete
{
public function handle($param)
{
//发送消息
if ($param[ "keywords" ] == "PINTUAN_COMPLETE") {
$model = new Pintuan();
$result = $model->pintuanCompleteMessage($param);
return $result;
}
}
}

View File

@@ -0,0 +1,31 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\pintuan\event;
use addon\pintuan\model\Pintuan;
/**
* 关闭活动消息
*/
class MessagePintuanFail
{
public function handle($param)
{
//发送消息
if ($param["keywords"] == "PINTUAN_FAIL") {
$model = new Pintuan();
$result = $model->pintuanFailMessage($param);
return $result;
}
}
}

View File

@@ -0,0 +1,28 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\pintuan\event;
use addon\pintuan\model\Pintuan;
/**
* 启动活动
*/
class OpenPintuan
{
public function handle($params)
{
$pintuan = new Pintuan();
$res = $pintuan->cronOpenPintuan($params['relate_id']);
return $res;
}
}

View File

@@ -0,0 +1,37 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\pintuan\event;
use addon\pintuan\model\PintuanOrder;
/**
* 订单关闭衍生
*/
class OrderClose
{
/**
* 活动展示
* @param $param
* @return array|mixed
*/
public function handle($params)
{
if ($params[ 'promotion_type' ] == 'pintuan') {
$pintuan_order = new PintuanOrder();
$condition= array(
['order_id', '=', $params['order_id']]
);
$res = $pintuan_order->pintuanOrderClose($condition);
return $res;
}
}
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\pintuan\event;
use addon\pintuan\model\PintuanOrder;
/**
* 活动展示
*/
class OrderPay
{
/**
* 活动展示
* @param $param
* @return array|mixed
*/
public function handle($param)
{
if ($param[ 'promotion_type' ] == 'pintuan') {
$pintuan_order = new PintuanOrder();
$res = $pintuan_order->orderPay($param);
return $res;
}
}
}

View File

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

View File

@@ -0,0 +1,37 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\pintuan\event;
/**
* 活动专区——拼团页面配置
*/
class PintuanZoneConfig
{
public function handle($params)
{
if (empty($params) || $params[ 'name' ] == 'pintuan') {
$data = [
'name' => 'pintuan', // 标识
'title' => '拼团', // 名称
'url' => 'shop/adv/lists?keyword=NS_PINTUAN', // 自定义跳转链接
'preview' => 'addon/pintuan/shop/view/public/img/zone_preview.png', // 预览图
// 页面配置
'value' => [
'bg_color' => '#FA3A1D'
],
];
return $data;
}
}
}

View File

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

View File

@@ -0,0 +1,98 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace addon\pintuan\event;
use think\facade\Db;
/**
* 活动展示
*/
class ShowPromotion
{
public $promotion_type = 'time_limit';
/**
* 活动展示
* @param array $params
* @return array
*/
public function handle($params = [])
{
$data = [
'shop' => [
[
//插件名称
'name' => 'pintuan',
//店铺端展示分类 shop:营销活动 member:互动营销
'show_type' => 'shop',
//展示主题
'title' => '拼团',
//展示介绍
'description' => '邀请朋友一起拼团购买',
//展示图标
'icon' => 'addon/pintuan/icon.png',
//跳转链接
'url' => 'pintuan://shop/pintuan/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_pintuan")->getCount([ [ 'site_id', '=', $params[ 'site_id' ] ] ]);
return [
'count' => $count
];
}
//获取活动概况,需要获取开始时间与结束时间
if (isset($params[ 'summary' ])) {
$join = [
[ 'goods g', 'p.goods_id = g.goods_id', 'inner' ]
];
$list = model("promotion_pintuan")->getList([
[ '', 'exp', Db::raw('not ( (`start_time` >= ' . $params[ 'end_time' ] . ') or (`end_time` <= ' . $params[ 'start_time' ] . '))') ],
[ 'p.site_id', '=', $params[ 'site_id' ] ],
[ 'p.status', '<>', 2 ],
[ 'p.status', '<>', 3 ],
[ 'p.status', '<>', 4 ],
[ 'g.goods_state', '=', 1 ],
[ 'g.is_delete', '=', 0 ]
], 'p.pintuan_name as promotion_name,p.pintuan_id as promotion_id,p.start_time,p.end_time', '', 'p', $join, 'p.pintuan_name');
return !empty($list) ? [
'time_limit' => [
'count' => count($list),
'detail' => $list,
'color' => '#6D66FF'
]
] : [];
}
}
}

View File

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