瀏覽代碼

User : ajout fonction getFullAddress()

dev
Guillaume Bourgeois 4 年之前
父節點
當前提交
7c46297cb4
共有 2 個檔案被更改,包括 13 行新增5 行删除
  1. +4
    -5
      backend/controllers/DocumentController.php
  2. +9
    -0
      common/models/User.php

+ 4
- 5
backend/controllers/DocumentController.php 查看文件

@@ -151,15 +151,14 @@ class DocumentController extends BackendController
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;

if ($idUser > 0) {
$user = User::findOne($idUser);
$user = User::searchOne([
'id' => $idUser
]) ;

if ($user) {
$address = $user['lastname'] . ' ' . $user['name'] . "\n";
$address .= $user['address'];

return [
'return' => 'success',
'address' => $address
'address' => $user->getFullAddress()
];
}
}

+ 9
- 0
common/models/User.php 查看文件

@@ -651,6 +651,14 @@ class User extends ActiveRecordCommon implements IdentityInterface
->send();
}
}

public function getFullAddress()
{
$address = '' ;
$address .= $this->lastname . ' ' . $this->name . "\n";
$address .= $this->address;
return $address ;
}
/**
* Retourne l'ID de l'utilisateur courant connecté.
@@ -684,4 +692,5 @@ class User extends ActiveRecordCommon implements IdentityInterface
return User::getCurrentStatus() == USER::STATUS_ADMIN || User::getCurrentStatus() == USER::STATUS_PRODUCER;
}


}

Loading…
取消
儲存