8 Комити bde29d872f ... 3a09043611

Аутор SHA1 Порука Датум
  Robin 3a09043611 增加撤消入金功能 пре 6 година
  jace 96671e7828 Merge branch 'master' of http://alisz.titanera.com:3000/titan/CRM пре 6 година
  jace e3db31a588 增加撤销入金的功能 пре 6 година
  Robin 2a9a56fc3e 下载包 пре 6 година
  Robin 3b4e63de58 修复入金记录 пре 6 година
  Robin dca33999fa 二维码调整 пре 6 година
  Robin 2f2e55a256 调整二维码样式 пре 6 година
  Robin 34a9baa5ab 修复撤销出金接口 пре 6 година

+ 60 - 0
crm_mt4_deposit_log.sql

@@ -0,0 +1,60 @@
+/*
+ Navicat Premium Data Transfer
+
+ Source Server         : berger
+ Source Server Type    : MySQL
+ Source Server Version : 50628
+ Source Host           : 15.165.74.227:3306
+ Source Schema         : bergermkt_crm
+
+ Target Server Type    : MySQL
+ Target Server Version : 50628
+ File Encoding         : 65001
+
+ Date: 26/12/2019 20:17:19
+*/
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for crm_mt4_deposit_log
+-- ----------------------------
+DROP TABLE IF EXISTS `crm_mt4_deposit_log`;
+CREATE TABLE `crm_mt4_deposit_log`  (
+  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
+  `type` smallint(4) NOT NULL DEFAULT 1 COMMENT '类型 1入金 2出金',
+  `mt4_id` int(11) NOT NULL DEFAULT 0 COMMENT 'mt4 id',
+  `order_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '订单号',
+  `mt4_order_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'mt4订单号',
+  `usd_money` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '操作金额 美元',
+  `err_code` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '错误码',
+  `err_msg` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '错误信息',
+  `create_time` int(11) NOT NULL COMMENT '创建时间',
+  `log_id` int(11) NOT NULL DEFAULT 0 COMMENT '出入金的id',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+
+-- ----------------------------
+-- Records of crm_mt4_deposit_log
+-- ----------------------------
+INSERT INTO `crm_mt4_deposit_log` VALUES (1, 1, 30100402, 'Deposit', '27231', 100.29, '0', 'RET_OK|正确', 1577241361, 13346);
+INSERT INTO `crm_mt4_deposit_log` VALUES (2, 2, 30100402, 'Withdraw', '27232', 100.29, '0', 'RET_OK|正确', 1577259920, 1);
+INSERT INTO `crm_mt4_deposit_log` VALUES (3, 1, 30100405, 'Deposit', '27233', 1000.47, '0', 'RET_OK|正确', 1577351823, 13362);
+INSERT INTO `crm_mt4_deposit_log` VALUES (4, 1, 30100408, 'Deposit', '27234', 10000.24, '0', 'RET_OK|正确', 1577351859, 13370);
+INSERT INTO `crm_mt4_deposit_log` VALUES (5, 1, 30100413, 'Deposit', '27235', 7143.52, '0', 'RET_OK|正确', 1577351876, 13373);
+INSERT INTO `crm_mt4_deposit_log` VALUES (6, 1, 30100450, 'Deposit', '27238', 1000.55, '0', 'RET_OK|正确', 1577356121, 13389);
+INSERT INTO `crm_mt4_deposit_log` VALUES (7, 1, 30100450, 'Deposit', '27239', 1000.18, '0', 'RET_OK|正确', 1577356127, 13390);
+INSERT INTO `crm_mt4_deposit_log` VALUES (8, 1, 30100424, 'Deposit', '27240', 10000.37, '0', 'RET_OK|正确', 1577356142, 13382);
+INSERT INTO `crm_mt4_deposit_log` VALUES (9, 1, 30100413, 'Deposit', '27241', 7140.22, '0', 'RET_OK|正确', 1577356175, 13380);
+INSERT INTO `crm_mt4_deposit_log` VALUES (10, 1, 30100438, 'Deposit', '27242', 4200.48, '0', 'RET_OK|正确', 1577356192, 13381);
+INSERT INTO `crm_mt4_deposit_log` VALUES (11, 1, 30100438, 'Deposit', '27243', 2857.13, '0', 'RET_OK|正确', 1577356217, 13384);
+INSERT INTO `crm_mt4_deposit_log` VALUES (12, 1, 30100413, 'Deposit', '27244', 7142.14, '0', 'RET_OK|正确', 1577356261, 13375);
+INSERT INTO `crm_mt4_deposit_log` VALUES (13, 1, 30100418, 'Deposit', '27245', 7000.64, '0', 'RET_OK|正确', 1577356268, 13391);
+INSERT INTO `crm_mt4_deposit_log` VALUES (14, 1, 30100410, 'Deposit', '27246', 5000.62, '0', 'RET_OK|正确', 1577357885, 13371);
+INSERT INTO `crm_mt4_deposit_log` VALUES (15, 1, 30100412, 'Deposit', '27248', 7000.39, '0', 'RET_OK|正确', 1577360935, 13399);
+INSERT INTO `crm_mt4_deposit_log` VALUES (16, 1, 30100433, 'Deposit', '27249', 1428.24, '0', 'RET_OK|正确', 1577360948, 13400);
+INSERT INTO `crm_mt4_deposit_log` VALUES (17, 1, 30100430, 'Deposit', '27250', 6000.25, '0', 'RET_OK|正确', 1577360968, 13401);
+INSERT INTO `crm_mt4_deposit_log` VALUES (18, 1, 30100405, 'Deposit', '27251', 2000.13, '0', 'RET_OK|正确', 1577360987, 13412);
+
+SET FOREIGN_KEY_CHECKS = 1;

BIN
normand/frontend/frontend/web/upload/BergerMetaTrader4.exe


+ 21 - 0
normandcrm/admin/backend/models/DepositApi.php

@@ -89,4 +89,25 @@ class DepositApi extends BaseApi
             return $this->returnArray(0, [], $result['message']);
         }
     }
