mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
增加支付记录
This commit is contained in:
parent
2f465757fe
commit
d1e645568f
95
admin_v6.sql
95
admin_v6.sql
@ -11,7 +11,7 @@
|
||||
Target Server Version : 50562
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 09/12/2020 17:38:11
|
||||
Date: 14/12/2020 13:59:54
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
@ -103,25 +103,58 @@ CREATE TABLE `data_news_x_comment` (
|
||||
INDEX `idx_data_news_x_comment_code`(`code`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据-文章-评论' ROW_FORMAT = COMPACT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of data_news_x_comment
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for data_payment
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `data_payment`;
|
||||
CREATE TABLE `data_payment` (
|
||||
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付类型',
|
||||
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付名称',
|
||||
`content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '支付参数',
|
||||
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付说明',
|
||||
`sort` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '排序权重',
|
||||
`status` tinyint(1) UNSIGNED NULL DEFAULT 1 COMMENT '支付状态(1使用,0禁用)',
|
||||
`deleted` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '删除状态',
|
||||
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_data_news_mark_status`(`status`) USING BTREE,
|
||||
INDEX `idx_data_news_mark_deleted`(`deleted`) USING BTREE
|
||||
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付类型',
|
||||
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付名称',
|
||||
`content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '支付参数',
|
||||
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付说明',
|
||||
`sort` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '排序权重',
|
||||
`status` tinyint(1) UNSIGNED NULL DEFAULT 1 COMMENT '支付状态(1使用,0禁用)',
|
||||
`deleted` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '删除状态',
|
||||
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_data_news_mark_status`(`status`) USING BTREE,
|
||||
INDEX `idx_data_news_mark_deleted`(`deleted`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据-支付-通道' ROW_FORMAT = COMPACT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of data_payment
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for data_payment_item
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `data_payment_item`;
|
||||
CREATE TABLE `data_payment_item` (
|
||||
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`order_no` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '订单单号',
|
||||
`order_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '订单描述',
|
||||
`order_amount` decimal(20, 2) NULL DEFAULT 0.00 COMMENT '订单金额',
|
||||
`payment_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付通道',
|
||||
`payment_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付单号',
|
||||
`payment_status` tinyint(1) NULL DEFAULT 0 COMMENT '支付状态',
|
||||
`payment_amount` decimal(20, 2) NULL DEFAULT NULL COMMENT '支付金额',
|
||||
`payment_datatime` datetime NULL DEFAULT NULL COMMENT '支付时间',
|
||||
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_data_payment_item_order_no`(`order_no`) USING BTREE,
|
||||
INDEX `idx_data_payment_item_payment_type`(`payment_type`) USING BTREE,
|
||||
INDEX `idx_data_payment_item_payment_status`(`payment_status`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据-支付-记录' ROW_FORMAT = COMPACT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of data_payment_item
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for data_user
|
||||
-- ----------------------------
|
||||
@ -4391,7 +4424,7 @@ CREATE TABLE `system_auth` (
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_system_auth_title`(`title`) USING BTREE,
|
||||
INDEX `idx_system_auth_status`(`status`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-权限' ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-权限' ROW_FORMAT = COMPACT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of system_auth
|
||||
@ -4408,7 +4441,7 @@ CREATE TABLE `system_auth_node` (
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_system_auth_auth`(`auth`) USING BTREE,
|
||||
INDEX `idx_system_auth_node`(`node`(191)) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-授权' ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-授权' ROW_FORMAT = COMPACT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of system_auth_node
|
||||
@ -4424,7 +4457,7 @@ CREATE TABLE `system_config` (
|
||||
`value` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '配置值',
|
||||
INDEX `idx_system_config_type`(`type`) USING BTREE,
|
||||
INDEX `idx_system_config_name`(`name`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-配置' ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-配置' ROW_FORMAT = COMPACT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of system_config
|
||||
@ -4437,7 +4470,7 @@ INSERT INTO `system_config` VALUES ('base', 'site_copy', '©版权所有 2014-20
|
||||
INSERT INTO `system_config` VALUES ('base', 'site_icon', 'https://v6.thinkadmin.top/upload/f4/7b8fe06e38ae9908e8398da45583b9.png');
|
||||
INSERT INTO `system_config` VALUES ('base', 'site_name', 'ThinkAdmin');
|
||||
INSERT INTO `system_config` VALUES ('base', 'xpath', 'admin');
|
||||
INSERT INTO `system_config` VALUES ('storage', 'link_type', 'none');
|
||||
INSERT INTO `system_config` VALUES ('storage', 'link_type', 'none+compress');
|
||||
INSERT INTO `system_config` VALUES ('storage', 'allow_exts', 'doc,gif,icon,jpg,mp3,mp4,p12,pem,png,rar,xls,xlsx');
|
||||
INSERT INTO `system_config` VALUES ('storage', 'local_http_protocol', 'follow');
|
||||
INSERT INTO `system_config` VALUES ('storage', 'local_http_domain', '');
|
||||
@ -4453,7 +4486,7 @@ CREATE TABLE `system_data` (
|
||||
`value` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '配置值',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_system_data_name`(`name`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-数据' ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-数据' ROW_FORMAT = COMPACT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of system_data
|
||||
@ -4477,7 +4510,7 @@ CREATE TABLE `system_menu` (
|
||||
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_system_menu_status`(`status`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 87 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-菜单' ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 88 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-菜单' ROW_FORMAT = COMPACT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of system_menu
|
||||
@ -4536,7 +4569,11 @@ CREATE TABLE `system_oplog` (
|
||||
`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '操作人用户名',
|
||||
`create_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-日志' ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-日志' ROW_FORMAT = COMPACT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of system_oplog
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for system_queue
|
||||
@ -4565,7 +4602,7 @@ CREATE TABLE `system_queue` (
|
||||
INDEX `idx_system_queue_rscript`(`rscript`) USING BTREE,
|
||||
INDEX `idx_system_queue_create_at`(`create_at`) USING BTREE,
|
||||
INDEX `idx_system_queue_exec_time`(`exec_time`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-任务' ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-任务' ROW_FORMAT = COMPACT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of system_queue
|
||||
@ -4597,12 +4634,12 @@ CREATE TABLE `system_user` (
|
||||
INDEX `idx_system_user_username`(`username`) USING BTREE,
|
||||
INDEX `idx_system_user_deleted`(`is_deleted`) USING BTREE,
|
||||
INDEX `idx_system_user_status`(`status`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 10001 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-用户' ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 10001 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-用户' ROW_FORMAT = COMPACT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of system_user
|
||||
-- ----------------------------
|
||||
INSERT INTO `system_user` VALUES (10000, 'admin', '21232f297a57a5a743894a0e4a801fc3', '系统管理员', 'https://v6.thinkadmin.top/upload/ec/f571134493e54fe06855c88557052c.png', '', '', '', '', '127.0.0.1', '2020-12-09 07:59:27', 8, '', 1, 0, 0, '2015-11-13 15:14:22');
|
||||
INSERT INTO `system_user` VALUES (10000, 'admin', '21232f297a57a5a743894a0e4a801fc3', '系统管理员', 'https://v6.thinkadmin.top/upload/ec/f571134493e54fe06855c88557052c.png', '', '', '', '', '127.0.0.1', '2020-12-13 04:29:27', 22, '', 1, 0, 0, '2015-11-13 15:14:22');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for wechat_fans
|
||||
@ -4635,7 +4672,7 @@ CREATE TABLE `wechat_fans` (
|
||||
INDEX `index_wechat_fans_unionid`(`unionid`) USING BTREE,
|
||||
INDEX `index_wechat_fans_subscribe`(`subscribe`) USING BTREE,
|
||||
INDEX `index_wechat_fans_isblack`(`is_black`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信-粉丝' ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信-粉丝' ROW_FORMAT = COMPACT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of wechat_fans
|
||||
@ -4653,7 +4690,7 @@ CREATE TABLE `wechat_fans_tags` (
|
||||
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期',
|
||||
INDEX `index_wechat_fans_tags_id`(`id`) USING BTREE,
|
||||
INDEX `index_wechat_fans_tags_appid`(`appid`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信-标签' ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信-标签' ROW_FORMAT = COMPACT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of wechat_fans_tags
|
||||
@ -4687,7 +4724,7 @@ CREATE TABLE `wechat_keys` (
|
||||
INDEX `index_wechat_keys_appid`(`appid`) USING BTREE,
|
||||
INDEX `index_wechat_keys_type`(`type`) USING BTREE,
|
||||
INDEX `index_wechat_keys_keys`(`keys`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信-规则' ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信-规则' ROW_FORMAT = COMPACT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of wechat_keys
|
||||
@ -4711,7 +4748,7 @@ CREATE TABLE `wechat_media` (
|
||||
INDEX `index_wechat_media_md5`(`md5`) USING BTREE,
|
||||
INDEX `index_wechat_media_type`(`type`) USING BTREE,
|
||||
INDEX `index_wechat_media_media_id`(`media_id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信-素材' ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信-素材' ROW_FORMAT = COMPACT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of wechat_media
|
||||
@ -4732,7 +4769,7 @@ CREATE TABLE `wechat_news` (
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `index_wechat_news_artcle_id`(`article_id`) USING BTREE,
|
||||
INDEX `index_wechat_news_media_id`(`media_id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信-图文' ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信-图文' ROW_FORMAT = COMPACT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of wechat_news
|
||||
@ -4754,7 +4791,7 @@ CREATE TABLE `wechat_news_article` (
|
||||
`read_num` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '阅读数量',
|
||||
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信-文章' ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信-文章' ROW_FORMAT = COMPACT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of wechat_news_article
|
||||
|
@ -67,16 +67,16 @@ class JoinPaymentService extends PaymentService
|
||||
*/
|
||||
public function create(string $openid, string $orderNo, string $payAmount, string $payTitle, string $payDescription): array
|
||||
{
|
||||
$types = [
|
||||
static::PAYMENT_JOINPAY_GZH => 'WEIXIN_GZH',
|
||||
static::PAYMENT_JOINPAY_XCX => 'WEIXIN_XCX',
|
||||
];
|
||||
if (isset($types[static::$type])) {
|
||||
$type = $types[static::$type];
|
||||
} else {
|
||||
throw new \think\Exception('支付类型[' . static::$type . ']未配置定义!');
|
||||
}
|
||||
try {
|
||||
$types = [
|
||||
static::PAYMENT_JOINPAY_GZH => 'WEIXIN_GZH',
|
||||
static::PAYMENT_JOINPAY_XCX => 'WEIXIN_XCX',
|
||||
];
|
||||
if (isset($types[static::$type])) {
|
||||
$type = $types[static::$type];
|
||||
} else {
|
||||
throw new \think\Exception('支付类型[' . static::$type . ']未配置定义!');
|
||||
}
|
||||
$data = [
|
||||
'p0_Version' => '1.0',
|
||||
'p1_MerchantNo' => $this->mchid,
|
||||
@ -95,12 +95,19 @@ class JoinPaymentService extends PaymentService
|
||||
$this->uri = 'https://www.joinpay.com/trade/uniPayApi.action';
|
||||
$result = $this->_doReuest($data);
|
||||
if (is_array($result) && isset($result['ra_Code']) && intval($result['ra_Code']) === 100) {
|
||||
// 创建支付记录
|
||||
$this->app->db->name('DataPaymentItem')->insert([
|
||||
'order_no' => $orderNo, 'order_name' => $payTitle, 'order_amount' => $payAmount, 'payment_type' => $type,
|
||||
]);
|
||||
// 返回支付参数
|
||||
return json_decode($result['rc_Result'], true);
|
||||
} elseif (is_array($result) && isset($result['rb_CodeMsg'])) {
|
||||
throw new \think\Exception($result['rb_CodeMsg']);
|
||||
} else {
|
||||
throw new \think\Exception('获取预支付码失败!');
|
||||
}
|
||||
} catch (\think\Exception $exception) {
|
||||
throw $exception;
|
||||
} catch (\Exception $exception) {
|
||||
throw new \think\Exception($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
@ -132,6 +139,15 @@ class JoinPaymentService extends PaymentService
|
||||
return 'error';
|
||||
}
|
||||
if (isset($notify['r6_Status']) && intval($notify['r6_Status']) === 100) {
|
||||
// 更新支付记录
|
||||
$map = ['order_no' => $notify['r2_OrderNo'], 'payment_type' => static::$type];
|
||||
$this->app->db->name('DataPaymentItem')->where($map)->update([
|
||||
'payment_code' => $notify['r9_BankTrxNo'],
|
||||
'payment_amount' => $notify['r3_Amount'],
|
||||
'payment_status' => 1,
|
||||
'payment_datatime' => date('Y-m-d H:i:s'),
|
||||
]);
|
||||
// 更新记录状态
|
||||
if ($this->updateOrder($notify['r2_OrderNo'], $notify['r9_BankTrxNo'], $notify['r3_Amount'], 'joinpay')) {
|
||||
return 'success';
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace app\data\service\payment;
|
||||
|
||||
use app\data\service\PaymentService;
|
||||
use http\Exception;
|
||||
use WePay\Order;
|
||||
|
||||
/**
|
||||
@ -71,6 +72,11 @@ class WechatPaymentService extends PaymentService
|
||||
if (empty($data['openid'])) unset($data['openid']);
|
||||
$info = $this->payment->create($data);
|
||||
if ($info['return_code'] === 'SUCCESS' && $info['result_code'] === 'SUCCESS') {
|
||||
// 创建支付记录
|
||||
$this->app->db->name('DataPaymentItem')->insert([
|
||||
'order_no' => $orderNo, 'order_name' => $payTitle, 'order_amount' => $payAmount, 'payment_type' => static::$type,
|
||||
]);
|
||||
// 返回支付参数
|
||||
return $this->payment->jsapiParams($info['prepay_id']);
|
||||
}
|
||||
if (isset($info['err_code_des'])) {
|
||||
@ -78,6 +84,8 @@ class WechatPaymentService extends PaymentService
|
||||
} else {
|
||||
throw new \think\Exception('获取预支付码失败!');
|
||||
}
|
||||
} catch (\think\Exception $exception) {
|
||||
throw $exception;
|
||||
} catch (\Exception $exception) {
|
||||
throw new \think\Exception($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
@ -95,6 +103,15 @@ class WechatPaymentService extends PaymentService
|
||||
{
|
||||
$notify = $this->payment->getNotify();
|
||||
if ($notify['result_code'] == 'SUCCESS' && $notify['return_code'] == 'SUCCESS') {
|
||||
// 更新支付记录
|
||||
$map = ['order_no' => $notify['out_trade_no'], 'payment_type' => static::$type];
|
||||
$this->app->db->name('DataPaymentItem')->where($map)->update([
|
||||
'payment_code' => $notify['r9_BankTrxNo'],
|
||||
'payment_amount' => $notify['r3_Amount'],
|
||||
'payment_status' => 1,
|
||||
'payment_datatime' => date('Y-m-d H:i:s'),
|
||||
]);
|
||||
// 更新记录状态
|
||||
if ($this->updateOrder($notify['out_trade_no'], $notify['transaction_id'], $notify['cash_fee'] / 100, 'wechat')) {
|
||||
return $this->payment->getNotifySuccessReply();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user