Commit 9c406110 by haojie

1

parent 299876bb
......@@ -23,36 +23,38 @@ public function toBuy($address, $hash, $id, $invite_code, $Invitees_box_id)
$price = BlindBoxList::query()->where('id', $id)->first(['price']);
# 检查提交的盲盒id是否存在
$box_id_item = BlindBoxList::query()->where('id', $Invitees_box_id)->first(['id']);
# 判断是否存在邀请人
if ($invite_code && $box_id_item) {
# 是分享的链接
# 筛选出邀请码对应的地址
$item = UseUser::query()->where('invitation_code', $invite_code)->first(['user_address']);
$cur_code_address = '';
if ($item->user_address) {
$cur_code_address = $item->user_address;
}
# 存在邀请人--且--购买账户与与邀请人账户不一致
if ($cur_code_address && $cur_code_address != $address) {
# 向order表插入邀请人地址和邀请人购买的盒子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]);
if ($price) {
# 判断是否存在邀请人
if ($invite_code && $box_id_item) {
# 是分享的链接
# 筛选出邀请码对应的地址
$item = UseUser::query()->where('invitation_code', $invite_code)->first(['user_address']);
$cur_code_address = '';
if ($item->user_address) {
$cur_code_address = $item->user_address;
}
# 存在邀请人--且--购买账户与与邀请人账户不一致
if ($cur_code_address && $cur_code_address != $address) {
# 向order表插入邀请人地址和邀请人购买的盒子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 {
# 创建订单
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 {
# 创建订单
UserWallet::query()->create(['user_address' => $address, 'status' => 0, 'price' => $price->price, 'blind_box_id' => $id, 'hash' => $hash]);
return false;
}
$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