Sfoglia il codice sorgente

feat: EK-744: 发送短信

kevinElken 8 mesi fa
parent
commit
53ee193ef8

+ 0 - 28
common/config/main.php

@@ -2,15 +2,6 @@
 
 // 根据运行环境加载不同的配置文件
 $mainConfig = require_once __DIR__ . '/config-product.php';
-//if (YII_ENV == YII_ENV_DEV) {
-//    $mainConfig = require_once __DIR__ . '/config-development.php';
-//} else if (YII_ENV == YII_ENV_TEST) {
-//    $mainConfig = require_once __DIR__ . '/config-test.php';
-//} else if (YII_ENV == YII_ENV_PROD) {
-//    $mainConfig = require_once __DIR__ . '/config-product.php';
-//} else {
-//    $mainConfig = require_once __DIR__ . '/config-development.php';
-//}
 
 return [
     'language' => 'zh-CN', // zh-CN 目标语言
@@ -19,39 +10,23 @@ return [
     'aliases' => [
         '@bower' => '@vendor/bower-asset',
         '@npm'   => '@vendor/npm-asset',
-//        'anlity/swooleAsyncTimer' => '@backend/runtime/tmp-extensions/yii2-swoole-async-timer',
     ],
     'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
     'components' => [
         'db' => array_merge([
             'class' => 'yii\db\Connection',
             'enableSlaves' => false,
-//            'enableSavepoint' => false,
         ], $mainConfig['db'], $mainConfig['slavesDb']),
-//        'dbShop' => array_merge(['class' => 'yii\db\Connection', 'schemaMap' => ['oci' => 'common\helpers\Schema']], $mainConfig['dbShop']),
         'dbLog' => array_merge(['class' => 'yii\mongodb\Connection',], $mainConfig['dbLog']),
         'dbCalc' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbCalc']),
         'dbCalcServer' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbCalcServer']),
-//        'dbShopCalc' => array_merge(['class' => 'yii\db\Connection', 'schemaMap' => ['oci' => 'common\helpers\Schema'],], $mainConfig['dbShopCalc']),
         'dbNetPoint' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbNetPoint']),
-        // 'cache' => [
-        //     //'class' => 'yii\caching\FileCache',
-        //     'class' => 'dcb9\redis\Cache',
-        //     'redis' => $mainConfig['cacheRedis'],
-        // ],
         'cache' => [
             'class' => 'yii\redis\Cache',
             'redis' => $mainConfig['cacheRedis'],
-            // 'redis' => [
-            //     'hostname' => '127.0.0.1',
-            //     'port' => 6379,
-            //     'database' => 0,
-            // ]
         ],
         'tokenRedis' => array_merge(['class' => 'yii\redis\Connection'], $mainConfig['tokenRedis']),
         'redis' => array_merge(['class' => 'yii\redis\Connection'], $mainConfig['otherRedis']),
-        // 'tokenRedis' => array_merge(['class' => 'common\components\Redis'], $mainConfig['tokenRedis']),
-        // 'redis' => array_merge(['class' => 'common\components\Redis'], $mainConfig['otherRedis']),
         'mailer' => [
             'class' => 'yii\swiftmailer\Mailer',
             'viewPath' => '@common/mail',
@@ -69,7 +44,6 @@ return [
         'swooleAsyncTimer' => [
             'class' => 'common\components\SwooleAsyncTimer',
         ],
-        // payStack配置
         'Paystack' => [
             'class'         => 'smladeoye\paystack\Paystack',
             'environment'   => YII_ENV,
@@ -78,7 +52,6 @@ return [
             'livePublicKey' => 'pk_live_fae524f9d073d877beeb661fd825a37a9bc91f0a',
             'liveSecretKey' => 'sk_live_b93c6bbee2cc0e9c594547bf4779ec9852b9d055',
         ],
-        // 配置SQL语句输出
         'log' => [
             'traceLevel' => YII_DEBUG ? 3 : 0,
             'targets' => [
@@ -91,7 +64,6 @@ return [
                 'db' => [ 'class' => 'yii\log\FileTarget'],
             ],
         ],
-        // 多语言
         'i18n' => [
             'translations' => [
                 'app*' => [

+ 4 - 2
common/models/forms/DeclarationForm.php

@@ -6,6 +6,7 @@ use common\helpers\Cache;
 use common\helpers\Date;
 use common\helpers\Form;
 use common\helpers\LoggerTool;
+use common\helpers\Sms;
 use common\helpers\Tool;
 use common\helpers\user\Cash;
 use common\helpers\user\Reconsume;
@@ -832,8 +833,6 @@ class DeclarationForm extends Model
         $user->PROVINCE = $this->province ?? 0;
         $user->LGA_NAME = $this->lgaName;
         $user->CITY_NAME = $this->cityName;
-//        $user->CITY = $this->city ?? 0;
-//        $user->COUNTY = intval($this->county) ?? 0;
         $user->AVATAR = 'avatar/1.png';
         $user->IS_DEC = 0;
         $user->DEC_ID = $this->_decId ?? null;
@@ -869,6 +868,9 @@ class DeclarationForm extends Model
             return false;
         }
         if($result = $userForm->add()){
+            //sms
+            Sms::sendSMS($this->countryId, $this->mobile, 'Elken: hello AE', $user->ID, 'welcomePack');
+
             return $result;
         } else {
             return false;

+ 2 - 1
frontendApi/modules/v1/controllers/UserController.php

@@ -632,8 +632,9 @@ SQL;
 
             $allData['data'][] = $post;
             if ($formModel->load($allData, '') && $result = $formModel->add()) {
-                //发送邮件
+                //email
                 Email::sendRegistrationEmail($post['email'], $post['insertUserName'], $post['password']);
+
                 return static::notice($result);//报单成功
             } else {
                 return static::notice(Form::formatErrorsForApi($formModel->getErrors()),400);