| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- namespace addons\QiJuhe\backend\controllers;
- use addons\QiJuhe\common\service\ApiService;
- use addons\QiJuhe\common\service\SettingService;
- use addons\QiJuhe\common\service\SupplysService;
- use Yii;
- use common\controllers\AddonsController;
- /**
- * 中台设置控制器
- *
- * Class MiddleGroundController
- * @package addons\QiJuhe\backend\controllers
- */
- class SupplysController extends BaseController
- {
- public $enableCsrfValidation = false;
-
- /**
- * 供应链列表
- *
- * @return void
- */
- public function actionIndex()
- {
- if ($this->request->isAjax) {
- $params = $this->request->getQueryParams();
- $service = new SupplysService(['mall_id' => $this->mall_id]);
- return $this->success('ok', $service->getSupplysList($params));
- }
- return $this->render('index');
- }
- /**
- * 供应链编辑及添加
- *
- * @return void
- */
- public function actionEdit()
- {
- $id = $this->request->getQueryParam('id');
- $service = new SupplysService(['mall_id' => $this->mall_id]);
- if ($this->request->isPost) {
- $data = $this->request->post('setting');
- return $service->save($id, $data) ? $this->success('保存成功') : $this->error($service->error);
- }
- if ($this->request->isAjax) {
- return $this->success('ok', $service->getInfo($id));
- }
- return $this->render('edit');
- }
- /**
- * 供应商列表
- *
- * @return string
- */
- public function actionSuppliers()
- {
- $supply_id = $this->request->get('supply_id') ?? 0;
- $api = ApiService::getConnect($this->mall_id, $supply_id);
- $list = $api->getSuppliers();
- return $this->success('ok', $list);
- }
- }
|