ShopExtClass.php 5.8 KB

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