初始上传
This commit is contained in:
26
addon/memberconsume/event/Install.php
Executable file
26
addon/memberconsume/event/Install.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\memberconsume\event;
|
||||
|
||||
/**
|
||||
* 应用安装
|
||||
*/
|
||||
class Install
|
||||
{
|
||||
/**
|
||||
* 执行安装
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return success();
|
||||
}
|
||||
}
|
||||
48
addon/memberconsume/event/MemberAccountFromType.php
Executable file
48
addon/memberconsume/event/MemberAccountFromType.php
Executable file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\memberconsume\event;
|
||||
|
||||
/**
|
||||
* 会员账户变化来源类型
|
||||
*/
|
||||
class MemberAccountFromType
|
||||
{
|
||||
|
||||
public function handle($data)
|
||||
{
|
||||
$from_type = [
|
||||
|
||||
'point' => [
|
||||
'memberconsume' => [
|
||||
'type_name' => '消费奖励',
|
||||
'admin_url' => 'admin/order/detail',
|
||||
'tag_name' => 'order_id'
|
||||
],
|
||||
|
||||
],
|
||||
'growth' => [
|
||||
'memberconsume' => [
|
||||
'type_name' => '消费奖励',
|
||||
'admin_url' => 'admin/order/detail',
|
||||
'tag_name' => 'order_id'
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
if ($data == '') {
|
||||
return $from_type;
|
||||
} else {
|
||||
return $from_type[$data] ?? [];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
35
addon/memberconsume/event/MemberAccountRule.php
Executable file
35
addon/memberconsume/event/MemberAccountRule.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\memberconsume\event;
|
||||
|
||||
use addon\memberconsume\model\Consume;
|
||||
|
||||
/**
|
||||
* 会员账户变化规则
|
||||
*/
|
||||
class MemberAccountRule
|
||||
{
|
||||
|
||||
public function handle($data)
|
||||
{
|
||||
$config = new Consume();
|
||||
$info = $config->getConfig($data['site_id']);
|
||||
$return = [];
|
||||
if ($info['data']['is_use'] == 1) {
|
||||
$return['point'] = "会员消费,订单支付返积分,比率" . $info['data']['value']['return_point_rate'] . "%";
|
||||
$return['growth'] = "会员消费订单支付返成长值,比率" . $info['data']['value']['return_growth_rate'] . "%";
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
||||
}
|
||||
}
|
||||
29
addon/memberconsume/event/MemberAction.php
Executable file
29
addon/memberconsume/event/MemberAction.php
Executable file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\memberconsume\event;
|
||||
|
||||
/**
|
||||
* 会员操作
|
||||
*/
|
||||
class MemberAction
|
||||
{
|
||||
/**
|
||||
* 会员操作
|
||||
*/
|
||||
public function handle($data)
|
||||
{
|
||||
if ($data[ 'member_action' ] == 'memberconsume') {
|
||||
return success();
|
||||
}
|
||||
return '';
|
||||
|
||||
}
|
||||
}
|
||||
27
addon/memberconsume/event/OrderPayAfter.php
Executable file
27
addon/memberconsume/event/OrderPayAfter.php
Executable file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\memberconsume\event;
|
||||
|
||||
use addon\memberconsume\model\Consume as ConsumeModel;
|
||||
|
||||
/**
|
||||
* 订单支付事件
|
||||
*/
|
||||
class OrderPayAfter
|
||||
{
|
||||
|
||||
public function handle($data)
|
||||
{
|
||||
$consume_model = new ConsumeModel();
|
||||
$res = $consume_model->memberConsume([ 'out_trade_no' => $data[ 'out_trade_no' ]], $data[ 'order_id' ]);
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
28
addon/memberconsume/event/OrderRefundFinish.php
Executable file
28
addon/memberconsume/event/OrderRefundFinish.php
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\memberconsume\event;
|
||||
|
||||
use addon\memberconsume\model\Consume as ConsumeModel;
|
||||
use app\model\order\OrderCommon;
|
||||
|
||||
/**
|
||||
* 订单维权成功
|
||||
*/
|
||||
class OrderRefundFinish
|
||||
{
|
||||
|
||||
public function handle($data)
|
||||
{
|
||||
$consume_model = new ConsumeModel();
|
||||
$res = $consume_model->rewardRecovery($data);
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
34
addon/memberconsume/event/PointRule.php
Executable file
34
addon/memberconsume/event/PointRule.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\memberconsume\event;
|
||||
|
||||
use addon\memberconsume\model\Consume;
|
||||
|
||||
/**
|
||||
* 积分规则
|
||||
*/
|
||||
class PointRule
|
||||
{
|
||||
|
||||
public function handle($data)
|
||||
{
|
||||
$config = new Consume();
|
||||
$info = $config->getConfig($data[ 'site_id' ])[ 'data' ];
|
||||
|
||||
$data = [
|
||||
'title' => '会员消费奖励',
|
||||
'content' => !$info[ 'is_use' ] || !$info[ 'value' ][ 'return_point_rate' ] ? '-' : "会员消费,赠送消费金额" . $info[ 'value' ][ 'return_point_rate' ] . "%的积分",
|
||||
'url' => 'memberconsume://shop/config/index',
|
||||
'update_time' => $info[ 'modify_time' ]
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
88
addon/memberconsume/event/ShowPromotion.php
Executable file
88
addon/memberconsume/event/ShowPromotion.php
Executable file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\memberconsume\event;
|
||||
|
||||
use addon\memberconsume\model\Consume;
|
||||
|
||||
/**
|
||||
* 活动展示
|
||||
*/
|
||||
class ShowPromotion
|
||||
{
|
||||
|
||||
/**
|
||||
* 活动展示
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function handle($params = [])
|
||||
{
|
||||
$data = [
|
||||
'shop' => [
|
||||
[
|
||||
//插件名称
|
||||
'name' => 'memberconsume',
|
||||
//展示分类(根据平台端设置,admin(平台营销),shop:店铺营销,member:会员营销, tool:应用工具)
|
||||
'show_type' => 'member',
|
||||
//展示主题
|
||||
'title' => '消费奖励',
|
||||
//展示介绍
|
||||
'description' => '客户消费后发放奖励',
|
||||
//展示图标
|
||||
'icon' => 'addon/memberconsume/icon.png',
|
||||
//跳转链接
|
||||
'url' => 'memberconsume://shop/config/index',
|
||||
'summary' => $this->summary($params)
|
||||
]
|
||||
]
|
||||
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 营销活动概况
|
||||
* @param $params
|
||||
* @return array
|
||||
*/
|
||||
private function summary($params)
|
||||
{
|
||||
if (empty($params)) {
|
||||
return [];
|
||||
}
|
||||
if (isset($params[ 'count' ]) || isset($params[ 'summary' ])) $config = ( new Consume() )->getConfig($params[ 'site_id' ])[ 'data' ];
|
||||
//获取活动数量
|
||||
if (isset($params[ 'count' ])) {
|
||||
return [
|
||||
'count' => $config[ 'is_use' ]
|
||||
];
|
||||
}
|
||||
//获取活动概况,需要获取开始时间与结束时间
|
||||
if (isset($params[ 'summary' ])) {
|
||||
$content = [];
|
||||
|
||||
$value = $config[ 'value' ];
|
||||
if ($value[ 'return_point_rate' ]) $content[] = '消费返消费额' . $value['return_point_rate'] . '%积分';
|
||||
if ($value[ 'return_growth_rate' ]) $content[] = '消费返消费额' . $value['return_growth_rate'] . '%成长值';
|
||||
if ($value[ 'coupon_list' ]) $content[] = '消费送优惠券';
|
||||
|
||||
return [
|
||||
'unlimited_time' => [
|
||||
'status' => $config[ 'is_use' ],
|
||||
'detail' => empty($content) ? '未配置活动' : implode('、', $content),
|
||||
'switch_type' => empty($content) ? 'jump' : 'switch',
|
||||
'config_key' => 'MEMBER_CONSUME_CONFIG'
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
26
addon/memberconsume/event/UnInstall.php
Executable file
26
addon/memberconsume/event/UnInstall.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\memberconsume\event;
|
||||
|
||||
/**
|
||||
* 应用卸载
|
||||
*/
|
||||
class UnInstall
|
||||
{
|
||||
/**
|
||||
* 执行卸载
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return error('', "系统插件不允许删除");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user