初始上传
This commit is contained in:
36
app/event/Qrcode.php
Executable file
36
app/event/Qrcode.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event;
|
||||
|
||||
use app\model\system\Qrcode as QrcodeModel;
|
||||
|
||||
/**
|
||||
* 生成二维码
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
class Qrcode
|
||||
{
|
||||
public function handle($param)
|
||||
{
|
||||
if (in_array($param[ "app_type" ], [ 'pc', 'h5', 'all', 'wechat', 'app' ])) {
|
||||
if ($param[ "app_type" ] == 'pc') {
|
||||
$param[ "app_type" ] = 'pc';
|
||||
} else {
|
||||
$param[ "app_type" ] = 'h5';
|
||||
}
|
||||
$qrcode = new QrcodeModel();
|
||||
$res = $qrcode->createQrcode($param);
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
25
app/event/account/CronPointTask.php
Executable file
25
app/event/account/CronPointTask.php
Executable file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\account;
|
||||
|
||||
use app\model\account\Point as PointModel;
|
||||
|
||||
/**
|
||||
* 登录成功发送通知
|
||||
*/
|
||||
class CronPointTask
|
||||
{
|
||||
public function handle($param)
|
||||
{
|
||||
return (new PointModel())->execPointTaskCron($param['relate_id']);
|
||||
}
|
||||
}
|
||||
27
app/event/addsite/AddMemberClusterCronRefresh.php
Executable file
27
app/event/addsite/AddMemberClusterCronRefresh.php
Executable file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\addsite;
|
||||
|
||||
use app\model\member\MemberCluster as MemberClusterModel;
|
||||
|
||||
/**
|
||||
* 初始化添加会员群体定时刷新事件
|
||||
*/
|
||||
class AddMemberClusterCronRefresh
|
||||
{
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle()
|
||||
{
|
||||
$member_cluster_model = new MemberClusterModel();
|
||||
$result = $member_cluster_model->addMemberClusterCronRefresh();
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
43
app/event/addsite/AddMemberLevel.php
Executable file
43
app/event/addsite/AddMemberLevel.php
Executable file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\addsite;
|
||||
|
||||
use app\model\member\MemberLevel;
|
||||
|
||||
|
||||
/**
|
||||
* 增加默认会员等级
|
||||
*/
|
||||
class AddMemberLevel
|
||||
{
|
||||
|
||||
public function handle($param)
|
||||
{
|
||||
if (!empty($param['site_id'])) {
|
||||
|
||||
$member_level = new MemberLevel();
|
||||
$data = [
|
||||
'site_id' => $param['site_id'],
|
||||
'level_name' => '普通会员',
|
||||
'is_default' => 1,
|
||||
'is_free_shipping' => 0,
|
||||
'charge_rule' => '',
|
||||
'charge_type' => 0
|
||||
];
|
||||
$res = $member_level->addMemberLevel($data);
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
35
app/event/addsite/AddRegisterAgreement.php
Executable file
35
app/event/addsite/AddRegisterAgreement.php
Executable file
File diff suppressed because one or more lines are too long
247
app/event/addsite/AddSiteAdv.php
Executable file
247
app/event/addsite/AddSiteAdv.php
Executable file
@@ -0,0 +1,247 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\addsite;
|
||||
|
||||
|
||||
use app\model\web\Adv;
|
||||
use app\model\web\AdvPosition;
|
||||
|
||||
/**
|
||||
* 增加默认广告位 广告图
|
||||
*/
|
||||
class AddSiteAdv
|
||||
{
|
||||
private $adv_data = [
|
||||
[
|
||||
'ap_name' => 'PC端首页',
|
||||
'keyword' => 'NS_PC_INDEX',
|
||||
'ap_intro' => '',
|
||||
'ap_width' => '763',
|
||||
'ap_height' => '430',
|
||||
'default_content' => '',
|
||||
'ap_background_color' => '#FFFFFF',
|
||||
'type' => 1,
|
||||
'adv' => [
|
||||
[
|
||||
'adv_title' => '广告一',
|
||||
'adv_url' => '',
|
||||
'adv_image' => 'public/static/img/pc/gg_pc_index_carousel_1.png',
|
||||
'background' => '#e7171f'
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'ap_name' => 'PC端首页顶部',
|
||||
'keyword' => 'NS_PC_INDEX_TOP',
|
||||
'ap_intro' => '',
|
||||
'ap_width' => '1210',
|
||||
'ap_height' => '70',
|
||||
'default_content' => '',
|
||||
'ap_background_color' => '#FFFFFF',
|
||||
'type' => 1,
|
||||
'adv' => [
|
||||
[
|
||||
'adv_title' => '广告一',
|
||||
'adv_url' => '',
|
||||
'adv_image' => 'public/static/img/pc/gg_pc_index_top_carousel_1.png',
|
||||
'background' => '#FF5726'
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'ap_name' => 'PC端首页中部左侧',
|
||||
'keyword' => 'NS_PC_INDEX_MID_LEFT',
|
||||
'ap_intro' => '',
|
||||
'ap_width' => '291',
|
||||
'ap_height' => '372',
|
||||
'default_content' => '',
|
||||
'ap_background_color' => '#FFFFFF',
|
||||
'type' => 1,
|
||||
'adv' => [
|
||||
[
|
||||
'adv_title' => '广告一',
|
||||
'adv_url' => '',
|
||||
'adv_image' => 'public/static/img/pc/gg_pc_index_mid_left_1.png',
|
||||
'background' => '#FFFFFF'
|
||||
],
|
||||
[
|
||||
'adv_title' => '广告二',
|
||||
'adv_url' => '',
|
||||
'adv_image' => 'public/static/img/pc/gg_pc_index_mid_left_2.png',
|
||||
'background' => '#FFFFFF'
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'ap_name' => 'PC端首页中部右侧',
|
||||
'keyword' => 'NS_PC_INDEX_MID_RIGHT',
|
||||
'ap_intro' => '',
|
||||
'ap_width' => '291',
|
||||
'ap_height' => '180',
|
||||
'default_content' => '',
|
||||
'ap_background_color' => '#FFFFFF',
|
||||
'type' => 1,
|
||||
'adv' => [
|
||||
[
|
||||
'adv_title' => '广告一',
|
||||
'adv_url' => '',
|
||||
'adv_image' => 'public/static/img/pc/gg_pc_index_mid_right_1.png',
|
||||
'background' => '#FFFFFF'
|
||||
],
|
||||
[
|
||||
'adv_title' => '广告二',
|
||||
'adv_url' => '',
|
||||
'adv_image' => 'public/static/img/pc/gg_pc_index_mid_right_2.png',
|
||||
'background' => '#FFFFFF'
|
||||
],
|
||||
[
|
||||
'adv_title' => '广告三',
|
||||
'adv_url' => '',
|
||||
'adv_image' => 'public/static/img/pc/gg_pc_index_mid_right_3.png',
|
||||
'background' => '#FFFFFF'
|
||||
],
|
||||
[
|
||||
'adv_title' => '广告四',
|
||||
'adv_url' => '',
|
||||
'adv_image' => 'public/static/img/pc/gg_pc_index_mid_right_4.png',
|
||||
'background' => '#FFFFFF'
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'ap_name' => 'PC端首页分类下方',
|
||||
'keyword' => 'NS_PC_INDEX_CATEGORY_BELOW',
|
||||
'ap_intro' => '',
|
||||
'ap_width' => '210',
|
||||
'ap_height' => '1200',
|
||||
'default_content' => '',
|
||||
'ap_background_color' => '#FFFFFF',
|
||||
'type' => 1,
|
||||
'adv' => [
|
||||
]
|
||||
],
|
||||
[
|
||||
'ap_name' => 'PC端品牌专区',
|
||||
'keyword' => 'NS_PC_BRAND',
|
||||
'ap_intro' => '',
|
||||
'ap_width' => '1200',
|
||||
'ap_height' => '440',
|
||||
'default_content' => '',
|
||||
'ap_background_color' => '#FFFFFF',
|
||||
'type' => 1,
|
||||
'adv' => [
|
||||
[
|
||||
'adv_title' => '广告一',
|
||||
'adv_url' => '',
|
||||
'adv_image' => 'public/static/img/pc/gg_pc_brand_carousel_1.png',
|
||||
'background' => '#FFFFFF'
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'ap_name' => 'PC端领券中心',
|
||||
'keyword' => 'NS_PC_COUPON',
|
||||
'ap_intro' => '',
|
||||
'ap_width' => '810',
|
||||
'ap_height' => '406',
|
||||
'default_content' => '',
|
||||
'ap_background_color' => '#FFFFFF',
|
||||
'type' => 1,
|
||||
'adv' => [
|
||||
[
|
||||
'adv_title' => '广告一',
|
||||
'adv_url' => '',
|
||||
'adv_image' => 'public/static/img/pc/gg_pc_coupon_carousel_1.png',
|
||||
'background' => '#FFFFFF'
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'ap_name' => 'PC端团购专区',
|
||||
'keyword' => 'NS_PC_GROUPBUY',
|
||||
'ap_intro' => '',
|
||||
'ap_width' => '1200',
|
||||
'ap_height' => '440',
|
||||
'default_content' => '',
|
||||
'ap_background_color' => '#FFFFFF',
|
||||
'type' => 1,
|
||||
'adv' => [
|
||||
[
|
||||
'adv_title' => '广告一',
|
||||
'adv_url' => '',
|
||||
'adv_image' => 'public/static/img/pc/gg_pc_groupbuy_carousel_1.png',
|
||||
'background' => '#FFFFFF'
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'ap_name' => 'PC端秒杀专区',
|
||||
'keyword' => 'NS_PC_SECKILL',
|
||||
'ap_intro' => '',
|
||||
'ap_width' => '1200',
|
||||
'ap_height' => '440',
|
||||
'default_content' => '',
|
||||
'ap_background_color' => '#FFFFFF',
|
||||
'type' => 1,
|
||||
'adv' => [
|
||||
[
|
||||
'adv_title' => '广告一',
|
||||
'adv_url' => '',
|
||||
'adv_image' => 'public/static/img/pc/gg_pc_seckill_carousel_1.png',
|
||||
'background' => '#FFFFFF'
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'ap_name' => 'PC端登录',
|
||||
'keyword' => 'NS_PC_LOGIN',
|
||||
'ap_intro' => '',
|
||||
'ap_width' => '800',
|
||||
'ap_height' => '460',
|
||||
'default_content' => '',
|
||||
'ap_background_color' => '#FFFFFF',
|
||||
'type' => 1,
|
||||
'adv' => [
|
||||
[
|
||||
'adv_title' => '广告一',
|
||||
'adv_url' => '',
|
||||
'adv_image' => 'public/static/img/pc/gg_pc_login_carousel_1.png',
|
||||
'background' => '#F53E45'
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
public function handle($param)
|
||||
{
|
||||
if (!empty($param[ 'site_id' ])) {
|
||||
$adv_position_model = new AdvPosition();
|
||||
$adv_model = new Adv();
|
||||
|
||||
foreach ($this->adv_data as $k => $v) {
|
||||
$v[ 'site_id' ] = $param[ 'site_id' ];
|
||||
$v[ 'is_system' ] = 1;
|
||||
$adv_data = $v[ 'adv' ];
|
||||
unset($v[ 'adv' ]);
|
||||
$res_adv_position = $adv_position_model->addAdvPosition($v);
|
||||
$ap_id = $res_adv_position[ 'data' ];
|
||||
if (!empty($ap_id) && !empty($adv_data)) {
|
||||
foreach ($adv_data as $ck => $cv) {
|
||||
$cv[ 'site_id' ] = $param[ 'site_id' ];
|
||||
$cv[ 'ap_id' ] = $ap_id;
|
||||
$adv_model->addAdv($cv);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
32
app/event/addsite/AddSiteConfig.php
Executable file
32
app/event/addsite/AddSiteConfig.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\addsite;
|
||||
|
||||
use app\model\goods\Config;
|
||||
|
||||
/**
|
||||
* 增加默认配置项
|
||||
*/
|
||||
class AddSiteConfig
|
||||
{
|
||||
|
||||
public function handle($param)
|
||||
{
|
||||
if (!empty($param[ 'site_id' ])) {
|
||||
$document_model = new Config();
|
||||
$content = '<p style="white-space: normal;"><span style="color: rgb(255, 0, 0);"><strong>权利声明:</strong></span><br/>商城上的所有商品信息、客户评价、商品咨询、网友讨论等内容,是商城重要的经营资源,未经许可,禁止非法转载使用。</p><p style="white-space: normal;"><span style="color: rgb(63, 63, 63);"><strong>注:</strong></span>本站商品信息均来自于合作方,其真实性、准确性和合法性由信息拥有者(合作方)负责。本站不提供任何保证,并不承担任何法律责任。</p><p style="white-space: normal;"><br/><span style="color: rgb(255, 0, 0);"><strong>价格说明:</strong></span><br/></p><p style="white-space: normal;"><span style="color: rgb(63, 63, 63);"><strong>价格:</strong></span>价格为商品的销售价,是您最终决定是否购买商品的依据。</p><p style="white-space: normal;"><span style="color: rgb(63, 63, 63);"><strong>划线价:</strong></span>商品展示的划横线价格为参考价,该价格可能是品牌专柜标价、商品吊牌价或由品牌供应商提供的正品零售价(如厂商指导价、建议零售价等)或该商品在商城平台上曾经展示过的销售价;由于地区、时间的差异性和市场行情波动,品牌专柜标价、商品吊牌价等可能会与您购物时展示的不一致,该价格仅供您参考。</p><p style="white-space: normal;"><span style="color: rgb(63, 63, 63);"><strong>折扣:</strong></span>如无特殊说明,折扣指销售商在原价、或划线价(如品牌专柜标价、商品吊牌价、厂商指导价、厂商建议零售价)等某一价格基础上计算出的优惠比例或优惠金额;如有疑问,您可在购买前联系销售商进行咨询。</p><p style="white-space: normal;"><span style="color: rgb(63, 63, 63);"><strong>异常问题:</strong></span>商品促销信息以商品详情页“促销”栏中的信息为准;商品的具体售价以订单结算页价格为准;如您发现活动商品售价或促销信息有异常,建议购买前先联系销售商咨询。</p>';
|
||||
$res = $document_model->setAfterSaleConfig('售后保障协议', $content, $param[ 'site_id' ]);
|
||||
return $res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
32
app/event/addsite/AddSiteDelivery.php
Executable file
32
app/event/addsite/AddSiteDelivery.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\addsite;
|
||||
|
||||
use app\model\express\Config as ConfigModel;
|
||||
|
||||
/**
|
||||
* 增加默认配送管理数据
|
||||
*/
|
||||
class AddSiteDelivery
|
||||
{
|
||||
|
||||
public function handle($param)
|
||||
{
|
||||
if (!empty($param[ 'site_id' ])) {
|
||||
|
||||
$config_model = new ConfigModel();
|
||||
$data = array ();
|
||||
$res = $config_model->setExpressConfig($data, 1, $param[ 'site_id' ]);
|
||||
return $res;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
37
app/event/addsite/AddSiteDiyView.php
Executable file
37
app/event/addsite/AddSiteDiyView.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\addsite;
|
||||
|
||||
use app\model\diy\Template;
|
||||
|
||||
/**
|
||||
* 增加默认自定义数据:网站主页、商品分类、底部导航
|
||||
*/
|
||||
class AddSiteDiyView
|
||||
{
|
||||
|
||||
public function handle($param)
|
||||
{
|
||||
if (!empty($param[ 'site_id' ])) {
|
||||
$diy_template = new Template();
|
||||
// 查询一条模板组
|
||||
$template_goods_info = $diy_template->getFirstTemplateGoods([], 'goods_id', 'goods_id asc')[ 'data' ];
|
||||
if (!empty($template_goods_info)) {
|
||||
$res = $diy_template->useTemplate([
|
||||
'site_id' => $param[ 'site_id' ],
|
||||
'goods_id' => $template_goods_info[ 'goods_id' ],
|
||||
]);
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
202
app/event/addsite/AddSiteExpressCompany.php
Executable file
202
app/event/addsite/AddSiteExpressCompany.php
Executable file
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\addsite;
|
||||
|
||||
use app\model\express\ExpressCompany;
|
||||
use app\model\express\ExpressCompanyTemplate;
|
||||
|
||||
/**
|
||||
* 增加默认物流公司数据:
|
||||
*/
|
||||
class AddSiteExpressCompany
|
||||
{
|
||||
public function handle($param)
|
||||
{
|
||||
if (!empty($param[ 'site_id' ])) {
|
||||
$template_model = new ExpressCompanyTemplate();
|
||||
$express_company_model = new ExpressCompany();
|
||||
|
||||
$template_data = [
|
||||
[
|
||||
'company_name' => '顺丰速运',
|
||||
'sort' => 1,
|
||||
'logo' => 'public/static/img/express/shunfeng.png',
|
||||
'url' => 'http://www.sf-express.com',
|
||||
'express_no' => 'SF',
|
||||
'express_no_kd100' => 'shunfeng',
|
||||
'express_no_cainiao' => 'SF',
|
||||
'content_json' => '[]',
|
||||
'background_image' => '',
|
||||
'font_size' => 14,
|
||||
'width' => 766,
|
||||
'height' => 510,
|
||||
'scale' => 1.00,
|
||||
'create_time' => time(),
|
||||
'is_electronicsheet' => 1,
|
||||
'print_style' => '[{"template_name":"二联 150 新","template_size":"15001"},{"template_name":"二联 180 新","template_size":"180"},{"template_name":"三联 210 新","template_size":"21001"}]'
|
||||
],
|
||||
[
|
||||
'company_name' => '韵达速递',
|
||||
'sort' => 2,
|
||||
'logo' => 'public/static/img/express/yunda.png',
|
||||
'url' => 'http://www.yundaex.com',
|
||||
'express_no' => 'YD',
|
||||
'express_no_kd100' => '',
|
||||
'express_no_cainiao' => '',
|
||||
'content_json' => '[]',
|
||||
'background_image' => '',
|
||||
'font_size' => 14,
|
||||
'width' => 766,
|
||||
'height' => 510,
|
||||
'scale' => 1.00,
|
||||
'create_time' => time(),
|
||||
'is_electronicsheet' => 0,
|
||||
'print_style' => ''
|
||||
],
|
||||
[
|
||||
'company_name' => '百世快递',
|
||||
'sort' => 3,
|
||||
'logo' => 'public/static/img/express/huitongkuaidi.png',
|
||||
'url' => 'http://www.800bestex.com/',
|
||||
'express_no' => 'HTKY',
|
||||
'express_no_kd100' => '',
|
||||
'express_no_cainiao' => '',
|
||||
'content_json' => '',
|
||||
'background_image' => '',
|
||||
'font_size' => 14,
|
||||
'width' => 766,
|
||||
'height' => 510,
|
||||
'scale' => 1.00,
|
||||
'create_time' => time(),
|
||||
'is_electronicsheet' => 0,
|
||||
'print_style' => ''
|
||||
],
|
||||
[
|
||||
'company_name' => '圆通速递',
|
||||
'sort' => 4,
|
||||
'logo' => 'public/static/img/express/yuantong.png',
|
||||
'url' => 'http://www.yto.net.cn/',
|
||||
'express_no' => 'YTO',
|
||||
'express_no_kd100' => '',
|
||||
'express_no_cainiao' => '',
|
||||
'content_json' => '',
|
||||
'background_image' => '',
|
||||
'font_size' => 14,
|
||||
'width' => 766,
|
||||
'height' => 510,
|
||||
'scale' => 1.00,
|
||||
'create_time' => time(),
|
||||
'is_electronicsheet' => 0,
|
||||
'print_style' => ''
|
||||
],
|
||||
[
|
||||
'company_name' => '中通快递',
|
||||
'sort' => 5,
|
||||
'logo' => 'public/static/img/express/zhongtong.png',
|
||||
'url' => 'https://www.zto.com/',
|
||||
'express_no' => 'ZTO',
|
||||
'express_no_kd100' => '',
|
||||
'express_no_cainiao' => '',
|
||||
'content_json' => '',
|
||||
'background_image' => '',
|
||||
'font_size' => 14,
|
||||
'width' => 766,
|
||||
'height' => 510,
|
||||
'scale' => 1.00,
|
||||
'create_time' => time(),
|
||||
'is_electronicsheet' => 0,
|
||||
'print_style' => ''
|
||||
],
|
||||
[
|
||||
'company_name' => '申通快递',
|
||||
'sort' => 6,
|
||||
'logo' => 'public/static/img/express/shentong.png',
|
||||
'url' => 'http://www.sto.cn/',
|
||||
'express_no' => 'STO',
|
||||
'express_no_kd100' => '',
|
||||
'express_no_cainiao' => '',
|
||||
'content_json' => '',
|
||||
'background_image' => '',
|
||||
'font_size' => 14,
|
||||
'width' => 766,
|
||||
'height' => 510,
|
||||
'scale' => 1.00,
|
||||
'create_time' => time(),
|
||||
'is_electronicsheet' => 0,
|
||||
'print_style' => ''
|
||||
],
|
||||
[
|
||||
'company_name' => '邮政国内标快',
|
||||
'sort' => 7,
|
||||
'logo' => 'public/static/img/express/youzhengguonei.png',
|
||||
'url' => 'http://yjcx.chinapost.com.cn/qps/yjcx',
|
||||
'express_no' => 'YZBK',
|
||||
'express_no_kd100' => '',
|
||||
'express_no_cainiao' => '',
|
||||
'content_json' => '',
|
||||
'background_image' => '',
|
||||
'font_size' => 14,
|
||||
'width' => 766,
|
||||
'height' => 510,
|
||||
'scale' => 1.00,
|
||||
'create_time' => time(),
|
||||
'is_electronicsheet' => 1,
|
||||
'print_style' => '[{"template_name":"二联 150","template_size":""}]'
|
||||
],
|
||||
[
|
||||
'company_name' => '邮政快递包裹',
|
||||
'sort' => 8,
|
||||
'logo' => 'public/static/img/express/youzhengkd.png',
|
||||
'url' => 'http://yjcx.chinapost.com.cn/qps/yjcx',
|
||||
'express_no' => 'YZPY',
|
||||
'express_no_kd100' => '',
|
||||
'express_no_cainiao' => '',
|
||||
'content_json' => '',
|
||||
'background_image' => '',
|
||||
'font_size' => 14,
|
||||
'width' => 766,
|
||||
'height' => 510,
|
||||
'scale' => 1.00,
|
||||
'create_time' => time(),
|
||||
'is_electronicsheet' => 1,
|
||||
'print_style' => '[{"template_name":"二联 180","template_size":""},{"template_name":"二联 180 新","template_size":"180"}]'
|
||||
],
|
||||
// [
|
||||
// 'company_name' => '天天快递',
|
||||
// 'sort' => 9,
|
||||
// 'logo' => 'public/static/img/express/tiantian.png',
|
||||
// 'url' => 'https://www.ttkdex.com/',
|
||||
// 'express_no' => '',
|
||||
// 'express_no_kd100' => '',
|
||||
// 'express_no_cainiao' => '',
|
||||
// 'content_json' => '',
|
||||
// 'background_image' => '',
|
||||
// 'font_size' => 14,
|
||||
// 'width' => 766,
|
||||
// 'height' => 510,
|
||||
// 'scale' => 1.00,
|
||||
// 'create_time' => time(),
|
||||
// 'is_electronicsheet' => 0,
|
||||
// 'print_style' => ''
|
||||
// ]
|
||||
];
|
||||
|
||||
foreach ($template_data as $item) {
|
||||
$item[ 'site_id' ] = $param[ 'site_id' ];
|
||||
$res = $template_model->addExpressCompanyTemplate($item);
|
||||
if ($res[ 'code' ] >= 0) {
|
||||
$express_company_model->addExpressCompany([ 'site_id' => $param[ 'site_id' ], 'company_id' => $res[ 'data' ] ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
1100
app/event/addsite/AddStoreDiyView.php
Executable file
1100
app/event/addsite/AddStoreDiyView.php
Executable file
File diff suppressed because it is too large
Load Diff
370
app/event/addsite/AddYanshiData.php
Executable file
370
app/event/addsite/AddYanshiData.php
Executable file
@@ -0,0 +1,370 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\addsite;
|
||||
|
||||
use app\model\goods\Goods as GoodsModel;
|
||||
use app\model\goods\GoodsCategory as GoodsCategoryModel;
|
||||
use app\model\goods\GoodsService as GoodsServiceModel;
|
||||
|
||||
/**
|
||||
* 增加默认商品相关数据:商品1~3个、商品分类、商品服务
|
||||
*/
|
||||
class AddYanshiData
|
||||
{
|
||||
|
||||
public function handle($param)
|
||||
{
|
||||
if (!empty($param[ 'site_id' ])) {
|
||||
|
||||
// 商品服务
|
||||
$goods_service_data = [
|
||||
[
|
||||
'site_id' => $param[ 'site_id' ],
|
||||
'service_name' => '7天无理由退货',
|
||||
'desc' => '支持7天无理由退货(拆封后不支持)',
|
||||
'icon' => '{"imageUrl":"","icon":"icondiy icon-system-7days-return","iconType":"icon","style":{"fontSize":100,"iconBgColor":[],"iconBgColorDeg":0,"iconBgImg":"","bgRadius":0,"iconColor":["#888888","#888888"],"iconColorDeg":125}}'
|
||||
],
|
||||
[
|
||||
'site_id' => $param[ 'site_id' ],
|
||||
'service_name' => '闪电退款',
|
||||
'desc' => '闪电退款为会员提供的快速退款服务',
|
||||
'icon' => '{"imageUrl":"","icon":"icondiy icon-system-lightning-refund","iconType":"icon","style":{"fontSize":100,"iconBgColor":[],"iconBgColorDeg":0,"iconBgImg":"","bgRadius":0,"iconColor":["#888888","#888888"],"iconColorDeg":125}}'
|
||||
],
|
||||
[
|
||||
'site_id' => $param[ 'site_id' ],
|
||||
'service_name' => '货到付款',
|
||||
'desc' => '支持送货上门后再收款,支持现金、POS机刷卡等方式',
|
||||
'icon' => '{"imageUrl":"","icon":"icondiy icon-system-cash-delivery","iconType":"icon","style":{"fontSize":100,"iconBgColor":[],"iconBgColorDeg":0,"iconBgImg":"","bgRadius":0,"iconColor":["#888888","#888888"],"iconColorDeg":125}}'
|
||||
],
|
||||
[
|
||||
'site_id' => $param[ 'site_id' ],
|
||||
'service_name' => '运费险',
|
||||
'desc' => '卖家为您购买的商品投保退货运费险(保单生效以确认订单页展示的运费险为准)',
|
||||
'icon' => '{"imageUrl":"","icon":"icondiy icon-system-freight","iconType":"icon","style":{"fontSize":100,"iconBgColor":[],"iconBgColorDeg":0,"iconBgImg":"","bgRadius":0,"iconColor":["#888888","#888888"],"iconColorDeg":125}}'
|
||||
],
|
||||
[
|
||||
'site_id' => $param[ 'site_id' ],
|
||||
'service_name' => '公益宝贝',
|
||||
'desc' => '购买该商品,每笔成交都会有相应金额捐赠给公益。感谢您的支持,愿公益的快乐伴随您每一天',
|
||||
'icon' => '{"imageUrl":"","icon":"icondiy icon-system-gongyi","iconType":"icon","style":{"fontSize":87,"iconBgColor":[],"iconBgColorDeg":0,"iconBgImg":"","bgRadius":0,"iconColor":["#888888","#888888"],"iconColorDeg":125}}'
|
||||
]
|
||||
];
|
||||
$model = new GoodsServiceModel();
|
||||
$model->addServiceList($goods_service_data);
|
||||
|
||||
// 商品分类
|
||||
$goods_category_model = new GoodsCategoryModel();
|
||||
|
||||
$category_data = [
|
||||
[
|
||||
'site_id' => $param[ 'site_id' ],
|
||||
'category_name' => '分类一',
|
||||
'level' => 1,
|
||||
'is_show' => 0,
|
||||
'category_full_name' => '分类一'
|
||||
],
|
||||
[
|
||||
'site_id' => $param[ 'site_id' ],
|
||||
'category_name' => '分类二',
|
||||
'level' => 1,
|
||||
'is_show' => 0,
|
||||
'category_full_name' => '分类二'
|
||||
],
|
||||
[
|
||||
'site_id' => $param[ 'site_id' ],
|
||||
'category_name' => '分类三',
|
||||
'level' => 1,
|
||||
'is_show' => 0,
|
||||
'category_full_name' => '分类三'
|
||||
],
|
||||
];
|
||||
|
||||
$category_ids = [];
|
||||
foreach ($category_data as $ck => $cv) {
|
||||
$category_res = $goods_category_model->addCategory($cv);
|
||||
|
||||
if (!empty($category_res[ 'data' ])) {
|
||||
|
||||
//修改category_id_
|
||||
$update_data = [
|
||||
'category_id' => $category_res[ 'data' ],
|
||||
'category_id_1' => $category_res[ 'data' ],
|
||||
'site_id' => $param[ 'site_id' ]
|
||||
];
|
||||
$goods_category_model->editCategory($update_data);
|
||||
$category_ids[] = $category_res[ 'data' ];
|
||||
}
|
||||
}
|
||||
|
||||
// 商品
|
||||
$goods_data = [
|
||||
[
|
||||
"goods_name" => '演示商品一',
|
||||
"goods_attr_class" => "",
|
||||
"goods_attr_name" => "",
|
||||
"site_id" => $param[ 'site_id' ],
|
||||
"category_id" => "," . $category_ids[ 0 ] . ",",
|
||||
"category_json" => '[" ' . $category_ids[ 0 ] . '"]',
|
||||
"goods_image" => "public/static/img/default_img/square.png",
|
||||
"goods_content" => "<p>演示商品一</p>",
|
||||
"goods_state" => "1",
|
||||
"price" => "0.01",
|
||||
"market_price" => "",
|
||||
"cost_price" => "",
|
||||
"sku_no" => "",
|
||||
"weight" => "",
|
||||
"volume" => "",
|
||||
"goods_stock" => "100",
|
||||
"goods_stock_alarm" => "",
|
||||
"is_free_shipping" => "1",
|
||||
"shipping_template" => "",
|
||||
"goods_spec_format" => "",
|
||||
"goods_attr_format" => "",
|
||||
"introduction" => "",
|
||||
"keywords" => "",
|
||||
"unit" => "",
|
||||
"sort" => "",
|
||||
"video_url" => "",
|
||||
"goods_sku_data" => json_encode([ [
|
||||
"sku_id" => 0,
|
||||
'sku_name' => '演示商品一',
|
||||
"spec_name" => "",
|
||||
"sku_no" => "",
|
||||
"sku_spec_format" => "",
|
||||
"price" => "0.01",
|
||||
"market_price" => "",
|
||||
"cost_price" => "",
|
||||
"stock" => "100",
|
||||
"weight" => "",
|
||||
"volume" => "",
|
||||
"sku_image" => "public/static/img/default_img/square.png",
|
||||
"sku_images" => "public/static/img/default_img/square.png",
|
||||
"virtual_sale" => 0,
|
||||
"max_buy" => 0,
|
||||
"min_buy" => 0,
|
||||
"stock_alarm" => 0
|
||||
] ]),
|
||||
"goods_service_ids" => "",
|
||||
"label_id" => "",
|
||||
"brand_id" => 0,
|
||||
"virtual_sale" => 0,
|
||||
"max_buy" => 0,
|
||||
"min_buy" => 0,
|
||||
"recommend_way" => 0,
|
||||
"timer_on" => 0,
|
||||
"timer_off" => 0,
|
||||
"is_consume_discount" => 0,
|
||||
"sale_show" => 1,
|
||||
"stock_show" => 1,
|
||||
"market_price_show" => 1,
|
||||
"barrage_show" => 1,
|
||||
'support_trade_type' => 'express'
|
||||
],
|
||||
[
|
||||
"goods_name" => '演示商品二',
|
||||
"goods_attr_class" => "",
|
||||
"goods_attr_name" => "",
|
||||
"site_id" => $param[ 'site_id' ],
|
||||
"category_id" => "," . $category_ids[ 1 ] . ",",
|
||||
"category_json" => '[" ' . $category_ids[ 1 ] . '"]',
|
||||
"goods_image" => "public/static/img/default_img/square.png",
|
||||
"goods_content" => "<p>演示商品二</p>",
|
||||
"goods_state" => "1",
|
||||
"price" => "0.01",
|
||||
"market_price" => "",
|
||||
"cost_price" => "",
|
||||
"sku_no" => "",
|
||||
"weight" => "",
|
||||
"volume" => "",
|
||||
"goods_stock" => "100",
|
||||
"goods_stock_alarm" => "",
|
||||
"is_free_shipping" => "1",
|
||||
"shipping_template" => "",
|
||||
"goods_spec_format" => "",
|
||||
"goods_attr_format" => "",
|
||||
"introduction" => "",
|
||||
"keywords" => "",
|
||||
"unit" => "",
|
||||
"sort" => "",
|
||||
"video_url" => "",
|
||||
"goods_sku_data" => json_encode([ [
|
||||
"sku_id" => 0,
|
||||
'sku_name' => '演示商品二',
|
||||
"spec_name" => "",
|
||||
"sku_no" => "",
|
||||
"sku_spec_format" => "",
|
||||
"price" => "0.01",
|
||||
"market_price" => "",
|
||||
"cost_price" => "",
|
||||
"stock" => "100",
|
||||
"weight" => "",
|
||||
"volume" => "",
|
||||
"sku_image" => "public/static/img/default_img/square.png",
|
||||
"sku_images" => "public/static/img/default_img/square.png",
|
||||
"virtual_sale" => 0,
|
||||
"max_buy" => 0,
|
||||
"min_buy" => 0,
|
||||
"stock_alarm" => 0
|
||||
] ]),
|
||||
"goods_service_ids" => "",
|
||||
"label_id" => "",
|
||||
"brand_id" => 0,
|
||||
"virtual_sale" => 0,
|
||||
"max_buy" => 0,
|
||||
"min_buy" => 0,
|
||||
"recommend_way" => 0,
|
||||
"timer_on" => 0,
|
||||
"timer_off" => 0,
|
||||
"is_consume_discount" => 0,
|
||||
"sale_show" => 1,
|
||||
"stock_show" => 1,
|
||||
"market_price_show" => 1,
|
||||
"barrage_show" => 1,
|
||||
'support_trade_type' => 'express'
|
||||
],
|
||||
[
|
||||
"goods_name" => '演示商品三',
|
||||
"goods_attr_class" => "",
|
||||
"goods_attr_name" => "",
|
||||
"site_id" => $param[ 'site_id' ],
|
||||
"category_id" => "," . $category_ids[ 2 ] . ",",
|
||||
"category_json" => '[" ' . $category_ids[ 2 ] . '"]',
|
||||
"goods_image" => "public/static/img/default_img/square.png",
|
||||
"goods_content" => "<p>演示商品三</p>",
|
||||
"goods_state" => "1",
|
||||
"price" => "0.01",
|
||||
"market_price" => "",
|
||||
"cost_price" => "",
|
||||
"sku_no" => "",
|
||||
"weight" => "",
|
||||
"volume" => "",
|
||||
"goods_stock" => "100",
|
||||
"goods_stock_alarm" => "",
|
||||
"is_free_shipping" => "1",
|
||||
"shipping_template" => "",
|
||||
"goods_spec_format" => "",
|
||||
"goods_attr_format" => "",
|
||||
"introduction" => "",
|
||||
"keywords" => "",
|
||||
"unit" => "",
|
||||
"sort" => "",
|
||||
"video_url" => "",
|
||||
"goods_sku_data" => json_encode([ [
|
||||
"sku_id" => 0,
|
||||
'sku_name' => '演示商品三',
|
||||
"spec_name" => "",
|
||||
"sku_no" => "",
|
||||
"sku_spec_format" => "",
|
||||
"price" => "0.01",
|
||||
"market_price" => "",
|
||||
"cost_price" => "",
|
||||
"stock" => "100",
|
||||
"weight" => "",
|
||||
"volume" => "",
|
||||
"sku_image" => "public/static/img/default_img/square.png",
|
||||
"sku_images" => "public/static/img/default_img/square.png",
|
||||
"virtual_sale" => 0,
|
||||
"max_buy" => 0,
|
||||
"min_buy" => 0,
|
||||
"stock_alarm" => 0
|
||||
] ]),
|
||||
"goods_service_ids" => "",
|
||||
"label_id" => "",
|
||||
"brand_id" => 0,
|
||||
"virtual_sale" => 0,
|
||||
"max_buy" => 0,
|
||||
"min_buy" => 0,
|
||||
"recommend_way" => 0,
|
||||
"timer_on" => 0,
|
||||
"timer_off" => 0,
|
||||
"is_consume_discount" => 0,
|
||||
"sale_show" => 1,
|
||||
"stock_show" => 1,
|
||||
"market_price_show" => 1,
|
||||
"barrage_show" => 1,
|
||||
'support_trade_type' => 'express'
|
||||
],
|
||||
[
|
||||
'goods_name' => '演示商品四',
|
||||
"goods_attr_class" => "",
|
||||
"goods_attr_name" => "",
|
||||
"site_id" => $param[ 'site_id' ],
|
||||
"category_id" => "," . $category_ids[ 2 ] . ",",
|
||||
"category_json" => '[" ' . $category_ids[ 2 ] . '"]',
|
||||
"goods_image" => "public/static/img/default_img/square.png",
|
||||
"goods_content" => "<p>演示商品四</p>",
|
||||
"goods_state" => "1",
|
||||
"price" => "0.01",
|
||||
"market_price" => "",
|
||||
"cost_price" => "",
|
||||
"sku_no" => "",
|
||||
"weight" => "",
|
||||
"volume" => "",
|
||||
"goods_stock" => "100",
|
||||
"goods_stock_alarm" => "",
|
||||
"is_free_shipping" => "1",
|
||||
"shipping_template" => "",
|
||||
"goods_spec_format" => "",
|
||||
"goods_attr_format" => "",
|
||||
"introduction" => "",
|
||||
"keywords" => "",
|
||||
"unit" => "",
|
||||
"sort" => "",
|
||||
"video_url" => "",
|
||||
"goods_sku_data" => json_encode([ [
|
||||
"sku_id" => 0,
|
||||
'sku_name' => '演示商品四',
|
||||
"spec_name" => "",
|
||||
"sku_no" => "",
|
||||
"sku_spec_format" => "",
|
||||
"price" => "0.01",
|
||||
"market_price" => "",
|
||||
"cost_price" => "",
|
||||
"stock" => "100",
|
||||
"weight" => "",
|
||||
"volume" => "",
|
||||
"sku_image" => "public/static/img/default_img/square.png",
|
||||
"sku_images" => "public/static/img/default_img/square.png",
|
||||
"virtual_sale" => 0,
|
||||
"max_buy" => 0,
|
||||
"min_buy" => 0,
|
||||
"stock_alarm" => 0
|
||||
] ]),
|
||||
"goods_service_ids" => "",
|
||||
"label_id" => "",
|
||||
"brand_id" => 0,
|
||||
"virtual_sale" => 0,
|
||||
"max_buy" => 0,
|
||||
"min_buy" => 0,
|
||||
"recommend_way" => 0,
|
||||
"timer_on" => 0,
|
||||
"timer_off" => 0,
|
||||
"is_consume_discount" => 0,
|
||||
"sale_show" => 1,
|
||||
"stock_show" => 1,
|
||||
"market_price_show" => 1,
|
||||
"barrage_show" => 1,
|
||||
'support_trade_type' => 'express'
|
||||
]
|
||||
];
|
||||
|
||||
$goods_model = new GoodsModel();
|
||||
foreach ($goods_data as $gk => $gv) {
|
||||
$res = $goods_model->addGoods($gv);
|
||||
}
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
197
app/event/diy/DiyViewEdit.php
Executable file
197
app/event/diy/DiyViewEdit.php
Executable file
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\diy;
|
||||
|
||||
use app\Controller;
|
||||
use app\model\diy\Template;
|
||||
use app\model\web\DiyView as DiyViewModel;
|
||||
|
||||
/**
|
||||
* 自定义页面编辑
|
||||
*/
|
||||
class DiyViewEdit extends Controller
|
||||
{
|
||||
/**
|
||||
* 行为扩展的执行入口必须是run
|
||||
* @param $data
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($data)
|
||||
{
|
||||
|
||||
$diy_view = new DiyViewModel();
|
||||
$diy_template = new Template();
|
||||
|
||||
if (empty($data[ 'is_default' ])) {
|
||||
$data[ 'is_default' ] = 1;
|
||||
}
|
||||
|
||||
$template_id = $data[ 'template_id' ] ?? 0; // 所属模板id
|
||||
$title = $data[ 'title' ] ?? ''; // 页面名称
|
||||
|
||||
// 页面类型
|
||||
if (!empty($data[ 'page_type' ])) {
|
||||
$name = $data[ 'page_type' ];
|
||||
} else {
|
||||
$name = 'DIY_VIEW_RANDOM_' . time();
|
||||
}
|
||||
|
||||
if (!empty($data[ 'id' ]) || !empty($data[ 'name' ])) {
|
||||
$diy_view_condition = [
|
||||
[ 'site_id', '=', $data[ 'site_id' ] ],
|
||||
];
|
||||
|
||||
if (!empty($data[ 'id' ])) {
|
||||
$diy_view_condition[] = [ 'id', '=', $data[ 'id' ] ];
|
||||
} elseif (!empty($data[ 'name' ])) {
|
||||
$diy_view_condition[] = [ 'name', '=', $data[ 'name' ] ];
|
||||
$name = $data[ 'name' ];
|
||||
|
||||
// 查询模板页面类型
|
||||
$diy_template_info = $diy_template->getTemplateInfo([ [ 'name', '=', $name ] ], 'name')[ 'data' ];
|
||||
if (!empty($diy_template_info)) {
|
||||
$diy_view_condition[] = [ 'is_default', '=', 1 ];
|
||||
}
|
||||
}
|
||||
|
||||
$diy_view_info = $diy_view->getSiteDiyViewDetail($diy_view_condition)[ 'data' ];
|
||||
if (!empty($diy_view_info)) {
|
||||
$name = $diy_view_info[ 'name' ];
|
||||
$template_id = $diy_view_info[ 'template_id' ];
|
||||
}
|
||||
$this->assign("diy_view_info", $diy_view_info);
|
||||
}
|
||||
|
||||
// 查询模板页面类型
|
||||
$diy_template_info = $diy_template->getTemplateInfo([ [ 'name', '=', $name ] ], 'title,name,rule')[ 'data' ];
|
||||
|
||||
$diy_view_utils = [];
|
||||
$extend_comp = []; // 第三方扩展的特定页面组件
|
||||
|
||||
$util_condition = [];
|
||||
|
||||
if (!empty($diy_template_info)) {
|
||||
$diy_template_info[ 'rule' ] = json_decode($diy_template_info[ 'rule' ], true);
|
||||
|
||||
// 支持的自定义页面(为空表示公共组件都支持)
|
||||
if (!empty($diy_template_info[ 'rule' ][ 'support' ])) {
|
||||
$util_condition[] = [ 'support_diy_view', 'in', $diy_template_info[ 'rule' ][ 'support' ], 'or' ];
|
||||
}
|
||||
|
||||
// 组件类型
|
||||
if (!empty($diy_template_info[ 'rule' ][ 'util_type' ])) {
|
||||
$util_condition[] = [ 'type', 'in', $diy_template_info[ 'rule' ][ 'util_type' ] ];
|
||||
}
|
||||
|
||||
$diy_view_utils[] = [
|
||||
'type' => $diy_template_info[ 'name' ],
|
||||
'type_name' => '页面组件',
|
||||
'list' => []
|
||||
];
|
||||
$title = $diy_template_info[ 'title' ];
|
||||
$this->assign('page_type', $diy_template_info[ 'name' ]);
|
||||
} else {
|
||||
// 自定义页面,只查询公共组件
|
||||
$util_condition[] = [ 'support_diy_view', '=', '' ];
|
||||
}
|
||||
|
||||
$utils = $diy_view->getDiyViewUtilList($util_condition)[ 'data' ];
|
||||
|
||||
if (!empty($utils)) {
|
||||
|
||||
// 先遍历,组件分类
|
||||
foreach ($utils as $k => $v) {
|
||||
$value = [];
|
||||
$value[ 'type' ] = $v[ 'type' ];
|
||||
$value[ 'type_name' ] = $diy_view->getTypeName($v[ 'type' ]);
|
||||
$value[ 'list' ] = [];
|
||||
|
||||
if (!in_array($value, $diy_view_utils)) {
|
||||
array_push($diy_view_utils, $value);
|
||||
}
|
||||
}
|
||||
|
||||
// 遍历每一个组件,将其添加到对应的分类中
|
||||
foreach ($utils as $k => $v) {
|
||||
foreach ($diy_view_utils as $diy_k => $diy_v) {
|
||||
$is_add = true;
|
||||
if (!empty($v[ 'addon_name' ])) {
|
||||
$is_exit = addon_is_exit($v[ 'addon_name' ], $data[ 'site_id' ]);
|
||||
// 检查插件是否存在
|
||||
if ($is_exit == 0) {
|
||||
$is_add = false;
|
||||
}
|
||||
}
|
||||
|
||||
// 特定页面组件归类
|
||||
if (!empty($v[ 'support_diy_view' ]) && $v[ 'support_diy_view' ] == $diy_v[ 'type' ] && $is_add) {
|
||||
if ($v[ 'type' ] == 'EXTEND') {
|
||||
// 第三方扩展的特定页面组件
|
||||
$extend_comp[] = $v;
|
||||
} else {
|
||||
array_push($diy_view_utils[ $diy_k ][ 'list' ], $v);
|
||||
}
|
||||
break;
|
||||
} elseif ($diy_v[ 'type' ] == $v[ 'type' ] && $is_add) {
|
||||
array_push($diy_view_utils[ $diy_k ][ 'list' ], $v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 第三方组件——>特定页面组件
|
||||
if (!empty($extend_comp)) {
|
||||
foreach ($diy_view_utils as $k => $v) {
|
||||
if ($v[ 'type' ] == 'EXTEND') {
|
||||
if (empty($v[ 'list' ])) {
|
||||
$diy_view_utils[ $k ][ 'type_name' ] = '页面组件';
|
||||
$diy_view_utils[ $k ][ 'list' ] = array_merge($extend_comp, $diy_view_utils[ $k ][ 'list' ]);
|
||||
} else {
|
||||
// 页面组件排在第一位置
|
||||
array_splice($diy_view_utils, $k, 0, [
|
||||
[
|
||||
'type' => 'EXTEND',
|
||||
'type_name' => '页面组件',
|
||||
'list' => $extend_comp
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 清除组件分类下空列表
|
||||
foreach ($diy_view_utils as $k => $v) {
|
||||
if (empty($v[ 'list' ])) {
|
||||
unset($diy_view_utils[ $k ]);
|
||||
}
|
||||
}
|
||||
|
||||
$diy_view_utils = array_values($diy_view_utils);
|
||||
|
||||
$this->assign('diy_view_utils', $diy_view_utils);
|
||||
|
||||
$this->assign("time", time());
|
||||
$this->assign("name", $name); // 页面标识
|
||||
|
||||
$this->assign('template_id', $template_id); // 所属模板id
|
||||
$this->assign('title', $title); // 页面名称
|
||||
|
||||
$request_url = 'shop/diy/edit';
|
||||
|
||||
$this->assign("request_url", $request_url);
|
||||
|
||||
$this->assign('store_is_exit', addon_is_exit('store', $data[ 'site_id' ]));
|
||||
$template = 'app/shop/view/diy/edit.html';
|
||||
return $this->fetch($template);
|
||||
}
|
||||
|
||||
}
|
||||
54
app/event/diy/DiyViewUtils.php
Executable file
54
app/event/diy/DiyViewUtils.php
Executable file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\diy;
|
||||
|
||||
use ReflectionClass;
|
||||
use ReflectionException;
|
||||
|
||||
/**
|
||||
* 自定义模板组件渲染
|
||||
*/
|
||||
class DiyViewUtils
|
||||
{
|
||||
/**
|
||||
* 行为扩展的执行入口必须是run
|
||||
* @param $data
|
||||
* @return mixed | void
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function handle($data)
|
||||
{
|
||||
$port = [ 'app', 'addon' ];
|
||||
if (!empty($data[ 'name' ])) {
|
||||
$class_name = '';
|
||||
$is_exist = false;
|
||||
foreach ($port as $k => $v) {
|
||||
if (!empty($data[ 'addon_name' ])) {
|
||||
$class_name = $v . '\\' . $data[ 'addon_name' ] . '\\component\\controller\\' . $data[ 'name' ];
|
||||
} else {
|
||||
$class_name = $v . '\\component\\controller\\' . $data[ 'name' ];
|
||||
}
|
||||
if (class_exists($class_name)) {
|
||||
$is_exist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($is_exist) {
|
||||
$class = new ReflectionClass($class_name);
|
||||
$instance = $class->newInstanceArgs();
|
||||
return $instance->design();
|
||||
} else {
|
||||
var_dump("not found:" . $class_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
32
app/event/goods/CronGoodsTimerOff.php
Executable file
32
app/event/goods/CronGoodsTimerOff.php
Executable 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;
|
||||
}
|
||||
}
|
||||
32
app/event/goods/CronGoodsTimerOn.php
Executable file
32
app/event/goods/CronGoodsTimerOn.php
Executable 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;
|
||||
}
|
||||
}
|
||||
29
app/event/goods/CronVirtualGoodsVerifyOff.php
Executable file
29
app/event/goods/CronVirtualGoodsVerifyOff.php
Executable 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;
|
||||
}
|
||||
|
||||
}
|
||||
37
app/event/goods/DeleteGoodsCheck.php
Executable file
37
app/event/goods/DeleteGoodsCheck.php
Executable 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
31
app/event/goods/GoodsClass.php
Executable 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'
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
31
app/event/goods/VirtualGoodsClass.php
Executable file
31
app/event/goods/VirtualGoodsClass.php
Executable 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'
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
24
app/event/init/AppEnd.php
Executable file
24
app/event/init/AppEnd.php
Executable file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\init;
|
||||
|
||||
/**
|
||||
* 应用结束
|
||||
*/
|
||||
class AppEnd
|
||||
{
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle()
|
||||
{
|
||||
return success();
|
||||
|
||||
}
|
||||
}
|
||||
2
app/event/init/HttpRun.php
Executable file
2
app/event/init/HttpRun.php
Executable file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
get_funcs('HttpRun');
|
||||
68
app/event/init/InitAddon.php
Executable file
68
app/event/init/InitAddon.php
Executable file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\init;
|
||||
|
||||
use app\model\system\Addon;
|
||||
use think\facade\Event;
|
||||
use think\facade\Cache;
|
||||
|
||||
/**
|
||||
* 初始化插件
|
||||
*/
|
||||
class InitAddon
|
||||
{
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle()
|
||||
{
|
||||
if (defined('BIND_MODULE') && BIND_MODULE === 'install') return;
|
||||
$this->InitEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化事件
|
||||
*/
|
||||
private function InitEvent()
|
||||
{
|
||||
$cache = Cache::get("addon_event_list");
|
||||
if (!defined("system_check_auth")) exit();
|
||||
if (empty($cache)) {
|
||||
$addon_model = new Addon();
|
||||
$addon_data = $addon_model->getAddonList([], 'name');
|
||||
|
||||
$listen_array = [];
|
||||
foreach ($addon_data[ 'data' ] as $k => $v) {
|
||||
if (file_exists('addon/' . $v[ 'name' ] . '/config/event.php')) {
|
||||
$addon_event = require_once 'addon/' . $v[ 'name' ] . '/config/event.php';
|
||||
|
||||
$listen = $addon_event['listen'] ?? [];
|
||||
if (!empty($listen)) {
|
||||
$listen_array[] = $listen;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Cache::tag("addon")->set("addon_event_list", $listen_array);
|
||||
} else {
|
||||
$listen_array = $cache;
|
||||
}
|
||||
|
||||
if (!empty($listen_array)) {
|
||||
foreach ($listen_array as $k => $listen) {
|
||||
if (!empty($listen)) {
|
||||
Event::listenEvents($listen);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
2
app/event/init/InitAuth.php
Executable file
2
app/event/init/InitAuth.php
Executable file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
get_funcs('InitAuth');
|
||||
130
app/event/init/InitConfig.php
Executable file
130
app/event/init/InitConfig.php
Executable file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\init;
|
||||
|
||||
use think\facade\Config;
|
||||
|
||||
/**
|
||||
* 初始化配置信息
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
class InitConfig
|
||||
{
|
||||
public function handle()
|
||||
{
|
||||
// 初始化常量
|
||||
$this->initConst();
|
||||
//初始化配置信息
|
||||
$this->initConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化常量
|
||||
*/
|
||||
private function initConst()
|
||||
{
|
||||
//加载版本信息
|
||||
define('SHOP_MODULE', 'shop');
|
||||
|
||||
//是否展示帮助快捷链接
|
||||
define('HELP_SHOW', 1);
|
||||
//加载基础化配置信息
|
||||
define('__ROOT__', str_replace([ '/index.php', '/install.php' ], '', request()->root(true)));
|
||||
|
||||
define('__PUBLIC__', __ROOT__ . '/public');
|
||||
define('__UPLOAD__', 'upload');
|
||||
|
||||
//插件目录名称
|
||||
define('ADDON_DIR_NAME', 'addon');
|
||||
//插件目录路径
|
||||
define('ADDON_PATH', 'addon/');
|
||||
//分页每页数量
|
||||
define('PAGE_LIST_ROWS', 10);
|
||||
|
||||
define('MEMBER_LEVEL', 10);
|
||||
|
||||
//伪静态模式是否开启
|
||||
define('REWRITE_MODULE', true);
|
||||
|
||||
// public目录绝对路径
|
||||
define('PUBLIC_PATH', root_path() . '/public/');
|
||||
// 项目绝对路径
|
||||
define('ROOT_PATH', root_path());
|
||||
|
||||
//兼容模式访问
|
||||
if (!REWRITE_MODULE) {
|
||||
define('ROOT_URL', request()->root(true) . '/?s=');
|
||||
} else {
|
||||
define('ROOT_URL', request()->root(true));
|
||||
}
|
||||
|
||||
//检测网址访问
|
||||
$url = request()->url(true);
|
||||
$url = strtolower($url);
|
||||
if (strstr($url, 'call_user_func_array') || strstr($url, 'invokefunction') || strstr($url, 'think\view')) {
|
||||
die("非法请求");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化配置信息
|
||||
*/
|
||||
private function initConfig()
|
||||
{
|
||||
$view_array = [
|
||||
// 模板引擎类型使用Think
|
||||
'type' => 'Think',
|
||||
// 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法
|
||||
'auto_rule' => 1,
|
||||
// 模板目录名
|
||||
'view_dir_name' => 'view',
|
||||
// 模板后缀
|
||||
'view_suffix' => 'html',
|
||||
// 模板文件名分隔符
|
||||
'view_depr' => DIRECTORY_SEPARATOR,
|
||||
// 模板引擎普通标签开始标记
|
||||
'tpl_begin' => '{',
|
||||
// 模板引擎普通标签结束标记
|
||||
'tpl_end' => '}',
|
||||
// 标签库标签开始标记
|
||||
'taglib_begin' => '{',
|
||||
// 标签库标签结束标记
|
||||
'taglib_end' => '}',
|
||||
'tpl_cache' => false, //模板缓存,部署模式后改为true
|
||||
'tpl_replace_string' => [
|
||||
'__ROOT__' => __ROOT__,
|
||||
'__PUBLIC__' => __PUBLIC__,
|
||||
'ROOT_URL' => ROOT_URL,
|
||||
'__STATIC__' => __PUBLIC__ . '/static',
|
||||
'STATIC_EXT' => __PUBLIC__ . '/static/ext',
|
||||
'STATIC_CSS' => __PUBLIC__ . '/static/css',
|
||||
'STATIC_JS' => __PUBLIC__ . '/static/js',
|
||||
'STATIC_IMG' => __PUBLIC__ . '/static/img',
|
||||
'HOME_IMG' => __ROOT__ . '/app/home/view/public/img',
|
||||
'HOME_CSS' => __ROOT__ . '/app/home/view/public/css',
|
||||
'HOME_JS' => __ROOT__ . '/app/home/view/public/js',
|
||||
'SHOP_IMG' => __ROOT__ . '/app/shop/view/public/img',
|
||||
'SHOP_CSS' => __ROOT__ . '/app/shop/view/public/css',
|
||||
'SHOP_JS' => __ROOT__ . '/app/shop/view/public/js',
|
||||
'__UPLOAD__' => __UPLOAD__,
|
||||
'INDEX_IMG' => __ROOT__ . '/app/index/view/public/img',
|
||||
'INDEX_CSS' => __ROOT__ . '/app/index/view/public/css',
|
||||
'INDEX_JS' => __ROOT__ . '/app/index/view/public/js',
|
||||
]
|
||||
];
|
||||
|
||||
Config::set($view_array, 'view');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
66
app/event/init/InitCron.php
Executable file
66
app/event/init/InitCron.php
Executable file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\init;
|
||||
|
||||
use app\dict\system\ScheduleDict;
|
||||
use app\model\system\Cron;
|
||||
use think\facade\Cache;
|
||||
|
||||
/**
|
||||
* 初始化计划任务启动
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
class InitCron
|
||||
{
|
||||
public function handle()
|
||||
{
|
||||
//根据计划任务类型来判断
|
||||
if(config('cron.default') != ScheduleDict::default) return;
|
||||
if (defined('BIND_MODULE') && BIND_MODULE === 'install') {
|
||||
return;
|
||||
}
|
||||
$last_time = Cache::get("cron_last_load_time");
|
||||
if (empty($last_time)) {
|
||||
$last_time = 0;
|
||||
}
|
||||
$last_exec_time = Cache::get("cron_http_last_exec_time");
|
||||
if (empty($last_exec_time)) {
|
||||
$last_exec_time = 0;
|
||||
}
|
||||
$module = request()->module();
|
||||
if ($module != 'cron') {
|
||||
if (!defined('CRON_EXECUTE') && time() - $last_time > 100 && time() - $last_exec_time > 100) {
|
||||
Cache::set("cron_http_last_exec_time", time());
|
||||
defined('CRON_EXECUTE') or define('CRON_EXECUTE', 1);
|
||||
$url = url('cron/task/cronExecute');
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HEADER, true);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_exec($ch);
|
||||
|
||||
// // 获取错误信息并打印
|
||||
// $error = curl_error($ch);
|
||||
// if($error){
|
||||
// //保存错误
|
||||
// Cron::setError(ScheduleDict::default, $error);
|
||||
// }
|
||||
// // 关闭cURL资源句柄
|
||||
// curl_close($ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
86
app/event/member/AddMemberAccount.php
Executable file
86
app/event/member/AddMemberAccount.php
Executable file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\member;
|
||||
|
||||
use addon\coupon\model\Coupon;
|
||||
use app\model\member\MemberAccount;
|
||||
use app\model\member\MemberLevel;
|
||||
|
||||
/**
|
||||
* 会员账户变化引起会员相关等级变化
|
||||
*/
|
||||
class AddMemberAccount
|
||||
{
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle($data)
|
||||
{
|
||||
$member_account_model = new MemberAccount();
|
||||
model('member_account')->startTrans();
|
||||
try {
|
||||
if ($data[ 'account_type' ] == 'growth') {
|
||||
//成长值变化等级检测变化
|
||||
$member_info = model('member')->getInfo([ [ 'member_id', '=', $data[ 'member_id' ] ] ], 'growth,member_level,member_level_type,nickname');
|
||||
//查询会员等级
|
||||
$member_level = new MemberLevel();
|
||||
$level_list = $member_level->getMemberLevelList([ [ 'growth', '<=', $member_info[ 'growth' ] ], [ 'level_type', '=', 0 ], [ 'site_id', '=', $data[ 'site_id' ] ], [ 'status', '=', 1 ] ], 'level_id, level_name, sort, growth, send_point, send_balance, send_coupon', 'growth desc');
|
||||
$level_detail = [];
|
||||
$upgrade = true; //升降级状态,存在降级情况
|
||||
if ($member_info[ 'member_level_type' ] == 0 && !empty($level_list[ 'data' ])) {
|
||||
//检测升级
|
||||
if ($member_info[ 'member_level' ] == 0) {
|
||||
//将用户设置为最大等级
|
||||
$level_detail = $level_list[ 'data' ][ 0 ];
|
||||
} else {
|
||||
$level_info = $member_level->getMemberLevelInfo([ [ 'level_id', '=', $member_info[ 'member_level' ] ] ]);
|
||||
if (empty($level_info[ 'data' ])) {
|
||||
$level_detail = $level_list[ 'data' ][ 0 ];
|
||||
} else {
|
||||
$level_detail = $level_list[ 'data' ][ 0 ];
|
||||
if ($level_info[ 'data' ][ 'growth' ] > $level_list[ 'data' ][ 0 ][ 'growth' ]) {
|
||||
$upgrade = false; //降级
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果存在已升级等级 发放升级奖励
|
||||
if (!empty($level_detail)) {
|
||||
// 添加会员卡变更记录
|
||||
$member_level->addMemberLevelChangeRecord($data[ 'member_id' ], $data[ 'site_id' ], $level_detail[ 'level_id' ], 0, 'upgrade', $data[ 'member_id' ], 'member', $member_info[ 'nickname' ]);
|
||||
if ($level_detail[ 'send_balance' ] > 0 && $upgrade) {
|
||||
//赠送红包
|
||||
$balance = $level_detail[ 'send_balance' ];
|
||||
$member_account_model->addMemberAccount($data[ 'site_id' ], $data[ 'member_id' ], 'balance', $balance, 'upgrade', '会员升级得红包' . $balance, '会员等级升级奖励');
|
||||
}
|
||||
if ($level_detail[ 'send_point' ] > 0 && $upgrade) {
|
||||
//赠送积分
|
||||
$send_point = $level_detail[ 'send_point' ];
|
||||
$member_account_model->addMemberAccount($data[ 'site_id' ], $data[ 'member_id' ], 'point', $send_point, 'upgrade', '会员升级得积分' . $send_point, '会员等级升级奖励');
|
||||
}
|
||||
//给用户发放优惠券
|
||||
$coupon_model = new Coupon();
|
||||
$coupon_array = empty($level_detail[ 'send_coupon' ]) ? [] : explode(',', $level_detail[ 'send_coupon' ]);
|
||||
if (!empty($coupon_array) && $upgrade) {
|
||||
foreach ($coupon_array as $k => $v) {
|
||||
$coupon_model->giveCoupon([['coupon_type_id' => $v, 'num' => 1]], $data['site_id'], $data[ 'member_id' ], Coupon::GET_TYPE_ACTIVITY_GIVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
model('member_account')->commit();
|
||||
return $member_account_model->success();
|
||||
} catch (\Exception $e) {
|
||||
model('member_account')->rollback();
|
||||
return $member_account_model->error('', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
27
app/event/member/CronMemberClusterRefresh.php
Executable file
27
app/event/member/CronMemberClusterRefresh.php
Executable file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\member;
|
||||
|
||||
use app\model\member\MemberCluster as MemberClusterModel;
|
||||
|
||||
/**
|
||||
* 刷新会员群体会员信息(计划任务)
|
||||
*/
|
||||
class CronMemberClusterRefresh
|
||||
{
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle()
|
||||
{
|
||||
$member_cluster_model = new MemberClusterModel();
|
||||
$result = $member_cluster_model->refreshMemberCluster();//会员群体定时刷新
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
84
app/event/member/MemberDetail.php
Executable file
84
app/event/member/MemberDetail.php
Executable file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\member;
|
||||
|
||||
use addon\coupon\model\Coupon as CouponModel;
|
||||
use app\Controller;
|
||||
use app\model\member\MemberAccount as MemberAccountModel;
|
||||
|
||||
/**
|
||||
* 会员详情账号明细
|
||||
*/
|
||||
class MemberDetail extends Controller
|
||||
{
|
||||
|
||||
public function handle($param)
|
||||
{
|
||||
$this->assign("member_id", $param[ 'member_id' ]);
|
||||
|
||||
if ($param[ 'type' ] == 'account') {
|
||||
// 账户余额、积分、成长值
|
||||
|
||||
$this->assign("account_type", $param[ 'account_type' ]);
|
||||
|
||||
$id = $param[ 'account_type' ];
|
||||
if ($param[ 'account_type' ] == 'balance,balance_money') {
|
||||
$id = 'balance';
|
||||
}
|
||||
$this->assign('table_id', $id);
|
||||
|
||||
//账户类型和来源类型
|
||||
$member_account_model = new MemberAccountModel();
|
||||
$account_type_arr = $member_account_model->getAccountType();
|
||||
$from_type_arr = $member_account_model->getFromType();
|
||||
$this->assign('account_type_arr', $account_type_arr);
|
||||
$this->assign('from_type_arr', $from_type_arr[ $param[ 'account_type' ] ] ?? []);
|
||||
|
||||
$template = 'app/shop/view/member/account_detail.html';
|
||||
return $this->fetch($template);
|
||||
|
||||
} elseif ($param[ 'type' ] == 'order') {
|
||||
|
||||
// 订单列表
|
||||
$template = 'app/shop/view/member/order.html';
|
||||
return $this->fetch($template);
|
||||
|
||||
} elseif ($param[ 'type' ] == 'address_detail') {
|
||||
|
||||
// 收货地址
|
||||
$template = 'app/shop/view/member/address_detail.html';
|
||||
return $this->fetch($template);
|
||||
|
||||
} elseif ($param[ 'type' ] == 'member_goods_collect') {
|
||||
|
||||
// 收藏记录
|
||||
$template = 'app/shop/view/goods/member_goods_collect.html';
|
||||
return $this->fetch($template);
|
||||
|
||||
} elseif ($param[ 'type' ] == 'member_goods_browse') {
|
||||
|
||||
// 浏览记录
|
||||
$template = 'app/shop/view/goods/member_goods_browse.html';
|
||||
return $this->fetch($template);
|
||||
|
||||
} elseif ($param[ 'type' ] == 'member_coupon') {
|
||||
|
||||
// 优惠券
|
||||
$coupon_model = new CouponModel();
|
||||
$this->assign('get_type', $coupon_model->getCouponGetType());
|
||||
$template = 'app/shop/view/member/member_coupon.html';
|
||||
return $this->fetch($template);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
29
app/event/member/MemberLogin.php
Executable file
29
app/event/member/MemberLogin.php
Executable file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\member;
|
||||
|
||||
use app\model\message\Message;
|
||||
|
||||
/**
|
||||
* 登录成功发送通知
|
||||
*/
|
||||
class MemberLogin
|
||||
{
|
||||
|
||||
public function handle($param)
|
||||
{
|
||||
// 发送通知
|
||||
$message_model = new Message();
|
||||
$message_model->sendMessage(["keywords" => "LOGIN", "member_id" => $param["member_id"], "site_id" => $param["site_id"]]);
|
||||
}
|
||||
|
||||
}
|
||||
39
app/event/message/MessageAccountChangeNotice.php
Executable file
39
app/event/message/MessageAccountChangeNotice.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\member\MemberAccount;
|
||||
|
||||
/**
|
||||
* 会员账户变动通知通知
|
||||
*/
|
||||
class MessageAccountChangeNotice
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return void|null
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
//会员余额变动通知
|
||||
if ($param[ "keywords" ] == "USER_BALANCE_CHANGE_NOTICE") {
|
||||
$model = new MemberAccount();
|
||||
return $model->messageAccountChangeNotice($param);
|
||||
}
|
||||
|
||||
//会员积分变动通知
|
||||
if ($param[ "keywords" ] == "USER_POINT_CHANGE_NOTICE") {
|
||||
$model = new MemberAccount();
|
||||
return $model->messagePointChangeNotice($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
31
app/event/message/MessageBindCode.php
Executable file
31
app/event/message/MessageBindCode.php
Executable file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\member\Member;
|
||||
|
||||
|
||||
/**
|
||||
* 绑定发送验证码
|
||||
*/
|
||||
class MessageBindCode
|
||||
{
|
||||
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param[ "keywords" ] == "MEMBER_BIND") {
|
||||
$member_model = new Member();
|
||||
$result = $member_model->bindCode($param);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
34
app/event/message/MessageBuyerOrderComplete.php
Executable file
34
app/event/message/MessageBuyerOrderComplete.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
|
||||
* 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\order\OrderMessage;
|
||||
|
||||
/**
|
||||
* 买家订单完成通知商家
|
||||
*/
|
||||
class MessageBuyerOrderComplete
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return array|mixed|void
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param["keywords"] == "BUYER_ORDER_COMPLETE") {
|
||||
$model = new OrderMessage();
|
||||
return $model->messageBuyerOrderComplete($param);
|
||||
}
|
||||
}
|
||||
}
|
||||
32
app/event/message/MessageBuyerPaySuccess.php
Executable file
32
app/event/message/MessageBuyerPaySuccess.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\order\OrderMessage;
|
||||
|
||||
/**
|
||||
* 买家支付成功通知商家
|
||||
*/
|
||||
class MessageBuyerPaySuccess
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return array|mixed|void
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param[ "keywords" ] == "BUYER_PAY") {
|
||||
$model = new OrderMessage();
|
||||
return $model->messageBuyerPaySuccess($param);
|
||||
}
|
||||
}
|
||||
}
|
||||
32
app/event/message/MessageCancelApply.php
Executable file
32
app/event/message/MessageCancelApply.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use addon\membercancel\model\MemberCancel;
|
||||
|
||||
/**
|
||||
* 会员注销申请通知
|
||||
*/
|
||||
class MessageCancelApply
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return array
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
if ($param[ "keywords" ] == "USER_CANCEL_APPLY") {
|
||||
$model = new MemberCancel();
|
||||
return $model->memberCancelApply($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
32
app/event/message/MessageCancelFail.php
Executable file
32
app/event/message/MessageCancelFail.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use addon\membercancel\model\MemberCancel;
|
||||
|
||||
/**
|
||||
* 会员注销失败通知
|
||||
*/
|
||||
class MessageCancelFail
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return array
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
if ($param[ "keywords" ] == "USER_CANCEL_FAIL") {
|
||||
$model = new MemberCancel();
|
||||
return $model->memberCancelFail($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
33
app/event/message/MessageCancelSuccess.php
Executable file
33
app/event/message/MessageCancelSuccess.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use addon\membercancel\model\MemberCancel;
|
||||
|
||||
/**
|
||||
* 会员注销成功通知
|
||||
*/
|
||||
class MessageCancelSuccess
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return array
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param[ "keywords" ] == "USER_CANCEL_SUCCESS") {
|
||||
$model = new MemberCancel();
|
||||
return $model->memberCancelSuccess($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
30
app/event/message/MessageCashierMemberVerifyCode.php
Executable file
30
app/event/message/MessageCashierMemberVerifyCode.php
Executable file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\member\Member;
|
||||
|
||||
|
||||
/**
|
||||
* 收银台会员验证验证码
|
||||
*/
|
||||
class MessageCashierMemberVerifyCode
|
||||
{
|
||||
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param[ "keywords" ] == "CASHIER_MEMBER_VERIFY_CODE") {
|
||||
$result = ( new Member() )->bindCode($param);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
35
app/event/message/MessageFenxiaoWithdrawalApply.php
Executable file
35
app/event/message/MessageFenxiaoWithdrawalApply.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use addon\fenxiao\model\FenxiaoWithdraw;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
/**
|
||||
* 分销提现申请发送消息
|
||||
*/
|
||||
class MessageFenxiaoWithdrawalApply
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return void|null
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param[ "keywords" ] == "FENXIAO_WITHDRAWAL_APPLY") {
|
||||
$model = new FenxiaoWithdraw();
|
||||
return $model->messageFenxiaoWithdrawalApply($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
35
app/event/message/MessageFenxiaoWithdrawalError.php
Executable file
35
app/event/message/MessageFenxiaoWithdrawalError.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use addon\fenxiao\model\FenxiaoWithdraw;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
/**
|
||||
* 分销提现失败发送消息
|
||||
*/
|
||||
class MessageFenxiaoWithdrawalError
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return void|null
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param[ "keywords" ] == "FENXIAO_WITHDRAWAL_ERROR") {
|
||||
$model = new FenxiaoWithdraw();
|
||||
return $model->messageFenxiaoWithdrawalError($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
35
app/event/message/MessageFenxiaoWithdrawalSuccess.php
Executable file
35
app/event/message/MessageFenxiaoWithdrawalSuccess.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use addon\fenxiao\model\FenxiaoWithdraw;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
/**
|
||||
* 分销提现成功发送消息
|
||||
*/
|
||||
class MessageFenxiaoWithdrawalSuccess
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return void|null
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param[ "keywords" ] == "FENXIAO_WITHDRAWAL_SUCCESS") {
|
||||
$model = new FenxiaoWithdraw();
|
||||
return $model->messageFenxiaoWithdrawalSuccess($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
30
app/event/message/MessageFindCode.php
Executable file
30
app/event/message/MessageFindCode.php
Executable file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\member\Member;
|
||||
|
||||
|
||||
/**
|
||||
* 找回密码发送验证码
|
||||
*/
|
||||
class MessageFindCode
|
||||
{
|
||||
|
||||
public function handle($param)
|
||||
{
|
||||
if ($param[ "keywords" ] == "FIND_PASSWORD") {
|
||||
$member_model = new Member();
|
||||
$result = $member_model->findCode($param);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
41
app/event/message/MessageLocalWaitDelivery.php
Executable file
41
app/event/message/MessageLocalWaitDelivery.php
Executable file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\order\OrderMessage;
|
||||
|
||||
|
||||
/**
|
||||
* 外卖订单 指定配送员后 同步短信推送
|
||||
*/
|
||||
class MessageLocalWaitDelivery
|
||||
{
|
||||
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param["keywords"] == "MESSAGE_LOCAL_WAIT_DELIVERY") {
|
||||
$model = new OrderMessage();
|
||||
return $model->messageLocalWaitDelivery($param);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
31
app/event/message/MessageLogin.php
Executable file
31
app/event/message/MessageLogin.php
Executable file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\member\Login;
|
||||
|
||||
|
||||
/**
|
||||
* 登录成功发送通知
|
||||
*/
|
||||
class MessageLogin
|
||||
{
|
||||
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param[ "keywords" ] == "LOGIN") {
|
||||
$login_model = new Login();
|
||||
$result = $login_model->loginSuccess($param);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
32
app/event/message/MessageLoginCode.php
Executable file
32
app/event/message/MessageLoginCode.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\member\Login;
|
||||
|
||||
|
||||
/**
|
||||
* 登录发送验证码
|
||||
*/
|
||||
class MessageLoginCode
|
||||
{
|
||||
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param["keywords"] == "LOGIN_CODE") {
|
||||
$login_model = new Login();
|
||||
$result = $login_model->loginCode($param);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
32
app/event/message/MessageMemberPayPassword.php
Executable file
32
app/event/message/MessageMemberPayPassword.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\member\Member;
|
||||
|
||||
/**
|
||||
* 登录成功发送通知
|
||||
*/
|
||||
class MessageMemberPayPassword
|
||||
{
|
||||
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param["keywords"] == "MEMBER_PAY_PASSWORD") {
|
||||
$member_model = new Member();
|
||||
$result = $member_model->paypasswordCode($param);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
37
app/event/message/MessageOrderClose.php
Executable file
37
app/event/message/MessageOrderClose.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\order\OrderMessage;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
/**
|
||||
* 订单关闭发送消息
|
||||
*/
|
||||
class MessageOrderClose
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return void|null
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param["keywords"] == "ORDER_CLOSE") {
|
||||
//发送订单消息
|
||||
$model = new OrderMessage();
|
||||
return $model->messageOrderClose($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
30
app/event/message/MessageOrderCommissionGrant.php
Executable file
30
app/event/message/MessageOrderCommissionGrant.php
Executable file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
|
||||
* 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use addon\fenxiao\model\FenxiaoWithdraw;
|
||||
|
||||
/**
|
||||
* 分销佣金发放通知
|
||||
*/
|
||||
class MessageOrderCommissionGrant
|
||||
{
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param["keywords"] == "COMMISSION_GRANT") {
|
||||
$model = new FenxiaoWithdraw();
|
||||
return $model->messageOrderCommissionGrant($param);
|
||||
}
|
||||
}
|
||||
}
|
||||
36
app/event/message/MessageOrderComplete.php
Executable file
36
app/event/message/MessageOrderComplete.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\order\OrderMessage;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
/**
|
||||
* 订单关闭发送消息
|
||||
*/
|
||||
class MessageOrderComplete
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return void|null
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
// 发送订单消息
|
||||
if ($param["keywords"] == "ORDER_COMPLETE") {
|
||||
$model = new OrderMessage();
|
||||
return $model->messageOrderComplete($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
36
app/event/message/MessageOrderDelivery.php
Executable file
36
app/event/message/MessageOrderDelivery.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\order\OrderMessage;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
/**
|
||||
* 订单发货发送消息
|
||||
*/
|
||||
class MessageOrderDelivery
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return void|null
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
// 发送订单消息
|
||||
if ($param["keywords"] == "ORDER_DELIVERY") {
|
||||
$model = new OrderMessage();
|
||||
return $model->messageOrderDelivery($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
33
app/event/message/MessageOrderPaySuccess.php
Executable file
33
app/event/message/MessageOrderPaySuccess.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\order\OrderMessage;
|
||||
|
||||
/**
|
||||
* 订单创建发送消息
|
||||
*/
|
||||
class MessageOrderPaySuccess
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return array|mixed|void
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param['keywords'] == 'ORDER_PAY') {
|
||||
$model = new OrderMessage();
|
||||
$model->messagePaySuccess($param);
|
||||
}
|
||||
}
|
||||
}
|
||||
33
app/event/message/MessageOrderRefundApply.php
Executable file
33
app/event/message/MessageOrderRefundApply.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\order\OrderMessage;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
class MessageOrderRefundApply
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return void|null
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
// 发送订单消息
|
||||
if ($param["keywords"] == "BUYER_REFUND") {
|
||||
$model = new OrderMessage();
|
||||
return $model->messageOrderRefundApply($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
32
app/event/message/MessageOrderRefundDelivery.php
Executable file
32
app/event/message/MessageOrderRefundDelivery.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\order\OrderMessage;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
class MessageOrderRefundDelivery
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return void|null
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
// 发送订单消息
|
||||
if ($param[ "keywords" ] == "BUYER_DELIVERY_REFUND") {
|
||||
$model = new OrderMessage();
|
||||
return $model->messageOrderRefundDelivery($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
35
app/event/message/MessageOrderUrgePayment.php
Executable file
35
app/event/message/MessageOrderUrgePayment.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
|
||||
* 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\order\OrderMessage;
|
||||
|
||||
/**
|
||||
* 订单催付通知
|
||||
*/
|
||||
class MessageOrderUrgePayment
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return void|null
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param['keywords'] == 'ORDER_URGE_PAYMENT') {
|
||||
$model = new OrderMessage();
|
||||
return $model->messageOrderUrgePayment($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
31
app/event/message/MessagePayPasswordCode.php
Executable file
31
app/event/message/MessagePayPasswordCode.php
Executable file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\member\Member;
|
||||
|
||||
/**
|
||||
* 绑定发送验证码
|
||||
*/
|
||||
class MessagePayPasswordCode
|
||||
{
|
||||
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param[ "keywords" ] == "MEMBER_PAY_PASSWORD") {
|
||||
$member_model = new Member();
|
||||
$result = $member_model->paypasswordCode($param);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
35
app/event/message/MessageRegisterCode.php
Executable file
35
app/event/message/MessageRegisterCode.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\member\Register;
|
||||
|
||||
|
||||
/**
|
||||
* 注册发送验证码
|
||||
*/
|
||||
class MessageRegisterCode
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return array|mixed|void
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param[ "keywords" ] == "REGISTER_CODE") {
|
||||
$register_model = new Register();
|
||||
$result = $register_model->registerCode($param);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
41
app/event/message/MessageSetPassWord.php
Executable file
41
app/event/message/MessageSetPassWord.php
Executable file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\member\Member;
|
||||
|
||||
|
||||
/**
|
||||
* 设置密码
|
||||
*/
|
||||
class MessageSetPassWord
|
||||
{
|
||||
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param[ "keywords" ] == "SET_PASSWORD") {
|
||||
$member_model = new Member();
|
||||
$result = $member_model->bindCode($param);
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
33
app/event/message/MessageShopRefundAgree.php
Executable file
33
app/event/message/MessageShopRefundAgree.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\order\OrderMessage;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
class MessageShopRefundAgree
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return void|null
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
// 发送订单消息
|
||||
if ($param["keywords"] == "ORDER_REFUND_AGREE") {
|
||||
$model = new OrderMessage();
|
||||
return $model->messageOrderRefundAgree($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
33
app/event/message/MessageShopRefundRefuse.php
Executable file
33
app/event/message/MessageShopRefundRefuse.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\order\OrderMessage;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
class MessageShopRefundRefuse
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return void|null
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
// 发送订单消息
|
||||
if ($param["keywords"] == "ORDER_REFUND_REFUSE") {
|
||||
$model = new OrderMessage();
|
||||
return $model->messageOrderRefundRefuse($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
33
app/event/message/MessageShopVerified.php
Executable file
33
app/event/message/MessageShopVerified.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\order\OrderMessage;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
class MessageShopVerified
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return void|null
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
// 发送订单消息
|
||||
if ($param["keywords"] == "VERIFY") {
|
||||
$model = new OrderMessage();
|
||||
return $model->messageOrderVerify($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
36
app/event/message/MessageUserWithdrawalApply.php
Executable file
36
app/event/message/MessageUserWithdrawalApply.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\member\Withdraw;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
/**
|
||||
* 会员提现申请发送消息
|
||||
*/
|
||||
class MessageUserWithdrawalApply
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return void|null
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param["keywords"] == "USER_WITHDRAWAL_APPLY") {
|
||||
$model = new Withdraw();
|
||||
return $model->messageUserWithdrawalApply($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
36
app/event/message/MessageUserWithdrawalError.php
Executable file
36
app/event/message/MessageUserWithdrawalError.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\member\Withdraw;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
/**
|
||||
* 会员提现失败发送消息
|
||||
*/
|
||||
class MessageUserWithdrawalError
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return void|null
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param["keywords"] == "USER_WITHDRAWAL_ERROR") {
|
||||
$model = new Withdraw();
|
||||
return $model->messageUserWithdrawalError($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
36
app/event/message/MessageUserWithdrawalSuccess.php
Executable file
36
app/event/message/MessageUserWithdrawalSuccess.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\member\Withdraw;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
/**
|
||||
* 会员提现成功发送消息
|
||||
*/
|
||||
class messageUserWithdrawalSuccess
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return void|null
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
//发送订单消息
|
||||
if ($param["keywords"] == "USER_WITHDRAWAL_SUCCESS") {
|
||||
$model = new Withdraw();
|
||||
return $model->messageUserWithdrawalSuccess($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
34
app/event/message/MessageVerifyCodeExpire.php
Executable file
34
app/event/message/MessageVerifyCodeExpire.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
|
||||
* 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\order\OrderMessage;
|
||||
|
||||
/**
|
||||
* 核销码过期提醒
|
||||
*/
|
||||
class MessageVerifyCodeExpire
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return void|null
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
if ($param["keywords"] == "VERIFY_CODE_EXPIRE") {
|
||||
$model = new OrderMessage();
|
||||
return $model->messageVerifyCodeExpire($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
34
app/event/message/MessageVerifyOrderOutTime.php
Executable file
34
app/event/message/MessageVerifyOrderOutTime.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
|
||||
* 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\message;
|
||||
|
||||
use app\model\order\OrderMessage;
|
||||
|
||||
/**
|
||||
* 核销商品临期提醒
|
||||
*/
|
||||
class MessageVerifyOrderOutTime
|
||||
{
|
||||
/**
|
||||
* @param $param
|
||||
* @return void|null
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
if ($param["keywords"] == "ORDER_VERIFY_OUT_TIME") {
|
||||
$model = new OrderMessage();
|
||||
return $model->messageVerifyOrderOutTime($param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
27
app/event/order/CronOrderAfterSaleClose.php
Executable file
27
app/event/order/CronOrderAfterSaleClose.php
Executable file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\order;
|
||||
|
||||
use app\model\order\OrderCommon;
|
||||
|
||||
/**
|
||||
* 订单完成之后达到时间自动关闭售后服务
|
||||
*/
|
||||
class CronOrderAfterSaleClose
|
||||
{
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle($data)
|
||||
{
|
||||
$order = new OrderCommon();
|
||||
//订单自动完成
|
||||
return $order->orderAfterSaleClose($data["relate_id"]);
|
||||
}
|
||||
}
|
||||
36
app/event/order/CronOrderClose.php
Executable file
36
app/event/order/CronOrderClose.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\order;
|
||||
|
||||
use app\model\order\OrderCommon;
|
||||
use app\model\order\OrderCron;
|
||||
use app\model\system\Cron;
|
||||
|
||||
/**
|
||||
* 订单自动关闭
|
||||
*/
|
||||
class CronOrderClose
|
||||
{
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle($data)
|
||||
{
|
||||
$order = new OrderCommon();
|
||||
$order_info = $order->getOrderInfo([ ['order_id', '=', $data['relate_id'] ] ], '*')['data'] ?? [];
|
||||
if (!empty($order_info) && $order_info['order_status'] == 0 && $order_info['pay_type'] != 'offlinepay') {
|
||||
$result = $order->orderClose($data['relate_id'], [], '长时间未支付,订单自动关闭');//订单自动关闭
|
||||
//todo 如果关闭失败,就再创建一个自动关闭任务
|
||||
if(empty($result) && empty($result['code']) && $result['code'] < 0){
|
||||
OrderCron::close(['site_id' => $order_info['site_id'], 'order_id' => $order_info['order_id']]);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
27
app/event/order/CronOrderComplete.php
Executable file
27
app/event/order/CronOrderComplete.php
Executable file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\order;
|
||||
|
||||
use app\model\order\OrderCommon;
|
||||
|
||||
/**
|
||||
* 订单自动完成
|
||||
*/
|
||||
class CronOrderComplete
|
||||
{
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle($data)
|
||||
{
|
||||
$order = new OrderCommon();
|
||||
//订单自动完成
|
||||
return $order->orderComplete($data['relate_id']);
|
||||
}
|
||||
}
|
||||
31
app/event/order/CronOrderTakeDelivery.php
Executable file
31
app/event/order/CronOrderTakeDelivery.php
Executable file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\order;
|
||||
|
||||
use app\model\order\OrderCommon;
|
||||
|
||||
/**
|
||||
* 订单自动收货
|
||||
*/
|
||||
class CronOrderTakeDelivery
|
||||
{
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle($data)
|
||||
{
|
||||
|
||||
$order = new OrderCommon();
|
||||
$order_info_result = $order->getOrderInfo([ ['order_id', '=', $data['relate_id'] ] ], 'order_status');
|
||||
if (isset($order_info_result['data']['order_status']) && $order_info_result['data']['order_status'] != 10) {
|
||||
//订单自动收货
|
||||
return $order->orderCommonTakeDelivery($data['relate_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
30
app/event/order/CronOrderUrgePayment.php
Executable file
30
app/event/order/CronOrderUrgePayment.php
Executable file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\order;
|
||||
|
||||
use app\model\message\Message;
|
||||
use app\model\order\OrderCommon;
|
||||
|
||||
/**
|
||||
* 订单催付通知
|
||||
*/
|
||||
class CronOrderUrgePayment
|
||||
{
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle($params)
|
||||
{
|
||||
$order_info = ( new OrderCommon() )->getOrderInfo([ [ 'order_id', '=', $params[ 'relate_id' ] ], [ 'order_status', '=', OrderCommon::ORDER_CREATE ] ], 'site_id')[ 'data' ];
|
||||
if (!empty($order_info)) {
|
||||
( new Message() )->sendMessage([ 'keywords' => 'ORDER_URGE_PAYMENT', 'order_id' => $params[ 'relate_id' ], 'site_id' => $order_info[ 'site_id' ] ]);
|
||||
}
|
||||
return success();
|
||||
}
|
||||
}
|
||||
39
app/event/order/OfflinePay.php
Executable file
39
app/event/order/OfflinePay.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\order;
|
||||
|
||||
use app\model\order\OrderCommon;
|
||||
|
||||
/**
|
||||
* 订单支付成功同步事件
|
||||
*/
|
||||
class OfflinePay
|
||||
{
|
||||
/**
|
||||
* 线下支付提交后记录支付方式
|
||||
* @param $pay_info
|
||||
* @return array|void
|
||||
*/
|
||||
public function handle($pay_info)
|
||||
{
|
||||
if($pay_info['event'] == 'OrderPayNotify'){
|
||||
$order_model = new OrderCommon();
|
||||
$pay_type_list = $order_model->getPayType();
|
||||
$res = $order_model->orderUpdate([
|
||||
'pay_type' => $pay_info['pay_type'],
|
||||
'pay_type_name' => $pay_type_list[$pay_info['pay_type']] ?? '',
|
||||
], [['out_trade_no', '=', $pay_info['out_trade_no']]]);
|
||||
return $res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
64
app/event/order/OrderComplete.php
Executable file
64
app/event/order/OrderComplete.php
Executable file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\order;
|
||||
|
||||
use app\model\member\Member;
|
||||
use app\model\member\MemberAccount;
|
||||
use app\model\member\MemberLevel;
|
||||
use app\model\order\OrderCommon;
|
||||
|
||||
/**
|
||||
* 订单完成事件
|
||||
*/
|
||||
class OrderComplete
|
||||
{
|
||||
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle($data)
|
||||
{
|
||||
//订单返还积分
|
||||
$order_model = new OrderCommon();
|
||||
$condition = [
|
||||
[ 'order_id', '=', $data[ 'order_id' ] ]
|
||||
];
|
||||
$order_info = $order_model->getOrderInfo($condition, 'order_money,order_status,site_id,member_id')[ 'data' ] ?? [];
|
||||
//如果缺失已完成
|
||||
if ($order_info[ 'order_status' ] == 10) {
|
||||
//会员等级 计算积分返还比率
|
||||
$site_id = $order_info[ 'site_id' ];
|
||||
$member_id = $order_info[ 'member_id' ];
|
||||
//存在散客的情况
|
||||
if ($member_id > 0) {
|
||||
$member_model = new Member();
|
||||
$member_info_result = $member_model->getMemberInfo([ [ 'member_id', '=', $member_id ], [ 'site_id', '=', $site_id ] ], 'member_level');
|
||||
$member_info = $member_info_result[ 'data' ];
|
||||
if ($member_info[ 'member_level' ] > 0) {
|
||||
$member_level_model = new MemberLevel();
|
||||
$member_level_info_result = $member_level_model->getMemberLevelInfo([ [ 'level_id', '=', $member_info[ 'member_level' ] ], [ 'site_id', '=', $site_id ] ], 'point_feedback');
|
||||
$member_level_info = $member_level_info_result[ 'data' ];
|
||||
if ($member_level_info[ 'point_feedback' ] > 0) {
|
||||
//计算返还的积分
|
||||
$point = round($order_info[ 'order_money' ] * $member_level_info[ 'point_feedback' ]);
|
||||
$member_account_model = new MemberAccount();
|
||||
$result = $member_account_model->addMemberAccount($site_id, $member_id, 'point', $point, 'order', '会员消费回馈积分', '会员消费奖励发放');
|
||||
if ($result[ 'code' ] < 0) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $order_model->success();
|
||||
}
|
||||
|
||||
}
|
||||
43
app/event/order/OrderCreate.php
Executable file
43
app/event/order/OrderCreate.php
Executable file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\order;
|
||||
|
||||
use app\model\goods\Cart;
|
||||
use app\model\system\Stat;
|
||||
|
||||
/**
|
||||
* 订单支付后店铺点单计算
|
||||
*/
|
||||
class OrderCreate
|
||||
{
|
||||
/**
|
||||
* 订单创建后事件
|
||||
* @param unknown $data
|
||||
*/
|
||||
public function handle($data)
|
||||
{
|
||||
/** @var \app\model\order\OrderCreate $order_object */
|
||||
$order_data = $data['create_data'];
|
||||
|
||||
$site_id = $order_data['site_id'];
|
||||
$order_id = $order_data['order_id'];
|
||||
$member_id = $order_data['member_id'];
|
||||
//添加统计
|
||||
$stat = new Stat();
|
||||
return $stat->switchStat([ 'type' => 'order_create', 'data' => [
|
||||
'site_id' => $site_id,
|
||||
'order_id' => $order_id,
|
||||
'member_id' => $member_id,
|
||||
'order_data' => $order_data
|
||||
] ]);
|
||||
}
|
||||
|
||||
}
|
||||
97
app/event/order/OrderCreateAfter.php
Executable file
97
app/event/order/OrderCreateAfter.php
Executable file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\order;
|
||||
|
||||
use app\model\goods\Cart;
|
||||
use app\model\message\Message;
|
||||
use app\model\order\OrderCommon;
|
||||
use app\model\order\OrderLog;
|
||||
use app\model\system\Stat;
|
||||
|
||||
/**
|
||||
* 订单创建后事件
|
||||
*/
|
||||
class OrderCreateAfter
|
||||
{
|
||||
/**
|
||||
* 传入订单信息
|
||||
* @param unknown $data
|
||||
*/
|
||||
public function handle($data)
|
||||
{
|
||||
//添加自动关闭事件
|
||||
/** @var \app\model\order\OrderCreate $order_object */
|
||||
$order_object = $data['order_object'];
|
||||
//清理订单缓存
|
||||
$order_object->deleteOrderCache($order_object->order_key);
|
||||
$order_data = $data['create_data'];
|
||||
$site_id = $order_data['site_id'];
|
||||
$order_id = $order_data['order_id'];
|
||||
$member_id = $order_data['member_id'];
|
||||
// $site_id = $order_object->site_id;
|
||||
// $order_id = $order_object->order_id;
|
||||
// $member_id = $order_object->member_id;
|
||||
//添加自动关闭事件
|
||||
$order_object->addOrderCronClose();
|
||||
//写日志
|
||||
$log_data = $order_data['log'] ?? [];
|
||||
if(!$log_data){
|
||||
//记录订单日志 start
|
||||
//获取用户信息
|
||||
$member_info = $order_object->member_account;
|
||||
|
||||
$buyer_name = !empty($member_info['nickname']) ? '【' . $member_info['nickname'] . '】' : '';
|
||||
$log_data = [
|
||||
'order_id' => $order_id,
|
||||
'action' => '买家下单了',
|
||||
'uid' => $member_id,
|
||||
'nick_name' => $member_info['nickname'],
|
||||
'action_way' => 1,
|
||||
'order_status' => 0,
|
||||
'order_status_name' => $order_object->order_type['order_status']['name']
|
||||
];
|
||||
}
|
||||
$order_common_model = new OrderCommon();
|
||||
OrderLog::addOrderLog($log_data, $order_common_model);
|
||||
//记录订单日志 end
|
||||
|
||||
|
||||
//清除购物车数据
|
||||
$cart_ids = $order_object->cart_ids;
|
||||
if (!empty($cart_ids)) {
|
||||
$cart = new Cart();
|
||||
$data_cart = [
|
||||
'cart_id' => $cart_ids,
|
||||
'member_id' => $member_id
|
||||
];
|
||||
if ($order_object->jielong_id == 0) {
|
||||
$cart->deleteCart($data_cart);
|
||||
}
|
||||
}
|
||||
//发送消息
|
||||
if($member_id > 0){
|
||||
//订单创建发消息
|
||||
$message_model = new Message();
|
||||
$message_model->sendMessage(['keywords' => 'ORDER_CREATE', 'order_id' => $order_id, 'site_id' => $site_id]);
|
||||
}
|
||||
|
||||
//添加统计
|
||||
$stat = new Stat();
|
||||
$stat->switchStat([ 'type' => 'order_create', 'data' => [
|
||||
'site_id' => $site_id,
|
||||
'order_id' => $order_id,
|
||||
'member_id' => $member_id,
|
||||
'order_data' => $order_data
|
||||
] ]);
|
||||
return success();
|
||||
}
|
||||
|
||||
}
|
||||
29
app/event/order/OrderPay.php
Executable file
29
app/event/order/OrderPay.php
Executable file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\order;
|
||||
|
||||
use app\model\system\Stat;
|
||||
|
||||
/**
|
||||
* 订单支付成功同步事件
|
||||
*/
|
||||
class OrderPay
|
||||
{
|
||||
/**
|
||||
* 传入订单信息
|
||||
* @param unknown $data
|
||||
*/
|
||||
public function handle($data)
|
||||
{
|
||||
return success();
|
||||
}
|
||||
|
||||
}
|
||||
31
app/event/order/OrderPayAfter.php
Executable file
31
app/event/order/OrderPayAfter.php
Executable file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\order;
|
||||
|
||||
use app\model\system\Stat;
|
||||
|
||||
/**
|
||||
* 订单支付成功异步事件
|
||||
*/
|
||||
class OrderPayAfter
|
||||
{
|
||||
/**
|
||||
* 传入订单信息
|
||||
* @param unknown $data
|
||||
*/
|
||||
public function handle($data)
|
||||
{
|
||||
//添加统计
|
||||
$stat = new Stat();
|
||||
return $stat->switchStat([ 'type' => 'order_pay', 'data' => $data ]);
|
||||
}
|
||||
|
||||
}
|
||||
29
app/event/order/OrderPayNotify.php
Executable file
29
app/event/order/OrderPayNotify.php
Executable file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\order;
|
||||
|
||||
use app\model\order\OrderCommon;
|
||||
|
||||
/**
|
||||
* 订单异步回调执行
|
||||
*/
|
||||
class OrderPayNotify
|
||||
{
|
||||
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle($data)
|
||||
{
|
||||
$order = new OrderCommon();
|
||||
return $order->orderOnlinePay($data);
|
||||
}
|
||||
|
||||
}
|
||||
68
app/event/order/OrderRefundFinish.php
Executable file
68
app/event/order/OrderRefundFinish.php
Executable file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\order;
|
||||
|
||||
use app\dict\order\OrderDict;
|
||||
use app\model\member\Member;
|
||||
use app\model\member\MemberAccount;
|
||||
use app\model\member\MemberLevel;
|
||||
use app\model\order\OrderCommon;
|
||||
use app\model\verify\Verify;
|
||||
|
||||
/**
|
||||
* 订单项退款完成后
|
||||
*/
|
||||
class OrderRefundFinish
|
||||
{
|
||||
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle($data)
|
||||
{
|
||||
$order_info = $data['order_info'];
|
||||
if (!empty($order_info) && in_array($order_info['order_type'], [OrderDict::store, OrderDict::virtual])) {
|
||||
$order_goods_info = $data['order_goods_info'];
|
||||
//核销商品操作
|
||||
if ($order_info['order_type'] == OrderDict::store) {//自提订单
|
||||
$verify_code = $order_info['delivery_code'];
|
||||
} else //虚拟订单
|
||||
$verify_code = $order_info['virtual_code'];
|
||||
|
||||
$verify_model = new Verify();
|
||||
$verify_condition = [
|
||||
['verify_code', '=', $verify_code]
|
||||
];
|
||||
$verify_info = $verify_model->getVerifyInfo($verify_condition)['data'] ?? [];
|
||||
if (!empty($verify_info)) {
|
||||
$json_data = $verify_info['data'];
|
||||
$item_array = $json_data['item_array'];
|
||||
foreach ($item_array as $k => $v) {
|
||||
if ($v['order_goods_id'] == $order_goods_info['order_goods_id']) {
|
||||
unset($item_array[$k]);
|
||||
}
|
||||
}
|
||||
sort($item_array);
|
||||
$json_data['item_array'] = $item_array;
|
||||
|
||||
$json_string = json_encode($json_data, JSON_UNESCAPED_UNICODE);
|
||||
$verify_data = [
|
||||
'verify_content_json' => $json_string
|
||||
];
|
||||
$verify_result = $verify_model->editVerify($verify_data, $verify_condition);
|
||||
if ($verify_result['code'] < 0) {
|
||||
return $verify_result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
30
app/event/order/WapOrderDetailPathByPayInfo.php
Executable file
30
app/event/order/WapOrderDetailPathByPayInfo.php
Executable file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\order;
|
||||
|
||||
use app\model\order\OrderCommon;
|
||||
|
||||
/**
|
||||
* 通过支付信息获取手机端订单详情路径
|
||||
*/
|
||||
class WapOrderDetailPathByPayInfo
|
||||
{
|
||||
public function handle($data)
|
||||
{
|
||||
if($data['event'] == 'OrderPayNotify'){
|
||||
$order_common = new OrderCommon();
|
||||
$order_info = $order_common->getOrderInfo([['out_trade_no', '=', $data['out_trade_no']]], 'order_id')['data'];
|
||||
if(!empty($order_info)){
|
||||
return '/pages/order/detail?order_id='.$order_info['order_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
29
app/event/pay/CronPayTransferResult.php
Executable file
29
app/event/pay/CronPayTransferResult.php
Executable file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\pay;
|
||||
|
||||
use app\model\system\PayTransfer;
|
||||
|
||||
/**
|
||||
* 定时查询转账结果
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
class CronPayTransferResult
|
||||
{
|
||||
public function handle($param)
|
||||
{
|
||||
$model = new PayTransfer();
|
||||
$result = $model->result($param['relate_id']);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
27
app/event/pay/OnlinePayEvent.php
Executable file
27
app/event/pay/OnlinePayEvent.php
Executable file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\pay;
|
||||
|
||||
use app\model\system\Pay;
|
||||
|
||||
/**
|
||||
* 支付回调事件
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
class OnlinePayEvent
|
||||
{
|
||||
public function handle($param)
|
||||
{
|
||||
return (new Pay)->onlinePayEvent($param['relate_id'], [], 4);
|
||||
}
|
||||
}
|
||||
29
app/event/promotion/CloseGame.php
Executable file
29
app/event/promotion/CloseGame.php
Executable file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\promotion;
|
||||
|
||||
use app\model\games\Games;
|
||||
|
||||
/**
|
||||
* 关闭小游戏
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
class CloseGame
|
||||
{
|
||||
public function handle($param)
|
||||
{
|
||||
$model = new Games();
|
||||
$result = $model->cronCloseGames($param['relate_id']);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
29
app/event/promotion/OpenGame.php
Executable file
29
app/event/promotion/OpenGame.php
Executable file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\promotion;
|
||||
|
||||
use app\model\games\Games;
|
||||
|
||||
/**
|
||||
* 开启小游戏
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
class OpenGame
|
||||
{
|
||||
public function handle($param)
|
||||
{
|
||||
$model = new Games();
|
||||
$result = $model->cronOpenGames($param['relate_id']);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
30
app/event/promotion/PromotionPage.php
Executable file
30
app/event/promotion/PromotionPage.php
Executable file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\promotion;
|
||||
|
||||
/**
|
||||
* 营销活动页面
|
||||
*/
|
||||
class PromotionPage
|
||||
{
|
||||
public function handle($params)
|
||||
{
|
||||
$page_list = [
|
||||
[
|
||||
'name' => 'GOODS_DETAIL',
|
||||
'title' => '商品详情',
|
||||
'wap_url' => '/pages/goods/detail?goods_id=$goods_id',
|
||||
'web_url' => '',
|
||||
],
|
||||
];
|
||||
return $page_list;
|
||||
}
|
||||
}
|
||||
67
app/event/promotion/PromotionQrcode.php
Executable file
67
app/event/promotion/PromotionQrcode.php
Executable file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\promotion;
|
||||
|
||||
|
||||
use app\model\web\Config as ConfigModel;
|
||||
|
||||
/**
|
||||
* 营销活动二维码
|
||||
*/
|
||||
class PromotionQrcode
|
||||
{
|
||||
|
||||
/**
|
||||
* 活动展示
|
||||
* @param $params
|
||||
* @return array
|
||||
*/
|
||||
public function handle($params)
|
||||
{
|
||||
$solitaire = [];
|
||||
|
||||
$qrcode_all = event('Qrcode', [
|
||||
'site_id' => $params[ 'site_id' ],
|
||||
'app_type' => $params[ 'app_type' ] ?? 'all',
|
||||
'type' => 'get',
|
||||
'data' => $params[ 'data' ],
|
||||
'page' => $params[ 'page' ],
|
||||
'qrcode_path' => $params[ 'qrcode_path' ],
|
||||
'qrcode_name' => $params[ 'qrcode_name' ],
|
||||
]);
|
||||
|
||||
if (!empty($qrcode_all)) {
|
||||
foreach ($qrcode_all as $item) {
|
||||
if ($item[ 'code' ] == 0) $solitaire[ $item[ 'data' ][ 'type' ] ] = $item[ 'data' ];
|
||||
}
|
||||
}
|
||||
|
||||
if (addon_is_exit('pc') == 1 && !empty($params[ 'pc_data' ]) && !empty($params[ 'pc_page' ])) {
|
||||
$pc_qrcode = event('Qrcode', [
|
||||
'site_id' => $params[ 'site_id' ],
|
||||
'app_type' => 'pc',
|
||||
'type' => 'create',
|
||||
'data' => $params[ 'pc_data' ],
|
||||
'page' => $params[ 'pc_page' ],
|
||||
'qrcode_path' => $params[ 'qrcode_path' ],
|
||||
'qrcode_name' => 'pc_' . $params[ 'qrcode_name' ],
|
||||
], true);
|
||||
if ($pc_qrcode[ 'code' ] >= 0) {
|
||||
$solitaire[ 'pc' ][ 'path' ] = $pc_qrcode[ 'data' ][ 'path' ];
|
||||
$config_model = new ConfigModel();
|
||||
$domain_name_pc = $config_model->getPcDomainName()[ 'data' ][ 'value' ][ 'domain_name_pc' ];
|
||||
$solitaire[ 'pc' ][ 'url' ] = $domain_name_pc . $params[ 'pc_path' ];
|
||||
}
|
||||
}
|
||||
|
||||
return $solitaire;
|
||||
}
|
||||
}
|
||||
36
app/event/promotion/ShowPromotion.php
Executable file
36
app/event/promotion/ShowPromotion.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\promotion;
|
||||
|
||||
/**
|
||||
* 平台推广营销类展示
|
||||
*/
|
||||
class ShowPromotion
|
||||
{
|
||||
|
||||
/**
|
||||
* 活动展示
|
||||
* @return array
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$data = [
|
||||
'admin' => [
|
||||
|
||||
],
|
||||
'shop' => [
|
||||
|
||||
]
|
||||
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
33
app/event/stat/CronStatCron.php
Executable file
33
app/event/stat/CronStatCron.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\stat;
|
||||
|
||||
use app\model\stat\StatStore;
|
||||
use app\model\system\Stat;
|
||||
|
||||
/**
|
||||
* 门店统计任务执行
|
||||
*/
|
||||
class CronStatCron
|
||||
{
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle($data)
|
||||
{
|
||||
$id = $data['relate_id'];
|
||||
$info = model('stat_shop_cron')->getInfo([['id', '=', $id]]);
|
||||
if(empty($info)){
|
||||
return [];
|
||||
}
|
||||
$stat_model = new Stat();
|
||||
$stat_model->switchStat(['type' => $info['type'], 'data' => json_decode($info['data'], true),'async'=>false]);
|
||||
model('stat_shop_cron')->delete([['id', '=', $id]]);
|
||||
}
|
||||
}
|
||||
26
app/event/stat/CronStatShop.php
Executable file
26
app/event/stat/CronStatShop.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\stat;
|
||||
|
||||
use app\model\stat\StatShop;
|
||||
|
||||
/**
|
||||
* 店铺统计(计划任务)
|
||||
*/
|
||||
class CronStatShop
|
||||
{
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle($data)
|
||||
{
|
||||
$shop_stat = new StatShop();
|
||||
$shop_stat->cronShopStat();
|
||||
}
|
||||
}
|
||||
26
app/event/stat/CronStatShopHour.php
Executable file
26
app/event/stat/CronStatShopHour.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\stat;
|
||||
|
||||
use app\model\stat\StatShop;
|
||||
|
||||
/**
|
||||
* 店铺小时统计(计划任务)
|
||||
*/
|
||||
class CronStatShopHour
|
||||
{
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle($data)
|
||||
{
|
||||
$shop_stat = new StatShop();
|
||||
$shop_stat->cronShopStatHour();
|
||||
}
|
||||
}
|
||||
26
app/event/stat/CronStatStore.php
Executable file
26
app/event/stat/CronStatStore.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\stat;
|
||||
|
||||
use app\model\stat\StatStore;
|
||||
|
||||
/**
|
||||
* 门店统计计划任务
|
||||
*/
|
||||
class CronStatStore
|
||||
{
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle($data)
|
||||
{
|
||||
$shop_stat = new StatStore();
|
||||
$shop_stat->cronStatStore();
|
||||
}
|
||||
}
|
||||
26
app/event/stat/CronStatStoreHour.php
Executable file
26
app/event/stat/CronStatStoreHour.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\stat;
|
||||
|
||||
use app\model\stat\StatStore;
|
||||
|
||||
/**
|
||||
* 门店小时统计(计划任务)
|
||||
*/
|
||||
class CronStatStoreHour
|
||||
{
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle($data)
|
||||
{
|
||||
$shop_stat = new StatStore();
|
||||
$shop_stat->cronStatStoreHour();
|
||||
}
|
||||
}
|
||||
33
app/event/verify/CronVerifyCodeExpire.php
Executable file
33
app/event/verify/CronVerifyCodeExpire.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\verify;
|
||||
|
||||
use app\model\message\Message;
|
||||
use app\model\verify\Verify;
|
||||
|
||||
|
||||
/**
|
||||
* 核销码过期提醒
|
||||
*/
|
||||
class CronVerifyCodeExpire
|
||||
{
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle($data)
|
||||
{
|
||||
// 商品表
|
||||
$goods_virtual_info = model('goods_virtual')->getInfo([["order_id", "=", $data["relate_id"]], ['expire_time', '<=', time()], ['is_veirfy', '=', 0]]);
|
||||
if (!empty($goods_virtual_info)) {
|
||||
(new Message())->sendMessage(['keywords' => 'VERIFY_CODE_EXPIRE', 'relate_id' => $data['relate_id'], 'site_id' => $goods_virtual_info['site_id']]);
|
||||
(new Verify())->verifyCodeExpire($goods_virtual_info);
|
||||
}
|
||||
return success();
|
||||
}
|
||||
}
|
||||
31
app/event/verify/PickupOrderVerify.php
Executable file
31
app/event/verify/PickupOrderVerify.php
Executable file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\verify;
|
||||
|
||||
use app\model\order\StoreOrder;
|
||||
|
||||
/**
|
||||
* 门店订单提货
|
||||
*/
|
||||
class PickupOrderVerify
|
||||
{
|
||||
|
||||
public function handle($data)
|
||||
{
|
||||
if ($data[ 'verify_type' ] == 'pickup') {
|
||||
$store_order = new StoreOrder();
|
||||
$result = $store_order->verify($data[ 'verify_code' ]);
|
||||
return $result;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
30
app/event/verify/VerifyOrderOutTime.php
Executable file
30
app/event/verify/VerifyOrderOutTime.php
Executable file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\verify;
|
||||
|
||||
use app\model\message\Message;
|
||||
|
||||
/**
|
||||
* 核销商品临期提醒
|
||||
*/
|
||||
class VerifyOrderOutTime
|
||||
{
|
||||
// 行为扩展的执行入口必须是run
|
||||
public function handle($data)
|
||||
{
|
||||
// 商品表
|
||||
$goods_virtual_info = model('goods_virtual')->getInfo([ ["order_id", "=", $data["relate_id"] ] ]);
|
||||
if(!empty($goods_virtual_info)){
|
||||
(new Message())->sendMessage(['keywords' => 'ORDER_VERIFY_OUT_TIME', 'order_id' => $data['relate_id'], 'site_id' => $goods_virtual_info['site_id'] ]);
|
||||
}
|
||||
return success();
|
||||
}
|
||||
}
|
||||
31
app/event/verify/VirtualGoodsVerify.php
Executable file
31
app/event/verify/VirtualGoodsVerify.php
Executable file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\verify;
|
||||
|
||||
use app\model\goods\VirtualGoods;
|
||||
|
||||
/**
|
||||
* 虚拟商品核销
|
||||
*/
|
||||
class VirtualGoodsVerify
|
||||
{
|
||||
|
||||
public function handle($data)
|
||||
{
|
||||
if ($data[ 'verify_type' ] == 'virtualgoods') {
|
||||
$virtual_goods_model = new VirtualGoods();
|
||||
$res = $virtual_goods_model->verify($data[ "verify_code" ]);
|
||||
return $res;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
28
app/event/wechat/WchatShareConfig.php
Executable file
28
app/event/wechat/WchatShareConfig.php
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\wechat;
|
||||
|
||||
use app\model\share\WchatShare as ShareModel;
|
||||
|
||||
|
||||
/**
|
||||
* 获取分享配置
|
||||
*/
|
||||
class WchatShareConfig
|
||||
{
|
||||
public function handle($param)
|
||||
{
|
||||
$share_model = new ShareModel();
|
||||
return $share_model->getShareConfig($param);
|
||||
}
|
||||
|
||||
}
|
||||
28
app/event/wechat/WchatShareData.php
Executable file
28
app/event/wechat/WchatShareData.php
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\wechat;
|
||||
|
||||
use app\model\share\WchatShare as ShareModel;
|
||||
|
||||
|
||||
/**
|
||||
* 获取分享数据
|
||||
*/
|
||||
class WchatShareData
|
||||
{
|
||||
public function handle($param)
|
||||
{
|
||||
$share_model = new ShareModel();
|
||||
return $share_model->getShareData($param);
|
||||
}
|
||||
|
||||
}
|
||||
28
app/event/wechat/WeappShareConfig.php
Executable file
28
app/event/wechat/WeappShareConfig.php
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\wechat;
|
||||
|
||||
use app\model\share\WeappShare as ShareModel;
|
||||
|
||||
|
||||
/**
|
||||
* 获取分享配置
|
||||
*/
|
||||
class WeappShareConfig
|
||||
{
|
||||
public function handle($param)
|
||||
{
|
||||
$share_model = new ShareModel();
|
||||
return $share_model->getShareConfig($param);
|
||||
}
|
||||
|
||||
}
|
||||
28
app/event/wechat/WeappShareData.php
Executable file
28
app/event/wechat/WeappShareData.php
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace app\event\wechat;
|
||||
|
||||
use app\model\share\WeappShare as ShareModel;
|
||||
|
||||
|
||||
/**
|
||||
* 获取分享数据
|
||||
*/
|
||||
class WeappShareData
|
||||
{
|
||||
public function handle($param)
|
||||
{
|
||||
$share_model = new ShareModel();
|
||||
return $share_model->getShareData($param);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user