Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
blind-box-api
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haojie
blind-box-api
Commits
854546a5
Commit
854546a5
authored
Mar 06, 2023
by
haojie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
fe11ff22
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
186 additions
and
6 deletions
+186
-6
app/Admin/Controllers/BlindBoxListController.php
+2
-2
app/Admin/Controllers/SetAddressController.php
+71
-0
app/Admin/Repositories/SetAddress.php
+16
-0
app/Admin/routes.php
+1
-0
app/Http/Controllers/API/BlindBox/BlindBoxController.php
+5
-2
app/Http/Controllers/API/IndexController.php
+11
-0
app/Models/SetAddress.php
+14
-0
database/migrations/2023_03_06_110923_create_set_address_table.php
+32
-0
dcat_admin_ide_helper.php
+20
-0
lang/zh_CN/set-address.php
+12
-0
public/uploads/files/0d8cfddcf71ecaa062d4e85b7a48bea0.jpg
+0
-0
routes/api.php
+2
-2
No files found.
app/Admin/Controllers/BlindBoxListController.php
View file @
854546a5
...
...
@@ -23,8 +23,8 @@ class BlindBoxListController extends AdminController
*/
protected
function
grid
()
{
$model
=
new
BlindBoxList
();
return
Grid
::
make
((
clone
$model
),
function
(
Grid
$grid
)
{
#
$model = new BlindBoxList();
return
Grid
::
make
((
new
BlindBoxList
()
),
function
(
Grid
$grid
)
{
# 未完成
$grid
->
model
()
->
where
(
'status'
,
'!='
,
3
);
$grid
->
column
(
'id'
)
->
sortable
();
...
...
app/Admin/Controllers/SetAddressController.php
0 → 100644
View file @
854546a5
<?php
namespace
App\Admin\Controllers
;
use
App\Admin\Repositories\SetAddress
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Http\Controllers\AdminController
;
class
SetAddressController
extends
AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected
function
grid
()
{
return
Grid
::
make
(
new
SetAddress
(),
function
(
Grid
$grid
)
{
// 新增按钮-禁用
$grid
->
disableCreateButton
();
// 行操作--禁用
$grid
->
disableActions
();
// 行选择器
$grid
->
disableRowSelector
();
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'address'
)
->
editable
();
# $grid->column('created_at');
# $grid->column('updated_at')->sortable();
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$filter
->
equal
(
'id'
);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected
function
detail
(
$id
)
{
return
Show
::
make
(
$id
,
new
SetAddress
(),
function
(
Show
$show
)
{
$show
->
field
(
'id'
);
$show
->
field
(
'address'
);
$show
->
field
(
'created_at'
);
$show
->
field
(
'updated_at'
);
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected
function
form
()
{
return
Form
::
make
(
new
SetAddress
(),
function
(
Form
$form
)
{
$form
->
display
(
'id'
);
$form
->
text
(
'address'
);
$form
->
display
(
'created_at'
);
$form
->
display
(
'updated_at'
);
});
}
}
app/Admin/Repositories/SetAddress.php
0 → 100644
View file @
854546a5
<?php
namespace
App\Admin\Repositories
;
use
App\Models\SetAddress
as
Model
;
use
Dcat\Admin\Repositories\EloquentRepository
;
class
SetAddress
extends
EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected
$eloquentClass
=
Model
::
class
;
}
app/Admin/routes.php
View file @
854546a5
...
...
@@ -15,4 +15,5 @@
$router
->
get
(
'/'
,
'HomeController@index'
);
$router
->
resource
(
'/blindBoxSetting/setting'
,
'BlindBoxListController'
);
$router
->
resource
(
'/blindBoxSetting/record'
,
'BlindBoxRecordController'
);
$router
->
resource
(
'/setAddress'
,
'SetAddressController'
);
});
app/Http/Controllers/API/BlindBox/BlindBoxController.php
View file @
854546a5
...
...
@@ -16,7 +16,7 @@ class BlindBoxController
*/
private
$Parameter
=
[
'end_time'
,
'id'
,
'invite_up_rate'
,
'max_participants_num'
,
'price'
,
'projectName'
,
'project_icon'
,
'rules'
,
'start_time'
,
'status'
,
'purchased'
];
'projectName'
,
'project_icon'
,
'rules'
,
'start_time'
,
'status'
,
'purchased'
,
'winner_list'
];
/**
* 进行中的盲盒列表
...
...
@@ -70,11 +70,12 @@ public function getUserPayBlindBox($address, $status, $page, $limit, $request)
$obj
=
self
::
getSuccessOrder
(
$value
->
blind_box_id
,
3
);
if
(
$obj
)
{
$buy_num
=
json_decode
(
$obj
->
purchased
);
if
(
$buy_num
&&
$buy_num
>=
$obj
->
min_participants_num
)
{
if
(
$buy_num
&&
count
(
$buy_num
)
>=
$obj
->
min_participants_num
)
{
# 购买人数已达到指定数
$obj
->
buy_num
=
count
(
$buy_num
);
# - 是否中奖
$winner_list
=
json_decode
(
$obj
->
winner_list
);
Log
::
error
(
$winner_list
);
$obj
->
is_sucess
=
false
;
if
(
$winner_list
&&
count
(
$winner_list
))
{
foreach
(
$winner_list
as
$item
)
{
...
...
@@ -92,6 +93,7 @@ public function getUserPayBlindBox($address, $status, $page, $limit, $request)
# 进行中 --
$obj
=
self
::
getSuccessOrder
(
$value
->
blind_box_id
,
2
);
if
(
$obj
)
{
unset
(
$obj
->
winner_list
);
$buy_num
=
json_decode
(
$obj
->
purchased
);
if
(
$buy_num
&&
count
(
$buy_num
)
>=
$obj
->
min_participants_num
)
{
# 购买人数已达到指定数
...
...
@@ -104,6 +106,7 @@ public function getUserPayBlindBox($address, $status, $page, $limit, $request)
# 未完成
$obj
=
self
::
getSuccessOrder
(
$value
->
blind_box_id
,
2
);
if
(
$obj
)
{
unset
(
$obj
->
winner_list
);
$buy_num
=
json_decode
(
$obj
->
purchased
);
if
(
$buy_num
&&
count
(
$buy_num
)
<
$obj
->
min_participants_num
)
{
# 未到达指定人数
...
...
app/Http/Controllers/API/IndexController.php
View file @
854546a5
...
...
@@ -12,6 +12,7 @@
use
App\Models\UserWallet
;
use
App\Http\Controllers\API\User\CreateUser
;
use
App\Models\BlindBoxList
;
use
App\Models\SetAddress
;
class
IndexController
extends
Controller
...
...
@@ -35,6 +36,16 @@ public function getUserInfo(Request $request)
}
/**
* 获取收款地址
*/
public
function
getReceiptAddress
(
Request
$request
)
{
$address
=
SetAddress
::
query
()
->
first
();
return
$this
->
success
(
'success'
,
$address
->
address
);
}
/**
* 获取盲盒列表
*
* @param Request $request
...
...
app/Models/SetAddress.php
0 → 100644
View file @
854546a5
<?php
namespace
App\Models
;
use
Dcat\Admin\Traits\HasDateTimeFormatter
;
use
Illuminate\Database\Eloquent\Model
;
class
SetAddress
extends
Model
{
use
HasDateTimeFormatter
;
protected
$table
=
'set_address'
;
}
database/migrations/2023_03_06_110923_create_set_address_table.php
0 → 100644
View file @
854546a5
<?php
use
Illuminate\Support\Facades\Schema
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Database\Migrations\Migration
;
class
CreateSetAddressTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'set_address'
,
function
(
Blueprint
$table
)
{
$table
->
increments
(
'id'
);
$table
->
string
(
'address'
)
->
default
(
''
);
$table
->
timestamps
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'set_address'
);
}
}
dcat_admin_ide_helper.php
View file @
854546a5
...
...
@@ -37,7 +37,9 @@
* @property Grid\Column|Collection remember_token
* @property Grid\Column|Collection username
* @property Grid\Column|Collection box_num
* @property Grid\Column|Collection can_invite_num
* @property Grid\Column|Collection end_time
* @property Grid\Column|Collection invite_up_rate
* @property Grid\Column|Collection max_participants_num
* @property Grid\Column|Collection min_participants_num
* @property Grid\Column|Collection price
...
...
@@ -62,10 +64,13 @@
* @property Grid\Column|Collection last_used_at
* @property Grid\Column|Collection tokenable_id
* @property Grid\Column|Collection tokenable_type
* @property Grid\Column|Collection address
* @property Grid\Column|Collection invitation_code
* @property Grid\Column|Collection user_address
* @property Grid\Column|Collection blind_box_id
* @property Grid\Column|Collection hash
* @property Grid\Column|Collection Invitees_address
* @property Grid\Column|Collection Invitees_box_id
* @property Grid\Column|Collection email_verified_at
*
* @method Grid\Column|Collection created_at(string $label = null)
...
...
@@ -94,7 +99,9 @@
* @method Grid\Column|Collection remember_token(string $label = null)
* @method Grid\Column|Collection username(string $label = null)
* @method Grid\Column|Collection box_num(string $label = null)
* @method Grid\Column|Collection can_invite_num(string $label = null)
* @method Grid\Column|Collection end_time(string $label = null)
* @method Grid\Column|Collection invite_up_rate(string $label = null)
* @method Grid\Column|Collection max_participants_num(string $label = null)
* @method Grid\Column|Collection min_participants_num(string $label = null)
* @method Grid\Column|Collection price(string $label = null)
...
...
@@ -119,10 +126,13 @@
* @method Grid\Column|Collection last_used_at(string $label = null)
* @method Grid\Column|Collection tokenable_id(string $label = null)
* @method Grid\Column|Collection tokenable_type(string $label = null)
* @method Grid\Column|Collection address(string $label = null)
* @method Grid\Column|Collection invitation_code(string $label = null)
* @method Grid\Column|Collection user_address(string $label = null)
* @method Grid\Column|Collection blind_box_id(string $label = null)
* @method Grid\Column|Collection hash(string $label = null)
* @method Grid\Column|Collection Invitees_address(string $label = null)
* @method Grid\Column|Collection Invitees_box_id(string $label = null)
* @method Grid\Column|Collection email_verified_at(string $label = null)
*/
class
Grid
{}
...
...
@@ -156,7 +166,9 @@ class MiniGrid extends Grid {}
* @property Show\Field|Collection remember_token
* @property Show\Field|Collection username
* @property Show\Field|Collection box_num
* @property Show\Field|Collection can_invite_num
* @property Show\Field|Collection end_time
* @property Show\Field|Collection invite_up_rate
* @property Show\Field|Collection max_participants_num
* @property Show\Field|Collection min_participants_num
* @property Show\Field|Collection price
...
...
@@ -181,10 +193,13 @@ class MiniGrid extends Grid {}
* @property Show\Field|Collection last_used_at
* @property Show\Field|Collection tokenable_id
* @property Show\Field|Collection tokenable_type
* @property Show\Field|Collection address
* @property Show\Field|Collection invitation_code
* @property Show\Field|Collection user_address
* @property Show\Field|Collection blind_box_id
* @property Show\Field|Collection hash
* @property Show\Field|Collection Invitees_address
* @property Show\Field|Collection Invitees_box_id
* @property Show\Field|Collection email_verified_at
*
* @method Show\Field|Collection created_at(string $label = null)
...
...
@@ -213,7 +228,9 @@ class MiniGrid extends Grid {}
* @method Show\Field|Collection remember_token(string $label = null)
* @method Show\Field|Collection username(string $label = null)
* @method Show\Field|Collection box_num(string $label = null)
* @method Show\Field|Collection can_invite_num(string $label = null)
* @method Show\Field|Collection end_time(string $label = null)
* @method Show\Field|Collection invite_up_rate(string $label = null)
* @method Show\Field|Collection max_participants_num(string $label = null)
* @method Show\Field|Collection min_participants_num(string $label = null)
* @method Show\Field|Collection price(string $label = null)
...
...
@@ -238,10 +255,13 @@ class MiniGrid extends Grid {}
* @method Show\Field|Collection last_used_at(string $label = null)
* @method Show\Field|Collection tokenable_id(string $label = null)
* @method Show\Field|Collection tokenable_type(string $label = null)
* @method Show\Field|Collection address(string $label = null)
* @method Show\Field|Collection invitation_code(string $label = null)
* @method Show\Field|Collection user_address(string $label = null)
* @method Show\Field|Collection blind_box_id(string $label = null)
* @method Show\Field|Collection hash(string $label = null)
* @method Show\Field|Collection Invitees_address(string $label = null)
* @method Show\Field|Collection Invitees_box_id(string $label = null)
* @method Show\Field|Collection email_verified_at(string $label = null)
*/
class
Show
{}
...
...
lang/zh_CN/set-address.php
0 → 100644
View file @
854546a5
<?php
return
[
'labels'
=>
[
'SetAddress'
=>
'SetAddress'
,
'set-address'
=>
'SetAddress'
,
],
'fields'
=>
[
'address'
=>
'收款地址'
,
],
'options'
=>
[
],
];
public/uploads/files/0d8cfddcf71ecaa062d4e85b7a48bea0.jpg
0 → 100644
View file @
854546a5
1.34 KB
routes/api.php
View file @
854546a5
...
...
@@ -33,8 +33,8 @@
Route
::
post
(
'/BlindBox/buy/CheckCallback'
,
'IndexController@useCheckCallback'
);
# 用户订单查询
Route
::
get
(
'/order'
,
'IndexController@useUserOrder'
);
# 获取收款地址
Route
::
get
(
'/address'
,
'IndexController@getReceiptAddress'
);
// ---------
# 获取用户信息
Route
::
get
(
'/user/info'
,
'IndexController@getUserInfo'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment