63 lines
1.4 KiB
PHP
63 lines
1.4 KiB
PHP
![]() |
<?php
|
||
|
|
||
|
namespace app\api\lists\user;
|
||
|
|
||
|
|
||
|
use app\admin\lists\BaseAdminDataLists;
|
||
|
use app\common\lists\ListsSearchInterface;
|
||
|
use app\common\model\user\UserAddress;
|
||
|
|
||
|
/**
|
||
|
* 地址列表
|
||
|
* Class OpurchaseclassLists
|
||
|
* @package app\api\operation
|
||
|
*/
|
||
|
class UserAddressList extends BaseAdminDataLists implements ListsSearchInterface
|
||
|
{
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @notes 设置搜索条件
|
||
|
* @return \string[][]
|
||
|
* @author likeadmin
|
||
|
*/
|
||
|
public function setSearch(): array
|
||
|
{
|
||
|
return [
|
||
|
];
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @notes 获取地址列表
|
||
|
* @return array
|
||
|
* @throws \think\db\exception\DataNotFoundException
|
||
|
* @throws \think\db\exception\DbException
|
||
|
* @throws \think\db\exception\ModelNotFoundException
|
||
|
* @date 2024/04/27 11:26
|
||
|
*/
|
||
|
public function lists(): array
|
||
|
{
|
||
|
$user_id=$this->request->userId;
|
||
|
if(!$user_id) return [];
|
||
|
return UserAddress::where($this->searchWhere)->where('uid',$user_id)
|
||
|
->field('address_id,real_name,detail,phone,is_default')
|
||
|
->limit($this->limitOffset, $this->limitLength)
|
||
|
->order(['address_id' => 'desc'])
|
||
|
->select()
|
||
|
->toArray();
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @notes 获取地址数量
|
||
|
* @return int
|
||
|
* @date 2024/04/27 11:26
|
||
|
*/
|
||
|
public function count(): int
|
||
|
{
|
||
|
$user_id=$this->request->userId;
|
||
|
return UserAddress::where($this->searchWhere)->where('uid',$user_id)->count();
|
||
|
}
|
||
|
|
||
|
}
|