<?php
/*
 +----------------------------------------------------------------------
 | TEMMOKUMVC [ NO BEST, ONLY BETTER ]
 +----------------------------------------------------------------------
 | Copyright (c) 2018~2019 https://www.temmoku.cn All rights reserved.
 +----------------------------------------------------------------------
 | Author: 张宗强 Email:webmaster@temmoku.cn QQ:158726877 516669373 TEL:17895221001 微信:temmokumvc
 +---------------------------------------------------------------------- 
*/
namespace admin\model;
use \temmoku\db;
class group {
   	public function add($data)
    {
    	db::insert(jab."user_group")->cols(array('name'=>$data['name'],'type'=>$data['type']))->query();
    }
    public function get_all()
    {
    	$user_group=db::select('*')->from(jab."user_group")->orderByDESC(array('id'))->query();
    	return $user_group;
    }
    public function del($id){
    	db::delete(jab."user_group")->where('id='.$id)->query();
    }
    public function edit(){
    	isset($_POST) && extract($_POST);
    	if($if_login_admin==='0'){
			unset($setting['power']);
		}
		$setting=serialize($setting);
		$array=[
			'name'=>$name,
			'type'=>$type,
			'if_login_admin'=>$if_login_admin,
			'if_login_user'=>$if_login_user,
			'setting'=>$setting
		];
		db::update(jab."user_group")->cols($array)->where("id=$id")->query();
    }
}
?>