|
|
@@ -13,6 +13,7 @@ use Illuminate\Http\Request as Req;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
Use App\Lib\Settlement\SettlementOrder;
|
|
|
Use App\Lib\Settlement\SettlementWinFail;
|
|
|
+use App\Models\MoneyBuyStr as MoneyBuyStrModel;
|
|
|
use App\Models;
|
|
|
use Request;
|
|
|
|
|
|
@@ -270,34 +271,36 @@ class SoccerStringNoteListController extends Controller
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ //把撤单状态的订单改为下单状态 (重下单,写流水,扣钱,改订单状态)
|
|
|
public function resetStrOrder(Req $req)
|
|
|
{
|
|
|
- return ['status'=>-1,'msg'=>'功能废弃'];
|
|
|
$id = $req->id;
|
|
|
if (intval($id) < 1) {
|
|
|
- return ['status'=>-1,'msg'=>'无效id'];
|
|
|
+ return ['status' => -1, 'msg' => '无效id'];
|
|
|
}
|
|
|
- $order = \App\Models\MoneyBuyStr::where('id', $id)->first();
|
|
|
- if (empty($order)){
|
|
|
- return ['status'=>-2,'msg'=>'订单不存在'];
|
|
|
+ $order = (new MoneyBuyStrModel())->with('matchdatas')->where('id', $id)->first();
|
|
|
+ $game_code = $order->matchdatas['0']->game_code;
|
|
|
+ $match_id = $order->matchdatas['0']->match_id;
|
|
|
+
|
|
|
+ if (empty($order)) {
|
|
|
+ return ['status' => -2, 'msg' => '订单不存在'];
|
|
|
}
|
|
|
- if ($order->status==1){
|
|
|
- return ['status'=>-3,'msg'=>'状态错误'];
|
|
|
+ if ($order->status == 1) {
|
|
|
+ return ['status' => -3, 'msg' => '状态错误'];
|
|
|
}
|
|
|
|
|
|
- $order->status =1 ;
|
|
|
- $order->settle_status =1 ;
|
|
|
- $order->game_status = 0;
|
|
|
- $ret = $order->save();
|
|
|
-
|
|
|
- if ($ret){
|
|
|
- return ['status'=>1,'msg'=>'更新成功'];
|
|
|
- }else{
|
|
|
- return ['status'=>-4,'msg'=>'更新失败'];
|
|
|
- }
|
|
|
+ $order_id = $order->order_id;
|
|
|
+ $data = [
|
|
|
+ 'token' => session('adminInfo.token'), //外网
|
|
|
+ 'order_id' => $order_id,
|
|
|
+ 'game_code' => $game_code,
|
|
|
+ 'match_id' => $match_id,
|
|
|
+ ];
|
|
|
+ $ret = request_post(config('sconstant.url') . '/ResStringOneOrder', $data);
|
|
|
+ return json_decode($ret, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -357,6 +360,17 @@ class SoccerStringNoteListController extends Controller
|
|
|
//单订单手动提交结算
|
|
|
private function do_settelement($order_id, $game_code, $match_id)
|
|
|
{
|
|
|
+ $data = [
|
|
|
+ 'token' => session('adminInfo.token'), //外网
|
|
|
+ 'order_id' => $order_id,
|
|
|
+ 'bet_type' => 2,
|
|
|
+ ];
|
|
|
+ $ret = request_post(config('sconstant.url') . '/WinfailoneNomal', $data);
|
|
|
+ $retarr = json_decode($ret, true);
|
|
|
+ if (empty($ret) || empty($retarr) || !isset($retarr['status']) || $retarr['status'] != 1) {
|
|
|
+ return ['status' => 0, 'msg' => '计算输赢失败', 'data' => ''];
|
|
|
+ }
|
|
|
+
|
|
|
$data = [
|
|
|
'token' => session('adminInfo.token'), //外网
|
|
|
'order_ids' => $order_id,
|
|
|
@@ -400,13 +414,23 @@ class SoccerStringNoteListController extends Controller
|
|
|
public function RevokeStrOrder(Req $req)
|
|
|
{
|
|
|
$order_id = $req->input('order_id');
|
|
|
- if (empty($order_id)) {
|
|
|
+ $model = (new MoneyBuyStrModel())->with('matchdatas')->where('order_id', $order_id)->first();
|
|
|
+ $match_first = $model->matchdatas['0'];
|
|
|
+
|
|
|
+ if (empty($order_id) || empty($model) || empty($match_first)) {
|
|
|
return responseToJson(-2001);
|
|
|
}
|
|
|
+
|
|
|
+ $game_code = $match_first->game_code;
|
|
|
+ $match_id = $match_first->match_id;
|
|
|
+
|
|
|
$data = [
|
|
|
'token' => session('adminInfo.token'),
|
|
|
'order_id' => $order_id,
|
|
|
+ 'game_code' => $game_code,
|
|
|
+ 'match_id' => $match_id,
|
|
|
];
|
|
|
+
|
|
|
$ret = request_post(config('sconstant.url') . '/UnsetOneStringOrder', $data);
|
|
|
return json_decode($ret, true);
|
|
|
|