处理支付行为

This commit is contained in:
邹景立 2021-03-26 18:11:14 +08:00
parent 644188231e
commit 09bf805ea3
7 changed files with 29 additions and 66 deletions

View File

@ -11,7 +11,7 @@
Target Server Version : 50562
File Encoding : 65001
Date: 26/03/2021 18:05:56
Date: 26/03/2021 18:10:56
*/
SET NAMES utf8mb4;
@ -78,6 +78,30 @@ CREATE TABLE `data_base_payment` (
INDEX `idx_data_base_payment_deleted`(`deleted`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据-基础-支付' ROW_FORMAT = COMPACT;
-- ----------------------------
-- Table structure for data_base_payment_record
-- ----------------------------
DROP TABLE IF EXISTS `data_base_payment_record`;
CREATE TABLE `data_base_payment_record` (
`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_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付编号',
`payment_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付通道',
`payment_trade` 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_base_payment_record_order_no`(`order_no`) USING BTREE,
INDEX `idx_data_base_payment_record_payment_code`(`payment_code`) USING BTREE,
INDEX `idx_data_base_payment_record_payment_type`(`payment_type`) USING BTREE,
INDEX `idx_data_base_payment_record_payment_trade`(`payment_trade`) USING BTREE,
INDEX `idx_data_base_payment_record_payment_status`(`payment_status`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 30 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据-基础-支付' ROW_FORMAT = COMPACT;
-- ----------------------------
-- Table structure for data_base_upgrade
-- ----------------------------
@ -645,30 +669,6 @@ CREATE TABLE `shop_order_send` (
INDEX `idx_shop_order_send_order_no`(`order_no`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 28 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商城-订单-配送' ROW_FORMAT = COMPACT;
-- ----------------------------
-- Table structure for shop_payment_item
-- ----------------------------
DROP TABLE IF EXISTS `shop_payment_item`;
CREATE TABLE `shop_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_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付编号',
`payment_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付通道',
`payment_trade` 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_shop_payment_item_order_no`(`order_no`) USING BTREE,
INDEX `idx_shop_payment_item_payment_code`(`payment_code`) USING BTREE,
INDEX `idx_shop_payment_item_payment_type`(`payment_type`) USING BTREE,
INDEX `idx_shop_payment_item_payment_trade`(`payment_trade`) USING BTREE,
INDEX `idx_shop_payment_item_payment_status`(`payment_status`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 30 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商城-支付-记录' ROW_FORMAT = COMPACT;
-- ----------------------------
-- Table structure for shop_truck_company
-- ----------------------------

View File

@ -1,35 +0,0 @@
<?php
namespace app\data\controller;
use think\admin\Controller;
/**
* 支付行为记录
* Class ShopPaymentItem
* @package app\data\controller
*/
class ShopPaymentItem extends Controller
{
/**
* 绑定数据
* @var string
*/
private $table = 'ShopPaymentItem';
/**
* 支付行为记录
* @auth true
* @menu true
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function index()
{
$this->title = '支付行为记录';
$query = $this->_query($this->table);
$query->like('order_no')->order('id desc')->page();
}
}

View File

@ -279,7 +279,7 @@ abstract class PaymentService
*/
protected function createPaymentAction(string $orderNo, string $paymentTitle, string $paymentAmount)
{
$this->app->db->name('ShopPaymentItem')->insert([
$this->app->db->name('DataBasePaymentRecord')->insert([
'payment_code' => $this->code, 'payment_type' => $this->type,
'order_amount' => $paymentAmount, 'order_name' => $paymentTitle, 'order_no' => $orderNo,
]);
@ -299,7 +299,7 @@ abstract class PaymentService
protected function updatePaymentAction(string $orderNo, string $paymentTrade, string $paymentAmount, string $paymentRemark = '在线支付'): bool
{
// 更新支付记录
data_save('ShopPaymentItem', [
data_save('DataBasePaymentRecord', [
'order_no' => $orderNo,
'payment_code' => $this->code,
'payment_type' => $this->type,

View File

@ -46,6 +46,6 @@ class Index extends Controller
$this->_query('ShopOrder')->empty();
$this->_query('ShopOrderItem')->empty();
$this->_query('ShopOrderSend')->empty();
$this->_query('ShopPaymentItem')->empty();
$this->_query('DataBasePaymentRecord')->empty();
}
}

View File

@ -216,7 +216,6 @@ return array(
'app\\data\\controller\\ShopOrder' => $baseDir . '/app/data/controller/ShopOrder.php',
'app\\data\\controller\\ShopOrderSend' => $baseDir . '/app/data/controller/ShopOrderSend.php',
'app\\data\\controller\\ShopOrderService' => $baseDir . '/app/data/controller/ShopOrderService.php',
'app\\data\\controller\\ShopPaymentItem' => $baseDir . '/app/data/controller/ShopPaymentItem.php',
'app\\data\\controller\\ShopTruckCompany' => $baseDir . '/app/data/controller/ShopTruckCompany.php',
'app\\data\\controller\\ShopTruckTemplate' => $baseDir . '/app/data/controller/ShopTruckTemplate.php',
'app\\data\\controller\\User' => $baseDir . '/app/data/controller/User.php',

View File

@ -345,7 +345,6 @@ class ComposerStaticInit6dcb8a18f830adceacf76408fbd14a53
'app\\data\\controller\\ShopOrder' => __DIR__ . '/../..' . '/app/data/controller/ShopOrder.php',
'app\\data\\controller\\ShopOrderSend' => __DIR__ . '/../..' . '/app/data/controller/ShopOrderSend.php',
'app\\data\\controller\\ShopOrderService' => __DIR__ . '/../..' . '/app/data/controller/ShopOrderService.php',
'app\\data\\controller\\ShopPaymentItem' => __DIR__ . '/../..' . '/app/data/controller/ShopPaymentItem.php',
'app\\data\\controller\\ShopTruckCompany' => __DIR__ . '/../..' . '/app/data/controller/ShopTruckCompany.php',
'app\\data\\controller\\ShopTruckTemplate' => __DIR__ . '/../..' . '/app/data/controller/ShopTruckTemplate.php',
'app\\data\\controller\\User' => __DIR__ . '/../..' . '/app/data/controller/User.php',

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php
// This file is automatically generated at:2021-03-26 18:05:04
// This file is automatically generated at:2021-03-26 18:11:02
declare (strict_types = 1);
return array (
0 => 'think\\admin\\Library',