ShopExtClass.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <?php
  2. namespace biz\shop\classes;
  3. use biz\notice\classes\NoticeClass;
  4. use bizHd\order\classes\OrderClass;
  5. use bizHd\purchase\classes\PurchaseClass;
  6. use bizHd\work\classes\WorkClass;
  7. use common\components\dict;
  8. use common\components\noticeUtil;
  9. use linslin\yii2\curl;
  10. use biz\base\classes\BaseClass;
  11. class ShopExtClass extends BaseClass
  12. {
  13. public static $baseFile = '\biz\shop\models\ShopExt';
  14. public static function orderCancelRemind($shopExt, $order)
  15. {
  16. $lbSn = $order->fromType == 4 ? $shopExt->mtLbSn : $shopExt->makeLbSn;
  17. $sendNum = $order->sendNum ?? 0;
  18. $sound = $sendNum . '号单已被取消';
  19. if ($order->fromType == 4) {
  20. $mtSn = $order->thirdSn ?? 0;
  21. $sound = '美团' . $mtSn . '号单已被取消';
  22. }
  23. $url = "https://speaker.17laimai.cn/notify.php?id={$lbSn}&token=HK1626595800&version=3&message=" . $sound;
  24. $curl = new curl\Curl();
  25. $curl->get($url);
  26. }
  27. //新的制作单提示
  28. public static function newWorkRemind($shopExt, $order)
  29. {
  30. $id = $order->id ?? 0;
  31. $work = WorkClass::getByCondition(['orderId' => $id], true);
  32. if (empty($work)) {
  33. return false;
  34. }
  35. $lbSn = $order->fromType == 4 ? $shopExt->mtLbSn : $shopExt->makeLbSn;
  36. $sound = "您有新的制作单";
  37. $reachDate = $order->reachDate ?? '';
  38. if ($order->sendType == 1) {
  39. if (!empty($reachDate) && $reachDate != '0000-00-00') {
  40. $readPeriod = $order->reachPeriod ?? 0;
  41. $period = explode(':', $readPeriod);
  42. $periodName = implode($period, '点');
  43. if ($reachDate == date("Y-m-d")) {
  44. $sound .= ',今天' . $periodName . "分客户到店自取";
  45. } elseif ($reachDate == date("Y-m-d", strtotime("+1 day"))) {
  46. $sound .= ',明天' . $periodName . "分客户到店自取";
  47. } elseif ($reachDate == date("Y-m-d", strtotime("+2 day"))) {
  48. $sound .= ',后天' . $periodName . "分客户到店自取";
  49. } else {
  50. $sound .= ',' . date("d", strtotime($reachDate)) . '号' . $periodName . "分客户到店自取";
  51. }
  52. } else {
  53. $sound .= ",客户到店自取";
  54. }
  55. } else {
  56. if (!empty($reachDate) && $reachDate != '0000-00-00') {
  57. $readPeriod = $order->reachPeriod ?? 0;
  58. $period = explode(':', $readPeriod);
  59. $periodName = implode($period, '点');
  60. if ($reachDate == date("Y-m-d")) {
  61. $sound .= ',今天' . $periodName . "分前送达";
  62. } elseif ($reachDate == date("Y-m-d", strtotime("+1 day"))) {
  63. $sound .= ',明天' . $periodName . "分前送达";
  64. } elseif ($reachDate == date("Y-m-d", strtotime("+2 day"))) {
  65. $sound .= ',后天' . $periodName . "分前送达";
  66. } else {
  67. $sound .= date("d", strtotime($reachDate)) . '号' . $periodName . "分前送达";
  68. }
  69. }
  70. }
  71. $url = "https://speaker.17laimai.cn/notify.php?id={$lbSn}&token=HK1626595800&version=3&message=" . $sound;
  72. $curl = new curl\Curl();
  73. $curl->get($url);
  74. }
  75. //花店采购供货商端播放声音
  76. public static function hdCgGhsReport($orderSn)
  77. {
  78. $cg = PurchaseClass::getByCondition(['orderSn' => $orderSn], true);
  79. if (isset($cg->onlinePay) && $cg->onlinePay == dict::getDict('onlinePay', 'yes')) {
  80. $saleId = $cg->saleId ?? 0;
  81. $order = \bizGhs\order\classes\OrderClass::getById($saleId, true);
  82. if (isset($order->needPrint) && $order->needPrint == dict::getDict('needPrint', 'noNeed')) {
  83. $shopId = $order->shopId ?? 0;
  84. $shopExt = ShopExtClass::getByCondition(['shopId' => $shopId], true);
  85. if (isset($shopExt->lbSn) && !empty($shopExt->lbSn)) {
  86. $actPrice = floatval($order->actPrice) ?? 0;
  87. $payWay = $order->payWay ?? dict::getDict('payWay', 'wxPay');
  88. $sound = $payWay == dict::getDict('payWay', 'wxPay') ? "微信收款{$actPrice}元" : "支付宝收款{$actPrice}元";
  89. $url = "https://speaker.17laimai.cn/notify.php?id={$shopExt->lbSn}&token=HK1626595800&version=3&message=" . $sound;
  90. $curl = new curl\Curl();
  91. $curl->get($url);
  92. }
  93. }
  94. //app新订单通知
  95. NoticeClass::ghsNewOrderNotice($order);
  96. }
  97. }
  98. public static function pleasePayReport($order)
  99. {
  100. $shopId = $order->shopId ?? 0;
  101. $shopExt = ShopExtClass::getByCondition(['shopId' => $shopId], true);
  102. if (isset($shopExt->lbSn) && !empty($shopExt->lbSn)) {
  103. $mainPay = $order->mainPay ? floatval($order->mainPay) : 0;
  104. $sound = $mainPay . '元,请出示付款码';
  105. $url = "https://speaker.17laimai.cn/notify.php?id={$shopExt->lbSn}&token=HK1626595800&version=3&message=" . $sound;
  106. $curl = new curl\Curl();
  107. $curl->get($url);
  108. }
  109. }
  110. //零售花店收款声音播放 ssh 20220423
  111. public static function hdGatheringReport($order)
  112. {
  113. if ($order->fromType != dict::getDict("fromType", "shop")) {
  114. //非门店订单不播报语音
  115. return false;
  116. }
  117. if ($order->onlinePay == dict::getDict('onlinePay', 'not')) {
  118. //非在线支付的不播报
  119. return false;
  120. }
  121. if ($order->payStatus != 1) {
  122. //还没有付款订单不播报
  123. return false;
  124. }
  125. $shopId = $order->shopId ?? 0;
  126. $shopExt = ShopExtClass::getByCondition(['shopId' => $shopId], true);
  127. if (isset($shopExt->lbSn) && !empty($shopExt->lbSn)) {
  128. $actPrice = $order->mainPay ? floatval($order->mainPay) : 0;
  129. $payWay = $order->payWay ?? dict::getDict('payWay', 'wxPay');
  130. $sound = $payWay == dict::getDict('payWay', 'wxPay') ? "微信收款{$actPrice}元" : "支付宝收款{$actPrice}元";
  131. $url = "https://speaker.17laimai.cn/notify.php?id={$shopExt->lbSn}&token=HK1626595800&version=3&message=" . $sound;
  132. $curl = new curl\Curl();
  133. $curl->get($url);
  134. }
  135. }
  136. //清除所有小菊
  137. public static function clearXjALl($shopId)
  138. {
  139. $where = [];
  140. $where['shopId'] = $shopId;
  141. return self::updateByCondition($where, ['xj' => '']);
  142. }
  143. }