Commit 4cfff754 authored by hujun's avatar hujun

角色权限编辑

parent 8397e40c
......@@ -49,8 +49,7 @@ class TransferHouseInfo extends Controller
}
$g_house_data['market_area'] = $house_info_data['business_area'];
$g_house_data['shop_area_start'] = $house_info_data['room_area'];
$g_house_data['shop_area_end'] = $house_info_data['room_area2'];
$g_house_data['rent_type'] = $house_info_data['rent_type'];
$g_house_data['rent_price'] = $house_info_data['price'];
$g_house_data['industry_type'] = $house_info_data['yetai'];
......@@ -59,10 +58,15 @@ class TransferHouseInfo extends Controller
//状态 0待审批 1上架 2下架 3回收
if ($g_house_data['room_num_left'] == 0) {
$g_house_data['status'] = 2;
$g_house_data['shop_area_start'] = $house_info_data['room_area'];
$g_house_data['shop_area_end'] = $house_info_data['room_area2'];
} else {
$g_house_data['status'] = 1;
$g_house_data['shop_area_start'] = $house_info_data['room_area'];
$g_house_data['shop_area_end'] = $house_info_data['room_area'];
}
$g_house_data['home_page_sort'] = empty($house_info_data['home_page_sort'])? 0:$house_info_data['home_page_sort'];
$g_house_data['shop_type'] = $house_info_data['shangpu_type'];
$g_house_data['shop_sign'] = $house_info_data['shangpu_tags'];
......
......@@ -253,22 +253,27 @@ class Auth extends Basic
}
return $this->response(200,'可以查看',$data);
}
//编辑角色权限
/**
* 编辑角色权限
*
* @return \think\Response
*/
public function updateAccess(){
$table= New AuthGroup;
$auth = new AuthGroup();
$this->params['rules'] = trim($this->params['rules'],',');
$rules = $auth->getValue('rules',['id'=>$this->params['id']]);
$data = input('post.');
// prt($data);
$data['rules']=trim($data['rules'],',');
//提交数据
if ( $table->editData($data,$data['id'])) {
if ($rules == $this->params['rules']) {
return $this->response(100, '无更新内容');
}
if ($auth->saveStatus('rules', $this->params['rules'], $this->params['id'])) {
return $this->response(200, '成功');
}else{
return $this->response(100, '失败');
}
}
/**
......
......@@ -120,7 +120,8 @@ class AuthGroup extends BaseModel
/**
* 获取某个用户组的用户列表
*
* @param int $group_id 用户组id
* @param $group_id 用户组id
* @return mixed
*/
static public function userInGroup($group_id){
$prefix = config('database.prefix');
......@@ -136,7 +137,11 @@ class AuthGroup extends BaseModel
/**
* 检查id是否全部存在
* @param array|string $gid 用户组id列表
*
* @param $modelname
* @param $mid
* @param string $msg
* @return bool
*/
public function checkId($modelname,$mid,$msg = '以下id不存在:'){
if(is_array($mid)){
......@@ -160,21 +165,39 @@ class AuthGroup extends BaseModel
/**
* 检查用户组是否全部存在
* @param array|string $gid 用户组id列表
*
* @param $gid
* @return bool
*/
public function checkGroupId($gid){
return $this->checkId('AuthGroup',$gid, '以下用户组id不存在:');
}
/**
* @param string $order_
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getList2( $order_ = 'id desc', $field = '', $params = '') {
return $this->field($field)
->where($params)
->order($order_)
->select();
}
/**
*检查重复
* 检查重复
*
* @param $key
* @param $name
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function repetition($key,$name){
$r=$this->field($name)
......@@ -185,12 +208,28 @@ class AuthGroup extends BaseModel
}else{
return false;
}
}
}
//更新数据
/**
* 更新数据
*
* @param $name
* @param $key
* @param $ids
* @return $this
*/
public function saveStatus($name,$key,$ids){
$r = $this->where("id",'in',$ids)->update([$name=>$key]);
return $r;
}
/**
* @param $key
* @param $where
* @return mixed
*/
public function getValue($key, $where) {
return $this->where($where)
->value($key);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment