浏览代码

改动retry表问题

Candy 6 年之前
父节点
当前提交
76a266fb7a

+ 2 - 2
thinkphp/TCPserver/tcpServer.php

@@ -673,8 +673,8 @@ function send_insert($data,$index=0,$order){
     $send['dest'] =[];
     $send_data = $data[$index];                                //将分割的数据交给全局变量
     foreach ($send_data as $key => $value) {
-        $send_child['dest_login'] = $value['LOGIN'];           //登录的账号
-        $send_child['percentage'] = $value['ladder'];          //梯度
+        $send_child['dest_login'] = (int)$value['LOGIN'];           //登录的账号
+        $send_child['percentage'] = (int)$value['ladder'];          //梯度
         array_push($send['dest'],$send_child);
     }
 

+ 17 - 12
thinkphp/application/index/controller/Index.php

@@ -143,8 +143,6 @@ class Index extends controller
             //获取订单的所有deal,orders
             $result =  Db::connect("db_con2")->query("select Deal as 'deal',`Order` from mt5_deals  WHERE PositionID = {$data['orderid']}");
 
-
-
             $getDeals = array_column($result,'deal');
             $order = array_column($result,'Order');
 
@@ -275,17 +273,17 @@ class Index extends controller
 
     public function update_percentage(Request $request){
         if ($request->isPost()){
+            $data = input();//获取传递的信息
 
-            $data = input();                                              //获取传递的信息
-            $update_array =[];
-            foreach ($data as $key => $value) {
-                $result =  Db::connect("db_con2")->name('mt5_users')->where(['Login'=>$value])->find();
-                $update_array[$value]= $result['Balance'];
-            }
-            if($update_array){
-                return json(['code'=>'00','data'=>$update_array,'msg'=>'请求数据成功']);
+            $where['Login'] = ['in',implode(',',$data)];
+
+            $result =  Db::connect("db_con2")->name('mt5_users')->where($where)->field(['Balance','Login'])->select();
+    $result = array_column($result,'Balance','Login');
+
+            if($result){
+                return json(['code'=>'00','data'=>$result,'msg'=>'请求数据成功']);
             }else{
-                return json(['code'=>'01','data'=>$update_array,'msg'=>'请求数据有误']);
+                return json(['code'=>'01','data'=>$result,'msg'=>'请求数据有误']);
             }
         }else{
 
@@ -293,5 +291,12 @@ class Index extends controller
         }
     }
 
-
+    //程序执行时间秒速
+    public function curenttime()
+    {
+        $t = microtime(true);
+        $micro = sprintf("%06d",($t - floor($t)) * 1000000);
+        $d = new \DateTime( date('Y-m-d H:i:s.'.$micro, $t) );
+        print $d->format("Y-m-d H:i:s.u"); // note at point on "u"
+    }
 }

+ 8 - 8
vue-admin-master/src/views/nav1/Table.vue

@@ -713,12 +713,13 @@
                                     _this.retry_sels.forEach(element => {
 										retry_obj.push(element.dest_login);      //获取到数组的login数据
 									});
-
+									_this.loading_retry = true;
+									_this.dialogVisible = true;
 									// 重新更新retry中数据的  percentage  的数据
-                                    _this.$api.post('/api/index/index/update_percentage',retry_obj, response => {
+                                    _this.$api.post('/api/index/index/update_percentage',retry_obj , response => {
 										if (response.status == 200 && response.status < 300) {
 											 let { msg, code , data} = response.data;
-
+											
 											//对请求的数量进行格式的梳理
 											if(code=="00"){
 												var data_arr = []
@@ -761,14 +762,13 @@
 											   //对改变完成的数据进行发送
 												_this.retry_index =0;
 											
-												_this.loading_retry = true;
-												_this.dialogVisible = true;
+													
 												let data_insert={};
 												data_insert.type = 'vue_insert'; 
 												data_insert.message = 'ErrorInsert';
 												data_insert.orderid = _this.filters.orderid;
 												data_insert.data = _this.retry_sels;
-												
+											
 												// 发送socket
 												_this.socket.send(JSON.stringify(data_insert));
 
@@ -1039,8 +1039,8 @@
 			connect: function () {
 				    var _that_ = this;
 					//this.socket = new WebSocket('ws://47.106.182.13:12380');
-					//this.socket = new WebSocket('ws://154.218.25.112:12381');
-					this.socket = new WebSocket('ws://127.0.0.1:12381');
+					this.socket = new WebSocket('ws://154.218.25.112:12381');
+					//this.socket = new WebSocket('ws://127.0.0.1:12381');
 					//连接成功后的回调函数
                     this.socket.onopen = function () {
                         clearInterval(this.reConnect);