|
|
@@ -70,21 +70,30 @@ class UserAddress extends BaseController
|
|
70
|
70
|
//新用户地址添加修改
|
|
71
|
71
|
public function new_create(validate $validate)
|
|
72
|
72
|
{
|
|
|
73
|
+ makeLock()->lock();
|
|
73
|
74
|
$data = $this->checkParams($validate);
|
|
74
|
75
|
if ($data['is_default']) {
|
|
75
|
76
|
$this->repository->changeDefault($this->request->uid());
|
|
76
|
77
|
} else {
|
|
77
|
78
|
if (!$this->repository->defaultExists($this->request->uid())) $data['is_default'] = 1;
|
|
78
|
79
|
}
|
|
79
|
|
- if (!$data['code_list']) return app('json')->fail('请选择完整地址');
|
|
|
80
|
+ if (!$data['code_list']) {
|
|
|
81
|
+ makeLock()->unlock();
|
|
|
82
|
+ return app('json')->fail('请选择完整地址');
|
|
|
83
|
+ }
|
|
80
|
84
|
if ($data['address_id']) {
|
|
81
|
|
- if (!$this->repository->fieldExists($data['address_id'], $this->request->uid()))
|
|
|
85
|
+ if (!$this->repository->fieldExists($data['address_id'], $this->request->uid())) {
|
|
|
86
|
+ makeLock()->unlock();
|
|
82
|
87
|
return app('json')->fail('信息不存在');
|
|
|
88
|
+ }
|
|
|
89
|
+
|
|
83
|
90
|
$this->repository->update($data['address_id'], $data);
|
|
|
91
|
+ makeLock()->unlock();
|
|
84
|
92
|
return app('json')->success('编辑成功', ['address_id' => $data['address_id']]);
|
|
85
|
93
|
};
|
|
86
|
94
|
$data['uid'] = $this->request->uid();
|
|
87
|
95
|
$address = $this->repository->create($data);
|
|
|
96
|
+ makeLock()->unlock();
|
|
88
|
97
|
return app('json')->success('添加成功', $address->toArray());
|
|
89
|
98
|
}
|
|
90
|
99
|
|