ShopExtClass.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 common\components\dict;
  7. use linslin\yii2\curl;
  8. use biz\base\classes\BaseClass;
  9. class ShopExtClass extends BaseClass
  10. {
  11. public static $baseFile = '\biz\shop\models\ShopExt';
  12. //花店采购供应商端播放声音
  13. public static function hdCgGhsReport($orderSn)
  14. {
  15. $cg = PurchaseClass::getByCondition(['orderSn' => $orderSn], true);
  16. if (isset($cg->onlinePay) && $cg->onlinePay == dict::getDict('onlinePay', 'yes')) {
  17. $saleId = $cg->saleId ?? 0;
  18. $order = \bizGhs\order\classes\OrderClass::getById($saleId, true);
  19. if (isset($order->needPrint) && $order->needPrint == dict::getDict('needPrint', 'noNeed')) {
  20. $shopId = $order->shopId ?? 0;
  21. $shopExt = ShopExtClass::getByCondition(['shopId' => $shopId], true);
  22. if (isset($shopExt->lbSn) && !empty($shopExt->lbSn)) {
  23. $actPrice = floatval($order->actPrice) ?? 0;
  24. $payWay = $order->payWay ?? dict::getDict('payWay', 'wxPay');
  25. $sound = $payWay == dict::getDict('payWay', 'wxPay') ? "微信收款{$actPrice}元" : "支付宝收款{$actPrice}元";
  26. $url = "https://speaker.17laimai.cn/notify.php?id={$shopExt->lbSn}&token=HK1626595800&version=3&message=" . $sound;
  27. $curl = new curl\Curl();
  28. $curl->get($url);
  29. }
  30. }
  31. //app新订单通知
  32. NoticeClass::ghsNewOrderNotice($order);
  33. }
  34. }
  35. //零售花店收款声音播放 ssh 20220423
  36. public static function hdGatheringReport($order)
  37. {
  38. if ($order->fromType != dict::getDict("fromType", "shop")) {
  39. //非门店订单不播报语音
  40. return false;
  41. }
  42. if ($order->needPrint == dict::getDict('needPrint', 'need')) {
  43. //需要打印小票的不播报语音
  44. return false;
  45. }
  46. if ($order->onlinePay == dict::getDict('onlinePay', 'not')) {
  47. //非在线支付的不播报
  48. return false;
  49. }
  50. if ($order->payStatus != 1) {
  51. //还没有付款订单不播报
  52. return false;
  53. }
  54. $shopId = $order->shopId ?? 0;
  55. $shopExt = ShopExtClass::getByCondition(['shopId' => $shopId], true);
  56. if (isset($shopExt->lbSn) && !empty($shopExt->lbSn)) {
  57. $actPrice = floatval($order->actPrice) ?? 0;
  58. $payWay = $order->payWay ?? dict::getDict('payWay', 'wxPay');
  59. $sound = $payWay == dict::getDict('payWay', 'wxPay') ? "微信收款{$actPrice}元" : "支付宝收款{$actPrice}元";
  60. $url = "https://speaker.17laimai.cn/notify.php?id={$shopExt->lbSn}&token=HK1626595800&version=3&message=" . $sound;
  61. $curl = new curl\Curl();
  62. $curl->get($url);
  63. }
  64. }
  65. //清除所有小菊
  66. public static function clearXjALl($shopId)
  67. {
  68. $where = [];
  69. $where['shopId'] = $shopId;
  70. return self::updateByCondition($where, ['xj' => '']);
  71. }
  72. }