add option for score consumption of adding to closet

This commit is contained in:
printempw 2016-12-28 13:08:17 +08:00
parent f31bd85445
commit da7a0ac606
6 changed files with 17 additions and 5 deletions

View File

@ -57,7 +57,12 @@ class AdminController extends Controller
$group->addon('积分 = 1 KB');
})->hint('上传私密材质将消耗更多积分');
$form->checkbox('return_score', '积分返还', '用户删除角色/材质时返还积分');
$form->group('score_per_closet_item', '收藏消耗积分', function($group) {
$group->text('score_per_closet_item');
$group->addon('积分 = 一个衣柜物品');
});
$form->checkbox('return_score', '积分返还', '用户删除角色/材质/收藏时返还积分');
$form->group('score_per_player', '角色', function($group) {
$group->text('score_per_player');

View File

@ -77,6 +77,10 @@ class ClosetController extends Controller
'name' => 'required|no_special_chars'
]);
if (app('user.current')->getScore() < option('score_per_closet_item', null, false)) {
return json(trans('user.closet.add.lack-score'), 7);
}
if ($this->closet->add($request->tid, $request->name)) {
$t = Texture::find($request->tid);
$t->likes += 1;

View File

@ -343,8 +343,8 @@ class OptionFormGroup
$rendered = [];
foreach ($this->items as $item) {
if ($item['id'] && !$item['value']) {
$item['value'] = option($item['id']);
if ($item['id'] && is_null($item['value'])) {
$item['value'] = option($item['id'], null, false);
}
$rendered[] = view('vendor.option-form.'.$item['type'])->withId($item['id'])->withValue($item['value']);

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-07-29 11:53:11
* @Last Modified by: printempw
* @Last Modified time: 2016-12-27 22:56:31
* @Last Modified time: 2016-12-28 12:59:37
*/
return [
@ -39,5 +39,6 @@ return [
'force_ssl' => '0',
'auto_detect_asset_url' => '1',
'plugins_enabled' => '',
'copyright_prefer' => '0'
'copyright_prefer' => '0',
'score_per_closet_item' => '0'
];

View File

@ -44,6 +44,7 @@ closet:
add:
success: Added :name to closet successfully~
repeated: You have already added this texture.
lack-score: You don't have enough score to add it to closet.
rename:
title: Rename item

View File

@ -50,6 +50,7 @@ closet:
add:
success: 材质 :name 收藏成功~
repeated: 你已经收藏过这个材质啦
lack-score: 积分不够添加收藏啦
rename:
title: 重命名物品