ShopExtClass.php 5.3 KB

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