1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- namespace app\bug\controller;
- use think\facade\Db;
- use think\App;use think\facade\Validate;
- class Deal extends Base
- {
- public $noLogin=[];
- public function __construct(App $app)
- {
- parent::__construct($app);
- }
- /**处理人添加
- * @return \think\Response|\think\response\Json|void
- */
- public function create(){
- $param=$this->request->param(["bugNo"=>"","level"=>0,"type"=>0,"status"=>1],"post","trim");
- $valid = Validate::rule([
- 'bugNo|工单编号'=>'require|max:255',
- 'level|优先级'=>'require|number',
- 'type|问题类型'=>'require|number',
- 'status|处理状态'=>'require|number|in:0,1',
- ]);
- if($valid->check($param)==false) return error($valid->getError());
- $data=[
- "bugNo"=>$param['bugNo'],
- "deal_name"=>$this->uname,
- "deal_id"=>$this->uid,
- "level"=>$param['level'],
- "type"=>$param['type'],
- "status"=>$param['status']
- ];
- \app\bug\model\Deal::create($data);
- return success("新建成功");
- }
- public function add(){
- $param=$this->request->param(['id'=>'','deal_id'=>0,'status'=>1],'post','trim');
- $valid = Validate::rule([
- 'id|工单id'=>'require|number|gt:0',
- 'deal_id|处理人'=>'number',
- 'status|处理状态'=>'require|number|in:0,1',
- ]);
- if($valid->check($param)==false) return error($valid->getError());
- $info = \app\bug\model\Note::where(["id"=>$param['id'],"is_del"=>0])->findOrEmpty();
- if($info->isEmpty()){
- return error('未找到数据');
- }
- $deal = \app\bug\model\Manange::where(["manange_id"=>$param['deal_id'],"is_del"=>0])->findOrEmpty();
- if($deal->isEmpty()){
- \app\bug\model\Deal::where(['bugNo'=>$info['bugNo'],'status'=>0,'is_del'=>0])->save(["is_del"=>0]);
- }else{
- \app\bug\model\Deal::create(["deal_name"=>$deal->manange_name,'deal_id'=>$deal->manange_id,
- 'bugNo'=>$info['bugNo']]);
- }
- return success('添加成功');
- }
- // public function MenuAllList(){
- // $company_type = isset($this->post['company_type']) && $this->post['company_type']!==""? trim($this->post['company_type']):"";
- // if ($company_type== "") {
- // return error_show(1002,"参数company_type不能为空");
- // }
- // $where=['company_type'=>$company_type,'pid'=>0,'is_del'=>0,"status"=>1];
- // $level = isset($this->post['level']) && $this->post['level']!==""? trim($this->post['level']):"";
- // if ($level== "") {
- // $where['level'] = explode(",",$level);
- // }
- // $data = Db::name("model")->where($where)->order("weight desc")->select();
- // $l=[];
- // foreach ($data as $key=>$value){
- // $temp = Db::name("model")->where(['pid'=>$value['id'],'is_del'=>0,"level"=>[2,3],"status"=>1])->order("weight desc")
- // ->select()->toArray();
- // $value['child']=$temp;
- // if(empty($temp)) continue;
- // $l[]=$value;
- // }
- // return app_show(0,"获取成功",$l);
- // }
- }
|