彭俊 %!s(int64=6) %!d(string=hai) anos
pai
achega
d0f19056ae

+ 7 - 6
app/Http/Controllers/Admin/SportsfootController.php

@@ -38,9 +38,10 @@ class SportsfootController extends Controller {
 		if($winfail == false){
 			return json_encode(['status'=>2,'msg'=>'判断输赢错误,请联系管理员!!!']);//输赢错误
 		}
+		//print_r(implode(',',$simplex_ids));exit;
 		$sim = array(
 			'token'=>$token,
-			'order_ids'=>$simplex_ids, //订单id字符串,用半角都好分隔
+			'order_ids'=>'', //订单id字符串,用半角都好分隔
 			'bettype'=>1, //结算类型  1单式  2串式
 			'settype'=>2, //结算次数  1首次  2非首冷饮
 			'game_code'=>$type, //赛事类型  zq lq wq bq
@@ -49,7 +50,7 @@ class SportsfootController extends Controller {
 		);
 		$str = array(
 			'token'=>$token,
-			'order_ids'=>$str_ids, //订单id字符串,用半角都好分隔
+			'order_ids'=>'', //订单id字符串,用半角都好分隔
 			'bettype'=>2, //结算类型  1单式  2串式
 			'settype'=>2, //结算次数  1首次  2非首冷饮
 			'game_code'=>$type, //赛事类型  zq lq wq bq
@@ -59,7 +60,7 @@ class SportsfootController extends Controller {
 		if(count($simplex_ids)>0 || count($str_ids)>0){
 			//单式结算
 			if(count($simplex_ids)>0 && count($str_ids)==0){
-				$sim['order_ids'] = json_encode($simplex_ids);
+				$sim['order_ids'] = implode(',',$simplex_ids);
 				$settlesim = $settlementAuto->SubmitSettelement('s',$sim);
 				if($settlesim == false){
 					return json_encode(['status'=>3,'msg'=>'单式注单结算有误,请联系管理员!!!']);
@@ -68,7 +69,7 @@ class SportsfootController extends Controller {
 				}
 			}
 			elseif(count($str_ids)>0 && count($simplex_ids)==0){
-				$str['order_ids'] = json_encode($str_ids);
+				$str['order_ids'] = implode(',',$str_ids);
 				$settlestr = $settlementAuto->SubmitSettelement('s',$str);
 				if($settlestr == false){
 					return json_encode(['status'=>3,'msg'=>'串式注单结算有误,请联系管理员!!!']);
@@ -77,8 +78,8 @@ class SportsfootController extends Controller {
 				}
 			}
 			elseif(count($str_ids)>0 && count($simplex_ids)>0){
-				$sim['order_ids'] = json_encode($simplex_ids);
-				$str['order_ids'] = json_encode($str_ids);
+				$sim['order_ids'] = implode(',',$simplex_ids);
+				$str['order_ids'] = implode(',',$str_ids);
 				$settlesim = $settlementAuto->SubmitSettelement('s',$sim);
 				$settlestr = $settlementAuto->SubmitSettelement('s',$str);
 				if($settlesim == true || $settlestr == true){

+ 1 - 1
app/Http/Controllers/Admin/SystemController.php

@@ -152,7 +152,7 @@ class SystemController extends Controller {
 
 	//获取活动信息
 	function getArticle() {
-		$limit = Request::has('limit') ? Request::get('limit') : 10;
+		$limit = Request::has('limit') ? Request::get('limit') : 5;
 
 		$title = Request::has('title') ? Request::get('title') : '';
 		$type = Request::has('type') ? Request::get('type') : '';

+ 143 - 0
app/Lib/Settlement/SwInterface.php

@@ -0,0 +1,143 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Administrator
+ * Date: 2019/11/7
+ * Time: 20:21
+ */
+
+namespace App\Lib\Settlement;
+
+//后台结算,输赢结算接口
+/*
+ * 返回  status=1 成功 其它失败
+ * Array
+(
+    [status] => 1
+    [msg] => succes
+    [data] => Array
+        (
+            [cost] => 0.035570859909058
+        )
+)
+ *
+ * */
+
+
+class SwInterface
+{
+    private static $Instance = null;
+    static $urlBase = '';
+    static $token = 'oclatv15689731035d84a12f550df';
+
+    public function debug()
+    {
+        return ['url' => self::$urlBase, 'token' => self::$token];
+    }
+
+    public static function getInstance($cache = true)
+    {
+        if ($cache && self::$Instance) {
+            return self::$Instance;
+        }
+        self::$Instance = new self();
+        self::$urlBase = config('sconstant.url');
+        if (session('adminInfo.token')) {
+            self::$token = session('adminInfo.token');
+        }
+        return self::$Instance;
+    }
+
+    //按赛事计算输赢
+    public function MatchWinFail($noticeId)
+    {
+        $url = self::$urlBase . '/WinFail';
+        $data = [
+            'token' => self::$token,
+            'noticeid' => $noticeId,
+        ];
+        $ret = json_decode($this->request_post($url, $data), true);
+        return $ret;
+    }
+
+    //手动计算某个订单输赢
+    public function WinFailHandOrder($order_id)
+    {
+        $url = self::$urlBase . '/DoWinFailOneOrder';
+        $data = [
+            'token' => self::$token,
+            'order_id' => $order_id,
+        ];
+        $ret = json_decode($this->request_post($url, $data), true);
+        return $ret;
+    }
+
+    //普通计算某个订单输赢
+    public function WinFailNomalOrder($order_id, $bet_type)
+    {
+        $url = self::$urlBase . '/WinFaileOneOrderNomal';
+        $data = [
+            'token' => self::$token,
+            'order_id' => $order_id,
+            'bet_type' => $bet_type,
+        ];
+        $ret = json_decode($this->request_post($url, $data), true);
+        return $ret;
+    }
+
+    //结算处理接口  注意只能同一赛事的订单(区分单式串式) $order_ids为空表示单式全部或串式全部  $change_statuc全部时是否更新状态 $is_manurl是否手动结果(单条单式才动结算时为1)
+    public function Setelement($game_code, $match_id, $bettype, $order_ids = '', $change_statuc = 0, $is_manurl = 0)
+    {
+        $url = self::$urlBase . '/Settelement';
+        $data = [
+            'token' => self::$token,
+            'game_code' => $game_code,
+            'match_id' => $match_id,
+            'change_status' => $change_statuc,
+            'is_manual' => $is_manurl,
+            'settype' => 2,
+            'bettype' => $bettype,
+            'order_ids' => $order_ids,
+        ];
+        $ret = json_decode($this->request_post($url, $data), true);
+        return $ret;
+    }
+
+
+    //取消一个订单
+    public function CancelOneOrder($game_code, $match_id, $order_id)
+    {
+        $url = self::$urlBase . '/UnsetOneOrder';
+        $data = [
+            'token' => self::$token,
+            'game_code' => $game_code,
+            'match_id' => $match_id,
+            'order_id' => $order_id
+        ];
+        $ret = json_decode($this->request_post($url, $data), true);
+        return $ret;
+    }
+
+
+    public function request_post($url = '', $param = '')
+    {
+        if (empty($url) || empty($param)) {
+            return false;
+        }
+
+        $postUrl = $url;
+        $curlPost = $param;
+        $ch = curl_init();//初始化curl
+        curl_setopt($ch, CURLOPT_URL, $postUrl);//抓取指定网页
+        curl_setopt($ch, CURLOPT_HEADER, 0);//设置header
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上
+        curl_setopt($ch, CURLOPT_POST, 1);//post提交方式
+        curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
+        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
+        $data = curl_exec($ch);//运行curl
+        curl_close($ch);
+
+        return $data;
+    }
+
+}

+ 1 - 1
app/Models/Article.php

@@ -11,7 +11,7 @@ class Article extends BaseModel {
 		if (!empty($where) && is_array($where)) {
 			$data = $data->where($where);
 		}
-		$data = $data->paginate($list);
+		$data = $data->paginate(5);
 
 		if (!$data) {
 			return -4010010022; //没有数据

+ 2 - 2
resources/views/admin/sportsfoot/outcome.blade.php

@@ -34,10 +34,10 @@
 
             @{{#if(d.status==2 || d.status==3){ }}
                 @{{#if(d.status==2){ }}
-                    <a href="javascript:;" onclick="settlement(@{{d.match_id}},1)" class="layui-btn layui-btn-sm">结算</a>
+                    <a href="javascript:;" onclick="settlement(@{{d.match_id}},'zq')" class="layui-btn layui-btn-sm">结算</a>
                 @{{#} }}
                 @{{#if(d.status==3){ }}
-                    <a href="javascript:;" onclick="settlement(@{{d.match_id}},2)" class="layui-btn layui-btn-sm">再结算</a>
+                    <a href="javascript:;" onclick="settlement(@{{d.match_id}},'zq')" class="layui-btn layui-btn-sm">再结算</a>
                 @{{#} }}
             @{{#} }}
             <!--