Beispiel #1
0
 public function lastCheckInTime()
 {
     if ($this->attributes['last_check_in_time'] == 0) {
         return "从未签到";
     }
     return Tools::toDateTime($this->attributes['last_check_in_time']);
 }
Beispiel #2
0
 public function testCheckInLog()
 {
     $log = new CheckInLog();
     $log->user_id = 1;
     $log->checkin_at = time();
     $log->traffic = 1024;
     $log->save();
     $this->assertEquals(Tools::toDateTime($log->checkin_at), $log->CheckInTime());
     $this->assertEquals(Tools::flowAutoShow($log->traffic), $log->traffic());
 }
Beispiel #3
0
 public function sendMailPost($request, $response, $args)
 {
     $to = $request->getParam('email');
     try {
         Mail::send($to, "Test", 'test.tpl', ['time' => Tools::toDateTime(time())], [BASE_PATH . '/LICENSE']);
         $res = ["ret" => 1, "msg" => "ok"];
     } catch (\Exception $e) {
         $res = ["ret" => 0, "msg" => $e->getMessage()];
     }
     return $this->echoJson($response, $res);
 }
Beispiel #4
0
 /**
  * @return mixed
  */
 public function CheckInTime()
 {
     return Tools::toDateTime($this->attributes['checkin_at']);
 }
Beispiel #5
0
 public function logTime()
 {
     return Tools::toDateTime($this->attributes['log_time']);
 }
Beispiel #6
0
 /**
  * @param $ip
  * @param int $time
  * @return int
  */
 public static function getIpRegCount($ip, $time = 3600 * 24)
 {
     return User::where('reg_ip', $ip)->where('reg_date', '>', Tools::toDateTime(time() - $time))->count();
 }
Beispiel #7
0
 public function store($u, $d, $nodeId, $userId, $traffic, $rate)
 {
     $id = Tools::genUUID();
     $result = $this->client->putItem(array('TableName' => $this->tableName, 'Item' => array('id' => array('S' => $id), 'u' => array('S' => (string) $u), 'd' => array('N' => (string) $d), 'node_id' => array('N' => (string) $nodeId), 'rate' => array('N' => (string) $rate), 'traffic' => array('S' => (string) $traffic), 'user_id' => array('N' => (string) $userId), 'create_at' => array('N' => (string) time()), 'create_time' => array('S' => Tools::toDateTime(time())))));
     return $id;
 }