mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 17:31:49 +08:00 
			
		
		
		
	update: fix order statistics
This commit is contained in:
		| @@ -50,8 +50,8 @@ class V2boardStatistics extends Command | |||||||
|     { |     { | ||||||
|         $endAt = strtotime(date('Y-m-d')); |         $endAt = strtotime(date('Y-m-d')); | ||||||
|         $startAt = strtotime('-1 day', $endAt); |         $startAt = strtotime('-1 day', $endAt); | ||||||
|         $builder = Order::where('created_at', '>=', $startAt) |         $builder = Order::where('paid_at', '>=', $startAt) | ||||||
|             ->where('created_at', '<', $endAt) |             ->where('paid_at', '<', $endAt) | ||||||
|             ->whereNotIn('status', [0, 2]); |             ->whereNotIn('status', [0, 2]); | ||||||
|         $orderCount = $builder->count(); |         $orderCount = $builder->count(); | ||||||
|         $orderAmount = $builder->sum('total_amount'); |         $orderAmount = $builder->sum('total_amount'); | ||||||
|   | |||||||
| @@ -239,6 +239,7 @@ class OrderService | |||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|         $order->status = 1; |         $order->status = 1; | ||||||
|  |         $order->paid_at = time(); | ||||||
|         $order->callback_no = $callbackNo; |         $order->callback_no = $callbackNo; | ||||||
|         return $order->save(); |         return $order->save(); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -110,6 +110,7 @@ CREATE TABLE `v2_order` ( | |||||||
|                             `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0待支付1开通中2已取消3已完成4已折抵', |                             `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0待支付1开通中2已取消3已完成4已折抵', | ||||||
|                             `commission_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0待确认1发放中2有效3无效', |                             `commission_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0待确认1发放中2有效3无效', | ||||||
|                             `commission_balance` int(11) NOT NULL DEFAULT '0', |                             `commission_balance` int(11) NOT NULL DEFAULT '0', | ||||||
|  |                             `paid_at` int(11) DEFAULT NULL, | ||||||
|                             `created_at` int(11) NOT NULL, |                             `created_at` int(11) NOT NULL, | ||||||
|                             `updated_at` int(11) NOT NULL, |                             `updated_at` int(11) NOT NULL, | ||||||
|                             PRIMARY KEY (`id`) |                             PRIMARY KEY (`id`) | ||||||
| @@ -348,4 +349,4 @@ CREATE TABLE `v2_user` ( | |||||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||||||
|  |  | ||||||
|  |  | ||||||
| -- 2021-07-13 13:50:52 | -- 2021-07-30 17:19:01 | ||||||
|   | |||||||
| @@ -425,3 +425,6 @@ DROP INDEX `email_deleted_at`; | |||||||
|  |  | ||||||
| ALTER TABLE `v2_user` | ALTER TABLE `v2_user` | ||||||
|     ADD `commission_type` tinyint NOT NULL DEFAULT '0' COMMENT '0: system 1: cycle 2: onetime' AFTER `discount`; |     ADD `commission_type` tinyint NOT NULL DEFAULT '0' COMMENT '0: system 1: cycle 2: onetime' AFTER `discount`; | ||||||
|  |  | ||||||
|  | ALTER TABLE `v2_order` | ||||||
|  |     ADD `paid_at` int(11) NULL AFTER `commission_balance`; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user