liche update for admin sys mannger not set app_id, cate_id, city_id and platform_id
This commit is contained in:
@@ -83,20 +83,6 @@ class Admin extends HD_Controller {
|
||||
$this->data = $this->_get_info();
|
||||
$data = $this->sysAdmin->get(['id' => $id]);
|
||||
$json = (array)json_decode($data['other_json']);
|
||||
if(isset($json['cate_id'])) {
|
||||
$this->data['cate_id'] = array_combine($json['cate_id'], $json['cate_id']);
|
||||
}
|
||||
if(isset($json['city_id'])) {
|
||||
if(is_array($json['city_id'])) {
|
||||
$this->data['city_id'] = array_combine($json['city_id'], $json['city_id']);
|
||||
}
|
||||
}
|
||||
if(isset($json['platfrom_id']) && is_array($json['platfrom_id'])) {
|
||||
$this->data['platfrom_id'] = array_combine($json['platfrom_id'], $json['platfrom_id']);
|
||||
}
|
||||
if(isset($json['app_id']) && is_array($json['app_id'])) {
|
||||
$this->data['app_id'] = array_combine($json['app_id'], $json['app_id']);
|
||||
}
|
||||
$this->data['username'] = $data['username'];
|
||||
$this->data['role_id'] = $data['role_id'];
|
||||
$this->data['mobile'] = $data['mobile'];
|
||||
@@ -145,13 +131,7 @@ class Admin extends HD_Controller {
|
||||
'username' => $input['username'],
|
||||
'mobile' => $input['mobile'],
|
||||
'role_id' => $input['role'],
|
||||
'role_id' => $input['role'],
|
||||
'other_json' => json_encode([
|
||||
'cate_id' => $input['category'],
|
||||
'city_id' => $input['city'],
|
||||
'platfrom_id' => $input['platfrom'],
|
||||
'app_id' => $input['apps'],
|
||||
]),
|
||||
'other_json' => json_encode([]),
|
||||
'password' => password_hash($input['password1'],PASSWORD_BCRYPT),
|
||||
'c_time' => time(),
|
||||
];
|
||||
@@ -172,12 +152,7 @@ class Admin extends HD_Controller {
|
||||
'username' => $input['username'],
|
||||
'mobile' => $input['mobile'],
|
||||
'role_id' => $input['role'],
|
||||
'other_json' => json_encode([
|
||||
'cate_id' => $input['category'],
|
||||
'city_id' => $input['city'],
|
||||
'platfrom_id' => $input['platfrom'],
|
||||
'app_id' => $input['apps'],
|
||||
]),
|
||||
'other_json' => json_encode([]),
|
||||
];
|
||||
if($this->sysAdmin->update($upd,['id' => $input['id']])) {
|
||||
return $this->show_json(SYS_CODE_SUCCESS,'修改成功!');
|
||||
@@ -209,10 +184,6 @@ class Admin extends HD_Controller {
|
||||
private function _get_info()
|
||||
{
|
||||
$data['role'] = $this->sysRole->select(['status' => '1'],'','','','id,name');
|
||||
$data['category'] = $this->sysCate->select(['pid' => '0', 'status' => '1']);
|
||||
$data['city'] = $this->sysCity->select(['status' => '1']);
|
||||
$data['platfrom'] = array(0=>'总后台',1=>'商家后台');
|
||||
$data['apps'] = $this->app_model->select(array(),'','','','id,name');
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -265,14 +236,10 @@ class Admin extends HD_Controller {
|
||||
{
|
||||
$data = [
|
||||
'id' => $this->input->post('id'),
|
||||
'category' => $this->input->post('category'),
|
||||
'city' => $this->input->post('city[]'),
|
||||
'platfrom' => $this->input->post('platfrom[]'),
|
||||
'username' => trim($this->input->post('username')),
|
||||
'mobile' => trim($this->input->post('mobile')),
|
||||
'status' => $this->input->post('status'),
|
||||
'role' => $this->input->post('role'),
|
||||
'apps' => $this->input->post('apps'),
|
||||
'password1' => trim($this->input->post('password1')),
|
||||
'password2' => trim($this->input->post('password2')),
|
||||
];
|
||||
|
||||
@@ -39,42 +39,6 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">小程序应用:</label>
|
||||
<div v-for="value in apps" class="am-para-inline">
|
||||
<input v-if="app_id[value.id] == value.id" checked type="checkbox" name="apps[]" v-bind:value="value.id" />
|
||||
<input v-else type="checkbox" name="apps[]" v-bind:value="value.id" />
|
||||
{{value.name}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">可登录平台:</label>
|
||||
<div class="am-para-inline">
|
||||
<div v-for="(value,key) in platfrom" class="am-para-inline">
|
||||
<input v-if="platfrom_id =='' || platfrom_id[key] == key" checked type="checkbox" name="platfrom[]" v-bind:value="key" />
|
||||
<input v-else type="checkbox" name="platfrom[]" v-bind:value="key" />
|
||||
{{value}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($this->data['role_id'] != SUPER_ADMIN) { ?>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">行业:</label>
|
||||
<div v-for="value in category" class="am-para-inline">
|
||||
<input v-if="cate_id[value.id] == value.id" checked type="checkbox" name="category[]" v-on:click="setCate(value.id)" v-bind:value="value.id" />
|
||||
<input v-else type="checkbox" name="category[]" v-on:click="setCate(value.id)" v-bind:value="value.id" />
|
||||
{{value.name}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">城市:</label>
|
||||
<div v-for="value in city" class="am-para-inline">
|
||||
<input v-if="city_id[value.city_id] == value.city_id" checked type="checkbox" name="city[]" v-bind:value="value.city_id" />
|
||||
<input v-else type="checkbox" name="city[]" v-bind:value="value.city_id" />
|
||||
{{value.name}}
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if($url == 'add') { ?>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">密码:</label>
|
||||
@@ -97,24 +61,12 @@
|
||||
var vm = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
cate_id: '',
|
||||
city_id: '',
|
||||
role_id: '',
|
||||
platfrom_id: '',
|
||||
app_id:'',
|
||||
role: <?=json_encode($this->data['role'])?>,
|
||||
category: <?=json_encode($this->data['category'])?>,
|
||||
city: <?=json_encode($this->data['city'])?>,
|
||||
platfrom: <?=json_encode($this->data['platfrom'])?>,
|
||||
apps:<?=json_encode($this->data['apps'])?>,
|
||||
},
|
||||
created: function(index) {
|
||||
if('edit' == '<?=$url?>') {
|
||||
this.cate_id = <?=json_encode($this->data['cate_id']?$this->data['cate_id']:[])?>;
|
||||
this.city_id = <?=json_encode($this->data['city_id']?$this->data['city_id']:[])?>;
|
||||
this.platfrom_id = <?=json_encode($this->data['platfrom_id']?$this->data['platfrom_id']:[])?>;
|
||||
this.role_id = '<?=$this->data['role_id']?>';
|
||||
this.app_id = <?=json_encode($this->data['app_id']?$this->data['app_id']:[])?>;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
Reference in New Issue
Block a user