+
+    /**
+     * 撤销入金
+     * @param int $id
+     * @param int $type
+     * @param string $admin_name
+     * @return array
+     */
+    public function Revokegold($id, $mt4_id)
+    {
+        $data = [
+            'id' => $id,
+            'mt4_id' => $mt4_id,
+        ];
+        $result = $this->post($this->apiUrl . '/revokegold', $data);
+        if ($result['code'] == 1) {
+            return $this->returnArray(1, $result['data'], 'SUCCESS');
+        } else {
+            return $this->returnArray(0, [], 'FAILED');
+        }
+    }
 }

+ 17 - 0
normandcrm/admin/backend/modules/admin/controllers/DepositController.php

@@ -65,4 +65,21 @@ class DepositController extends BaseController
             return $this->asJson(['isSuccess' => false, 'msg' => '操作失败']);
         }
     }
+
+    /**
+     * 撤销入金
+     * @return \yii\web\Response
+     */
+    public function actionRevokegold()
+    {
+        $id = Yii::$app->getRequest()->post('id');
+        $mt4_id = Yii::$app->getRequest()->post('mt4_order_id');
+        $api = new DepositApi();
+        $result = $api->Revokegold($id, $mt4_id);
+        if ($result['code'] == 1) {
+            return $this->asJson(['isSuccess' => true, 'msg' => '操作成功']);
+        } else {
+            return $this->asJson(['isSuccess' => false, 'msg' => '操作失败']);
+        }
+    }
 }

+ 48 - 0
normandcrm/admin/backend/modules/admin/views/deposit/index.php

@@ -92,6 +92,11 @@ use yii\helpers\Url;
                             <button id="patchIntoGold" class="btn btn-primary">补单</button>
                         </div>
                     <?php endif;?>
+                    <?php if ($type == 1): ?>
+                        <div class="btn-group pull-right" style="margin-right: 10px;">
+                            <button id="RevokeIntoGold" class="btn btn-primary">撤销入金</button>
+                        </div>
+                    <?php endif; ?>
                     <div class="clearfix"></div>
                 </div>
                 <div class="ibox-content">
@@ -351,6 +356,49 @@ use yii\helpers\Url;
             });
         }
     });
