NotifyClass.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace bizHd\notify\classes;
  3. use bizHd\admin\classes\ShopAdminClass;
  4. use bizHd\base\classes\BaseClass;
  5. use Yii;
  6. class NotifyClass extends BaseClass
  7. {
  8. public static $baseFile = '\bizHd\notify\models\Notify';
  9. public static function getNotifyList($where)
  10. {
  11. $data = self::getList('*', $where, 'addTime DESC');
  12. return $data;
  13. }
  14. //采购获取新花材通知 ssh 20231119
  15. public static function cgGetNewProduct($newProduct, $mainId, $shopId, $ghs)
  16. {
  17. $ghsName = $ghs['name'] ?? '';
  18. $productName = $newProduct->name ?? '';
  19. $id = $newProduct->id ?? 0;
  20. $staffList = ShopAdminClass::getAllByCondition(['mainId' => $mainId], null, '*', null, true);
  21. if (!empty($staffList)) {
  22. foreach ($staffList as $staff) {
  23. $staffId = $staff->id;
  24. $data = [
  25. 'mainId' => $mainId,
  26. 'shopId' => $shopId,
  27. 'staffId' => $staffId,
  28. 'title' => '花材需要归类',
  29. 'type' => 1,
  30. 'targetId' => $id,
  31. 'read' => 0,
  32. 'content' => $ghsName . '的【' . $productName . '】,被归到默认分类',
  33. 'page' => '/admin/item/detail?from=1&source=notify&id=' . $id,
  34. ];
  35. self::add($data);
  36. $notifyNum = bcadd($staff->notifyNum, 1);
  37. $staff->notifyNum = $notifyNum;
  38. $staff->save();
  39. }
  40. }
  41. }
  42. }