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
e4039343
Commit
e4039343
authored
Mar 20, 2023
by
haojie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
8eefbf5e
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
45 additions
and
36 deletions
+45
-36
app/Admin/Controllers/BlindBoxListController.php
+0
-15
app/Admin/Controllers/BlindBoxRecordController.php
+10
-14
app/Admin/Controllers/SetAddressController.php
+7
-3
app/Http/Controllers/API/IndexController.php
+5
-0
app/Models/BlindBoxList.php
+5
-1
app/Models/SetAddress.php
+6
-2
app/Models/UserWallet.php
+0
-1
app/Service/RedisKeyController.php
+12
-0
public/uploads/files/6af03c85d2b4110188a1fd370a6b5506.png
+0
-0
No files found.
app/Admin/Controllers/BlindBoxListController.php
View file @
e4039343
...
...
@@ -40,18 +40,6 @@ protected function grid()
<div>
$this->end_time
</div>
</div>"
;
});
# $grid->column('end_time');
# $grid->column('status', '当前状态');
# 中奖人数
# $grid->column('winner_num')
# 项目图片
# $grid->column('project_icon');
# 批量生成项目
# $grid->column('box_num');
# $grid->column('rules', '规则');
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$filter
->
equal
(
'id'
);
});
...
...
@@ -100,9 +88,6 @@ protected function form()
$form
->
number
(
'min_participants_num'
)
->
default
(
1
)
->
min
(
0
);
$form
->
datetime
(
'start_time'
);
$form
->
datetime
(
'end_time'
);
#purchased--已购买
# winner_list--中奖用户列表
// $form->display('status');
$form
->
number
(
'winner_num'
,
'中奖人数'
)
->
default
(
1
)
->
min
(
0
);
$form
->
number
(
'box_num'
,
'生成盲盒数量'
)
->
default
(
1
)
->
min
(
0
);
$form
->
number
(
'can_invite_num'
,
'最高邀请人数'
)
->
default
(
1
)
->
min
(
0
);
...
...
app/Admin/Controllers/BlindBoxRecordController.php
View file @
e4039343
...
...
@@ -87,18 +87,24 @@ protected function grid()
return
'暂无'
;
}
return
'点击展开'
;
})
->
expand
(
function
()
{
})
->
expand
(
function
(
$model
)
{
// 返回显示的详情
$json
=
json_decode
(
$this
->
purchased
);
# 是数组
$div
=
''
;
if
(
$json
&&
count
(
$json
))
{
foreach
(
$json
as
$value
)
{
$div
=
$div
.
"<div>
$value->address
</div>"
;
}
}
return
"<div style='padding:10px 10px 0'>
$div
</div>"
;
return
"<div style='padding:10px 0'>
$div
</div>"
;
// $div = '';
// $list = BlindBoxList::find($this->id)->user_wallet()->where('status', 1)->get();
// if ($list && count($list)) {
// foreach ($list as $value) {
// $div = $div . "<div>$value->user_address</div>";
// }
// }
// return $div;
});
# winner_list-中奖钱包
$grid
->
column
(
'winner_list'
,
'中奖钱包'
)
->
display
(
function
(
$item
)
{
...
...
@@ -132,16 +138,6 @@ protected function grid()
}
return
''
;
});
# 中奖人数
# $grid->column('winner_num')
# 项目图片
# $grid->column('project_icon');
# 批量生成项目
# $grid->column('box_num');
# $grid->column('rules', '规则');
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
# $filter->equal('status', '状态');
$filter
->
where
(
'status'
,
function
(
$query
)
{
...
...
app/Admin/Controllers/SetAddressController.php
View file @
e4039343
...
...
@@ -3,10 +3,13 @@
namespace
App\Admin\Controllers
;
use
App\Admin\Repositories\SetAddress
;
use
App\Service\RedisKeyController
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
Illuminate\Support\Facades\Log
;
use
Illuminate\Support\Facades\Redis
;
class
SetAddressController
extends
AdminController
{
...
...
@@ -28,10 +31,8 @@ protected function grid()
$grid
->
column
(
'address'
)
->
editable
();
# $grid->column('created_at');
# $grid->column('updated_at')->sortable();
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$filter
->
equal
(
'id'
);
});
});
}
...
...
@@ -63,9 +64,12 @@ 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'
);
$form
->
saved
(
function
(
Form
$from
,
$res
)
{
# 更新缓存
Redis
::
set
(
RedisKeyController
::
receipt_account
,
$from
->
address
);
});
});
}
}
app/Http/Controllers/API/IndexController.php
View file @
e4039343
...
...
@@ -7,6 +7,7 @@
use
App\Http\Controllers\API\Redis\CheckArrivalCl
;
use
App\Http\Controllers\API\Test\TestController
;
use
App\Http\Controllers\Controller
;
use
App\Service\RedisKeyController
;
use
Illuminate\Http\Request
;
use
App\Http\Controllers\API\BlindBox\BlindBoxController
;
use
App\Http\Controllers\API\BlindBox\BuyBlindBoxController
;
...
...
@@ -43,6 +44,10 @@ public function getUserInfo(Request $request)
*/
public
function
getReceiptAddress
(
Request
$request
)
{
$address
=
Redis
::
get
(
RedisKeyController
::
receipt_account
);
if
(
$address
)
{
return
$this
->
success
(
'success'
,
$address
);
}
$address
=
SetAddress
::
query
()
->
first
([
'address'
]);
return
$this
->
success
(
'success'
,
$address
->
address
);
...
...
app/Models/BlindBoxList.php
View file @
e4039343
...
...
@@ -25,6 +25,10 @@ class BlindBoxList extends Model
'status'
,
'can_invite_num'
,
'invite_up_rate'
];
public
function
user_wallet
()
{
return
$this
->
hasMany
(
UserWallet
::
class
,
'blind_box_id'
);
}
}
app/Models/SetAddress.php
View file @
e4039343
...
...
@@ -8,7 +8,11 @@
class
SetAddress
extends
Model
{
use
HasDateTimeFormatter
;
use
HasDateTimeFormatter
;
protected
$fillable
=
[
'address'
];
protected
$table
=
'set_address'
;
}
app/Models/UserWallet.php
View file @
e4039343
...
...
@@ -20,5 +20,4 @@ class UserWallet extends Model
'transfer_status'
];
protected
$table
=
'user_wallet'
;
}
app/Service/RedisKeyController.php
0 → 100644
View file @
e4039343
<?php
namespace
App\Service
;
/**
* redis-key
*/
class
RedisKeyController
{
# 收款账号
public
const
receipt_account
=
'receipt_account'
;
}
public/uploads/files/6af03c85d2b4110188a1fd370a6b5506.png
0 → 100644
View file @
e4039343
6.34 KB
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