初始上传
This commit is contained in:
26
addon/pointexchange/event/CouponGetType.php
Executable file
26
addon/pointexchange/event/CouponGetType.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\pointexchange\event;
|
||||
|
||||
/**
|
||||
* 优惠券来源类型
|
||||
*/
|
||||
class CouponGetType
|
||||
{
|
||||
/**
|
||||
* 执行安装
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return [ 7 => '积分兑换'];
|
||||
}
|
||||
}
|
||||
28
addon/pointexchange/event/CronExchangeOrderClose.php
Executable file
28
addon/pointexchange/event/CronExchangeOrderClose.php
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
|
||||
namespace addon\pointexchange\event;
|
||||
|
||||
use addon\pointexchange\model\Order;
|
||||
/**
|
||||
* 积分兑换订单关闭
|
||||
*/
|
||||
class CronExchangeOrderClose
|
||||
{
|
||||
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle($data)
|
||||
{
|
||||
$order = new Order();
|
||||
$order->closeOrder($data['relate_id']);
|
||||
}
|
||||
|
||||
}
|
||||
45
addon/pointexchange/event/DeleteGoodsCheck.php
Executable file
45
addon/pointexchange/event/DeleteGoodsCheck.php
Executable file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
|
||||
* 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
|
||||
namespace addon\pointexchange\event;
|
||||
|
||||
class DeleteGoodsCheck
|
||||
{
|
||||
public function handle($param)
|
||||
{
|
||||
if(in_array($param['field'], ['goods_id', 'sku_id'])){
|
||||
$alias = 'peg';
|
||||
$join = [
|
||||
['promotion_exchange pe', 'peg.id = pe.exchange_goods_id', 'inner'],
|
||||
];
|
||||
$condition = [
|
||||
['peg.type', '=', 1],
|
||||
['peg.state', '=', 1],
|
||||
];
|
||||
if($param['field'] == 'goods_id'){
|
||||
$condition[] = ['peg.type_id', 'in', $param['ids']];
|
||||
$query_field = 'peg.type_id';
|
||||
}else{
|
||||
$condition[] = ['pe.type_id', 'in', $param['ids']];
|
||||
$query_field = 'pe.type_id';
|
||||
}
|
||||
$field = 'type_id';
|
||||
$cannot_delete_goods_list = model('promotion_exchange_goods')->getList($condition, $query_field, '', $alias, $join);
|
||||
$cannot_delete_ids = array_unique(array_column($cannot_delete_goods_list, $field));
|
||||
return [
|
||||
'reason' => '存在积分兑换活动',
|
||||
'cannot_delete_ids' => $cannot_delete_ids,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
26
addon/pointexchange/event/Install.php
Executable file
26
addon/pointexchange/event/Install.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
|
||||
namespace addon\pointexchange\event;
|
||||
|
||||
/**
|
||||
* 应用安装
|
||||
*/
|
||||
class Install
|
||||
{
|
||||
/**
|
||||
* 执行安装
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return success();
|
||||
}
|
||||
}
|
||||
46
addon/pointexchange/event/MemberAccountFromType.php
Executable file
46
addon/pointexchange/event/MemberAccountFromType.php
Executable file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
|
||||
namespace addon\pointexchange\event;
|
||||
|
||||
/**
|
||||
* 会员账户变化来源类型
|
||||
*/
|
||||
class MemberAccountFromType
|
||||
{
|
||||
|
||||
public function handle($data)
|
||||
{
|
||||
$from_type = [
|
||||
|
||||
'point' => [
|
||||
'pointexchange' => [
|
||||
'type_name' => '积分兑换',
|
||||
'type_url' => ''
|
||||
]
|
||||
],
|
||||
// 'point' => [
|
||||
// 'pointexchangerefund' => [
|
||||
// 'type_name' => '积分兑换退还',
|
||||
// 'type_url' => ''
|
||||
// ],
|
||||
//
|
||||
// ]
|
||||
];
|
||||
if($data == ''){
|
||||
return $from_type;
|
||||
}else{
|
||||
return $from_type[$data] ?? [];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
41
addon/pointexchange/event/OrderClose.php
Executable file
41
addon/pointexchange/event/OrderClose.php
Executable file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
|
||||
namespace addon\pointexchange\event;
|
||||
|
||||
use addon\pointexchange\model\Order;
|
||||
|
||||
/**
|
||||
* 订单关闭
|
||||
*/
|
||||
class OrderClose
|
||||
{
|
||||
|
||||
/**
|
||||
* 订单关闭
|
||||
* @param $param
|
||||
* @return array|int|mixed|void
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
$order_model = new Order();
|
||||
$order_info_result = $order_model->getOrderInfo([ [ 'relate_order_id', '=', $param[ 'order_id' ] ] ]);
|
||||
|
||||
if ($order_info_result[ 'code' ] < 0 || empty($order_info_result[ 'data' ])) {
|
||||
return $order_info_result;
|
||||
}
|
||||
if (empty($order_info_result[ 'data' ])) {
|
||||
$order_info_result[ 'data' ][ 'order_id' ] = $param[ 'order_id' ];
|
||||
}
|
||||
$res = $order_model->closeOrder($order_info_result[ 'data' ][ 'order_id' ]);
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
29
addon/pointexchange/event/OrderPromotionType.php
Executable file
29
addon/pointexchange/event/OrderPromotionType.php
Executable file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
|
||||
namespace addon\pointexchange\event;
|
||||
|
||||
/**
|
||||
* 订单营销活动类型
|
||||
*/
|
||||
class OrderPromotionType
|
||||
{
|
||||
|
||||
/**
|
||||
* 订单营销活动类型
|
||||
* @return array
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return ["name" => "积分兑换", "type" => "pointexchange"];
|
||||
}
|
||||
}
|
||||
29
addon/pointexchange/event/PointexchangeOrderPayNotify.php
Executable file
29
addon/pointexchange/event/PointexchangeOrderPayNotify.php
Executable file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
|
||||
namespace addon\pointexchange\event;
|
||||
|
||||
use addon\pointexchange\model\Order;
|
||||
/**
|
||||
* 积分兑换订单异步回调执行
|
||||
*/
|
||||
class PointexchangeOrderPayNotify
|
||||
{
|
||||
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle($data)
|
||||
{
|
||||
$order = new Order();
|
||||
$order->orderPay($data);
|
||||
}
|
||||
|
||||
}
|
||||
52
addon/pointexchange/event/ShowPromotion.php
Executable file
52
addon/pointexchange/event/ShowPromotion.php
Executable file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
|
||||
namespace addon\pointexchange\event;
|
||||
|
||||
/**
|
||||
* 活动展示
|
||||
*/
|
||||
class ShowPromotion
|
||||
{
|
||||
|
||||
/**
|
||||
* 活动展示
|
||||
* @return array
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$data = [
|
||||
|
||||
'admin' => [
|
||||
|
||||
],
|
||||
'shop' => [
|
||||
[
|
||||
//插件名称
|
||||
'name' => 'pointexchange',
|
||||
//展示分类(根据平台端设置,admin(平台营销),shop:店铺营销,member:会员营销, tool:应用工具)
|
||||
'show_type' => 'shop',
|
||||
//展示主题
|
||||
'title' => '积分商城',
|
||||
//展示介绍
|
||||
'description' => '客户积分兑换更多好物',
|
||||
//展示图标
|
||||
'icon' => 'addon/pointexchange/icon.png',
|
||||
//跳转链接
|
||||
'url' => 'pointexchange://shop/exchange/lists',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
26
addon/pointexchange/event/UnInstall.php
Executable file
26
addon/pointexchange/event/UnInstall.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
|
||||
namespace addon\pointexchange\event;
|
||||
|
||||
/**
|
||||
* 应用卸载
|
||||
*/
|
||||
class UnInstall
|
||||
{
|
||||
/**
|
||||
* 执行卸载
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return error("系统插件不能删除");
|
||||
}
|
||||
}
|
||||
34
addon/pointexchange/event/WapOrderDetailPathByPayInfo.php
Executable file
34
addon/pointexchange/event/WapOrderDetailPathByPayInfo.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\pointexchange\event;
|
||||
|
||||
use addon\pointexchange\model\Order;
|
||||
|
||||
/**
|
||||
* 通过支付信息获取手机端订单详情路径
|
||||
*/
|
||||
class WapOrderDetailPathByPayInfo
|
||||
{
|
||||
public function handle($data)
|
||||
{
|
||||
if($data['event'] == 'PointexchangeOrderPayNotify'){
|
||||
$order = new Order();
|
||||
$order_info = $order->getOrderInfo([['out_trade_no', '=', $data['out_trade_no']]])['data'];
|
||||
if(!empty($order_info)){
|
||||
if($order_info['type'] == 1){
|
||||
return '/pages/order/detail?order_id='.$order_info['relate_order_id'];
|
||||
}else{
|
||||
return '/pages/order/detail_point?order_id='.$order_info['order_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user