155 lines
4.7 KiB
PHP
155 lines
4.7 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @author Any
|
|
* @description KISS
|
|
* @date 2020-11-5
|
|
* @version 1.0.0
|
|
*
|
|
* _____LOG_____
|
|
*
|
|
*/
|
|
namespace app\modules\store\controllers;
|
|
|
|
use app\modules\store\behaviors\LoginBehavior;
|
|
use app\modules\store\models\PasswordEditForm;
|
|
use app\models\common\CommonPaymentSettingForm;
|
|
use app\models\common\CommonPaymentConfigActionForm;
|
|
use app\models\common\CommonPaymentConfigEditForm;
|
|
use app\models\common\CommonPaymentConfigListForm;
|
|
use app\models\PaymentConfig;
|
|
|
|
class SettingController extends Controller
|
|
{
|
|
public function behaviors()
|
|
{
|
|
return array_merge(parent::behaviors(), [
|
|
'login' => [
|
|
'class' => LoginBehavior::className(),
|
|
],
|
|
]);
|
|
}
|
|
|
|
|
|
//密码修改
|
|
public function actionPassword()
|
|
{
|
|
$form = new PasswordEditForm();
|
|
if(\Yii::$app->request->isPost){
|
|
$form->attributes = \Yii::$app->request->post();
|
|
return $this->responseHandler($form->save());
|
|
} else {
|
|
return $this->render('password',[
|
|
'model' => $form,
|
|
]);
|
|
}
|
|
}
|
|
|
|
public function actionBase()
|
|
{
|
|
if(\Yii::$app->request->isPost){
|
|
$form = new CommonPaymentSettingForm();
|
|
$form->scenario = 'edit';
|
|
$form->attributes = \Yii::$app->request->post();
|
|
$form->cx_mch_id = $this->cx_mch_id;
|
|
$data = $form->save();
|
|
return $this->responseHandler($data);
|
|
}
|
|
$form = new CommonPaymentSettingForm();
|
|
$form->cx_mch_id = $this->cx_mch_id;
|
|
$data = $form->search();
|
|
return $this->render('base',$data);
|
|
}
|
|
|
|
|
|
public function actionPaymentConfig()
|
|
{
|
|
if(\Yii::$app->request->isAjax){
|
|
$form = new CommonPaymentConfigListForm();
|
|
$form->attributes = \Yii::$app->request->get();
|
|
$form->cx_mch_id = $this->cx_mch_id;
|
|
$data = $form->search();
|
|
return $this->responseHandler($data);
|
|
}
|
|
$form = new CommonPaymentSettingForm();
|
|
$form->cx_mch_id = $this->cx_mch_id;
|
|
$data = $form->search();
|
|
$pay_types = $data['pay_types'];
|
|
return $this->render('payment-config',[
|
|
'pay_types' => $pay_types
|
|
]);
|
|
}
|
|
|
|
public function actionPaymentConfigEdit($id = 0)
|
|
{
|
|
$model = PaymentConfig::findOne([
|
|
'id' => $id,
|
|
'is_delete' => 0
|
|
]);
|
|
if($model == null){
|
|
$model = new PaymentConfig();
|
|
}
|
|
$model->initConfig();
|
|
|
|
if(\Yii::$app->request->isPost){
|
|
$form = new CommonPaymentConfigEditForm();
|
|
$form->attributes = \Yii::$app->request->post();
|
|
$form->config = \Yii::$app->request->post();
|
|
$form->cx_mch_id = $this->cx_mch_id;
|
|
$form->model = $model;
|
|
$data = $form->save();
|
|
return $this->responseHandler($data);
|
|
}
|
|
$form = new CommonPaymentSettingForm();
|
|
$form->cx_mch_id = $this->cx_mch_id;
|
|
$data = $form->search();
|
|
$pay_types = $data['pay_types'];
|
|
$return_url = \Yii::$app->request->referrer;
|
|
return $this->render('payment-config-edit',[
|
|
'model' => $model,
|
|
'pay_types' => $pay_types,
|
|
'return_url' => $return_url
|
|
]);
|
|
}
|
|
|
|
|
|
public function actionPaymentConfigDelete()
|
|
{
|
|
if(!\Yii::$app->request->isPost){
|
|
$data = $this->invaildRequest();
|
|
return $this->responseHandler($data);
|
|
}
|
|
$form = new CommonPaymentConfigActionForm();
|
|
$form->attributes = \Yii::$app->request->post();
|
|
$form->cx_mch_id = $this->cx_mch_id;
|
|
$data = $form->delete();
|
|
return $this->responseHandler($data);
|
|
}
|
|
|
|
public function actionPaymentConfigOpen()
|
|
{
|
|
if(!\Yii::$app->request->isPost){
|
|
$data = $this->invaildRequest();
|
|
return $this->responseHandler($data);
|
|
}
|
|
$form = new CommonPaymentConfigActionForm();
|
|
$form->attributes = \Yii::$app->request->post();
|
|
$form->cx_mch_id = $this->cx_mch_id;
|
|
$data = $form->open();
|
|
return $this->responseHandler($data);
|
|
}
|
|
|
|
public function actionPaymentConfigClose()
|
|
{
|
|
if(!\Yii::$app->request->isPost){
|
|
$data = $this->invaildRequest();
|
|
return $this->responseHandler($data);
|
|
}
|
|
$form = new CommonPaymentConfigActionForm();
|
|
$form->attributes = \Yii::$app->request->post();
|
|
$form->cx_mch_id = $this->cx_mch_id;
|
|
$data = $form->close();
|
|
return $this->responseHandler($data);
|
|
}
|
|
|
|
} |