| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace ghs\controllers;
- use bizGhs\item\classes\ItemClass;
- use bizGhs\item\services\ItemService;
- use common\components\util;
- use common\services\xhItemService;
- use Yii;
- class ItemController extends BaseController
- {
- public function actionList()
- {
- //classId
- $classId = Yii::$app->request->get('classId',0);
- $where['merchantId'] = $this->sjId;
- $where['classId'] = $classId;
- $list = ItemClass::getGhsItemList($where);
- util::success($list);
- }
- public function actionAdd()
- {
- $post = Yii::$app->request->post();
- $post['adminId'] = $this->adminId;
- $post['shopId'] = $this->shopId;
- $post['merchantId'] = $this->sjId;
- ItemService::addGhsItem($post);
- util::complete('添加成功');
- }
- public function actionUpdate()
- {
- $data = Yii::$app->request->post();
- $data['adminId'] = $this->adminId;
- $data['merchantId'] = $this->sjId;
- ItemService::updateGshItem($data);
- util::complete('修改成功');
- }
- public function actionDelete()
- {
- $get = Yii::$app->request->get();
- $id = isset($get['id']) ? $get['id'] : 0;
- ItemService::deleteGhsItem($id,$this->shopId,$this->adminId);
- util::complete('操作成功');
- }
- //获取平台里的花材信息
- public function actionPlatformItem()
- {
- $py = Yii::$app->request->get('py','');
- $where = [];
- if($py){
- $where = ['py' => $py];
- }
- $list = xhItemService::getItemList('*',$where,'id desc');
- util::success($list);
- }
- }
|