You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
489 B
28 lines
489 B
<?php
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
class ScoreLog extends SoftDeletesModel
|
|
{
|
|
/**
|
|
* 添加积分
|
|
* @param $user_id
|
|
* @param $score
|
|
* @param string $remark
|
|
* @return mixed
|
|
*/
|
|
public static function add($user_id, $score, $remark = '')
|
|
{
|
|
User::where('id', $user_id)->increment('score', $score);
|
|
return self::create([
|
|
'user_id' => $user_id,
|
|
'score' => $score,
|
|
'remark' => $remark,
|
|
]);
|
|
}
|
|
|
|
}
|
|
|