| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- namespace bizGhs\notify\classes;
- use bizGhs\base\classes\BaseClass;
- use bizGhs\custom\classes\CustomClass;
- use bizGhs\shop\classes\ShopAdminClass;
- use Yii;
- class NotifyClass extends BaseClass
- {
- public static $baseFile = '\bizGhs\notify\models\Notify';
- public static function getNotifyList($where)
- {
- $data = self::getList('*', $where, 'addTime DESC');
- return $data;
- }
- //减少预订造成花材需要下架
- public static function bookReduceOutItem($bookItemCustomRes, $num, $shop)
- {
- $mainId = $shop->mainId ?? 0;
- $shopId = $shop->id ?? 0;
- $id = $bookItemCustomRes->id ?? 0;
- $customName = $bookItemCustomRes->customName ?? '';
- $seatSn = $bookItemCustomRes->seatSn ?? 0;
- $itemName = $bookItemCustomRes->name ?? '';
- $itemId = $bookItemCustomRes->itemId ?? 0;
- $staffList = ShopAdminClass::getAllByCondition(['mainId' => $mainId], null, '*', null, true);
- if (!empty($staffList)) {
- foreach ($staffList as $staff) {
- $staffId = $staff->id;
- $data = [
- 'mainId' => $mainId,
- 'shopId' => $shopId,
- 'staffId' => $staffId,
- 'title' => '下架花材',
- 'type' => 2,
- 'targetId' => $id,
- 'read' => 0,
- 'content' => '预订减少,请下架' . $customName . '(' . $seatSn . ')' . $itemName . $num . '份',
- 'page' => '/admin/book/itemCustom?itemId=' . $itemId . '&itemName=' . $itemName,
- ];
- self::add($data);
- $notifyNum = bcadd($staff->notifyNum, 1);
- $staff->notifyNum = $notifyNum;
- $staff->save();
- }
- }
- $noticeText = json_encode(['id' => $id, 'num' => $num, 'shopId' => $shopId]);
- $noticeKey = "bookChangeOffItem";
- Yii::$app->redis->executeCommand('LPUSH', [$noticeKey, $noticeText]);
- }
- //新增售后申请通过 ssh 20230814
- public static function addRefundApplyNotify($refund)
- {
- $mainId = $refund->mainId ?? 0;
- $shopId = $refund->shopId ?? 0;
- $title = '售后申请';
- $id = $refund->id;
- $refundPrice = $refund->refundPrice;
- $refundPrice = floatval($refundPrice);
- $customId = $refund->customId;
- $custom = CustomClass::getById($customId, true);
- $customName = $custom->name ?? '';
- $staffList = ShopAdminClass::getAllByCondition(['mainId' => $mainId], null, '*', null, true);
- if (!empty($staffList)) {
- foreach ($staffList as $staff) {
- $staffId = $staff->id;
- $data = [
- 'mainId' => $mainId,
- 'shopId' => $shopId,
- 'staffId' => $staffId,
- 'title' => $title,
- 'type' => 0,
- 'targetId' => $id,
- 'read' => 0,
- 'content' => $customName . '申请退款' . $refundPrice . '元',
- 'page' => '/pagesOrder/refundDetail?from=1&id=' . $id,
- ];
- self::add($data);
- $notifyNum = bcadd($staff->notifyNum, 1);
- $staff->notifyNum = $notifyNum;
- $staff->save();
- }
- }
- }
- }
|