
【主 题】:再public控制器里 调用公用的 构造方法 【描 述】: [原因]:统一调用公用公用构造方法 [过程]: [影响]: 【结 束】 # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
91 lines
2.9 KiB
PHP
91 lines
2.9 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: 获取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' => '暂无商铺信息'));
|
|
}
|
|
}
|
|
}
|