<?php
namespace App\Models;
use Illuminate\Support\Facades\DB;
class System_bank extends BaseModel {
	protected $table = "system_bank";	
    public $timestamps = false;

    function getInfos(){
        $data=$this->orderby('sort','desc')->whereIn('type',array(1))->get();
        if(!$data){
            return -6010000122;
        }
        return $data->toArray();
    }

    //更新设置
    function updateInfos($data,$id){
        $res=$this->where('id',$id)->update($data);
        if(!$res) {
            return -7020050022;//更新失败
        }
        return 1;
    }


    protected function changeShow($group,$groups_names){
        foreach ($groups_names as $k=>$v){
            $sql="UPDATE system_bank set  groups_names=regexp_replace(groups_names,'".$v."', ' ')";
            $data=DB::select($sql);
        }
        return 1;
    }

}
