| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <?php
- namespace biz\shop\classes;
- use biz\notice\classes\NoticeClass;
- use bizHd\order\classes\OrderClass;
- use bizHd\purchase\classes\PurchaseClass;
- use bizHd\work\classes\WorkClass;
- use common\components\dict;
- use common\components\noticeUtil;
- use linslin\yii2\curl;
- use biz\base\classes\BaseClass;
- class ShopExtClass extends BaseClass
- {
- public static $baseFile = '\biz\shop\models\ShopExt';
- public static function orderCancelRemind($shopExt, $order)
- {
- $lbSn = $order->fromType == 4 ? $shopExt->mtLbSn : $shopExt->makeLbSn;
- $sendNum = $order->sendNum ?? 0;
- $sound = $sendNum . '号单已被取消';
- if ($order->fromType == 4) {
- $mtSn = $order->thirdSn ?? 0;
- $sound = '美团' . $mtSn . '号单已被取消';
- }
- $url = "https://speaker.17laimai.cn/notify.php?id={$lbSn}&token=HK1626595800&version=3&message=" . $sound;
- $curl = new curl\Curl();
- $curl->get($url);
- }
- //新的制作单提示
- public static function newWorkRemind($shopExt, $order)
- {
- $id = $order->id ?? 0;
- $work = WorkClass::getByCondition(['orderId' => $id], true);
- if (empty($work)) {
- return false;
- }
- $lbSn = $order->fromType == 4 ? $shopExt->mtLbSn : $shopExt->makeLbSn;
- $sound = "您有新的制作单";
- $reachDate = $order->reachDate ?? '';
- if ($order->sendType == 1) {
- if (!empty($reachDate) && $reachDate != '0000-00-00') {
- $readPeriod = $order->reachPeriod ?? 0;
- $period = explode(':', $readPeriod);
- $periodName = implode($period, '点');
- if ($reachDate == date("Y-m-d")) {
- $sound .= ',今天' . $periodName . "分客户到店自取";
- } elseif ($reachDate == date("Y-m-d", strtotime("+1 day"))) {
- $sound .= ',明天' . $periodName . "分客户到店自取";
- } elseif ($reachDate == date("Y-m-d", strtotime("+2 day"))) {
- $sound .= ',后天' . $periodName . "分客户到店自取";
- } else {
- $sound .= ',' . date("d", strtotime($reachDate)) . '号' . $periodName . "分客户到店自取";
- }
- } else {
- $sound .= ",客户到店自取";
- }
- } else {
- if (!empty($reachDate) && $reachDate != '0000-00-00') {
- $readPeriod = $order->reachPeriod ?? 0;
- $period = explode(':', $readPeriod);
- $periodName = implode($period, '点');
- if ($reachDate == date("Y-m-d")) {
- $sound .= ',今天' . $periodName . "分前送达";
- } elseif ($reachDate == date("Y-m-d", strtotime("+1 day"))) {
- $sound .= ',明天' . $periodName . "分前送达";
- } elseif ($reachDate == date("Y-m-d", strtotime("+2 day"))) {
- $sound .= ',后天' . $periodName . "分前送达";
- } else {
- $sound .= date("d", strtotime($reachDate)) . '号' . $periodName . "分前送达";
- }
- }
- }
- $url = "https://speaker.17laimai.cn/notify.php?id={$lbSn}&token=HK1626595800&version=3&message=" . $sound;
- $curl = new curl\Curl();
- $curl->get($url);
- }
- //花店采购供货商端播放声音
- public static function hdCgGhsReport($orderSn)
- {
- $cg = PurchaseClass::getByCondition(['orderSn' => $orderSn], true);
- if (isset($cg->onlinePay) && $cg->onlinePay == dict::getDict('onlinePay', 'yes')) {
- $saleId = $cg->saleId ?? 0;
- $order = \bizGhs\order\classes\OrderClass::getById($saleId, true);
- if (isset($order->needPrint) && $order->needPrint == dict::getDict('needPrint', 'noNeed')) {
- $shopId = $order->shopId ?? 0;
- $shopExt = ShopExtClass::getByCondition(['shopId' => $shopId], true);
- if (isset($shopExt->lbSn) && !empty($shopExt->lbSn)) {
- $actPrice = floatval($order->actPrice) ?? 0;
- $payWay = $order->payWay ?? dict::getDict('payWay', 'wxPay');
- $sound = $payWay == dict::getDict('payWay', 'wxPay') ? "微信收款{$actPrice}元" : "支付宝收款{$actPrice}元";
- $url = "https://speaker.17laimai.cn/notify.php?id={$shopExt->lbSn}&token=HK1626595800&version=3&message=" . $sound;
- $curl = new curl\Curl();
- $curl->get($url);
- }
- }
- //app新订单通知
- NoticeClass::ghsNewOrderNotice($order);
- }
- }
- public static function pleasePayReport($order)
- {
- $shopId = $order->shopId ?? 0;
- $shopExt = ShopExtClass::getByCondition(['shopId' => $shopId], true);
- if (isset($shopExt->lbSn) && !empty($shopExt->lbSn)) {
- $mainPay = $order->mainPay ? floatval($order->mainPay) : 0;
- $sound = $mainPay . '元,请出示付款码';
- $url = "https://speaker.17laimai.cn/notify.php?id={$shopExt->lbSn}&token=HK1626595800&version=3&message=" . $sound;
- $curl = new curl\Curl();
- $curl->get($url);
- }
- }
- //零售花店收款声音播放 ssh 20220423
- public static function hdGatheringReport($order)
- {
- if ($order->fromType != dict::getDict("fromType", "shop")) {
- //非门店订单不播报语音
- return false;
- }
- if ($order->onlinePay == dict::getDict('onlinePay', 'not')) {
- //非在线支付的不播报
- return false;
- }
- if ($order->payStatus != 1) {
- //还没有付款订单不播报
- return false;
- }
- $shopId = $order->shopId ?? 0;
- $shopExt = ShopExtClass::getByCondition(['shopId' => $shopId], true);
- if (isset($shopExt->lbSn) && !empty($shopExt->lbSn)) {
- $actPrice = $order->mainPay ? floatval($order->mainPay) : 0;
- $payWay = $order->payWay ?? dict::getDict('payWay', 'wxPay');
- $sound = $payWay == dict::getDict('payWay', 'wxPay') ? "微信收款{$actPrice}元" : "支付宝收款{$actPrice}元";
- $url = "https://speaker.17laimai.cn/notify.php?id={$shopExt->lbSn}&token=HK1626595800&version=3&message=" . $sound;
- $curl = new curl\Curl();
- $curl->get($url);
- }
- }
- //清除所有小菊
- public static function clearXjALl($shopId)
- {
- $where = [];
- $where['shopId'] = $shopId;
- return self::updateByCondition($where, ['xj' => '']);
- }
- }
|