Fix score calculation
This commit is contained in:
parent
98ff895d3b
commit
2b0f8b20c1
@ -119,7 +119,7 @@ class ClosetController extends Controller
|
||||
$t->save();
|
||||
|
||||
if (option('return_score'))
|
||||
app('user.current')->setScore(option('score_per_closet_item'), 'minus');
|
||||
app('user.current')->setScore(option('score_per_closet_item'), 'plus');
|
||||
|
||||
return json(trans('user.closet.remove.success'), 0);
|
||||
} else {
|
||||
|
@ -197,7 +197,10 @@ class SkinlibController extends Controller
|
||||
Storage::delete($result['hash']);
|
||||
|
||||
if (option('return_score')) {
|
||||
$this->user->setScore($result->size * Option::get('score_per_storage'), 'plus');
|
||||
if ($result->public == 1)
|
||||
$this->user->setScore($result->size * Option::get('score_per_storage'), 'plus');
|
||||
else
|
||||
$this->user->setScore($result->size * Option::get('private_score_per_storage'), 'plus');
|
||||
}
|
||||
|
||||
if ($result->delete())
|
||||
@ -223,9 +226,17 @@ class SkinlibController extends Controller
|
||||
foreach (Closet::all() as $closet) {
|
||||
if ($closet->uid != $uid && $closet->has($t->tid)) {
|
||||
$closet->remove($t->tid);
|
||||
if (option('return_score')) {
|
||||
User::find($closet->uid)->setScore(option('score_per_closet_item'), 'plus');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
app('user.current')->setScore(
|
||||
$t->size * (option('private_score_per_storage') - option('score_per_storage')) * ($t->public == 1 ? -1 : 1),
|
||||
'plus'
|
||||
);
|
||||
|
||||
if ($t->setPrivacy(!$t->public)) {
|
||||
return json([
|
||||
'errno' => 0,
|
||||
|
Loading…
Reference in New Issue
Block a user