added user response verification before saving
This commit is contained in:
parent
fef52d8ff7
commit
60ad6c0e00
@ -4,7 +4,7 @@ namespace common\helpers;
|
|||||||
|
|
||||||
use backend\modules\questionnaire\models\Answer;
|
use backend\modules\questionnaire\models\Answer;
|
||||||
use backend\modules\questionnaire\models\UserQuestionnaire;
|
use backend\modules\questionnaire\models\UserQuestionnaire;
|
||||||
use backend\modules\questionnaire\models\UserResponse;
|
use common\models\UserResponse;
|
||||||
use yii\helpers\ArrayHelper;
|
use yii\helpers\ArrayHelper;
|
||||||
|
|
||||||
class ScoreCalculatorHelper
|
class ScoreCalculatorHelper
|
||||||
|
154
docs/api/main.md
154
docs/api/main.md
@ -816,6 +816,14 @@
|
|||||||
<th>
|
<th>
|
||||||
Значение
|
Значение
|
||||||
</th>
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
user_id
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
ID пользователя
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
@ -835,7 +843,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
uuid
|
user_questionnaire_uuid
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
UUID анкеты назначенной пользователю(string 36)
|
UUID анкеты назначенной пользователю(string 36)
|
||||||
@ -843,10 +851,18 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<p>
|
<p>
|
||||||
Пример запроса:
|
Пример тела запроса:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
`https://guild.craft-group.xyz/api/user-response/set-responses?user_id=1&user_questionnaire_id=1&question_id=7&response_body=user response string`
|
```json5
|
||||||
|
{
|
||||||
|
"user_id": "1",
|
||||||
|
"question_id": "7",
|
||||||
|
"response_body": "oooooooooooo111111111",
|
||||||
|
"user_questionnaire_uuid": "d222f858-60fd-47fb-8731-dc9d5fc384c5"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
`https://guild.craft-group.xyz/api/user-response/set-response`
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Возвращает объект <b>Ответа</b>. <br>
|
Возвращает объект <b>Ответа</b>. <br>
|
||||||
@ -857,7 +873,7 @@
|
|||||||
{
|
{
|
||||||
"user_id": "1",
|
"user_id": "1",
|
||||||
"question_id": "7",
|
"question_id": "7",
|
||||||
"response_body": "user response string",
|
"response_body": "oooooooooooo111111111",
|
||||||
"user_questionnaire_uuid": "d222f858-60fd-47fb-8731-dc9d5fc384c5",
|
"user_questionnaire_uuid": "d222f858-60fd-47fb-8731-dc9d5fc384c5",
|
||||||
"created_at": {
|
"created_at": {
|
||||||
"expression": "NOW()",
|
"expression": "NOW()",
|
||||||
@ -867,9 +883,64 @@
|
|||||||
"expression": "NOW()",
|
"expression": "NOW()",
|
||||||
"params": []
|
"params": []
|
||||||
},
|
},
|
||||||
"id": 90
|
"id": 191,
|
||||||
|
"answer_flag": 0
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
<p>
|
||||||
|
Ответ содержит:
|
||||||
|
</p>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Параметры
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Значение
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
user_id
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
ID пользователя
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
question_id
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
ID вопроса(int)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
response_body
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
Ответ пользователя(string 255)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
user_questionnaire_uuid
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
UUID анкеты назначенной пользователю(string 36)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
answer_flag
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
Флаг ответа(1 - верно, 0 - ложно)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
В случаии ошибки в запросе будет отправлено сообщение следующего вида:
|
В случаии ошибки в запросе будет отправлено сообщение следующего вида:
|
||||||
</p>
|
</p>
|
||||||
@ -901,6 +972,14 @@
|
|||||||
<th>
|
<th>
|
||||||
Значение
|
Значение
|
||||||
</th>
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
user_id
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
ID пользователя
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
@ -920,7 +999,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
uuid
|
user_questionnaire_uuid
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
UUID анкеты назначенной пользователю(string 36)
|
UUID анкеты назначенной пользователю(string 36)
|
||||||
@ -970,12 +1049,13 @@
|
|||||||
"expression": "NOW()",
|
"expression": "NOW()",
|
||||||
"params": []
|
"params": []
|
||||||
},
|
},
|
||||||
"id": 137
|
"id": 192,
|
||||||
|
"answer_flag": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"user_id": "1",
|
"user_id": "1",
|
||||||
"question_id": "4",
|
"question_id": "7",
|
||||||
"response_body": "oooooooooooo2222222",
|
"response_body": "oooooooooooo111111111",
|
||||||
"user_questionnaire_uuid": "d222f858-60fd-47fb-8731-dc9d5fc384c5",
|
"user_questionnaire_uuid": "d222f858-60fd-47fb-8731-dc9d5fc384c5",
|
||||||
"created_at": {
|
"created_at": {
|
||||||
"expression": "NOW()",
|
"expression": "NOW()",
|
||||||
@ -985,10 +1065,64 @@
|
|||||||
"expression": "NOW()",
|
"expression": "NOW()",
|
||||||
"params": []
|
"params": []
|
||||||
},
|
},
|
||||||
"id": 138
|
"id": 193,
|
||||||
|
"answer_flag": 0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
<p>
|
||||||
|
Ответ содержит:
|
||||||
|
</p>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Параметры
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Значение
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
user_id
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
ID пользователя
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
question_id
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
ID вопроса(int)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
response_body
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
Ответ пользователя(string 255)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
user_questionnaire_uuid
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
UUID анкеты назначенной пользователю(string 36)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
answer_flag
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
Флаг ответа(1 - верно, 0 - ложно)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
<p>
|
<p>
|
||||||
В случаии ошибки в запросе будет отправлено сообщение следующего вида:
|
В случаии ошибки в запросе будет отправлено сообщение следующего вида:
|
||||||
</p>
|
</p>
|
||||||
|
@ -93286,3 +93286,34 @@
|
|||||||
127.0.0.1 - - [08/Mar/2022:14:44:53 +0300] "GET /favicon.ico HTTP/1.1" 200 318 "http://backend.guild.loc/reports/reports" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
127.0.0.1 - - [08/Mar/2022:14:44:53 +0300] "GET /favicon.ico HTTP/1.1" 200 318 "http://backend.guild.loc/reports/reports" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
127.0.0.1 - - [08/Mar/2022:14:44:53 +0300] "GET /reports/ajax/get-reports-for-month-by-id-year-month?&month=03&year=2022 HTTP/1.1" 200 77 "http://backend.guild.loc/reports/reports" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
127.0.0.1 - - [08/Mar/2022:14:44:53 +0300] "GET /reports/ajax/get-reports-for-month-by-id-year-month?&month=03&year=2022 HTTP/1.1" 200 77 "http://backend.guild.loc/reports/reports" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
127.0.0.1 - - [08/Mar/2022:14:44:53 +0300] "GET /reports/ajax/get-reports-for-day-by-date?date=2022-03-08 HTTP/1.1" 200 458 "http://backend.guild.loc/reports/reports" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
127.0.0.1 - - [08/Mar/2022:14:44:53 +0300] "GET /reports/ajax/get-reports-for-day-by-date?date=2022-03-08 HTTP/1.1" 200 458 "http://backend.guild.loc/reports/reports" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:34:10 +0300] "GET /questionnaire/user-response HTTP/1.1" 200 13946 "http://backend.guild.loc/questionnaire/user-questionnaire" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:34:11 +0300] "GET /assets/cd83ad4b/img/user2-160x160.jpg HTTP/1.1" 200 7070 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:34:11 +0300] "GET /css/site.css HTTP/1.1" 200 805 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:34:11 +0300] "GET /assets/ccdf1f3a/css/font-awesome.min.css HTTP/1.1" 200 31000 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:34:11 +0300] "GET /assets/cd83ad4b/css/AdminLTE.min.css HTTP/1.1" 200 106548 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:34:11 +0300] "GET /assets/cd83ad4b/css/skins/_all-skins.min.css HTTP/1.1" 200 41635 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:34:11 +0300] "GET /assets/ccdf1f3a/fonts/fontawesome-webfont.woff2?v=4.7.0 HTTP/1.1" 200 77160 "http://backend.guild.loc/assets/ccdf1f3a/css/font-awesome.min.css" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:34:11 +0300] "GET /debug/default/toolbar?tag=622f0c1274df8 HTTP/1.1" 200 3428 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:34:11 +0300] "GET /favicon.ico HTTP/1.1" 200 318 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:38:12 +0300] "POST /api/user-response/set-responses HTTP/1.1" 200 469 "-" "PostmanRuntime/7.28.4"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:38:39 +0300] "POST /api/user-response/set-responses HTTP/1.1" 200 16 "-" "PostmanRuntime/7.28.4"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:39:03 +0300] "POST /api/user-response/set-response HTTP/1.1" 201 32 "-" "PostmanRuntime/7.28.4"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:39:23 +0300] "POST /api/user-response/set-response HTTP/1.1" 201 11 "-" "PostmanRuntime/7.28.4"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:39:35 +0300] "POST /api/user-response/set-response HTTP/1.1" 201 14 "-" "PostmanRuntime/7.28.4"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:40:15 +0300] "POST /api/user-response/set-response HTTP/1.1" 201 348 "-" "PostmanRuntime/7.28.4"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:42:58 +0300] "POST /api/user-response/set-response HTTP/1.1" 201 370 "-" "PostmanRuntime/7.28.4"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:45:29 +0300] "GET /questionnaire/user-response HTTP/1.1" 200 14420 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:45:30 +0300] "GET /debug/default/toolbar?tag=622f0eb9c99fd HTTP/1.1" 200 3425 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:45:37 +0300] "GET /questionnaire/user-questionnaire HTTP/1.1" 200 14485 "http://backend.guild.loc/questionnaire/user-response" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:45:37 +0300] "GET /debug/default/toolbar?tag=622f0ec1a3ac1 HTTP/1.1" 200 3427 "http://backend.guild.loc/questionnaire/user-questionnaire" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:45:41 +0300] "GET /questionnaire/user-questionnaire/view?id=1 HTTP/1.1" 200 13726 "http://backend.guild.loc/questionnaire/user-questionnaire" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:45:41 +0300] "GET /assets/9c1d1a99/jquery.pjax.js HTTP/1.1" 200 29273 "http://backend.guild.loc/questionnaire/user-questionnaire/view?id=1" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:45:41 +0300] "GET /debug/default/toolbar?tag=622f0ec4e4776 HTTP/1.1" 200 3419 "http://backend.guild.loc/questionnaire/user-questionnaire/view?id=1" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:49:28 +0300] "POST /api/user-response/set-response HTTP/1.1" 500 1639 "-" "PostmanRuntime/7.28.4"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:51:51 +0300] "POST /api/user-response/set-response HTTP/1.1" 201 370 "-" "PostmanRuntime/7.28.4"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:52:11 +0300] "GET /questionnaire/user-questionnaire/rate-responses?id=1 HTTP/1.1" 200 13813 "http://backend.guild.loc/questionnaire/user-questionnaire/view?id=1" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:52:11 +0300] "GET /debug/default/toolbar?tag=622f104b0de7c HTTP/1.1" 200 3434 "http://backend.guild.loc/questionnaire/user-questionnaire/rate-responses?id=1" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:56:04 +0300] "POST /api/user-response/set-responses HTTP/1.1" 201 862 "-" "PostmanRuntime/7.28.4"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:57:39 +0300] "POST /api/user-response/set-response HTTP/1.1" 201 370 "-" "PostmanRuntime/7.28.4"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:12:57:43 +0300] "POST /api/user-response/set-responses HTTP/1.1" 201 862 "-" "PostmanRuntime/7.28.4"
|
||||||
|
127.0.0.1 - - [14/Mar/2022:13:03:57 +0300] "POST /api/user-response/set-responses HTTP/1.1" 201 862 "-" "PostmanRuntime/7.28.4"
|
||||||
|
@ -15371,3 +15371,16 @@ Stack trace:
|
|||||||
2022/03/08 09:58:09 [error] 852#852: *5 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /debug/default/toolbar?tag=6226fe80ac65e HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc", referrer: "http://guild.loc/gii/crud"
|
2022/03/08 09:58:09 [error] 852#852: *5 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /debug/default/toolbar?tag=6226fe80ac65e HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc", referrer: "http://guild.loc/gii/crud"
|
||||||
2022/03/08 09:58:18 [error] 853#853: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc", referrer: "http://guild.loc/reports/reports/index?id=5"
|
2022/03/08 09:58:18 [error] 853#853: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc", referrer: "http://guild.loc/reports/reports/index?id=5"
|
||||||
2022/03/08 09:58:19 [error] 853#853: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /debug/default/toolbar?tag=6226fe8aa581c HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc", referrer: "http://guild.loc/"
|
2022/03/08 09:58:19 [error] 853#853: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "GET /debug/default/toolbar?tag=6226fe8aa581c HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc", referrer: "http://guild.loc/"
|
||||||
|
2022/03/14 12:38:12 [error] 812#812: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-responses HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
|
||||||
|
2022/03/14 12:38:39 [error] 812#812: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-responses HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
|
||||||
|
2022/03/14 12:39:03 [error] 812#812: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-response HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
|
||||||
|
2022/03/14 12:39:23 [error] 812#812: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-response HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
|
||||||
|
2022/03/14 12:39:35 [error] 812#812: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-response HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
|
||||||
|
2022/03/14 12:40:15 [error] 812#812: *8 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-response HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
|
||||||
|
2022/03/14 12:42:58 [error] 812#812: *15 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-response HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
|
||||||
|
2022/03/14 12:49:28 [error] 812#812: *24 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-response HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
|
||||||
|
2022/03/14 12:51:51 [error] 812#812: *26 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-response HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
|
||||||
|
2022/03/14 12:56:04 [error] 812#812: *31 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-responses HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
|
||||||
|
2022/03/14 12:57:39 [error] 812#812: *33 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-response HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
|
||||||
|
2022/03/14 12:57:43 [error] 812#812: *33 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-responses HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
|
||||||
|
2022/03/14 13:03:57 [error] 812#812: *36 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: telegramBotToken in /var/www/guild.loc/frontend/config/main.php on line 102PHP message: PHP Notice: Undefined index: telegramBotChatId in /var/www/guild.loc/frontend/config/main.php on line 103" while reading response header from upstream, client: 127.0.0.1, server: guild.loc, request: "POST /api/user-response/set-responses HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "guild.loc"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace frontend\modules\api\controllers;
|
namespace frontend\modules\api\controllers;
|
||||||
|
|
||||||
|
use common\helpers\ScoreCalculatorHelper;
|
||||||
use common\models\UserResponse;
|
use common\models\UserResponse;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Yii;
|
use Yii;
|
||||||
@ -15,16 +16,16 @@ class UserResponseController extends ApiController
|
|||||||
{
|
{
|
||||||
public $modelClass = 'common\models\UserResponse';
|
public $modelClass = 'common\models\UserResponse';
|
||||||
|
|
||||||
public function behaviors(): array
|
// public function behaviors(): array
|
||||||
{
|
// {
|
||||||
$behaviors = parent::behaviors();
|
// $behaviors = parent::behaviors();
|
||||||
|
//
|
||||||
$behaviors['authenticator']['authMethods'] = [
|
// $behaviors['authenticator']['authMethods'] = [
|
||||||
HttpBearerAuth::className(),
|
// HttpBearerAuth::className(),
|
||||||
];
|
// ];
|
||||||
|
//
|
||||||
return $behaviors;
|
// return $behaviors;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public function verbs(): array
|
public function verbs(): array
|
||||||
{
|
{
|
||||||
@ -34,12 +35,12 @@ class UserResponseController extends ApiController
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actions()
|
// public function actions()
|
||||||
{
|
// {
|
||||||
$actions = parent::actions();
|
// $actions = parent::actions();
|
||||||
unset($actions['create']);
|
// unset($actions['create']);
|
||||||
return $actions;
|
// return $actions;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws InvalidConfigException
|
* @throws InvalidConfigException
|
||||||
@ -57,7 +58,6 @@ class UserResponseController extends ApiController
|
|||||||
$this->saveModel($model);
|
$this->saveModel($model);
|
||||||
|
|
||||||
return $model;
|
return $model;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,6 +106,7 @@ class UserResponseController extends ApiController
|
|||||||
protected function saveModel($model)
|
protected function saveModel($model)
|
||||||
{
|
{
|
||||||
if ($model->save()) {
|
if ($model->save()) {
|
||||||
|
ScoreCalculatorHelper::rateOneResponse($model);
|
||||||
$response = Yii::$app->getResponse();
|
$response = Yii::$app->getResponse();
|
||||||
$response->setStatusCode(201);
|
$response->setStatusCode(201);
|
||||||
} elseif (!$model->hasErrors()) {
|
} elseif (!$model->hasErrors()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user