| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace addons\QiJuhe\backend\controllers;
- use addons\QiJuhe\common\service\ApiService;
- use addons\QiJuhe\common\service\CategoryService;
- use phpDocumentor\Reflection\Types\This;
- /**
- * 分类控制器
- *
- * Class CategorysController
- * @package addons\QiJuhe\backend\controllers
- */
- class CategoryController extends BaseController
- {
- /**
- * 导入分类
- *
- * @return void
- */
- public function actionIndex()
- {
- return $this->render('index');
- }
-
- /**
- * 导入分类
- *
- * @return void
- */
- public function actionImport()
- {
- $supply_id = $this->request->get('supply_id');
- $service = new CategoryService(['mall_id'=>$this->mall_id,'supply_id'=>$supply_id]);
- $res = $service->import($this->mall_id,$supply_id,0);
- return $res ? $this->success('导入成功,后台执行中...') : $this->error($service->error);
- }
- public function actionList(){
- if (!$this->request->isAjax) {
- return;
- }
- $param = $this->request->getQueryParams();
- $parent_id = $param['parent_id'] ?? 0;
- $supply_id = $param['supply_id'] ?? 0;
- // 获取分类
- $service = new CategoryService([
- 'mall_id'=>$this->mall_id,
- 'supply_id'=>$supply_id,
- ]);
- $list = $service->getCategory($parent_id,false);
- return $this->success('ok', $list);
- }
- }
|