<?php

namespace app\api\untils;

use think\Session;
/**
 * Created by fuju
 * User : hj
 * Date : 2017-12-8
 * Time : 16:34:07
 * Intro: 
 */
class JwtUntils {
    
    /**
     * 生成authToken
     * @param type $data
     * @return boolean
     */
    public function createToken($data){
        if ($data) {        
            $result = \Firebase\JWT\JWT::encode($data, config('jwt_key'));
            Session::set('authToken', $result);
        } else {
            $result = false;
        }
        return $result;
    }
}
