medal add gift_fee_factor and user_medal add priority

This commit is contained in:
xiaomlove
2023-01-29 20:00:58 +08:00
parent fb803d1989
commit 0845bca268
25 changed files with 335 additions and 55 deletions

View File

@@ -138,3 +138,26 @@ function buyMedal($params)
$rep = new \App\Repositories\BonusRepository();
return $rep->consumeToBuyMedal($CURUSER['id'], $params['medal_id']);
}
function giftMedal($params)
{
global $CURUSER;
$rep = new \App\Repositories\BonusRepository();
return $rep->consumeToGiftMedal($CURUSER['id'], $params['medal_id'], $params['uid']);
}
function saveUserMedal($params)
{
global $CURUSER;
$data = [];
foreach ($params as $param) {
$fieldAndId = explode('_', $param['name']);
$field = $fieldAndId[0];
$id = $fieldAndId[1];
$value = $param['value'];
$data[$id][$field] = $value;
}
// dd($params, $data);
$rep = new \App\Repositories\MedalRepository();
return $rep->saveUserMedal($CURUSER['id'], $data);
}