| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace App\Module\GameItems\AdminControllers\Tools;
- use App\Module\Game\DCache\ChestJsonConfig;
- use App\Module\Game\DCache\ItemJsonConfig;
- use Dcat\Admin\Grid\Tools\AbstractTool;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\Log;
- class SyncChetsJsonTool extends AbstractTool
- {
- protected $style = 'btn btn-danger waves-effect';
- public function title()
- {
- return '立即同步';
- }
- public function confirm()
- {
- return '确定要立即同步JSON数据吗?';
- }
- public function handle(Request $request)
- {
- try {
- $json =ChestJsonConfig::getData([],true);
- return $this->response()->success('同步成功')->refresh();
- } catch (\Exception $e) {
- Log::error('Sync items.json exception: '.$e->getMessage());
- return $this->response()->error('同步失败:'.$e->getMessage());
- }
- }
- }
|