<?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) {
            $jwt_data['data']       = $data;
            $jwt_data['timeStamp_'] = time();
            $result = \Firebase\JWT\JWT::encode($jwt_data, config('jwt_key'));
            Session::set('authToken', $result);
        } else {
            $result = false;
        }
        return $result;
    }
}
