You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.0 KiB
39 lines
1.0 KiB
<?php
|
|
namespace app\base\model\user;
|
|
|
|
use app\base\model\Base;
|
|
use think\model\concern\SoftDelete;
|
|
|
|
class UserAddress extends Base
|
|
{
|
|
use SoftDelete;
|
|
|
|
// 设置当前模型对应的完整数据表名称
|
|
protected $table = 'base_user_address';
|
|
|
|
/**
|
|
* 获取默认地址
|
|
* @date 2022-10-13
|
|
*/
|
|
public function getDefaultAddress(){
|
|
$where = [
|
|
['user_id', '=', $this->userId],
|
|
['is_default', '=', 1]
|
|
];
|
|
return $this->getOneData($where, 'id,user_id,linkman,mobile_phone,province_id,city_id,area_id,province,city,area,address,is_default');
|
|
}
|
|
|
|
/**
|
|
* 获取指定地址
|
|
* @param int $my_address_id 我的地址ID
|
|
* @date 2022-10-13
|
|
*/
|
|
public function getAddress($my_address_id){
|
|
$where = [
|
|
['user_id', '=', $this->userId],
|
|
['id', '=', $my_address_id]
|
|
];
|
|
return $this->getOneData($where, 'id,user_id,linkman,mobile_phone,province_id,city_id,area_id,province,city,area,address,is_default');
|
|
}
|
|
|
|
} |