RefreshDepartmentJob.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * Name: 芸众商城系统
  5. * Author: 广州市芸众信息科技有限公司
  6. * Profile: 广州市芸众信息科技有限公司位于国际商贸中心的广州,专注于移动电子商务生态系统打造,拥有芸众社交电商系统、区块链数字资产管理系统、供应链管理系统、电子合同等产品/服务。官网 :www.yunzmall.com www.yunzshop.com
  7. * Date: 2021/9/22
  8. * Time: 13:37
  9. */
  10. namespace business\common\job;
  11. use app\common\facades\Setting;
  12. use business\common\services\DepartmentService;
  13. use Illuminate\Bus\Queueable;
  14. use Illuminate\Contracts\Queue\ShouldQueue;
  15. use Illuminate\Queue\InteractsWithQueue;
  16. use Illuminate\Queue\SerializesModels;
  17. class RefreshDepartmentJob implements ShouldQueue
  18. {
  19. use InteractsWithQueue, Queueable, SerializesModels;
  20. protected $business_id;
  21. protected $uniacid;
  22. public function __construct($uniacid, $business_id)
  23. {
  24. $this->uniacid = $uniacid;
  25. $this->business_id = $business_id;
  26. }
  27. /**
  28. * Execute the job.
  29. *
  30. * @return void
  31. */
  32. public function handle()
  33. {
  34. \YunShop::app()->uniacid = $this->uniacid;
  35. Setting::$uniqueAccountId = $this->uniacid;
  36. \Log::debug('企业微信部门更新队列开始' . $this->business_id);
  37. $res = DepartmentService::refreshDepartment($this->business_id);
  38. $result = $res['result'] ? '成功' : '失败';
  39. \Log::debug('企业微信部门更新队列' . $result . ':' . $res['msg']);
  40. }
  41. }