belongsTo(OrderCategory::class,"sequenceNo",'code')->bind(["cat_code","cat_name","cat_tax"=>"tax","inv_good_name"]); } public static function CheckQrd($orderCode,&$data) { $qrdinf =self::where(['sequenceNo|cxCode'=>$orderCode,'is_del'=>0]) ->field('sequenceNo,ownerName,companyName,inv_tag,pay_tag')->select()->toArray(); if(!empty($qrdinf)){ foreach ($qrdinf as $item){ if($item['inv_tag']==1){ $uname= TagLog::alias('a') ->join("order_tag b","a.tag_id=b.id",'left') ->where(["code"=>$item['sequenceNo'],"b.type"=>2]) ->order("a.id desc") ->value("creater",''); $data[]=['type'=>'结算销售单开票标签','username'=>$uname,'orderCode'=>$item['sequenceNo'],'companyName'=>$item['companyName']]; } if($item['pay_tag']==1){ $uname= TagLog::alias('a') ->join('order_tag b','a.tag_id=b.id','left') ->where(['code'=>$item['sequenceNo'],'b.type'=>1]) ->order('a.id desc') ->value('creater',''); $data[]=['type'=>'结算销售单付款标签','username'=> $uname,'orderCode'=>$item['sequenceNo'],'companyName'=>$item['companyName']]; } Assoc::CheckQrd($item['sequenceNo'],$data); } } } }