$list]); } //基地教学视频 ssh 20231203 public function actionJdList() { $list = bookJd::$list; util::success(['list' => $list]); } //手册详情页 ssh 20211206 public function actionDetail() { $id = Yii::$app->request->get('id'); $data = book::$data; $bookTitleList = book::$list; //取出title $titleData = []; foreach ($bookTitleList as $bookList) { foreach ($bookList['list'] as $item) { $currentId = $item['id'] ?? ''; $title = $item['title'] ?? ''; $titleData[$currentId] = $title; } } $currentTitle = $titleData[$id] ?? ''; $info = $data[$id] ?? []; array_unshift($info, ['style' => 'title', 'value' => $currentTitle]); //组合出视频完整链接 $apiHost = Yii::$app->params['ghsHost']; foreach ($info as $key => $val) { if (isset($val['style']) && $val['style'] == 'video') { $info[$key]['value'] = $apiHost . '/' . $val['value']; } } util::success(['list' => $info]); } //关闭手册 ssh 20211211 public function actionCloseBook() { $cacheKey = 'close_book_' . $this->shopAdminId; Yii::$app->redis->executeCommand('SET', [$cacheKey, 'has']); util::complete(); } //变更预订活动 ssh 20240623 public function actionChangeBook() { $get = Yii::$app->request->get(); $status = $get['status'] ?? 0; $shop = $this->shop; $staff = $this->shopAdmin; if ($staff->founder != 2 && $staff->mobile != 15280215347) { //util::fail('这个需要超管才能操作'); } $pfLevel = $shop->pfLevel ?? 0; if ($pfLevel == 0) { util::fail('昆明批发才能使用'); } $connection = Yii::$app->db; $transaction = $connection->beginTransaction(); try { if ($status == 0) { if ($shop->bookSn == 0) { util::fail('已经关闭了'); } $shop->bookSn = 0; $shop->save(); $transaction->commit(); $bookSn = $shop->bookSn ?? 0; //删除采购单货位需要更新标记 $cacheKey1 = 'ghs_cg_order_staff_refresh_seat_' . $bookSn; Yii::$app->redis->executeCommand('DEL', [$cacheKey1]); $cacheKey2 = 'ghs_cg_order_guest_refresh_seat_' . $bookSn; Yii::$app->redis->executeCommand('DEL', [$cacheKey2]); util::success(['bookSn' => 0], '已关闭'); } else { $orderSn = orderSn::getBookSn(); $data = [ 'orderSn' => $orderSn, 'shopId' => $this->shopId, 'mainId' => $this->mainId, ]; BookClass::add($data, true); $shop = $this->shop; $shop->bookSn = $orderSn; $shop->save(); $transaction->commit(); util::success(['bookSn' => $orderSn], '开启成功'); } } catch (\Exception $e) { Yii::info("操作失败原因:" . $e->getMessage()); $transaction->rollBack(); util::fail('操作失败'); } } public function actionLsList() { $list = bookPfHd::$list; util::success(['list' => $list]); } //手册详情页 ssh 20211206 public function actionLsDetail() { $id = Yii::$app->request->get('id'); $data = bookPfHd::$data; $bookTitleList = bookPfHd::$list; //取出title $titleData = []; foreach ($bookTitleList as $bookList) { foreach ($bookList['list'] as $item) { $currentId = $item['id'] ?? ''; $title = $item['title'] ?? ''; $titleData[$currentId] = $title; } } $currentTitle = $titleData[$id] ?? ''; $info = $data[$id] ?? []; array_unshift($info, ['style' => 'title', 'value' => $currentTitle]); //组合出视频完整链接 $apiHost = Yii::$app->params['ghsHost']; foreach ($info as $key => $val) { if (isset($val['style']) && $val['style'] == 'video') { $info[$key]['value'] = $apiHost . '/' . $val['value']; } } util::success(['list' => $info]); } }