Files
shopxo/app/index/controller/Useraddress.php

143 lines
3.9 KiB
PHP
Raw Permalink 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\index\controller;
2023-08-27 16:59:15 +08:00
use app\index\controller\Center;
use app\service\ApiService;
2019-12-24 15:18:56 +08:00
use app\service\SeoService;
use app\service\UserAddressService;
2021-01-27 22:21:04 +08:00
use app\service\ResourcesService;
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
*/
2023-08-27 16:59:15 +08:00
class UserAddress extends Center
2018-12-28 18:58:37 +08:00
{
/**
* 构造方法
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-11-30
* @desc description
*/
public function __construct()
{
parent::__construct();
}
/**
* 首页
2018-12-28 18:58:37 +08:00
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-02-22T16:50:32+0800
*/
public function Index()
{
// 模板数据
$assign = [
// 浏览器名称
2024-01-19 14:49:32 +08:00
'home_seo_site_title' => SeoService::BrowserSeoTitle(MyLang('useraddress.base_nav_title'), 1),
];
2019-12-24 15:18:56 +08:00
// 用户地址列表
$data = UserAddressService::UserAddressList(['user'=>$this->user]);
$assign['user_address_list'] = $data['data'];
2019-12-24 15:18:56 +08:00
// 模板赋值
MyViewAssign($assign);
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-14T21:37:02+0800
*/
public function SaveInfo()
{
// 模板数据
$assign = [
// 关闭头尾
'is_header' => 0,
'is_footer' => 0,
// 加载地图
2023-01-12 12:11:15 +08:00
'is_load_map_api' => MyC('home_user_address_map_status'),
// 编辑器文件存放地址
'editor_path_type' => ResourcesService::EditorPathTypeValue(UserAddressService::EditorAttachmentPathType($this->user['id'])),
];
2022-07-07 20:27:16 +08:00
// 地址数据
2020-07-08 19:47:19 +08:00
if(!empty($this->data_request))
2018-12-28 18:58:37 +08:00
{
2020-07-08 19:47:19 +08:00
$params = $this->data_request;
2018-12-28 18:58:37 +08:00
$params['user'] = $this->user;
$ret = UserAddressService::UserAddressRow($params);
2020-07-08 19:47:19 +08:00
$data = $ret['data'];
2018-12-28 18:58:37 +08:00
}
$assign['data'] = $data;
// 模板赋值
MyViewAssign($assign);
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 1.0.0
* @datetime 2018-09-23T22:36:18+0800
*/
public function Save()
{
2023-08-27 16:59:15 +08:00
$params = $this->data_request;
2018-12-28 18:58:37 +08:00
$params['user'] = $this->user;
return ApiService::ApiDataReturn(UserAddressService::UserAddressSave($params));
2018-12-28 18:58:37 +08:00
}
/**
* 删除
2018-12-28 18:58:37 +08:00
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-07-18
* @desc description
*/
public function Delete()
{
2023-08-27 16:59:15 +08:00
$params = $this->data_request;
2018-12-28 18:58:37 +08:00
$params['user'] = $this->user;
return ApiService::ApiDataReturn(UserAddressService::UserAddressDelete($params));
2018-12-28 18:58:37 +08:00
}
/**
* 默认地址设置
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-07-18
* @desc description
*/
public function SetDefault()
{
2023-08-27 16:59:15 +08:00
$params = $this->data_request;
2018-12-28 18:58:37 +08:00
$params['user'] = $this->user;
return ApiService::ApiDataReturn(UserAddressService::UserAddressDefault($params));
2018-12-28 18:58:37 +08:00
}
}
?>