Files
shopxo/app/admin/controller/Region.php

98 lines
2.5 KiB
PHP
Raw Normal View History

2018-12-28 18:58:37 +08:00
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
2021-03-16 10:34:52 +08:00
// | Copyright (c) 2011~2099 http://shopxo.net All rights reserved.
2018-12-28 18:58:37 +08:00
// +----------------------------------------------------------------------
2021-03-16 10:34:52 +08:00
// | Licensed ( https://opensource.org/licenses/mit-license.php )
2018-12-28 18:58:37 +08:00
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\controller\Base;
use app\service\ApiService;
use app\service\RegionService;
2018-12-28 18:58:37 +08:00
/**
* 地区管理
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class Region extends Base
2018-12-28 18:58:37 +08:00
{
/**
* 列表
2018-12-28 18:58:37 +08:00
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-06T21:31:53+0800
*/
public function Index()
{
// 是否启用
2021-08-14 17:17:45 +08:00
MyViewAssign('common_is_enable_list', MyConst('common_is_enable_list'));
2021-07-18 23:42:10 +08:00
return MyView();
2018-12-28 18:58:37 +08:00
}
/**
* 获取节点子列表
2018-12-28 18:58:37 +08:00
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-25T15:19:45+0800
*/
public function GetNodeSon()
{
return ApiService::ApiDataReturn(RegionService::RegionNodeSon($this->data_request));
2018-12-28 18:58:37 +08:00
}
/**
* 保存
2018-12-28 18:58:37 +08:00
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-25T22:36:12+0800
*/
public function Save()
{
return ApiService::ApiDataReturn(RegionService::RegionSave($this->data_request));
2018-12-28 18:58:37 +08:00
}
/**
* 删除
2018-12-28 18:58:37 +08:00
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-25T22:36:12+0800
*/
public function Delete()
{
2020-10-06 22:24:35 +08:00
$params = $this->data_post;
2018-12-28 18:58:37 +08:00
$params['admin'] = $this->admin;
return ApiService::ApiDataReturn(RegionService::RegionDelete($params));
2018-12-28 18:58:37 +08:00
}
2019-11-12 18:44:59 +08:00
/**
* 获取地区节点数据
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-21
* @desc description
*/
public function Node()
{
// 获取地区
$pid = empty($this->data_request['pid']) ? 0 : intval($this->data_request['pid']);
2019-11-12 18:44:59 +08:00
$params = [
'where' => [
['pid', '=', $pid],
2019-11-12 18:44:59 +08:00
],
];
return ApiService::ApiDataReturn(DataReturn('获取成功', 0, RegionService::RegionNode($params)));
2019-11-12 18:44:59 +08:00
}
2018-12-28 18:58:37 +08:00
}
?>