mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2025-12-12 19:02:49 +00:00
1.5.0
This commit is contained in:
parent
b6b7198a2d
commit
941910a528
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'version' => '1.4.4',
|
'version' => '1.5.1',
|
||||||
'code' => '202501030001'
|
'code' => '2025022201'
|
||||||
];
|
];
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Niucloud-admin 企业快速开发的saas管理平台
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | 官方网址:https://www.niucloud.com
|
// | 官方网址:https://www.niucloud.com
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|||||||
38
niucloud/core/dict/DiyFormComponent.php
Normal file
38
niucloud/core/dict/DiyFormComponent.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 官方网址:https://www.niucloud.com
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | niucloud团队 版权所有 开源版本可自由商用
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: Niucloud Team
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
namespace core\dict;
|
||||||
|
|
||||||
|
class DiyFormComponent extends BaseDict
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 万能表单组件配置
|
||||||
|
* @param array $data
|
||||||
|
* @return array|mixed
|
||||||
|
*/
|
||||||
|
public function load(array $data)
|
||||||
|
{
|
||||||
|
$addons = $this->getLocalAddons();
|
||||||
|
$components_files = [];
|
||||||
|
|
||||||
|
foreach ($addons as $v) {
|
||||||
|
$components_path = $this->getAddonDictPath($v) . "diy_form" . DIRECTORY_SEPARATOR . "components.php";
|
||||||
|
if (is_file($components_path)) {
|
||||||
|
$components_files[] = $components_path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$components_files_data = $this->loadFiles($components_files);
|
||||||
|
$components = $data;
|
||||||
|
foreach ($components_files_data as $file_data) {
|
||||||
|
$components = empty($components) ? $file_data : array_merge2($components, $file_data);
|
||||||
|
}
|
||||||
|
return $components;
|
||||||
|
}
|
||||||
|
}
|
||||||
38
niucloud/core/dict/DiyFormTemplate.php
Normal file
38
niucloud/core/dict/DiyFormTemplate.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 官方网址:https://www.niucloud.com
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | niucloud团队 版权所有 开源版本可自由商用
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: Niucloud Team
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
namespace core\dict;
|
||||||
|
|
||||||
|
class DiyFormTemplate extends BaseDict
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 万能表单模版
|
||||||
|
* @param array $data
|
||||||
|
* @return array|mixed
|
||||||
|
*/
|
||||||
|
public function load(array $data)
|
||||||
|
{
|
||||||
|
$addons = $this->getLocalAddons();
|
||||||
|
$components_files = [];
|
||||||
|
|
||||||
|
foreach ($addons as $v) {
|
||||||
|
$components_path = $this->getAddonDictPath($v) . "diy_form" . DIRECTORY_SEPARATOR . "template.php";
|
||||||
|
if (is_file($components_path)) {
|
||||||
|
$components_files[] = $components_path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$components_files_data = $this->loadFiles($components_files);
|
||||||
|
$components = $data;
|
||||||
|
foreach ($components_files_data as $file_data) {
|
||||||
|
$components = empty($components) ? $file_data : array_merge2($components, $file_data);
|
||||||
|
}
|
||||||
|
return $components;
|
||||||
|
}
|
||||||
|
}
|
||||||
38
niucloud/core/dict/DiyFormType.php
Normal file
38
niucloud/core/dict/DiyFormType.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 官方网址:https://www.niucloud.com
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | niucloud团队 版权所有 开源版本可自由商用
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: Niucloud Team
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
namespace core\dict;
|
||||||
|
|
||||||
|
class DiyFormType extends BaseDict
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 万能表单组件配置
|
||||||
|
* @param array $data
|
||||||
|
* @return array|mixed
|
||||||
|
*/
|
||||||
|
public function load(array $data)
|
||||||
|
{
|
||||||
|
$addons = $this->getLocalAddons();
|
||||||
|
$components_files = [];
|
||||||
|
|
||||||
|
foreach ($addons as $v) {
|
||||||
|
$components_path = $this->getAddonDictPath($v) . "diy_form" . DIRECTORY_SEPARATOR . "type.php";
|
||||||
|
if (is_file($components_path)) {
|
||||||
|
$components_files[] = $components_path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$components_files_data = $this->loadFiles($components_files);
|
||||||
|
$components = $data;
|
||||||
|
foreach ($components_files_data as $file_data) {
|
||||||
|
$components = empty($components) ? $file_data : array_merge2($components, $file_data);
|
||||||
|
}
|
||||||
|
return $components;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Niucloud-admin 企业快速开发的saas管理平台
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | 官方网址:https://www.niucloud.com
|
// | 官方网址:https://www.niucloud.com
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Niucloud-admin 企业快速开发的saas管理平台
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | 官方网址:https://www.niucloud.com
|
// | 官方网址:https://www.niucloud.com
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace core\pay;
|
namespace core\pay;
|
||||||
|
|
||||||
|
use app\dict\common\ChannelDict;
|
||||||
use app\dict\pay\OnlinePayDict;
|
use app\dict\pay\OnlinePayDict;
|
||||||
use app\dict\pay\RefundDict;
|
use app\dict\pay\RefundDict;
|
||||||
use app\dict\pay\TransferDict;
|
use app\dict\pay\TransferDict;
|
||||||
@ -224,21 +225,32 @@ class Wechatpay extends BasePay
|
|||||||
*/
|
*/
|
||||||
public function transfer(array $params)
|
public function transfer(array $params)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$to_data = $params['to_no'];//收款人数据
|
||||||
|
$channel = $to_data['channel'] ?? '';//渠道
|
||||||
|
$open_id = $to_data['open_id'] ?? '';//openid
|
||||||
|
|
||||||
|
if(empty($this->config['mch_id']) || empty($this->config['mch_secret_key']) || empty($this->config['mch_secret_cert']) || empty($this->config['mch_public_cert_path'])){
|
||||||
|
throw new PayException('WECHAT_TRANSFER_CONFIG_NOT_EXIST');
|
||||||
|
}
|
||||||
//这儿的批次信息可能是这儿生成的,但依然需要记录
|
//这儿的批次信息可能是这儿生成的,但依然需要记录
|
||||||
$order = [
|
$order = [
|
||||||
'out_batch_no' => $params['transfer_no'] . '',//
|
'out_batch_no' => ($to_data['out_batch_no'] ?? '') . '',//
|
||||||
'batch_name' => $params['remark'],
|
'batch_name' => $params['remark'] ?? '',
|
||||||
'batch_remark' => $params['remark'],
|
'batch_remark' => $params['remark'] ?? '',
|
||||||
];
|
];
|
||||||
|
if($channel == ChannelDict::WEAPP){
|
||||||
|
$order['_type'] = 'mini';
|
||||||
|
}
|
||||||
$transfer_list = $params['transfer_list'];
|
$transfer_list = $params['transfer_list'];
|
||||||
//单笔转账
|
//单笔转账
|
||||||
if (empty($transfer_list)) {
|
if (empty($transfer_list)) {
|
||||||
$transfer_list = [
|
$transfer_list = [
|
||||||
[
|
[
|
||||||
'transfer_no' => $params['transfer_no'] . '1',
|
'transfer_no' => $params['transfer_no'],
|
||||||
'money' => (int)$params['money'],
|
'money' => (int)$params['money'],
|
||||||
'remark' => $params['remark'],
|
'remark' => $params['remark'],
|
||||||
'openid' => $params['to_no']
|
'openid' => $open_id
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -247,7 +259,7 @@ class Wechatpay extends BasePay
|
|||||||
|
|
||||||
foreach ($transfer_list as $k => $v) {
|
foreach ($transfer_list as $k => $v) {
|
||||||
$item_transfer = [
|
$item_transfer = [
|
||||||
'out_detail_no' => $params['transfer_no'] . $k,
|
'out_detail_no' => $params['transfer_no'],
|
||||||
'transfer_amount' => (int)$v['money'],
|
'transfer_amount' => (int)$v['money'],
|
||||||
'transfer_remark' => $v['remark'],
|
'transfer_remark' => $v['remark'],
|
||||||
'openid' => $v['openid'],
|
'openid' => $v['openid'],
|
||||||
@ -261,8 +273,14 @@ class Wechatpay extends BasePay
|
|||||||
}
|
}
|
||||||
$order['total_amount'] = $total_amount;
|
$order['total_amount'] = $total_amount;
|
||||||
$order['total_num'] = $total_num;
|
$order['total_num'] = $total_num;
|
||||||
|
$tran_status_list = [
|
||||||
|
'PROCESSING' => TransferDict::DEALING,
|
||||||
|
'ACCEPTED' => TransferDict::DEALING,
|
||||||
|
'CLOSED' => TransferDict::FAIL,
|
||||||
|
'FINISHED' => TransferDict::SUCCESS,
|
||||||
|
];
|
||||||
|
try {
|
||||||
$result = $this->returnFormat(Pay::wechat()->transfer($order));
|
$result = $this->returnFormat(Pay::wechat()->transfer($order));
|
||||||
|
|
||||||
if (!empty($result['code'])) {
|
if (!empty($result['code'])) {
|
||||||
// if($result['code'] == 'PARAM_ERROR'){
|
// if($result['code'] == 'PARAM_ERROR'){
|
||||||
// throw new PayException();
|
// throw new PayException();
|
||||||
@ -274,7 +292,19 @@ class Wechatpay extends BasePay
|
|||||||
}
|
}
|
||||||
throw new PayException($result['message']);
|
throw new PayException($result['message']);
|
||||||
}
|
}
|
||||||
return ['batch_id' => $result['batch_id'], 'out_batch_no' => $result['out_batch_no'], 'status' => TransferDict::SUCCESS];
|
|
||||||
|
|
||||||
|
return ['batch_id' => $result['batch_id'], 'out_batch_no' => $result['out_batch_no'], 'status' => $tran_status_list[$result['batch_status']]];
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
if($e->getCode() == 9402){
|
||||||
|
return ['batch_id' => '', 'out_batch_no' => $order['out_batch_no'], 'status' => TransferDict::DEALING];
|
||||||
|
}
|
||||||
|
if ($e instanceof InvalidResponseException) {
|
||||||
|
throw new PayException($e->response->all()['message'] ?? '');
|
||||||
|
}
|
||||||
|
throw new PayException($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -465,14 +495,15 @@ class Wechatpay extends BasePay
|
|||||||
* @throws ContainerException
|
* @throws ContainerException
|
||||||
* @throws InvalidParamsException
|
* @throws InvalidParamsException
|
||||||
*/
|
*/
|
||||||
public function getTransfer(string $transfer_no, $out_transfer_no = '')
|
public function getTransfer(string $transfer_no, $out_batch_no = '')
|
||||||
{
|
{
|
||||||
$order = [
|
$order = [
|
||||||
'out_batch_no' => $out_transfer_no,
|
'out_batch_no' => $out_batch_no,
|
||||||
'out_detail_no' => $transfer_no,
|
'out_detail_no' => $transfer_no,
|
||||||
'_action' => 'transfer',
|
'_action' => 'transfer',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
try {
|
||||||
$result = Pay::wechat()->query($order);
|
$result = Pay::wechat()->query($order);
|
||||||
$result = $this->returnFormat($result);
|
$result = $this->returnFormat($result);
|
||||||
//微信转账状态
|
//微信转账状态
|
||||||
@ -484,9 +515,15 @@ class Wechatpay extends BasePay
|
|||||||
'SUCCESS' => TransferDict::SUCCESS,
|
'SUCCESS' => TransferDict::SUCCESS,
|
||||||
];
|
];
|
||||||
return [
|
return [
|
||||||
'status' => $transfer_status_array[$result['status']],
|
'status' => $transfer_status_array[$result['detail_status']],
|
||||||
'transfer_no' => $transfer_no
|
'transfer_no' => $transfer_no
|
||||||
];
|
];
|
||||||
|
}catch(Throwable $e){
|
||||||
|
return [
|
||||||
|
'status' => TransferDict::DEALING,
|
||||||
|
'transfer_no' => $transfer_no
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user