|
@@ -76,7 +76,7 @@ class Mobile extends Backend
|
|
|
}
|
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildindexparams();
|
|
|
|
|
|
- if(!$this->admin('sub')){
|
|
|
+ if(!$this->admin('is_sub')){
|
|
|
$list = $this->model
|
|
|
->with(['info','proxy'])
|
|
|
->where($where)
|
|
@@ -105,7 +105,7 @@ class Mobile extends Backend
|
|
|
}
|
|
|
$row['rules']=array_values(array_unique($rules));
|
|
|
|
|
|
- if($this->admin('sub')) {
|
|
|
+ if($this->admin('is_sub')) {
|
|
|
$row['mobile_sub'] = [
|
|
|
'sub_sort' => (int)$row['sub_sort'],
|
|
|
'sub_rec_time' => (int)$row['sub_rec_time'],
|
|
@@ -164,11 +164,11 @@ class Mobile extends Backend
|
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildindexparams();
|
|
|
|
|
|
$map=[];
|
|
|
- if($this->admin('sub')){
|
|
|
+ if($this->admin('is_sub')){
|
|
|
$map['hold_chan']=$this->auth->id;
|
|
|
}
|
|
|
$relation=['info'];
|
|
|
- if(!$this->admin('sub')){
|
|
|
+ if(!$this->admin('is_sub')){
|
|
|
$relation[]='proxy';
|
|
|
}
|
|
|
|
|
@@ -259,13 +259,20 @@ class Mobile extends Backend
|
|
|
$this->success('');
|
|
|
}
|
|
|
#
|
|
|
- protected function optDisabled($mobile){
|
|
|
- if(!$this->admin('sub') && !$this->admin('proxy')){
|
|
|
+ protected function subDisabled(){
|
|
|
+ if($this->admin('is_manager')){
|
|
|
return false;
|
|
|
}
|
|
|
- if($this->admin(''))
|
|
|
- if(!$mobile['is_activity']){
|
|
|
-
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ protected function killDisabled($mobile){
|
|
|
+ if($this->admin('is_manager')){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if ($mobile['is_activity']) {
|
|
|
+ return $mobile['hold_chan']!=$this->admin('id');
|
|
|
+ }else{
|
|
|
+ return false;
|
|
|
}
|
|
|
}
|
|
|
#预占
|
|
@@ -273,7 +280,8 @@ class Mobile extends Backend
|
|
|
if($this->request->isGet()){
|
|
|
$mobile=$this->model->find($ids);
|
|
|
$this->assign('row',$mobile);
|
|
|
- $this->assign('disabled',$this->admin('sub'));
|
|
|
+ $this->assign('subDisabled',$this->subDisabled());
|
|
|
+ $this->assign('killDisabled',$this->killDisabled($mobile));
|
|
|
return view();
|
|
|
}else{
|
|
|
Db::startTrans();
|
|
@@ -307,8 +315,8 @@ class Mobile extends Backend
|
|
|
$mobile['province']=\app\common\model\Area::where('id',$mobile['province_id'])->value('name');
|
|
|
$mobile['city']=\app\common\model\Area::where('id',$mobile['city_id'])->value('name');
|
|
|
$this->assign('row',$mobile);
|
|
|
- $this->assign('disabled',$this->admin('sub'));
|
|
|
- $this->assign('otherSubDisabled',$this->admin('sub') && $this->admin('id')!=$mobile['hold_chan']);
|
|
|
+ $this->assign('disabled',$this->subDisabled());
|
|
|
+ $this->assign('otherSubDisabled',$this->killDisabled($mobile));
|
|
|
return view();
|
|
|
}else{
|
|
|
$data=input('row/a');
|
|
@@ -317,12 +325,12 @@ class Mobile extends Backend
|
|
|
if(!$mobile){
|
|
|
$this->error('号码不存在');
|
|
|
}
|
|
|
- if($this->admin('sub') && $this->auth->id!=$mobile['hold_chan']){
|
|
|
+ if($this->admin('is_sub') && $this->auth->id!=$mobile['hold_chan']){
|
|
|
$this->error('无权操作');
|
|
|
}
|
|
|
/*foreach ($mobiles as $mobile){*/
|
|
|
Db::startTrans();
|
|
|
- if($this->admin('sub')){
|
|
|
+ if($this->admin('is_sub')){
|
|
|
$data=[
|
|
|
'amount_kill'=>$data['amount_kill'],
|
|
|
];
|
|
@@ -875,7 +883,7 @@ class Mobile extends Backend
|
|
|
}
|
|
|
public function batch_activity_cancel($ids){
|
|
|
$map=[];
|
|
|
- if($this->admin('sub')){
|
|
|
+ if($this->admin('is_sub')){
|
|
|
$map['hold_chan']=$this->admin('id');
|
|
|
}
|
|
|
$this->model->whereIn('id',$ids)->where($map)->update([
|
|
@@ -897,7 +905,7 @@ class Mobile extends Backend
|
|
|
'sort'=>0,
|
|
|
];
|
|
|
if($this->request->isGet()){
|
|
|
- if($this->admin('sub')){
|
|
|
+ if($this->admin('is_sub')){
|
|
|
$row['sort']=MobileSub::getBy($mobile,$this->admin())['sub_sort'];
|
|
|
}else{
|
|
|
$row['sort']=$mobile['sort'];
|
|
@@ -909,7 +917,7 @@ class Mobile extends Backend
|
|
|
$this->validate($data,[
|
|
|
'sort|排序'=>['require','integer','gt:0'],
|
|
|
]);
|
|
|
- if($this->admin('sub')){
|
|
|
+ if($this->admin('is_sub')){
|
|
|
$mobileSub=MobileSub::getBy($mobile,$this->admin());
|
|
|
$mobileSub['sub_sort']=$data['sort'];
|
|
|
$mobileSub->save();
|