初始上传

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,32 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace app\event\goods;
use app\model\goods\Goods;
/**
* 商品自动下架(计划任务)
* @author Administrator
*
*/
class CronGoodsTimerOff
{
public function handle($param)
{
$goods_model = new Goods();
$condition = [
[ 'goods_id', '=', $param[ 'relate_id' ] ]
];
$res = $goods_model->cronModifyGoodsState($condition, 0);
return $res;
}
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace app\event\goods;
use app\model\goods\Goods;
/**
* 商品自动上架(计划任务)
* @author Administrator
*
*/
class CronGoodsTimerOn
{
public function handle($param)
{
$goods_model = new Goods();
$condition = [
[ 'goods_id', '=', $param[ 'relate_id' ] ]
];
$res = $goods_model->cronModifyGoodsState($condition, 1);
return $res;
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace app\event\goods;
use app\model\goods\Goods;
/**
* 虚拟商品自动下架(计划任务)
* @author Administrator
*
*/
class CronVirtualGoodsVerifyOff
{
public function handle($param)
{
$goods_model = new Goods();
$condition = [
[ 'goods_id', '=', $param[ 'relate_id' ] ]
];
$res = $goods_model->getGoodsDetail($param[ 'relate_id' ])['data'];
if($res['goods_state'] == 1){
$res = $goods_model->cronModifyGoodsState($condition, 0);
}
return $res;
}
}

View File

@@ -0,0 +1,37 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
* 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
* =========================================================
*/
namespace app\event\goods;
use app\model\order\Order;
use think\facade\Db;
class DeleteGoodsCheck
{
public function handle($param)
{
if(in_array($param['field'], ['goods_id', 'sku_id'])){
$order_close = Order::ORDER_CLOSE;
$order_complete = Order::ORDER_COMPLETE;
$cannot_delete_goods_list = model('order_goods')->getList([
['', 'exp', Db::raw("o.order_status not in ({$order_close},{$order_complete}) or (o.order_status = {$order_complete} and o.is_enable_refund = 1)")],
['og.'.$param['field'], 'in', $param['ids']],
], $param['field'], '', 'og', [['order o', 'og.order_id = o.order_id', 'inner']]);
$cannot_delete_ids = array_unique(array_column($cannot_delete_goods_list, $param['field']));
return [
'reason' => '存在进行中的订单',
'cannot_delete_ids' => $cannot_delete_ids,
];
}
}
}

31
app/event/goods/GoodsClass.php Executable file
View File

@@ -0,0 +1,31 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace app\event\goods;
use app\model\goods\Goods;
/**
* 商品类型(用于商品添加编辑自动寻找)
*/
class GoodsClass
{
public function handle()
{
return [
'goods_class' => (new Goods())->getGoodsClass()['id'],
'goods_class_name' => (new Goods())->getGoodsClass()['name'],
'is_virtual' => 0,
'add_url' => 'shop/goods/addGoods',
'edit_url' => 'shop/goods/editGoods'
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
/**
* Niushop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.niushop.com
* =========================================================
*/
namespace app\event\goods;
use app\model\goods\VirtualGoods;
/**
* 商品类型
*/
class VirtualGoodsClass
{
public function handle()
{
return [
'goods_class' => (new VirtualGoods())->getGoodsClass()['id'],
'goods_class_name' => (new VirtualGoods())->getGoodsClass()['name'],
'is_virtual' => 1,
'add_url' => 'shop/virtualgoods/addGoods',
'edit_url' => 'shop/virtualgoods/editGoods'
];
}
}