cxgj/modules/admin/controllers/CashController.php
2023-11-27 09:45:13 +08:00

98 lines
2.8 KiB
PHP

<?php
/**
* @author Any
* @description KISS
* @date 2021年6月10日
* @version 1.0.0
*
* _____LOG_____
*
*/
namespace app\modules\admin\controllers;
use yii\helpers\VarDumper;
use app\modules\admin\behaviors\LoginBehavior;
use app\models\Balance;
use app\models\Cash;
use app\models\CashSetting;
use app\models\common\CommonCashActionForm;
use app\models\common\CommonCashListForm;
use app\models\common\CommonCashSettingForm;
use app\components\SysConst;
class CashController extends Controller
{
public function behaviors()
{
return array_merge(parent::behaviors(), [
'login' => [
'class' => LoginBehavior::className(),
],
]);
}
public function actionIndex()
{
if(\Yii::$app->request->isAjax){
$form = new CommonCashListForm();
$form->attributes = \Yii::$app->request->get();
$form->cx_mch_id = $this->cx_mch_id;
$data = $form->search();
return $this->responseHandler($data);
}
return $this->render('index');
}
public function actionSetting()
{
$form = new CommonCashSettingForm();
if(\Yii::$app->request->isPost){
$form->scenario = 'edit';
$form->attributes = \Yii::$app->request->post();
$form->cx_mch_id = $this->cx_mch_id;
$form->scene = Balance::$cxBalanceSceneUserWallet;
$data = $form->save();
return $this->responseHandler($data);
}
$form->cx_mch_id = $this->cx_mch_id;
$form->scene = Balance::$cxBalanceSceneUserWallet;
$model = $form->search();
return $this->render('setting',[
'model' => $model,
'title' => '钱包提现设置',
'post_api' => \Yii::$app->urlManager->createUrl(['/admin/cash/setting'])
]);
}
public function actionReview()
{
$form = new CommonCashActionForm();
$form->scenario = 'review';
$form->attributes = \Yii::$app->request->post();
$form->cx_mch_id = $this->cx_mch_id;
$data = $form->review();
return $this->responseHandler($data);
}
public function actionTransfer()
{
$form = new CommonCashActionForm();
$form->attributes = \Yii::$app->request->post();
$form->cx_mch_id = $this->cx_mch_id;
$data = $form->transfer();
return $this->responseHandler($data);
}
public function actionDelete()
{
$form = new CommonCashActionForm();
$form->attributes = \Yii::$app->request->post();
$form->cx_mch_id = $this->cx_mch_id;
$data = $form->delete();
return $this->responseHandler($data);
}
}