zm
2021-03-29 1ecdc5ecb49d2a4e092e80cf397427cedf1f8d15
修改,兑换时验证BUG(增加卡号条件)
5 files modified
21 ■■■■■ changed files
plugins/exchange/forms/api/COrderSubmitForm.php 3 ●●●● patch | view | raw | blame | history
plugins/exchange/forms/exchange/ExchangeFactory.php 8 ●●●●● patch | view | raw | blame | history
plugins/exchange/forms/exchange/validate/FacadeAdmin.php 4 ●●●● patch | view | raw | blame | history
plugins/exchange/jobs/CovertJob.php 3 ●●●● patch | view | raw | blame | history
plugins/exchange/jobs/ExchangeJob.php 3 ●●●● patch | view | raw | blame | history
plugins/exchange/forms/api/COrderSubmitForm.php
@@ -45,9 +45,10 @@
            $info = current($this->form_data['list']);
            $code = $info['code'];
            $token = $info['token'];
            $card_no = $info['card_no'];
            $f = new FacadeAdmin();
            $f->user(\Yii::$app->user->id);
            $f->cover(\Yii::$app->mall->id, $code);
            $f->cover(\Yii::$app->mall->id, $code,$card_no);
            $rewards = \yii\helpers\BaseJson::decode($f->validate->codeModel->r_rewards);
            $f->token($rewards, $token, ['goods']);
        } catch (\Exception $e) {
plugins/exchange/forms/exchange/ExchangeFactory.php
@@ -154,7 +154,7 @@
            $this->user = $model->user;
            //小程序
            if ($this->origin === ExchangeCode::ORIGIN_ADMIN) {
                $f->admin(\Yii::$app->mall->id, $this->code);
                $f->admin2(\Yii::$app->mall->id, $this->code,$this->card_no);
            } else {
                $model->hasExchangeSetting([
                    'is_anti_brush' => $this->is_anti_brush,
@@ -163,7 +163,7 @@
                    'freeze_hour' => $this->freeze_hour,
                    'is_limit' => 0,
                ]);
                $f->admin(\Yii::$app->mall->id, $this->code);
                $f->admin2(\Yii::$app->mall->id, $this->code,$this->card_no);
                $model->hasExchangeSetting([
                    'is_anti_brush' => 0,
                    'is_limit' => $model->libraryModel->is_limit,
@@ -182,6 +182,7 @@
                'code' => $this->code,
                'token' => $this->token,
                'result_token' => $this->result_token,
                'card_no' => $this->card_no,
                'extra_info' => array_merge($this->extra_info, [
                    'has_imitate' => $has_imitate,
                ])
@@ -235,7 +236,7 @@
        try {
            $f = new FacadeAdmin();
            $f->user($this->user_id);
            $f->cover(\Yii::$app->mall->id, $this->code);
            $f->cover(\Yii::$app->mall->id, $this->code,$this->card_no);
            $model = $f->validate;
            $codeModel = $model->codeModel;
@@ -246,6 +247,7 @@
                'code' => $this->code,
                'token' => $this->token,
                'origin' => $this->origin,
                'card_no'=> $this->card_no,
                'result_token' => $this->result_token
            ]));
            $status = \Yii::$app->queue->isDone($queueId);
plugins/exchange/forms/exchange/validate/FacadeAdmin.php
@@ -45,10 +45,10 @@
        $this->validate->hasExpireAfter();//是否到期
    }
    public function cover($mall_id, $code)
    public function cover($mall_id, $code, $card_no)
    {
        $this->validate->setMallId($mall_id);
        $this->validate->setCodeModel($code);
        $this->validate->setCodeModel($code,$card_no);
        $this->validate->hasCode();
        $this->validate->hasExchangeUser();//用户是否合法
        $this->validate->setLibraryModel($this->validate->codeModel->library_id);
plugins/exchange/jobs/CovertJob.php
@@ -22,6 +22,7 @@
    public $code;
    public $token;
    public $result_token;
    public $card_no;
    public function execute($queue)
    {
@@ -30,7 +31,7 @@
        try {
            $f = new FacadeAdmin();
            $f->validate->user = $this->user;
            $f->cover($this->user->mall_id, $this->code);
            $f->cover($this->user->mall_id, $this->code,$this->card_no);
            $model = $f->validate;
            $codeModel = $model->codeModel;
plugins/exchange/jobs/ExchangeJob.php
@@ -20,6 +20,7 @@
    public $token;
    public $result_token;
    public $extra_info;
    public $card_no;
    public function execute($queue)
    {
@@ -27,7 +28,7 @@
        $t = \Yii::$app->db->beginTransaction();
        try {
            $f = new FacadeAdmin();
            $f->admin($this->user->mall_id, $this->code);
            $f->admin2($this->user->mall_id, $this->code,$this->card_no);
            $model = $f->validate;
            $codeModel = $model->codeModel;