ShopExtClass.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. $addTime = $order->addTime??'';
  19. $addDate = date('m-d H:i', strtotime($addTime));
  20. $sjId = $shop->sjId ?? 0;
  21. $sj = SjClass::getById($sjId, true);
  22. $sjName = $sj->name ?? '';
  23. $shopName = $shop->shopName ?? '';
  24. $currentName = $shopName == '首店' ? $sjName : $sjName . ' ' . $shopName;
  25. $content = "<CB>" . $currentName . "</CB><BR><BR>";
  26. $content .= '<AUDIO-CANCEL>';
  27. $content .= "<CB>订单即将取消</CB><BR>";
  28. $content .= '--------------------------------<BR>';
  29. $content .= '<CB>订单号</CB><BR>';
  30. $content .= '<CB>' . $orderSn . '</CB><BR>';
  31. $content .= "<CB>订单金额</CB><BR>";
  32. $content .= "<CB>{$actPrice}</CB><BR>";
  33. $content .= "<CB>订单时间</CB><BR>";
  34. $content .= "<CB>{$addDate}</CB><BR>";
  35. $content .= '--------------------------------<BR>';
  36. $content .= '<CB>买家信息</CB><BR>';
  37. $content .= '<CB>' . $order->customName . '</CB><BR>';
  38. $content .= '<CB>' . $order->customMobile . '</CB><BR>';
  39. $content .= '--------------------------------<BR>';
  40. $content .= "<BR>";
  41. $content .= "<BR>";
  42. $content .= "<CB>此单客户下单10分钟未付款,稍后将自动取消,如有需要,请跟客户电话确认是否还要</CB><BR>";
  43. $content .= "<BR>";
  44. $content .= "<CB>注意不是客户主动申请取消!!!因小票机提示音无法修改,所以说是客户申请取消</CB><BR>";
  45. $ext = self::getByCondition(['shopId' => $shopId]);
  46. $printSn = $ext['printSn'] ?? '';
  47. if (!empty($printSn)) {
  48. $p = new printUtil($printSn);
  49. $p->printMsg($content, $shop, $orderSn);
  50. }
  51. }
  52. }