|
|
@@ -3,7 +3,6 @@
|
|
|
namespace App\Jobs;
|
|
|
|
|
|
use App\Procurement;
|
|
|
-use App\Services\LogService;
|
|
|
use App\Services\ProcurementWeiXinSendMessageService;
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
@@ -25,7 +24,6 @@ class ProcurementConfirmInform implements ShouldQueue
|
|
|
public function __construct(Procurement $procurement)
|
|
|
{
|
|
|
$this->procurement=$procurement;
|
|
|
- LogService::log(__METHOD__," __construct",json_encode($this->procurement));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -35,14 +33,9 @@ class ProcurementConfirmInform implements ShouldQueue
|
|
|
*/
|
|
|
public function handle()
|
|
|
{
|
|
|
- LogService::log(__METHOD__,"log procurement",json_encode($this->procurement));
|
|
|
$pro=$this->procurement->loadMissing(['ownerMaterial.material.supplier.user.userDetail','ownerMaterial.owner.customer']);
|
|
|
$suppliers=$pro->ownerMaterial->material->supplier ?? false;
|
|
|
- if(!$suppliers){
|
|
|
- LogService::log(__METHOD__,"suppliers not find ",json_encode($this->procurement['id']));
|
|
|
- return ;
|
|
|
- }
|
|
|
- LogService::log(__METHOD__,"采购单耗材关联供应商1",json_encode($suppliers));
|
|
|
+ if(!$suppliers) return ;
|
|
|
$open_ids=[];
|
|
|
foreach ($suppliers as $supplier) {
|
|
|
foreach ($supplier->user as $user){
|
|
|
@@ -51,7 +44,6 @@ class ProcurementConfirmInform implements ShouldQueue
|
|
|
}
|
|
|
}
|
|
|
$open_ids=array_unique($open_ids);
|
|
|
- LogService::log(__METHOD__,"发送用户openid2",json_encode($open_ids));
|
|
|
foreach ($open_ids as $open_id){
|
|
|
$param['touser'] =$open_id;
|
|
|
$param['mp_template_msg'] =[
|
|
|
@@ -79,7 +71,6 @@ class ProcurementConfirmInform implements ShouldQueue
|
|
|
],
|
|
|
]
|
|
|
];
|
|
|
- LogService::log(__METHOD__,"模板信息3",json_encode($param));
|
|
|
app(ProcurementWeiXinSendMessageService::class)->sendWenChantTemplate($param);
|
|
|
}
|
|
|
|