| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\plugins\food\controllers\client;
- use app\models\Option;
- use app\models\Store;
- use app\plugins\food\controllers\BaseController;
- use app\plugins\food\models\client\IndexForm;
- use yii\base\BaseObject;
- use yii\helpers\Json;
- use yii\web\Controller;
- class IndexController extends BaseController
- {
- /**
- * 商户信息 & 轮播图 & 商家推荐
- */
- public function actionMainInfo() {
- $form = new IndexForm();
- $form->store_id = get_store_id();
- return $form->getInfo();
- }
- /**
- * 商品列表
- */
- public function actionGoodsList() {
- $form = new IndexForm();
- $form->store_id = get_store_id();
- return $form->getGoodsList();
- }
- /**
- * 店铺信息
- */
- public function actionStore() {
- $store_id = get_store_id();
- $store_info = Store::find()->where(['id' => $store_id, 'is_delete' => 0])->asArray()->one();
- if (!$store_info) {
- return [
- 'code' => 1,
- 'msg' => '该店铺不存在'
- ];
- }
- $food_config = Option::getFoodBookConfig();
- $store_info['name'] = $food_config['name'];
- $store_info['phone'] = $food_config['phone'];
- $store_info['address'] = $food_config['address'];
- $store_info['category'] = IndexForm::$validCategory[$food_config['category']];
- $store_info['logo'] = $food_config['logo'];
- $store_info['pic'] = Json::decode(Option::get('food_book', $store_id, 'store')['value'])['store_pic'];
- $store_info['open_time'] = $food_config['open_time'];
- $store_info['latitude'] = explode(',', $store_info['coordinate'])[0] ?: '';
- $store_info['longitude'] = explode(',', $store_info['coordinate'])[1] ?: '';
- $store_info['service'] = $food_config['service'];
- return [
- 'code' => 0,
- 'msg' => 'success',
- 'data' => $store_info
- ];
- }
- }
|