|
@@ -49,8 +49,8 @@ class Address extends Base
|
|
|
*/
|
|
|
public function all()
|
|
|
{
|
|
|
- $page = $this->request->post('page', 1);
|
|
|
- $pagesize = $this->request->post('pagesize', 15);
|
|
|
+ $page = input('page', 1);
|
|
|
+ $pagesize = input('pagesize', 15);
|
|
|
|
|
|
$data = (new AddressModel())
|
|
|
->with([
|
|
@@ -90,7 +90,7 @@ class Address extends Base
|
|
|
*/
|
|
|
public function add()
|
|
|
{
|
|
|
- $data = $this->request->post();
|
|
|
+ $data = input();
|
|
|
try {
|
|
|
$validate = Loader::validate('\\addons\\unishop\\validate\\Address');
|
|
|
if (!$validate->check($data, [], 'add')) {
|
|
@@ -136,7 +136,7 @@ class Address extends Base
|
|
|
*/
|
|
|
public function edit()
|
|
|
{
|
|
|
- $data = $this->request->post();
|
|
|
+ $data = input();
|
|
|
try {
|
|
|
new Validate();
|
|
|
$validate = Loader::validate('\\addons\\unishop\\validate\\Address');
|
|
@@ -170,7 +170,7 @@ class Address extends Base
|
|
|
*/
|
|
|
public function delete()
|
|
|
{
|
|
|
- $address_id = $this->request->get('id', 0);
|
|
|
+ $address_id = input('id', 0);
|
|
|
|
|
|
$data = (new AddressModel())
|
|
|
->where([
|
|
@@ -200,7 +200,7 @@ class Address extends Base
|
|
|
*/
|
|
|
public function area()
|
|
|
{
|
|
|
- $pid = $this->request->get('pid', 1);
|
|
|
+ $pid = input('pid', 1);
|
|
|
Cache::clear('area_pid_'.$pid);
|
|
|
if (Cache::has('area_pid_'.$pid)) {
|
|
|
$area = Cache::get('area_pid_'.$pid);
|
|
@@ -240,8 +240,14 @@ class Address extends Base
|
|
|
*/
|
|
|
public function info()
|
|
|
{
|
|
|
- $id = $this->request->get('id');
|
|
|
- $address = (new AddressModel())->where(['id' => $id, 'user_id' => $this->auth->id])->find()->toArray();
|
|
|
+ $id = input('id');
|
|
|
+ $address = (new AddressModel())
|
|
|
+ ->with([
|
|
|
+ 'province' => function($query) {$query->field('id,name');},
|
|
|
+ 'city' => function($query) {$query->field('id,name');},
|
|
|
+ 'area' => function($query) {$query->field('id,name');}
|
|
|
+ ])
|
|
|
+ ->where(['id' => $id, 'user_id' => $this->auth->id])->find()->toArray();
|
|
|
$this->success('', $address);
|
|
|
}
|
|
|
|