1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace App\Http\Controllers\Admin;
- use Illuminate\Support\Facades\Redis;
- use App\Http\Controllers\Core\Auth;
- use App\Http\Controllers\Controller;
- use Illuminate\Http\Request;
- class Debug extends Controller
- {
- public function get()
- {
- $uid = Auth::adminAuth();
- try {
- $admins = Redis::hgetall("fpdx_admin_debug");
- unset($admins['#']);
- $result = array();
- foreach ($admins as $k => $v) {
- array_push($result, [
- 'admin_uid' => $k,
- 'debug_uid' => $v
- ]);
- }
- return array(
- 'code' => 200,
- 'message' => 'success',
- 'data' => $result
- );
- } catch (\Exception $e) {
- throw new \ApiException($e->getMessage(), 501);
- }
- }
- public function store(Request $request)
- {
- $uid = Auth::adminAuth();
- try {
- $this->validate($request, [
- 'admin_uid' => 'required|integer',
- 'debug_uid' => 'required|integer'
- ]);
- Redis::hset("fpdx_admin_debug", $request->input('admin_uid'), $request->input('debug_uid'));
- return array(
- 'code' => 200,
- 'message' => 'success'
- );
- } catch (\Exception $e) {
- throw new \ApiException($e->getMessage(), 501);
- }
- }
- public function delete(Request $request)
- {
- $uid = Auth::adminAuth();
- try {
- $this->validate($request, [
- 'admin_uid' => 'required|integer'
- ]);
- Redis::hdel("fpdx_admin_debug", $request->input('admin_uid'));
- return array(
- 'code' => 200,
- 'message' => 'success'
- );
- } catch (\Exception $e) {
- throw new \ApiException($e->getMessage(), 501);
- }
- }
- }
|