|
@@ -0,0 +1,91 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace app\company\controller;
|
|
|
+
|
|
|
+use app\common\controller\Apic;
|
|
|
+use think\Db;
|
|
|
+/**
|
|
|
+ * 调试维修
|
|
|
+ */
|
|
|
+class Tiaoshiweixiu extends Apic
|
|
|
+{
|
|
|
+ protected $noNeedLogin = [];
|
|
|
+ protected $noNeedRight = [];
|
|
|
+
|
|
|
+ protected $table = 'tiaoshiweixiu';
|
|
|
+
|
|
|
+ public function index(){
|
|
|
+ $list = Db::name($this->table)->alias('a')
|
|
|
+ ->field('a.id,a.logo_id,a.title,a.createtime,logo.title as logo_title,logo.image as logo_image')
|
|
|
+ ->join('tiaoshiweixiu_logo logo','a.logo_id = logo.id','LEFT')
|
|
|
+ ->where('a.company_id',$this->auth->company_id)
|
|
|
+ ->select();
|
|
|
+ $list = list_domain_image($list,['image']);
|
|
|
+
|
|
|
+ $this->success(1,$list);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function add(){
|
|
|
+ $data = [
|
|
|
+ 'logo_id' => input('logo_id',0),
|
|
|
+ 'title' => input('title',''),
|
|
|
+ 'content' => input('content',''),
|
|
|
+ 'company_id' => $this->auth->company_id,
|
|
|
+ 'createtime' => time(),
|
|
|
+ 'updatetime' => time(),
|
|
|
+ ];
|
|
|
+
|
|
|
+ Db::name($this->table)->insertGetId($data);
|
|
|
+
|
|
|
+ $this->success();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function info(){
|
|
|
+ $id = input('id',0);
|
|
|
+ $info = Db::name($this->table)->alias('a')
|
|
|
+ ->field('a.id,a.logo_id,a.title,a.content,a.createtime,logo.title as logo_title,logo.image as logo_image')
|
|
|
+ ->join('tiaoshiweixiu_logo logo','a.logo_id = logo.id','LEFT')
|
|
|
+ ->where('a.id',$id)->where('a.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 = [
|
|
|
+ 'logo_id' => input('logo_id',0),
|
|
|
+ 'title' => input('title',''),
|
|
|
+ 'content' => input('content',''),
|
|
|
+ 'updatetime' => time(),
|
|
|
+ ];
|
|
|
+
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|