| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace App\Models;
- use Illuminate\Support\Facades\DB;
- /**
- *
- */
- class Account_Token extends BaseModel {
- protected $table = 'account_token';
- public $timestamps = 'false';
- //获取在线人数的id
- function getOn(){
- $time=time();
- $time=1504604886;
- $data=$this->select('account_identity')->where('effective_time','>',$time)->get();
- $data = ($data-600)->update();
- if(!$data){
- return array();
- }
- return $data->toArray();
- }
- function getTime($id) {
- $time=time();
- $time=1504604886;
- $sql="update account_token set effective_time = (effective_time-600) where account_identity='{$id}'";
- $data = DB::select($sql);
- if($data < 0){
- return array();
- }
- return 1;
-
- }
- // function getUser(){
- // $time=time()-30*60;
- // $data=$this->select(DB::raw('distinct min(b.url) as name,count(last_time) as value'))
- // ->rightJoin('account_token as b','b.account_identity',$this->table.'.account_identity')
- // ->where('effective_time','>',$time)
- // ->groupBy('b.url')
- // ->get();
- // if(!$data){
- // return -2020032103; //没有用户登录日志
- // }
- // print_r($data->toArray());
- // return $data->toArray();
- // }
- }
|