merge
This commit is contained in:
@ -77,6 +77,19 @@ return [
|
||||
['class' => 'yii\rest\UrlRule', 'controller' => 'skills'],
|
||||
],
|
||||
],
|
||||
'telegram_bot' => [
|
||||
'class' => 'kavalar\TelegramBotApi',
|
||||
'templates' => [
|
||||
'interview_request' =>
|
||||
"Пришёл запрос на интервью.\n".
|
||||
"Профиль: ~profile_id~\n".
|
||||
"Телефон: ~phone~\n".
|
||||
"Email: ~email~\n".
|
||||
"Комментарий: ~comment~"
|
||||
],
|
||||
'telegramBotToken' => $params['telegramBotToken'],
|
||||
'telegramChatId' => $params['telegramBotChatId'],
|
||||
],
|
||||
|
||||
],
|
||||
'params' => $params,
|
||||
|
@ -7,6 +7,8 @@ use common\classes\Debug;
|
||||
use common\models\InterviewRequest;
|
||||
use common\models\User;
|
||||
use frontend\modules\api\models\ProfileSearchForm;
|
||||
use kavalar\BotNotificationTemplateProcessor;
|
||||
use kavalar\TelegramBotService;
|
||||
use yii\filters\auth\CompositeAuth;
|
||||
use yii\filters\auth\HttpBearerAuth;
|
||||
use yii\filters\auth\QueryParamAuth;
|
||||
@ -60,11 +62,14 @@ class ProfileController extends \yii\rest\Controller
|
||||
public function actionAddToInterview()
|
||||
{
|
||||
if (\Yii::$app->request->isPost) {
|
||||
$attributes = \Yii::$app->request->post();
|
||||
|
||||
$model = new InterviewRequest();
|
||||
$model->attributes = \Yii::$app->request->post();
|
||||
$model->attributes = $attributes;
|
||||
$model->created_at = time();
|
||||
$model->user_id = \Yii::$app->user->id;
|
||||
if ($model->save()) {
|
||||
\Yii::$app->telegram_bot->sendRenderedMessage('interview_request', $attributes);
|
||||
return ['status' => 'success'];
|
||||
}
|
||||
|
||||
|
@ -45,8 +45,9 @@ class UserCardController extends Controller
|
||||
public function actionIndex()
|
||||
{
|
||||
$id_user = Yii::$app->user->id;
|
||||
echo $id_user;
|
||||
// die();
|
||||
$result = UserCard::find()->where(['id_user' => $id_user])->asArray()->all();
|
||||
|
||||
if($result) {
|
||||
$id = $result[0]['id'];
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
|
@ -50,7 +50,7 @@ class ReportsController extends Controller
|
||||
$dataProvider->query
|
||||
->where(['user_card.id_user' => Yii::$app->user->identity->id])
|
||||
->innerJoin('user_card', 'reports.user_card_id = user_card.id');
|
||||
|
||||
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
|
Reference in New Issue
Block a user