|
@@ -6,9 +6,10 @@ use Dever;
|
|
|
class Address
|
|
|
{
|
|
|
|
|
|
- public function getDefault($uid)
|
|
|
+ public function getDefault($source_id, $source_table = 'user/info')
|
|
|
{
|
|
|
- $where['uid'] = $uid;
|
|
|
+ $where['source_table'] = $source_table;
|
|
|
+ $where['source_id'] = $source_id;
|
|
|
$where['type'] = 2;
|
|
|
$data = Dever::db('user/address')->one($where);
|
|
|
|
|
@@ -16,9 +17,10 @@ class Address
|
|
|
}
|
|
|
|
|
|
|
|
|
- public function getInfo($uid, $id)
|
|
|
+ public function getInfo($source_id, $id, $source_table = 'user/info')
|
|
|
{
|
|
|
- $where['uid'] = $uid;
|
|
|
+ $where['source_table'] = $source_table;
|
|
|
+ $where['source_id'] = $source_id;
|
|
|
$where['id'] = $id;
|
|
|
$data = Dever::db('user/address')->one($where);
|
|
|
|
|
@@ -30,9 +32,10 @@ class Address
|
|
|
}
|
|
|
|
|
|
|
|
|
- public function getList($uid)
|
|
|
+ public function getList($source_id, $source_table = 'user/info')
|
|
|
{
|
|
|
- $where['uid'] = $uid;
|
|
|
+ $where['source_table'] = $source_table;
|
|
|
+ $where['source_id'] = $source_id;
|
|
|
$data = Dever::db('user/address')->getList($where);
|
|
|
|
|
|
if ($data && Dever::project('area')) {
|
|
@@ -46,9 +49,9 @@ class Address
|
|
|
|
|
|
|
|
|
|
|
|
- public function delete($uid, $id, $state = 2)
|
|
|
+ public function delete($source_id, $id, $state = 2, $source_table = 'user/info')
|
|
|
{
|
|
|
- $info = $this->getOne($uid, $id);
|
|
|
+ $info = $this->getOne($source_id, $id, $source_table);
|
|
|
if ($info) {
|
|
|
$update['where_id'] = $info['id'];
|
|
|
$update['state'] = $state;
|
|
@@ -63,7 +66,8 @@ class Address
|
|
|
|
|
|
public function update()
|
|
|
{
|
|
|
- $uid = $this->check();
|
|
|
+ $source_id = $this->check();
|
|
|
+ $source_table = 'user/info';
|
|
|
$id = Dever::input('id');
|
|
|
$type = Dever::input('type', 2);
|
|
|
$province = Dever::input('province');
|
|
@@ -75,6 +79,6 @@ class Address
|
|
|
$mobile = Dever::input('mobile');
|
|
|
$tag = Dever::input('tag');
|
|
|
|
|
|
- return Dever::load('user/lib/address')->update($id, $uid, $type, $mobile, $contact, $province, $city, $town, $address, $country, $tag);
|
|
|
+ return Dever::load('user/lib/address')->update($id, $source_id, $source_table, $type, $mobile, $contact, $province, $city, $town, $address, $country, $tag);
|
|
|
}
|
|
|
}
|