107 lines
3.1 KiB
PHP
107 lines
3.1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @author Any
|
|
* @description KISS
|
|
* @date 2020-11-5
|
|
* @version 1.0.0
|
|
*
|
|
* _____LOG_____
|
|
*
|
|
*/
|
|
namespace app\modules\admin\controllers;
|
|
use app\models\CardUnion;
|
|
use app\models\District;
|
|
use app\models\Model;
|
|
use app\models\Store;
|
|
use app\modules\admin\behaviors\LoginBehavior;
|
|
use app\modules\admin\models\card\CardUnionEditForm;
|
|
use app\modules\admin\models\card\CardUnionListForm;
|
|
|
|
class CardUnionController extends Controller
|
|
{
|
|
public function behaviors()
|
|
{
|
|
return array_merge(parent::behaviors(), [
|
|
'login' => [
|
|
'class' => LoginBehavior::className(),
|
|
],
|
|
]);
|
|
}
|
|
|
|
//银行卡列表
|
|
public function actionIndex()
|
|
{
|
|
if(\Yii::$app->request->isAjax){
|
|
$form = new CardUnionListForm();
|
|
$form->attributes = \Yii::$app->request->get();
|
|
$data = $form->search();
|
|
return $this->responseHandler($data);
|
|
}
|
|
return $this->render('index');
|
|
|
|
}
|
|
|
|
//确定验证码
|
|
public function actionEdit($id = 0)
|
|
{
|
|
$district_list = District::getTerritorial();
|
|
$model = CardUnion::findOne(['id' => $id,'is_delete' => 0]);
|
|
if($model == null)
|
|
$model = new CardUnion();
|
|
if(\Yii::$app->request->isPost){
|
|
$from = new CardUnionEditForm();
|
|
$from->attributes = \Yii::$app->request->post();
|
|
$from->cx_mch_id = $this->cx_mch_id;
|
|
$from->model = $model;
|
|
$data = $from->confirm_sms();
|
|
return $this->responseHandler($data);
|
|
}
|
|
$banks = [];
|
|
if($model->cardBank && $model->cardBank->id != null){
|
|
$banks2['name'] = $model->cardBank->name;
|
|
$banks2['value'] = $model->cardBank->id;
|
|
$banks2['disabled'] = false;
|
|
$banks2['selected'] = true;
|
|
array_push($banks,$banks2);
|
|
}
|
|
return $this->render('edit',[
|
|
'district_list' => json_encode($district_list,JSON_UNESCAPED_UNICODE),
|
|
'model' => $model,
|
|
'banks' => json_encode($banks),
|
|
]);
|
|
|
|
}
|
|
|
|
/**
|
|
* 获取验证码按钮
|
|
* 状态 动作
|
|
* 无数据 - 发送绑定申请接口
|
|
* 已请求 - 短信重发接口
|
|
* 已绑定 - 无动作
|
|
*/
|
|
public function actionSendBankUnion()
|
|
{
|
|
if(!\Yii::$app->request->isPost){
|
|
$data = $this->invaildRequest();
|
|
return $this->responseHandler($data);
|
|
}
|
|
$key = "SendBankUnion";
|
|
$request = \Yii::$app->request;
|
|
$id = empty($request->post('id')) ? 0 : $request->post('id');
|
|
$model = CardUnion::findOne(['id' => $id,'is_delete' => 0]);
|
|
if($model == null)
|
|
$model = new CardUnion();
|
|
$from = new CardUnionEditForm();
|
|
$from->attributes = $request->post();
|
|
$from->cx_mch_id = $this->cx_mch_id;
|
|
$from->model = $model;
|
|
$from->redis_key = $key;
|
|
$data = $from->send_bank_union();
|
|
return $this->responseHandler($data);
|
|
}
|
|
|
|
|
|
|
|
|
|
} |