Skip to content

Commit

Permalink
Merge pull request #385 from betaxab/p1
Browse files Browse the repository at this point in the history
createOrder: Use uppercase chars for order numbers
  • Loading branch information
assimon authored Aug 9, 2022
2 parents d5e7896 + a43f3a8 commit 62aaad3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/Service/OrderProcessService.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public function createOrder(): Order
try {
$order = new Order();
// 生成订单号
$order->order_sn = Str::random(16);
$order->order_sn = strtoupper(Str::random(16));
// 设置商品
$order->goods_id = $this->goods->id;
// 标题
Expand Down
5 changes: 3 additions & 2 deletions database/factories/OrderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

use App\Model;
use Faker\Generator as Faker;
use Illuminate\Support\Str;

$factory->define(\App\Models\Order::class, function (Faker $faker) {
return [
'order_sn' => \Illuminate\Support\Str::random(12),
'order_sn' => strtoupper(Str::random(12)),
'goods_id' => rand(1, 3),
'coupon_id' => rand(1, 3),
'title' => $faker->words(3, true),
Expand All @@ -23,7 +24,7 @@
'info' => $faker->words(3, true),
'pay_id' => rand(1, 20),
'buy_ip' => $faker->ipv4,
'trade_no' => \Illuminate\Support\Str::random(12),
'trade_no' => strtoupper(Str::random(12)),
'status' => rand(1, 5),
'created_at' => $faker->dateTimeBetween('-7 days', 'now', 'PRC'),
'updated_at' => $faker->dateTimeBetween('-7 days', 'now', 'PRC'),
Expand Down

0 comments on commit 62aaad3

Please sign in to comment.