fix missing argument when upload texture

This commit is contained in:
printempw 2016-07-23 21:43:42 +08:00
parent b565c9e0ff
commit 0e155a0f5c
2 changed files with 5 additions and 8 deletions

View File

@ -144,7 +144,7 @@ class SkinlibController extends BaseController
$this->user->setScore($t->size, 'minus');
if ($this->user->closet->add($t->tid)) {
if ($this->user->closet->add($t->tid, $t->name)) {
$t = Texture::find($t->tid);
$t->likes += 1;
$t->save();

View File

@ -70,6 +70,10 @@ class Closet
}
unset($textures_invalid);
} else {
$this->eloquent_model = new ClosetModel();
$this->eloquent_model->uid = $uid;
$this->eloquent_model->save();
}
}
@ -85,11 +89,6 @@ class Closet
return array_reverse(($category == "skin") ? $this->textures_skin : $this->textures_cape);
}
public function getAmount()
{
return $this->eloquent_model->amount;
}
public function add($tid, $name)
{
foreach ($this->textures as $item) {
@ -103,7 +102,6 @@ class Closet
'add_at' => time()
);
$this->eloquent_model->amount += 1;
$this->eloquent_model->textures = json_encode($this->textures);
return $this->eloquent_model->save();
}
@ -133,7 +131,6 @@ class Closet
foreach ($this->textures as $item) {
if ($item['tid'] == $tid) {
array_splice($this->textures, $offset, 1);
$this->eloquent_model->amount -= 1;
$this->eloquent_model->textures = json_encode($this->textures);
return $this->eloquent_model->save();
}