food_server/FlyCube/Api/Controller/NormalController.class.php
szdot 00196c7299 【类 型】:feat
【原  因】:增加 获取banner列表 api
【过  程】:
【影  响】:

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
2025-05-12 00:42:07 +08:00

104 lines
3.5 KiB
PHP

<?php
namespace Api\Controller;
class NormalController extends PublicController
{
/**
* @description: 子类的初始化
*/
public function _initialize() {}
public function index()
{
echo "hello world";
}
/**
* @description: 分类列表
*/
public function getCategoryList()
{
$where['shop_id'] = $_REQUEST["shop_id"];
$order['sort'] = 'desc';
$field = array('id', 'pid', 'path', 'name', 'shop_id', 'sort', 'show', 'describe', 'photo');
$categoryDb = D('category');
if ($categoryList = $categoryDb->where($where)->order($order)->field($field)->select()) {
echo json_encode(array('status' => 1, 'msg' => '访问成功', "categoryList" => $categoryList));
} else {
echo json_encode(array('status' => 0, 'msg' => '暂无分类数据'));
}
}
/**
* @description: 获取banner列表
*/
public function getBannerList()
{
$where['shop_id'] = $_REQUEST["shop_id"];
$order['sort'] = 'desc';
$field = array('id', 'name', 'shop_id', 'sort', 'photo', 'type', 'action', 'addtime');
$bannerDb = D('banner');
if ($bannerList = $bannerDb->where($where)->order($order)->field($field)->select()) {
echo json_encode(array('status' => 1, 'msg' => '访问成功', "bannerList" => $bannerList));
} else {
echo json_encode(array('status' => 0, 'msg' => '暂无分类数据'));
}
}
/**
* @description: 获取spu列表
*/
public function getSpuList()
{
$where['shop_id'] = $_REQUEST["shop_id"];
$where['del'] = '0';
$order['sort'] = 'desc';
$order['id'] = 'desc';
$spuDb = D('spu');
if ($spuList = $spuDb->where($where)->order($order)->select()) {
echo json_encode(array('status' => 1, 'msg' => '访问成功', "spuList" => $spuList));
} else {
echo json_encode(array('status' => 0, 'msg' => '暂无商品数据'));
}
}
/**
* @description: 获取sku列表
*/
public function getSkuList()
{
$where['shop_id'] = $_REQUEST["shop_id"];
$where['del'] = '0';
$order['id'] = 'desc';
$skuDb = D('sku');
if ($skuList = $skuDb->where($where)->order($order)->select()) {
echo json_encode(array('status' => 1, 'msg' => '访问成功', "skuList" => $skuList));
} else {
echo json_encode(array('status' => 0, 'msg' => '暂无商品数据'));
}
}
/**
* @description: 获取站点列表
*/
public function getSiteList()
{
$where['shop_id'] = $_REQUEST["shop_id"];
$field = array('id', 'sitename', 'photo', 'describe');
$siteDb = D('receive_site');
if ($siteList = $siteDb->where($where)->field($field)->select()) {
echo json_encode(array('status' => 1, 'msg' => '访问成功', "siteList" => $siteList));
} else {
echo json_encode(array('status' => 0, 'msg' => '暂无商品数据'));
}
}
/**
* @description: 获取商铺信息
*/
public function getShopCon()
{
$where['shop_id'] = $_REQUEST["shop_id"];
$shopDb = D('shop');
if ($shopCon = $shopDb->where($where)->find()) {
echo json_encode(array('status' => 1, 'msg' => '访问成功', "shopCon" => $shopCon));
} else {
echo json_encode(array('status' => 0, 'msg' => '暂无商铺信息'));
}
}
}