mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
update: new generate order number method
This commit is contained in:
parent
c957a4ca83
commit
abe1ebccae
@ -3,6 +3,7 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Order;
|
||||
use App\Utils\Helper;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class Test extends Command
|
||||
@ -38,5 +39,6 @@ class Test extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
dd(Helper::generateOrderNo());
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ class OrderController extends Controller
|
||||
$order->user_id = $request->session()->get('id');
|
||||
$order->plan_id = $plan->id;
|
||||
$order->cycle = $request->input('cycle');
|
||||
$order->trade_no = Helper::guid();
|
||||
$order->trade_no = Helper::generateOrderNo();
|
||||
$order->total_amount = $plan[$request->input('cycle')];
|
||||
|
||||
if ($request->input('coupon_code')) {
|
||||
|
@ -23,6 +23,12 @@ class Helper
|
||||
return md5(vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)) . '-' . time());
|
||||
}
|
||||
|
||||
public static function generateOrderNo(): string
|
||||
{
|
||||
$randomChar = rand(10000, 99999);
|
||||
return date('YmdHms') . $randomChar;
|
||||
}
|
||||
|
||||
public static function exchange($from, $to)
|
||||
{
|
||||
$result = file_get_contents('https://api.exchangerate.host/latest?symbols=' . $to . '&base=' . $from);
|
||||
|
2
public/assets/admin/umi.js
vendored
2
public/assets/admin/umi.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user