| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace addons\StarChain\backend\controllers;
- use addons\StarChain\common\services\SpuService;
- use addons\StarChain\common\services\StorageService;
- /**
- * 选品库
- */
- class StorageController extends BaseController
- {
- /**
- * 商品库
- *
- * @return string
- */
- public function actionIndex()
- {
- if ($this->request->isAjax) {
- $params = $this->request->get();
- $service = new StorageService(['mall_id' => $this->mall_id]);
- return $this->success('ok', $service->getStorageList($params));
- }
- return $this->render($this->action->id);
- }
- /**
- * 重新导入
- *
- * @return string
- */
- public function actionAgainImport()
- {
- if ($this->request->isAjax) {
- $ids = $this->request->getBodyParam('ids');
- $service = new SpuService(['mall_id' => $this->mall_id]);
-
- $count = $service->addTaskDoImport($ids, false);
- $count > 0
- ? $this->success("成功重新加载{$count}个商品")
- : $this->error($service->error);
- }
- }
- /**
- * 移除导入商品
- *
- * @return string
- */
- public function actionRemoveImport()
- {
- if ($this->request->isAjax) {
- $ids = $this->request->getBodyParam('ids');
- $service = new SpuService(['mall_id' => $this->mall_id]);
-
- $count = $service->removeImport($ids);
- $count > 0
- ? $this->success("成功移除{$count}个商品")
- : $this->error($service->error);
- }
- }
- }
|