ShopExtClass.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace bizHd\shop\classes;
  3. use biz\shop\classes\ShopClass;
  4. use biz\sj\classes\SjClass;
  5. use common\components\printUtil;
  6. use common\components\util;
  7. use Yii;
  8. use bizHd\base\classes\BaseClass;
  9. class ShopExtClass extends BaseClass
  10. {
  11. public static $baseFile = '\bizHd\shop\models\ShopExt';
  12. //订单取消前三分钟打印通知商家 ssh 20250221
  13. public static function beforeCancelPrint($shopId, $order)
  14. {
  15. $shop = ShopClass::getById($shopId, true);
  16. $orderSn = $order->orderSn ?? '';
  17. $actPrice = $order->actPrice ?? 0;
  18. $sjId = $shop->sjId ?? 0;
  19. $sj = SjClass::getById($sjId, true);
  20. $sjName = $sj->name ?? '';
  21. $shopName = $shop->shopName ?? '';
  22. $currentName = $shopName == '首店' ? $sjName : $sjName . ' ' . $shopName;
  23. $content = "<CB>" . $currentName . "</CB><BR><BR>";
  24. $content .= "<CB>订单即将过期</CB><BR>";
  25. $content .= '--------------------------------<BR>';
  26. $content .= '<CB>订单号</CB><BR>';
  27. $content .= '<CB>' . $orderSn . '</CB><BR>';
  28. $content .= "<CB>订单金额</CB><BR>";
  29. $content .= "<CB>{$actPrice}</CB><BR>";
  30. $content .= '--------------------------------<BR>';
  31. $content .= '<CB>买家信息</CB><BR><BR>';
  32. $content .= '<CB>' . $order->customName . '</CB><BR>';
  33. $content .= '<CB>' . $order->customMobile . '</CB><BR>';
  34. $content .= '--------------------------------<BR>';
  35. $content .= "<BR>";
  36. $content .= "<BR>";
  37. $content .= "<CB>此单客户下单后10分钟未付款,稍后将自动取消,如有需要,请跟客户电话确认是否还要</CB><BR>";
  38. $content .= "<BR>";
  39. $content .= "<CB>注意不是客户申请取消!!!</CB><BR>";
  40. $content .= '<AUDIO-CANCEL>';
  41. $ext = self::getByCondition(['shopId' => $shopId]);
  42. $printSn = $ext['printSn'] ?? '';
  43. if (!empty($printSn)) {
  44. $p = new printUtil($printSn);
  45. $p->printMsg($content, $shop, $orderSn);
  46. }
  47. }
  48. }