彭俊 преди 6 години
родител
ревизия
b02e836c84

+ 7 - 1
app/Http/Controllers/Admin/SoccerNoteListController.php

@@ -593,6 +593,9 @@ class SoccerNoteListController extends Controller
     public function invalid(Req $req)
     {
         $id = $req->id;
+        //$reason = isset($_POST['reason']) ? $_POST['reason'] : '';
+        $reason = $req->reason;
+
         if (intval($id) < 1) {
             return -1;
         }
@@ -628,7 +631,8 @@ class SoccerNoteListController extends Controller
         $model->status = '1';
         try {
             DB::beginTransaction();//开启事务
-            \App\Models\SportsNoteList::where('id', $id)->update(['status' => '2'], ['gain_money' => '0']);
+            \App\Models\SportsNoteList::where('id', $id)->update(['status' => '2'], ['gain_money' => '0'], ['use_mark' => $reason]);
+
             \App\Models\Account_detailed::where('account_identity', $order->account_identity)->update(['available_cash' => $new_available_cash, 'cash' => $new_available_cash]);
             $model->save();
 
@@ -802,6 +806,8 @@ class SoccerNoteListController extends Controller
         $model = new  \App\Models\SportsNoteList();
         $ret = $model->getorder($order_id);
         if ($ret) {
+//            $league = db('st_'.$ret->game_code.'_league')->where('id',$ret->lg_id)->first();
+//            $ret->league = $league->name_chinese;
             $modelcode = new  \App\Models\StoddsCode();
             $opcode_nameArr = $modelcode->getTypeDatas($ret->game_code);
             $ret = $ret->toArray();

+ 8 - 5
app/Http/Controllers/Admin/SportsfootController.php

@@ -149,11 +149,12 @@ class SportsfootController extends Controller {
 			for ($c=0; $c < count($order); $c++){
 				if(strtotime($timei) >= strtotime($order[$c]['money_time']) && strtotime($timei)-$timep <= strtotime($order[$c]['money_time'])){
 					$orders[] = $order[$c];
-					$account_identitys[] = $order[$c]['account_identitys'];
+					$account_identitys[] = $order[$c]['account_identity'];
 					$order_ids[] = $order[$c]['order_id'];
 				}
 			}
 		}
+		//return $account_identitys;
 
 		$sel = json_decode($model['warn_more'],true);
 		$addru = array(
@@ -179,7 +180,7 @@ class SportsfootController extends Controller {
 				}
 			}else{
 				//编辑
-				for ($i=0; $i < count($sel); $i++) { 
+				for ($i=0; $i < count($sel); $i++) {
 					$sel[$wid]['timei'] = $timei;
 					$sel[$wid]['timep'] = $timep;
 					$sel[$wid]['rtype'] = $rtype;
@@ -191,16 +192,18 @@ class SportsfootController extends Controller {
 			$account_money = \App\Models\Account_detailed::wherein('account_identity',$account_identitys)->get();
 			//反水
 			$water_return_money = \App\Models\Money_details::wherein('trade_id',$order_ids)->where('trade_type', '7')->get();
+
+			//return $water_return_money;
 			if(!empty($orders)){
 				for($i=0;$i<count($orders);$i++){
 					for($a=0;$a<count($account_money);$a++){
-						if($orders[$i]['account_identity'] == $orders[$a]['account_identity']){
-							$available_cash = $account_money->available_cash;
+						if($orders[$i]['account_identity'] == $account_money[$a]['account_identity']){
+							$available_cash = $account_money[$a]['available_cash'];
 						}
 					}
 					for($b=0;$b<count($water_return_money);$b++){
 						if($orders[$i]['order_id'] == $water_return_money[$b]['trade_id']){
-							$water_return = $water_return_money->money;
+							$water_return = $water_return_money[$b]['money'];
 						} else {
 							$water_return = 0;
 						}

+ 1 - 1
app/Models/SportsNoteList.php

@@ -403,7 +403,7 @@ class SportsNoteList extends BaseModel
 
         for ($i = 0; $i < count($data); $i++) {
             if ($data[$i]->status == 1 && $data[$i]->game_status == 0) {
-                $data[$i]->order_status = '投注' . '<br><a class="layui-btn layui-btn-sm invalid" lay-event="detail" pid="id" uri="/admin/SoccerNoteList/invalid/?id=" href="javascript:invalid(\'/admin/SoccerNoteList/invalid/?id=' . $data[$i]->id . '\');"> 作废 </a>';
+                $data[$i]->order_status = '投注' . '<br><a class="layui-btn layui-btn-sm invalid" lay-event="detail" pid="id" uri="/admin/SoccerNoteList/invalid/?id=" href="javascript:invalid(\'/admin/SoccerNoteList/invalid/?id=' . $data[$i]->id . '\',\''.$data[$i]->order_id.'\',\''.$data[$i]->name_chinese.'\');"> 作废 </a>';
             } else if ($data[$i]->status == 1 && $data[$i]->game_status != 0) {
                 $data[$i]->order_status = '投注';
             } else if ($data[$i]->status == 2) {

+ 1 - 0
resources/views/admin/sportsfoot/addwarn.blade.php

@@ -132,6 +132,7 @@
                 url: '/admin/Sportsfoot/addwarnonly',
                 data: {matchid:matchid,timei:timei,timep:timep,warntype:warntype,wid:wid,typenum:typenum},
                 success: function(data) {
+                    //console.log(data);
                     if(data.status==1){
                         layer.msg(data.msg);
                         location. reload()//刷新当前页面

+ 114 - 14
resources/views/sports/sports_notelist.blade.php

@@ -490,22 +490,122 @@
         }
 
         //单式注单作废
-        function invalid(url,ids) {
-            layer.confirm('是否确认作废?', {
-                btn: ['确认', '取消'] //按钮
-            }, function() {
-                $.getJSON(url, function(data, textStatus) {
-                    //console.log(data);
-                    if (data == '1') {
-                        reloadDataTable();
-                        layer.msg('作废成功');
-                    } else {
-                        layer.msg(data.msg);
+        function invalid(url,order_id,league) {
+            // 请求订单数据
+            $.getJSON("/admin/SoccerNoteList/manualmatchget", {'order_id' : order_id}, function(res) {
+                console.log(res);
+                if(1 == res.status){
+                    const getData = res.data.matchdatas;
+                    let content = '<div class="ibox-content" id="box" style="width: 400px !important;">';
+                    let id = '';
+                    let teamName = '';
+                    let detail = '';
+                    // 拼接玩法数据
+                    for (let o in getData) {
+                        id = getData[o].id;
+                        teamName = getData[o].home_team + ' VS ' + getData[o].guest_team;
+                        detail += getData[o].odds_name+' '+getData[o].condition+'@'+getData[o].odds+'<br>';
                     }
-                });
-            }, function() {
+                    content +=
+                            '        <div style="margin-top: 20px;margin-left: 15px; margin-bottom: 10px;">' +
+                            '       <div class="col-5 layui-inline">' +
+                            '                <label class="layui-form-label">联赛名称:</label>' +
+                            '                <div class="layui-input-inline" style="line-height: 38px;">' + league +
+                            '                </div>' +
+                            '            </div><br>' +
+                            '       <div class="col-5 layui-inline">' +
+                            '                <label class="layui-form-label">主客队:</label>' +
+                            '                <div class="layui-input-inline" style="line-height: 38px;">' + teamName +
+                            '                </div>' +
+                            '            </div><br>' +
+                            '       <div class="col-5 layui-inline">' +
+                            '                <label class="layui-form-label">投注信息:</label>' +
+                            '                <div class="layui-input-inline" style="line-height: 38px;">' + detail +
+                            '                </div>' +
+                            '            </div><br>' +
+                            '       <div class="col-5 layui-inline">' +
+                            '                <label class="layui-form-label">投注金额 :</label>' +
+                            '                <div class="layui-input-inline" style="line-height: 38px;">' + res.data.money +
+                            '                </div>' +
+                            '            </div><br>' +
+                            '       <div class="col-5 layui-inline">' +
+                            '                <label class="layui-form-label">最高可赢 :</label>' +
+                            '                <div class="layui-input-inline" style="line-height: 38px;">' + res.data.prize_money +
+                            '                </div>' +
+                            '            </div><br>' +
+                            '       <div class="col-5 layui-inline">' +
+                            '                <label class="layui-form-label">下注时间 :</label>' +
+                            '                <div class="layui-input-inline" style="line-height: 38px;">' + res.data.money_time +
+                            '                </div>' +
+                            '            </div><br>' +
+//                                '            <div style="color: #5f5f5f; margin-left: 10px; margin-bottom: 10px;">' + teamName + '</div>' +
+                            '            <div class="col-5 layui-inline">' +
+                            '                <label class="layui-form-label">作废原因:</label>' +
+                            '                <div class="layui-input-inline" style="">' +
+                            '                    <input type="text" name="" id="reason' + id + '" placeholder="请输入作废原因" eventType="event-query" lay-verify="required" autocomplete="off" class="layui-input">' +
+                            '                </div><br>' +
+                            '            </div>' +
+                            '        </div>';
+                    content += '</div>';
+                    // 打开弹窗.
+                    layer.open({
+                        area: ['400px', '480px'], //宽高
+                        type: 1,
+                        title: '注单作废',
+                        content: content, //这里content是一个DOM,注意:最好该元素要存放在body最外层,否则可能被其它的相对元素所影响,
+                        btn: ['提交', '取消'],
+                        yes: function(index, layero){
+                            let orderdata = [];
+                            let reason = '';
+                            let resultInfo = '';
+                            // 循环获取输入的数据.
+
+                                reason = $("#reason" + id).val();
+                            //console.log(reason);
+                            url = url+'&reason='+reason;
+                            // 请求设置接口
+                            console.log(url);
+                            $.ajax({
+                                type: 'get',
+                                dataType: 'json',
+                                url: url,
+                                data: {reason: reason},
+                                success: function(res) {
+                                    console.log(res);
+                                    if (1 == res) {
+                                        layer.alert("设置成功", {title: '友情提示', icon: 1, closeBtn: 0}, function(){
+                                            window.location.reload();
+                                        });
+                                    } else {
+                                        layer.alert("服务器异常", {title: '友情提示', icon: 2});
+                                    }
+                                },
+                                error: function () {
+                                    layer.alert("服务器异常", {title: '友情提示', icon: 2});
+                                }
+                            })
+                        },
+                    });
+                } else {
+                    layer.alert("数据拉取失败", {title: '友情提示', icon: 2});
+                }
 
-            });
+        });
+//            layer.confirm('是否确认作废?', {
+//                btn: ['确认', '取消'] //按钮
+//            }, function() {
+//                $.getJSON(url, function(data, textStatus) {
+//                    //console.log(data);
+//                    if (data == '1') {
+//                        reloadDataTable();
+//                        layer.msg('作废成功');
+//                    } else {
+//                        layer.msg(data.msg);
+//                    }
+//                });
+//            }, function() {
+//
+//            });
 
         }
     </script>