12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- namespace app\company\controller;
- use app\common\controller\Apic;
- use think\Db;
- /**
- * 密码
- */
- class Password extends Apic
- {
- protected $noNeedLogin = [];
- protected $noNeedRight = ['info'];
- protected $table = 'password';
- public function index(){
- $list = Db::name($this->table)->where('company_id',$this->auth->company_id)->order('id desc')->paginate();
- $total = $list->total();
- $list = $list->items();
- $list = list_domain_image($list,['logo_image']);
- $rs = [
- 'list' => $list,
- 'total'=> $total,
- ];
- $this->success(1,$rs);
- }
- public function add(){
- $data = [
- 'brand' => input('brand',''),
- 'logo_image' => input('logo_image',''),
- 'typename' => input('typename',''),
- 'name' => input('name',''),
- 'password' => input('password',''),
- 'company_id' => $this->auth->company_id,
- ];
- Db::name($this->table)->insertGetId($data);
- $this->success();
- }
- public function info(){
- $id = input('id',0);
- $info = Db::name($this->table)->where('id',$id)->where('company_id',$this->auth->company_id)->find();
- $info = info_domain_image($info,['logo_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)->find();
- if(empty($info)){
- $this->error('没找到该信息,请刷新重试');
- }
- $data = [
- 'brand' => input('brand',''),
- 'logo_image' => input('logo_image',''),
- 'typename' => input('typename',''),
- 'name' => input('name',''),
- 'password' => input('password',''),
- ];
- Db::name($this->table)->where('id',$id)->update($data);
- $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)->delete();
- $this->success();
- }
- }
|