|
@@ -71,16 +71,17 @@ class UserAddress extends BaseController
|
|
71
|
public function new_create(validate $validate)
|
71
|
public function new_create(validate $validate)
|
|
72
|
{
|
72
|
{
|
|
73
|
$data = $this->checkParams($validate);
|
73
|
$data = $this->checkParams($validate);
|
|
74
|
- if($data['is_default']){
|
|
|
|
|
|
74
|
+ if ($data['is_default']) {
|
|
75
|
$this->repository->changeDefault($this->request->uid());
|
75
|
$this->repository->changeDefault($this->request->uid());
|
|
76
|
} else {
|
76
|
} else {
|
|
77
|
- if(!$this->repository->defaultExists($this->request->uid()))$data['is_default'] = 1;
|
|
|
|
|
|
77
|
+ if (!$this->repository->defaultExists($this->request->uid())) $data['is_default'] = 1;
|
|
78
|
}
|
78
|
}
|
|
79
|
- if($data['address_id']){
|
|
|
|
80
|
- if(!$this->repository->fieldExists($data['address_id'],$this->request->uid()))
|
|
|
|
|
|
79
|
+ if (!$data['code_list']) return app('json')->fail('请选择完整地址');
|
|
|
|
80
|
+ if ($data['address_id']) {
|
|
|
|
81
|
+ if (!$this->repository->fieldExists($data['address_id'], $this->request->uid()))
|
|
81
|
return app('json')->fail('信息不存在');
|
82
|
return app('json')->fail('信息不存在');
|
|
82
|
- $this->repository->update($data['address_id'],$data);
|
|
|
|
83
|
- return app('json')->success('编辑成功', ['address_id'=>$data['address_id']]);
|
|
|
|
|
|
83
|
+ $this->repository->update($data['address_id'], $data);
|
|
|
|
84
|
+ return app('json')->success('编辑成功', ['address_id' => $data['address_id']]);
|
|
84
|
};
|
85
|
};
|
|
85
|
$data['uid'] = $this->request->uid();
|
86
|
$data['uid'] = $this->request->uid();
|
|
86
|
$address = $this->repository->create($data);
|
87
|
$address = $this->repository->create($data);
|