全栈小学生 1d87b08b07 up
2025-01-03 17:59:22 +08:00

90 lines
2.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\service\api\member;
use app\model\member\MemberAddress;
use app\service\core\member\CoreMemberAddressService;
use core\base\BaseApiService;
/**
* 会员收货地址服务层
* Class AddressService
* @package app\service\admin\address
*/
class AddressService extends BaseApiService
{
public function __construct()
{
parent::__construct();
$this->model = new MemberAddress();
}
/**
* 获取会员收货地址列表
* @param array $where
* @return array
*/
public function getList(array $where = [])
{
$where['member_id'] = $this->member_id;
return ( new CoreMemberAddressService() )->getList($where);
}
/**
* 获取会员收货地址信息
* @param int $id
* @return array
*/
public function getInfo(int $id)
{
$data['member_id'] = $this->member_id;
return ( new CoreMemberAddressService() )->getInfo($id, $data);
}
/**
* 添加会员收货地址
* @param array $data
* @return mixed
*/
public function add(array $data)
{
$data['member_id'] = $this->member_id;
return ( new CoreMemberAddressService() )->add($data);
}
/**
* 会员收货地址编辑
* @param int $id
* @param array $data
* @return bool
*/
public function edit(int $id, array $data)
{
$data['member_id'] = $this->member_id;
return ( new CoreMemberAddressService() )->edit($id, $data);
}
/**
* 删除会员收货地址
* @param int $id
* @return bool
*/
public function del(int $id)
{
$model = $this->model->where([ ['id', '=', $id], ['member_id', '=', $this->member_id ] ])->find();
$res = $model->delete();
return $res;
}
}