255], [['company'], 'string', 'max' => 120], [['tel', 'city', 'district','province'], 'string', 'max' => 32], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => 'ID', 'uid' => '用户ID', 'logo' => 'logo地址', 'company' => '公司名称', 'age' => '年限', 'level' => '等级', 'licence' => 'Licence', 'created_at' => '创建时间', 'tel' => '联系电话', 'city' => '城市', 'district' => '地区', 'address' => '地址', 'updated_at' => 'Updated At', 'introduction' => '公司简介', 'openid' =>'openid', 'member' =>'是否会员', 'vip_start' =>'会员开始时间', 'vip_end' =>'会员结束时间', ]; } static public function _getToken($uid) { $auth_str = $uid; $expiry = 0; $key = 'building'; $timeExpiry = sprintf('%010d', $expiry ? $expiry + time() : 0); $topAuth = substr(md5($auth_str . $timeExpiry . $key), 0, 6); $enString = base64_encode($timeExpiry . $auth_str); return $topAuth . $enString; } static public function _checkToken($token) { $string = $token; $key = 'building'; $topAuth = substr($string, 0, 6); $enString = substr($string, 6); $str = base64_decode($enString); $timeExpiry = substr($str, 0, 10); $deString = substr($str, 10); if ($topAuth != substr(md5($deString . $timeExpiry . $key), 0, 6)) { return false; } $timeExpiry *= 1; if ($timeExpiry != 0 && $timeExpiry < time()) { return false; } return $deString; } }