diff --git a/config/params.php b/config/params.php index 0f4d50fc..a82a4bf9 100644 --- a/config/params.php +++ b/config/params.php @@ -3,7 +3,8 @@ return [ "hideInfomation" => false, "TCTECH" => true, - "CardService" => "192.168.10.200:2001", + "CardService" => "192.168.1.166:2001", + "dataPath" => "AC/", "time" => 1606755599, "pageSize" => 200 ]; diff --git a/controllers/StaffController.php b/controllers/StaffController.php index b9425aab..36689a3b 100644 --- a/controllers/StaffController.php +++ b/controllers/StaffController.php @@ -325,7 +325,11 @@ class StaffController extends Controller { public function actionImage() { if (Yii::$app->request->post()) { $model = new common(); - return $model->UploadFile("AnhNhanVien", ["PNG", "JPG", "JPEG", "GIF"], "staff"); + Yii::$app->response->format = "json"; + return [ + "dataPath" => Yii::$app->params["dataPath"], + "url" => $model->UploadFile("AnhNhanVien", ["PNG", "JPG", "JPEG", "GIF"], "staff") + ]; } } diff --git a/views/staff/form.tpl b/views/staff/form.tpl index d410a170..9608d4ee 100644 --- a/views/staff/form.tpl +++ b/views/staff/form.tpl @@ -67,7 +67,7 @@ Hình nhân viên {$img=$directoryAsset|cat:"/img/user2-160x160.jpg"} {if $model->image} - {$img="/"|cat:$model->image} + {$img="/"|cat:Yii::$app->params['dataPath']|cat:trim($model->image)} {/if}