<?php

namespace App\Http\Controllers\User;

use App\Http\Controllers\Controller;
use App\Http\Controllers\Miniprogram\Auth;
use Illuminate\Support\Facades\Redis;
use Illuminate\Support\Facades\Request;

/**
 * 弹窗控制器
 * Class PopupController
 * @package App\Http\Controllers\User
 */
class PopupController extends Controller
{


    /**
     * 走心一画首页弹窗
     * @param  Request  $request
     * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
     * @throws \Tymon\JWTAuth\Exceptions\JWTException
     */
    public function paint(Request $request)
    {
        $uid = Auth::auth();
        $key = "{popup:paint}";
        $bool = Redis::Sismember($key, $uid);
        Redis::sadd($key, $uid);
        return response([
            'code' => 200,
            'message' => 'OK',
            'data' => [
                'result' => $bool,
            ]
        ]);
    }
}
