初始上传
This commit is contained in:
38
addon/memberwithdraw/config/diy_view.php
Executable file
38
addon/memberwithdraw/config/diy_view.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
return [
|
||||
|
||||
// 自定义模板页面类型,格式:[ 'title' => '页面类型名称', 'name' => '页面标识', 'path' => '页面路径', 'value' => '页面数据,json格式' ]
|
||||
'template' => [],
|
||||
|
||||
// 后台自定义组件——装修
|
||||
'util' => [],
|
||||
|
||||
// 自定义页面路径
|
||||
'link' => [],
|
||||
|
||||
// 自定义图标库
|
||||
'icon_library' => [],
|
||||
|
||||
// uni-app 组件,格式:[ 'name' => '组件名称/文件夹名称', 'path' => '文件路径/目录路径' ],多个逗号隔开,自定义组件名称前缀必须是diy-,也可以引用第三方组件
|
||||
'component' => [],
|
||||
|
||||
// uni-app 页面,多个逗号隔开
|
||||
'pages' => [],
|
||||
|
||||
// 模板信息,格式:'title' => '模板名称', 'name' => '模板标识', 'cover' => '模板封面图', 'preview' => '模板预览图', 'desc' => '模板描述'
|
||||
'info' => [],
|
||||
|
||||
// 主题风格配色,格式可以自由定义扩展,【在uni-app中通过:this.themeStyle... 获取定义的颜色字段,例如:this.themeStyle.main_color】
|
||||
'theme' => [],
|
||||
|
||||
// 自定义页面数据,格式:[ 'title' => '页面名称', 'name' => "页面标识", 'value' => [页面数据,json格式] ]
|
||||
'data' => []
|
||||
];
|
||||
20
addon/memberwithdraw/config/event.php
Executable file
20
addon/memberwithdraw/config/event.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// 事件定义文件
|
||||
return [
|
||||
'bind' => [
|
||||
|
||||
],
|
||||
|
||||
'listen' => [
|
||||
//转账结果通知
|
||||
'PayTransferNotify' => [
|
||||
'addon\memberwithdraw\event\WithdrawTransferNotify',
|
||||
],
|
||||
'PayTransferCheck' => [
|
||||
'addon\memberwithdraw\event\WithdrawTransferCheck',
|
||||
],
|
||||
],
|
||||
|
||||
'subscribe' => [
|
||||
],
|
||||
];
|
||||
21
addon/memberwithdraw/config/info.php
Executable file
21
addon/memberwithdraw/config/info.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
return [
|
||||
'name' => 'memberwithdraw',
|
||||
'title' => '会员提现',
|
||||
'description' => '会员提现',
|
||||
'type' => 'tool', //插件类型 system :系统插件(自动安装),promotion:扩展营销插件 tool:工具插件
|
||||
'status' => 1,
|
||||
'author' => '',
|
||||
'version' => '5.5.3',
|
||||
'version_no' => '553250709001',
|
||||
'content' => '',
|
||||
];
|
||||
26
addon/memberwithdraw/config/menu_shop.php
Executable file
26
addon/memberwithdraw/config/menu_shop.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 平台端菜单设置
|
||||
// +----------------------------------------------------------------------
|
||||
return [
|
||||
[
|
||||
'name' => 'MEMBERWITHDRAW',
|
||||
'title' => '会员提现',
|
||||
'url' => 'memberwithdraw://shop/withdraw/transfer',
|
||||
'parent' => 'PROMOTION_CENTER',
|
||||
'is_show' => 0,
|
||||
'is_control' => 1,
|
||||
'is_icon' => 0,
|
||||
'picture' => '',
|
||||
'picture_select' => '',
|
||||
'sort' => 100,
|
||||
],
|
||||
[
|
||||
'parent' => 'CONFIG_BASE_ORDER',
|
||||
'name' => 'MEMBER_WITHDRAW_CONFIG',
|
||||
'title' => '提现设置',
|
||||
'url' => 'shop/memberwithdraw/config',
|
||||
'is_show' => 1,
|
||||
'sort' => 3,
|
||||
],
|
||||
];
|
||||
1
addon/memberwithdraw/data/install.sql
Executable file
1
addon/memberwithdraw/data/install.sql
Executable file
@@ -0,0 +1 @@
|
||||
SET NAMES 'utf8';
|
||||
1
addon/memberwithdraw/data/uninstall.sql
Executable file
1
addon/memberwithdraw/data/uninstall.sql
Executable file
@@ -0,0 +1 @@
|
||||
SET NAMES 'utf8';
|
||||
26
addon/memberwithdraw/event/Install.php
Executable file
26
addon/memberwithdraw/event/Install.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\memberwithdraw\event;
|
||||
|
||||
/**
|
||||
* 应用安装
|
||||
*/
|
||||
class Install
|
||||
{
|
||||
/**
|
||||
* 执行安装
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return success();
|
||||
}
|
||||
}
|
||||
26
addon/memberwithdraw/event/UnInstall.php
Executable file
26
addon/memberwithdraw/event/UnInstall.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\memberwithdraw\event;
|
||||
|
||||
/**
|
||||
* 应用卸载
|
||||
*/
|
||||
class UnInstall
|
||||
{
|
||||
/**
|
||||
* 执行卸载
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return error('', "系统插件不允许删除");
|
||||
}
|
||||
}
|
||||
29
addon/memberwithdraw/event/WithdrawTransferCheck.php
Executable file
29
addon/memberwithdraw/event/WithdrawTransferCheck.php
Executable file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\memberwithdraw\event;
|
||||
|
||||
use addon\memberwithdraw\model\Withdraw;
|
||||
|
||||
|
||||
/**
|
||||
* 提现转账通知
|
||||
*/
|
||||
class WithdrawTransferCheck
|
||||
{
|
||||
public function handle($param)
|
||||
{
|
||||
if($param['from_type'] == 'member_withdraw'){
|
||||
$model = new Withdraw();
|
||||
return $model->transferCheck($param['relate_tag']);
|
||||
}
|
||||
}
|
||||
}
|
||||
29
addon/memberwithdraw/event/WithdrawTransferNotify.php
Executable file
29
addon/memberwithdraw/event/WithdrawTransferNotify.php
Executable file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\memberwithdraw\event;
|
||||
|
||||
use addon\memberwithdraw\model\Withdraw;
|
||||
|
||||
|
||||
/**
|
||||
* 提现转账通知
|
||||
*/
|
||||
class WithdrawTransferNotify
|
||||
{
|
||||
public function handle($param)
|
||||
{
|
||||
if($param['from_type'] == 'member_withdraw'){
|
||||
$model = new Withdraw();
|
||||
return $model->transferNotify($param);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
addon/memberwithdraw/icon.png
Executable file
BIN
addon/memberwithdraw/icon.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
110
addon/memberwithdraw/model/Withdraw.php
Executable file
110
addon/memberwithdraw/model/Withdraw.php
Executable file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\memberwithdraw\model;
|
||||
|
||||
use app\model\BaseModel;
|
||||
use app\model\member\Withdraw as MemberWithdraw;
|
||||
use app\model\system\PayTransfer;
|
||||
|
||||
/**
|
||||
* 会员提现
|
||||
*/
|
||||
class Withdraw extends BaseModel
|
||||
{
|
||||
|
||||
/**
|
||||
* 转账
|
||||
* @param $condition
|
||||
*/
|
||||
public function transfer($id)
|
||||
{
|
||||
$withdraw_model = new MemberWithdraw();
|
||||
$info_result = $withdraw_model->getMemberWithdrawInfo([ [ "id", "=", $id ] ], "withdraw_no,account_number,realname,money,memo,transfer_type,site_id,applet_type,member_id,status");
|
||||
if (empty($info_result[ "data" ]))
|
||||
return $this->error();
|
||||
|
||||
$info = $info_result[ "data" ];
|
||||
if (!in_array($info[ "transfer_type" ], [ "wechatpay", "alipay" ]))
|
||||
return $this->error('', "当前提现方式不支持在线转账");
|
||||
|
||||
$pay_transfer_model = new PayTransfer();
|
||||
$transfer_res = $pay_transfer_model->transfer('member_withdraw', $id);
|
||||
return $transfer_res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转账结果通知
|
||||
* @param $param
|
||||
* @return array
|
||||
* @throws \think\db\exception\DbException
|
||||
*/
|
||||
public function transferNotify($param)
|
||||
{
|
||||
$id = $param['relate_tag'];
|
||||
$site_id = $param['site_id'];
|
||||
$withdraw_model = new MemberWithdraw();
|
||||
$withdraw_info = $withdraw_model->getMemberWithdrawInfo([
|
||||
['id', '=', $id ],
|
||||
['site_id', '=', $site_id],
|
||||
], "*")['data'];
|
||||
if(empty($withdraw_info)){
|
||||
return $this->error(null, '提现信息有误');
|
||||
}
|
||||
|
||||
//成功的处理
|
||||
switch($param['status']){
|
||||
case PayTransfer::STATUS_IN_PROCESS:
|
||||
return $withdraw_model->transferInProcess([
|
||||
'id' => $withdraw_info['id'],
|
||||
'site_id' => $withdraw_info['site_id'],
|
||||
]);
|
||||
break;
|
||||
case PayTransfer::STATUS_SUCCESS:
|
||||
return $withdraw_model->transferFinish([
|
||||
'id' => $withdraw_info['id'],
|
||||
'site_id' => $withdraw_info['site_id'],
|
||||
]);
|
||||
break;
|
||||
case PayTransfer::STATUS_FAIL:
|
||||
$resp_data = json_decode($param['resp_data'], true);
|
||||
$fail_reason = $resp_data['fail_reason'] ?? '';
|
||||
return $withdraw_model->transferFail([
|
||||
'id' => $withdraw_info['id'],
|
||||
'site_id' => $withdraw_info['site_id'],
|
||||
'fail_reason' => $fail_reason,
|
||||
]);
|
||||
break;
|
||||
default:
|
||||
return $this->error(null, '转账结果状态有误');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 转账检测
|
||||
* @param $id
|
||||
*/
|
||||
public function transferCheck($id)
|
||||
{
|
||||
$withdraw_model = new MemberWithdraw();
|
||||
$info_result = $withdraw_model->getMemberWithdrawInfo([ [ "id", "=", $id ] ], "withdraw_no,account_number,realname,money,memo,transfer_type,status");
|
||||
if (empty($info_result["data"]))
|
||||
return $this->error(null, '提现信息缺失');
|
||||
|
||||
$info = $info_result["data"];
|
||||
if(!in_array($info["transfer_type"], ["wechatpay","alipay"]))
|
||||
return $this->error('', "当前提现方式不支持在线转账");
|
||||
if($info['status'] != $withdraw_model::STATUS_WAIT_TRANSFER){
|
||||
return $this->error('', "当前提现单非待转账状态");
|
||||
}
|
||||
return $this->success();
|
||||
}
|
||||
}
|
||||
35
addon/memberwithdraw/shop/controller/Withdraw.php
Executable file
35
addon/memberwithdraw/shop/controller/Withdraw.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\memberwithdraw\shop\controller;
|
||||
|
||||
use addon\memberwithdraw\model\Withdraw as WithdrawModel;
|
||||
use app\shop\controller\BaseShop;
|
||||
|
||||
/**
|
||||
* 会员提现
|
||||
*/
|
||||
class Withdraw extends BaseShop
|
||||
{
|
||||
|
||||
/**
|
||||
* 转账
|
||||
*/
|
||||
public function transfer()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
$id = input('id', 0);
|
||||
$withdraw_model = new WithdrawModel();
|
||||
$result = $withdraw_model->transfer($id);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user