修改原有框架中英文映射
This commit is contained in:
@@ -29,11 +29,11 @@ class DiceRewardController extends BaseController
|
||||
{
|
||||
$direction = $request->input('direction', null);
|
||||
if ($direction === null || $direction === '') {
|
||||
return $this->fail('请传入 direction(0=顺时针 1=逆时针)');
|
||||
return $this->fail('please provide direction (0=clockwise, 1=counterclockwise)');
|
||||
}
|
||||
$direction = (int) $direction;
|
||||
if (!in_array($direction, [DiceReward::DIRECTION_CLOCKWISE, DiceReward::DIRECTION_COUNTERCLOCKWISE], true)) {
|
||||
return $this->fail('direction 必须为 0(顺时针)或 1(逆时针)');
|
||||
return $this->fail('direction must be 0 (clockwise) or 1 (counterclockwise)');
|
||||
}
|
||||
$tier = $request->input('tier', '');
|
||||
$page = (int) $request->input('page', 1);
|
||||
@@ -120,11 +120,11 @@ class DiceRewardController extends BaseController
|
||||
{
|
||||
$recordId = (int) $request->input('record_id', 0);
|
||||
if ($recordId <= 0) {
|
||||
return $this->fail('请传入 record_id');
|
||||
return $this->fail('please provide record_id');
|
||||
}
|
||||
$record = DiceRewardConfigRecord::find($recordId);
|
||||
if (!$record) {
|
||||
return $this->fail('记录不存在');
|
||||
return $this->fail('record not found');
|
||||
}
|
||||
$arr = $record->toArray();
|
||||
$data = [
|
||||
@@ -147,9 +147,9 @@ class DiceRewardController extends BaseController
|
||||
try {
|
||||
$table = (new DicePlayRecordTest())->getTable();
|
||||
Db::execute('TRUNCATE TABLE `' . $table . '`');
|
||||
return $this->success('已清空测试数据');
|
||||
return $this->success('test data cleared');
|
||||
} catch (\Throwable $e) {
|
||||
return $this->fail('清空失败:' . $e->getMessage());
|
||||
return $this->fail('clear failed: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,12 +162,12 @@ class DiceRewardController extends BaseController
|
||||
{
|
||||
$items = $request->post('items', []);
|
||||
if (!is_array($items)) {
|
||||
return $this->fail('参数 items 必须为数组');
|
||||
return $this->fail('parameter items must be an array');
|
||||
}
|
||||
try {
|
||||
$logic = new DiceRewardLogic();
|
||||
$logic->batchUpdateWeights($items);
|
||||
return $this->success('保存成功');
|
||||
return $this->success('save success');
|
||||
} catch (\plugin\saiadmin\exception\ApiException $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
@@ -182,16 +182,16 @@ class DiceRewardController extends BaseController
|
||||
{
|
||||
$direction = (int) $request->post('direction', 0);
|
||||
if (!in_array($direction, [DiceReward::DIRECTION_CLOCKWISE, DiceReward::DIRECTION_COUNTERCLOCKWISE], true)) {
|
||||
return $this->fail('direction 必须为 0(顺时针)或 1(逆时针)');
|
||||
return $this->fail('direction must be 0 (clockwise) or 1 (counterclockwise)');
|
||||
}
|
||||
$items = $request->post('items', []);
|
||||
if (!is_array($items)) {
|
||||
return $this->fail('参数 items 必须为数组');
|
||||
return $this->fail('parameter items must be an array');
|
||||
}
|
||||
try {
|
||||
$logic = new DiceRewardLogic();
|
||||
$logic->batchUpdateWeightsByDirection($direction, $items);
|
||||
return $this->success('保存成功');
|
||||
return $this->success('save success');
|
||||
} catch (\plugin\saiadmin\exception\ApiException $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user