NoticeClass.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. namespace biz\notice\classes;
  3. use biz\admin\classes\AdminClass;
  4. use biz\base\classes\BaseClass;
  5. use biz\shop\classes\ShopAdminClass;
  6. use biz\shop\classes\ShopClass;
  7. use common\components\pushNotice;
  8. use Yii;
  9. class NoticeClass extends BaseClass
  10. {
  11. //城市供应商新订单通知 ssh 20210115
  12. public static function ghsNewOrderNotice($order)
  13. {
  14. //app消息通知
  15. $shopId = $order->shopId ?? 0;
  16. $shop = ShopClass::getById($shopId, true);
  17. if (empty($shop)) {
  18. return false;
  19. }
  20. $adminList = ShopAdminClass::getRemainAdmin($shop);
  21. if (empty($adminList)) {
  22. return false;
  23. }
  24. $customName = $order->customName ?? '';
  25. $actPrice = $order->actPrice ?? 0;
  26. foreach ($adminList as $admin) {
  27. $clientId = $admin['clientId'] ?? '';
  28. if (empty($clientId)) {
  29. continue;
  30. }
  31. pushNotice::gtPush($clientId, '新订单通知', $customName . '下单' . $actPrice . '元');
  32. }
  33. }
  34. //提现审核通过通知所有人 ssh 20210115
  35. public static function cashPassNotice($shop, $cash)
  36. {
  37. $ptStyle = $shop->ptStyle;
  38. $amount = $cash->amount;
  39. Yii::$app->params['ptStyle'] = $ptStyle;
  40. $shopAdminId = $cash->shopAdminId ?? 0;
  41. $staff = ShopAdminClass::getById($shopAdminId, true);
  42. if (empty($staff)) {
  43. return false;
  44. }
  45. $adminId = $staff->adminId ?? 0;
  46. $admin = AdminClass::getById($adminId, true);
  47. if (empty($admin)) {
  48. return false;
  49. }
  50. $clientId = $admin['clientId'] ?? '';
  51. if (empty($clientId)) {
  52. return false;
  53. }
  54. pushNotice::gtPush($clientId, '提现到账通知', $amount . '元已到账,请查收');
  55. }
  56. //新客户通知 ssh 20210115
  57. public static function newCustomNotice($shop, $custom)
  58. {
  59. $ptStyle = $shop['ptStyle'] ?? 1;
  60. $name = $custom['name'] ?? '';
  61. Yii::$app->params['ptStyle'] = $ptStyle;
  62. $id = $shop['id'] ?? 0;
  63. $newShop = ShopClass::getById($id, true);
  64. if (empty($newShop)) {
  65. return false;
  66. }
  67. $adminList = ShopAdminClass::getRemainAdmin($newShop);
  68. if (empty($adminList)) {
  69. return false;
  70. }
  71. foreach ($adminList as $admin) {
  72. $clientId = $admin['clientId'] ?? '';
  73. if (empty($clientId)) {
  74. continue;
  75. }
  76. pushNotice::gtPush($clientId, '新客户加入', $name);
  77. }
  78. }
  79. }