初始上传
This commit is contained in:
50
addon/wechat/event/AddSiteReplay.php
Executable file
50
addon/wechat/event/AddSiteReplay.php
Executable file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\wechat\event;
|
||||
|
||||
use addon\wechat\model\Replay;
|
||||
|
||||
/**
|
||||
* 增加站点关注回复
|
||||
*/
|
||||
class AddSiteReplay
|
||||
{
|
||||
|
||||
public function handle($param)
|
||||
{
|
||||
if (!empty($param[ 'site_id' ])) {
|
||||
|
||||
$replay = new Replay();
|
||||
$data = [
|
||||
'site_id' => $param[ 'site_id' ],
|
||||
'rule_name' => '关注回复',
|
||||
'rule_type' => 'AFTER',
|
||||
'keywords_json' => '',
|
||||
'replay_json' => '[{"type":"text","reply_content":"关注回复"}]',
|
||||
'create_time' => time()
|
||||
];
|
||||
$res = $replay->addRule($data);
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
27
addon/wechat/event/CronMessageSend.php
Executable file
27
addon/wechat/event/CronMessageSend.php
Executable file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\system\Wechat\event;
|
||||
|
||||
use addon\system\Wechat\common\model\WechatMessage;
|
||||
|
||||
class CronMessageSend
|
||||
{
|
||||
/**
|
||||
* 邮箱消息延时发送
|
||||
* @param array $param
|
||||
*/
|
||||
public function handle($param = [])
|
||||
{
|
||||
$wechat_message = new WechatMessage();
|
||||
$res = $wechat_message->cronMessageSend($param);
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
25
addon/wechat/event/Install.php
Executable file
25
addon/wechat/event/Install.php
Executable file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\Wechat\event;
|
||||
|
||||
/**
|
||||
* 应用安装
|
||||
*/
|
||||
class Install
|
||||
{
|
||||
/**
|
||||
* 执行安装
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return success();
|
||||
}
|
||||
}
|
||||
47
addon/wechat/event/OAuthLogin.php
Executable file
47
addon/wechat/event/OAuthLogin.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\system\Wechat\event;
|
||||
|
||||
use addon\wechat\model\Wechat;
|
||||
use liliuwei\think\Jump;
|
||||
|
||||
/**
|
||||
* 应用安装
|
||||
*/
|
||||
class OAuthLogin
|
||||
{
|
||||
use Jump;
|
||||
|
||||
/**
|
||||
* 授权登录
|
||||
* @param array $params
|
||||
*/
|
||||
public function handle($params = [])
|
||||
{
|
||||
if ($params[ 'name' ] == 'Wechat') {
|
||||
$wechat_model = new Wechat();
|
||||
$wechat_config = $wechat_model->getWechatConfigInfo($params[ 'site_id' ]);
|
||||
|
||||
if (empty($wechat_config[ 'data' ][ 'value' ])) {
|
||||
$this->error('站点未配置微信公众号');
|
||||
} else {
|
||||
$value = $wechat_config[ 'data' ][ 'value' ];
|
||||
if (empty($value[ 'appid' ]) || empty($value[ 'appsecret' ])) {
|
||||
$this->error('请配置您公众号的AppID和AppSecret');
|
||||
} else {
|
||||
$redirect_url = addon_url('wechat://common/login/callback', [ 'site_id' => $params[ 'site_id' ] ]);
|
||||
$get_request_code_url = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' . $value[ 'appid' ] . '&redirect_uri=' . $redirect_url . '&response_type=code&scope=snsapi_userinfo&state=niucloud#wechat_redirect';
|
||||
$this->redirect($get_request_code_url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
25
addon/wechat/event/UnInstall.php
Executable file
25
addon/wechat/event/UnInstall.php
Executable file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\Wechat\event;
|
||||
|
||||
/**
|
||||
* 应用卸载
|
||||
*/
|
||||
class UnInstall
|
||||
{
|
||||
/**
|
||||
* 执行卸载
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return error('', 'System addon can not be uninstalled!');
|
||||
}
|
||||
}
|
||||
32
addon/wechat/event/WechatMessage.php
Executable file
32
addon/wechat/event/WechatMessage.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\system\Wechat\event;
|
||||
|
||||
use liliuwei\think\Jump;
|
||||
use addon\system\Wechat\common\model\WechatMessage as WechatMessageModel;
|
||||
|
||||
class WechatMessage
|
||||
{
|
||||
use Jump;
|
||||
|
||||
/**
|
||||
* 微信模板消息
|
||||
* @param array $param
|
||||
* @return array
|
||||
*/
|
||||
public function handle($param = [])
|
||||
{
|
||||
$wechat_message = new WechatMessageModel();
|
||||
$res = $wechat_message->sendMessage($param);
|
||||
return $res;
|
||||
}
|
||||
|
||||
}
|
||||
23
addon/wechat/event/WechatMsg.php
Executable file
23
addon/wechat/event/WechatMsg.php
Executable file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\system\Wechat\event;
|
||||
|
||||
use addon\system\Wechat\common\model\Wechat;
|
||||
|
||||
class WechatMsg
|
||||
{
|
||||
public function handle($param = [])
|
||||
{
|
||||
$wechat_config = new Wechat();
|
||||
$res = $wechat_config->sendTemplateMsg(request()->siteid(), $param);
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user