table)->where('company_id',$this->auth->company_id)->where('deletetime',NULL)->order('id desc')->select(); $list = list_domain_image($list,['avatar','idcard_z_image','idcard_f_image','jineng_image']); $this->success(1,$list); } public function add(){ $mobile = input('mobile',''); if(empty($mobile)){ $this->error(); } $check = Db::name($this->table)->where('mobile',$mobile)->where('deletetime',NULL)->find(); if($check){ $this->error('该手机号已被他人注册'); } $data = [ 'avatar' => input('avatar',''), 'truename' => input('truename',''), 'gonghao' => input('gonghao',''), 'mobile' => $mobile, 'password' => input('password',''), 'company_id' => $this->auth->company_id, 'status' => input('status',1), 'idcard_z_image' => input('idcard_z_image',''), 'idcard_f_image' => input('idcard_f_image',''), 'jineng_image' => input('jineng_image',''), ]; $worker_id = Db::name($this->table)->insertGetId($data); //注册到im //user_用户端小程序,master_师傅,kefu_客服 $tenim = new Tenim(); $rs = $tenim->register('master_'. $worker_id, $data['truename'], localpath_to_netpath($data['avatar'])); $this->success(); } public function info(){ $id = input('id',0); $info = Db::name($this->table)->where('id',$id)->where('company_id',$this->auth->company_id)->where('deletetime',NULL)->find(); $info = info_domain_image($info,['avatar','idcard_z_image','idcard_f_image','jineng_image']); $this->success(1,$info); } public function edit(){ $id = input('id',0); $info = Db::name($this->table)->where('id',$id)->where('company_id',$this->auth->company_id)->where('deletetime',NULL)->find(); if(empty($info)){ $this->error('没找到该信息,请刷新重试'); } $mobile = input('mobile',''); if(empty($mobile)){ $this->error(); } $check = Db::name($this->table)->where('mobile',$mobile)->where('id','NEQ',$id)->where('deletetime',NULL)->find(); if($check){ $this->error('该手机号已被他人注册'); } $data = [ 'avatar' => input('avatar',''), 'truename' => input('truename',''), 'gonghao' => input('gonghao',''), 'mobile' => $mobile, 'password' => input('password',''), 'status' => input('status',1), 'idcard_z_image' => input('idcard_z_image',''), 'idcard_f_image' => input('idcard_f_image',''), 'jineng_image' => input('jineng_image',''), ]; Db::name($this->table)->where('id',$id)->update($data); //如果有修改头像或昵称,同步到im //user_用户端小程序,master_师傅,kefu_客服 $tenim = new Tenim(); $rs = $tenim->useredit('master_'. $id, $data['truename'], localpath_to_netpath($data['avatar'])); $this->success(); } public function del(){ $ids = input('ids',''); $ids = explode(',',$ids); if (empty($ids)) { $this->error(); } Db::name($this->table)->where('id','IN',$ids)->where('company_id',$this->auth->company_id)->update(['deletetime'=>time()]); $this->success(); } }