57 lines
1.4 KiB
PHP
57 lines
1.4 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @author Any
|
|
* @description KISS
|
|
* @date 2020-11-5
|
|
* @version 1.0.0
|
|
*
|
|
* _____LOG_____
|
|
*
|
|
*/
|
|
namespace app\modules\admin\controllers;
|
|
|
|
use app\models\BallCart;
|
|
use app\modules\admin\behaviors\LoginBehavior;
|
|
use app\modules\admin\models\sms\SmsConfigEditForm;
|
|
use app\models\sms\SmsSetting;
|
|
use app\models\sms\SmsTpl;
|
|
|
|
|
|
class SmsController extends Controller
|
|
{
|
|
public function behaviors()
|
|
{
|
|
return array_merge(parent::behaviors(), [
|
|
'login' => [
|
|
'class' => LoginBehavior::className(),
|
|
],
|
|
]);
|
|
}
|
|
|
|
|
|
public function actionConfig()
|
|
{
|
|
$model = SmsSetting::findOne([
|
|
'cx_mch_id' => $this->cx_mch_id,
|
|
]);
|
|
if($model == null){
|
|
$model = new SmsSetting();
|
|
}
|
|
if(\Yii::$app->request->isPost){
|
|
$form = new SmsConfigEditForm();
|
|
$form->attributes = \Yii::$app->request->post();
|
|
$form->cx_mch_id = $this->cx_mch_id;
|
|
$form->model = $model;
|
|
$data = $form->save();
|
|
return $this->responseHandler($data);
|
|
}
|
|
$return_url = "";
|
|
$type = $model->isNewRecord ? SmsSetting::TYPE_ALIYUN : $model->type;
|
|
return $this->render('config',[
|
|
'return_url' => $return_url,
|
|
'model' => $model,
|
|
'tpl_list' => SmsTpl::getTplList($type, $this->cx_mch_id),
|
|
]);
|
|
}
|
|
} |