| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- class Allowip extends BaseModel
- {
- protected $table='dc_allowip';
- function getCode(){
- $data=$this->orderby('time','desc')->get();
- if(!$data){
- return -6010000122;
- }
- return $data->toArray();
- }
- function getRole($id){
- $data=$this->where('id',$id)->first();
- if(!$data){
- return -7050001204;
- }
- return $data->toArray();
- }
- protected function checkIp(){
- $ip=GETIP();
- if(\App\Models\Setinfo::getIPlimit()<0){
- return 1;
- }
- if(S('IPLIST')<0)
- {
- $ip_list=$this->getCode();
- if($ip_list<0){
- return 1;
- }
- $ips=array();
- if(is_array($ip_list) && count($ip_list)>0){
- foreach($ip_list as $k=>$v){
- $ips[]=trim($v['ip']);
- }
- }
- S('IPLIST',$ips);
- }
- if(!is_array(S('IPLIST'))){
- return 1;
- }
- if(in_array($ip,S('IPLIST'))){
- return 1;
- }
- return -33333;
- }
-
- }
|