Commit 9c406110 by haojie

1

parent 299876bb
...@@ -23,36 +23,38 @@ public function toBuy($address, $hash, $id, $invite_code, $Invitees_box_id) ...@@ -23,36 +23,38 @@ public function toBuy($address, $hash, $id, $invite_code, $Invitees_box_id)
$price = BlindBoxList::query()->where('id', $id)->first(['price']); $price = BlindBoxList::query()->where('id', $id)->first(['price']);
# 检查提交的盲盒id是否存在 # 检查提交的盲盒id是否存在
$box_id_item = BlindBoxList::query()->where('id', $Invitees_box_id)->first(['id']); $box_id_item = BlindBoxList::query()->where('id', $Invitees_box_id)->first(['id']);
# 判断是否存在邀请人 if ($price) {
if ($invite_code && $box_id_item) { # 判断是否存在邀请人
# 是分享的链接 if ($invite_code && $box_id_item) {
# 筛选出邀请码对应的地址 # 是分享的链接
$item = UseUser::query()->where('invitation_code', $invite_code)->first(['user_address']); # 筛选出邀请码对应的地址
$cur_code_address = ''; $item = UseUser::query()->where('invitation_code', $invite_code)->first(['user_address']);
if ($item->user_address) { $cur_code_address = '';
$cur_code_address = $item->user_address; if ($item->user_address) {
} $cur_code_address = $item->user_address;
# 存在邀请人--且--购买账户与与邀请人账户不一致 }
if ($cur_code_address && $cur_code_address != $address) { # 存在邀请人--且--购买账户与与邀请人账户不一致
# 向order表插入邀请人地址和邀请人购买的盒子id if ($cur_code_address && $cur_code_address != $address) {
UserWallet::query()->create(['user_address' => $address, 'status' => 0, 'price' => $price->price, # 向order表插入邀请人地址和邀请人购买的盒子id
'blind_box_id' => $id, 'hash' => $hash, 'Invitees_address' => $cur_code_address, 'Invitees_box_id' => $Invitees_box_id]); UserWallet::query()->create(['user_address' => $address, 'status' => 0, 'price' => $price->price,
'blind_box_id' => $id, 'hash' => $hash, 'Invitees_address' => $cur_code_address, 'Invitees_box_id' => $Invitees_box_id]);
} else {
# 创建订单
UserWallet::query()->create(['user_address' => $address, 'status' => 0, 'price' => $price->price, 'blind_box_id' => $id, 'hash' => $hash]);
}
} else { } else {
# 创建订单 # 创建订单
UserWallet::query()->create(['user_address' => $address, 'status' => 0, 'price' => $price->price, 'blind_box_id' => $id, 'hash' => $hash]); UserWallet::query()->create(['user_address' => $address, 'status' => 0, 'price' => $price->price, 'blind_box_id' => $id, 'hash' => $hash]);
} }
$address = SetAddress::query()->first();
$to = $address->address;
# 添加订单后
# 异步检查到账情况
dispatch(new CheckArrival($hash, $price->price, $address, $to));
return true;
} else { } else {
# 创建订单 return false;
UserWallet::query()->create(['user_address' => $address, 'status' => 0, 'price' => $price->price, 'blind_box_id' => $id, 'hash' => $hash]);
} }
$address = SetAddress::query()->first();
$to = $address->address;
# 添加订单后
# 异步检查到账情况
dispatch(new CheckArrival($hash, $price->price, $address, $to));
return true;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment