[接口]优化新增购买抽奖券时记录DicePlayerTicketRecord
This commit is contained in:
@@ -53,8 +53,14 @@ class GameController extends OpenController
|
||||
$logic = new GameLogic();
|
||||
$data = $logic->buyLotteryTickets($userId, $count);
|
||||
return $this->success($data);
|
||||
} catch (\plugin\saiadmin\exception\ApiException $e) {
|
||||
return $this->fail($e->getMessage(), ReturnCode::EMPTY_PARAMS);
|
||||
} catch (ApiException $e) {
|
||||
$msg = $e->getMessage();
|
||||
if ($msg === '平台币不足') {
|
||||
$player = DicePlayer::find($userId);
|
||||
$coin = $player ? (float) $player->coin : 0;
|
||||
return $this->success(['coin' => $coin], $msg);
|
||||
}
|
||||
return $this->fail($msg, ReturnCode::EMPTY_PARAMS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user