+
+    // 撤销入金的操作
+    $('#RevokeIntoGold').click(function () {
+        var data = table.row('.selected').data();
+        if (data != undefined) {
+            swal({
+                title: "您确定吗?",
+                text: "确定撤销此订单",
+                type: "warning",
+                showCancelButton: true,
+                confirmButtonColor: "#DD6B55",
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                closeOnConfirm: true
+            }, function (isConfirm) {
+                if (isConfirm) {
+                    $.ajax({
+                        type: "POST",
+                        url: "<?= Url::to(['revokegold']) ?>",
+                        data: {
+                            id: data.id,
+                            mt4_order_id:data.mt4_order_id
+                        },
+                        dataType: "json",
+                        beforeSend: function () {
+                        },
+                        success: function (data) {
+                            if (data.isSuccess) {
+                                toastr.success(data.msg,'提示');
+                                table.ajax.reload();
+                            } else {
+                                toastr.error(data.msg, "提示");
+                            }
+                        },
+                        complete: function (XMLHttpRequest, textStatus) {
+                        },
+                        error: function () {
+                        }
+                    });
+                }
+            });
+        }
+    });
 </script>
 <?php $this->endBlock();?>
 

+ 1 - 0
normandcrm/admin/backend/web/str1.txt

@@ -0,0 +1 @@
+member_id=1app_oauth#^A3lopM5*$%TUa@wtC467^

+ 54 - 0
normandcrm/service/backend/controllers/DepositController.php

@@ -14,6 +14,7 @@ use backend\models\UserMember;
 use common\helpers\MtKit;
 use common\helpers\Utils;
 use common\pay\PayForm;
+use common\lib\Mt4ManagerApi;
 use Yii;
 
 class DepositController extends BaseController
@@ -160,6 +161,59 @@ class DepositController extends BaseController
         return $this->outJson(1, [], '操作成功');
     }
 
+    /**
+     * 撤销入金
+     */
+    public function actionRevokegold(){
+
+        $id = (int) Yii::$app->request->post('id');                 //获取入金id
+        $mt4_id = (int) Yii::$app->request->post('mt4_id');         //获取mt4的订单号
+
+        file_put_contents('goldentry_id.txt',$id);
+        file_put_contents('goldentry_mt4_id.txt',$mt4_id);
+
+        if ($id <= 0) {
+            return $this->outJson(0, [], '未指定数据对象');
+        }
+        $login = Deposit::findOne($id)['login'];                    //获取login参数
+        $res = Deposit::updateAll(['type' => 0], "id = $id");       //更新入金表的状态(等待)      后续还需要更改什么
+
+        if($res){
+
+             //调用mt4的撤销入金接口
+             $api = new Mt4ManagerApi();
+             $result = $api->revokeOrder($mt4_id);
+             if(empty($result)){
+                 return $this->outJson(0, [], '更新失败');
+             }
+             $result = json_decode($result,true);
+             $tt = print_r($result,true);
+             file_put_contents('goldentry1.txt',$tt);
+             if(!$result['ret']){
+                 $result2 = $api->fixbalance($login);
+                 if(empty($result2)){
+                     return $this->outJson(0, [], '更新失败');
+                 }
+                 $res2 = json_decode($result2,true);
+                 $tt = print_r($res2,true);
+                 file_put_contents('goldentry2.txt',$tt);
+                 if(!$res2['ret']){
+                     $res3 = Deposit::updateAll(['mt4_status' => 0], "id = $id");        //更新出金表的状态(mt4未扣减)
+                     if($res3){
+                         return $this->outJson(1, [], '操作成功');
+                     }else{
+                         return $this->outJson(0, [], '更新失败');
+                     }
+                 }
+             }else{
+                 return $this->outJson(0, [], '更新失败');
+             }
+
+        }else{
+            return $this->outJson(0, [], '更新失败');
+        }
+    }
+
     /**
      * 获取入金配置
      * @return \yii\web\Response

+ 1 - 0
normandcrm/service/backend/web/str1.txt

@@ -0,0 +1 @@
+member_id=1app_oauth#^A3lopM5*$%TUa@wtC467^

+ 1 - 0
normandcrm/service/backend/web/test.txt

@@ -0,0 +1 @@
+{"ip":"127.0.0.1","password":"123456","type":"99","username":"admin","token":"6bf46044553c27e3122b7893c6d5b3ba"}