SettlementController.php 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <?php
  2. namespace App\Http\Controllers\Api;
  3. use App\Http\Model\StSettlementMiddleDetail;
  4. use App\Lib\Settlement\Adapter\RulePlus;
  5. use App\Lib\Settlement\Adapter\LqRule;
  6. use App\Lib\Settlement\SettlementAuto;
  7. use App\Lib\Settlement\SettlementOrder;
  8. use App\Lib\Settlement\Adapter\WqRule;
  9. use Illuminate\Http\Request as Req;
  10. use App\Lib\Settlement\SettlementWinFail;
  11. use Illuminate\Routing\Controller as Controller;
  12. use Illuminate\Support\Facades\DB;
  13. use App\Lib\Biz\Sport\WagentProxy;
  14. use App\Models\Comendnotice as ComendnoticeModel;
  15. use App\Models\MoneyBuyMatch as MoneyBuyMatchModel;
  16. use App\Lib\Biz\Sport\Common;
  17. use App\Lib\Settlement\SwInterface;
  18. class SettlementController extends Controller
  19. {
  20. use RulePlus;
  21. public function AutoSett()
  22. {
  23. }
  24. public function index()
  25. {
  26. $dd = new ZqRule();
  27. dd($dd->bodan(1, 2, 1));
  28. }
  29. public function dd()
  30. {
  31. $obj = new SettlementOrder();
  32. $ret = $obj->stringComputing(1);
  33. var_dump($ret);
  34. }
  35. public function debug(Req $req)
  36. {
  37. $ret = SwInterface::getInstance()->WinfailMulNomal('S20191115134824896580423,S2019111513484154555218',1);
  38. var_dump($ret);
  39. exit ;
  40. $ret = SwInterface::getInstance()->WinFailNomalOrder('S20191106102310815438283',1);
  41. print_r($ret);
  42. exit ;
  43. $match = DB::table('money_buy_match')->where(['order_id' => 'S20191102170628894846203'])->first();
  44. $result = DB::table('st_lq_result')->where(['match_id' => '161'])->get();
  45. //$result = DB::table('st_wq_result')->where(['id' => '20'])->get();
  46. $rule = new LqRule();
  47. $resultb = $rule->tnb($match, $result, []);
  48. print_r($resultb);
  49. exit ;
  50. $model = new ComendnoticeModel();
  51. $need = $model->getNeedSettelent() ;
  52. var_dump($need);
  53. exit ;
  54. $auto = new SettlementAuto();
  55. $ret =$auto->doAutoSett('oclatv15689731035d84a12f550df');
  56. var_dump($ret);
  57. //return;
  58. //print_r($_SERVER);
  59. exit;
  60. $model = new MoneyBuyMatchModel();
  61. $ret = $model->countByMatch(758);
  62. print_r($ret);
  63. exit;
  64. /*
  65. $model = new \App\Models\StoddsCode();
  66. $aa =$model->getTypeDatas('zq');
  67. print_r($aa);
  68. return ;
  69. */
  70. $order_id = isset($req->order_id) ? $req->order_id : 0;
  71. $model = new \App\Models\SportsNoteList();
  72. $ret = $model->getorder($order_id);
  73. if ($ret) {
  74. $ret = $ret->toArray();
  75. }
  76. print_r($ret);
  77. exit;
  78. return responseToJson(1, '成功', $ret);
  79. return;
  80. $match = DB::table('money_buy_match')->where(['batch_id' => '20190916094717519851520'])->first();
  81. $result = DB::table('st_zq_result')->where(['match_id' => '2115'])->get();
  82. //$result = DB::table('st_wq_result')->where(['id' => '20'])->get();
  83. $rule = new ZqRule();
  84. $resultb = $rule->GunqiuWeixian($match, $result, []);
  85. print_r($match);
  86. print_r($result);
  87. print_r($resultb);
  88. return;
  89. //print_r([$match, $result]);
  90. // return ;
  91. //$resultb = $rule->bq_getResultBySn($result, 1,1);
  92. //print_r($resultb);
  93. //return;
  94. $resultb = $rule->wq_scoreDatas($result);
  95. print_r($resultb);
  96. exit;
  97. return;
  98. $datas = DB::table("dc_navs")->select("id", "name", "href", "type")->get();
  99. $r = trans('menu');
  100. foreach ($datas as $val) {
  101. $tname = trim($val->name);
  102. if (isset($r[$tname])) {
  103. if ($tname != $r[$tname]) {
  104. DB::table("dc_navs")->where("id", $val->id)->update(["name" => $r[$tname]]);
  105. }
  106. }
  107. }
  108. echo "ok";
  109. return;
  110. $match = DB::table('money_buy_match')->where(['batch_id' => '15671599105'])->first();
  111. $result = DB::table('st_zq_result')->where(['match_id' => '1'])->get();
  112. $rule = new ZqRule();
  113. //print_r([$match,$result]);exit ;
  114. $result = $rule->B($match, $result, []);
  115. print_r($result);
  116. exit;
  117. ///$config = ['name' => 'test1agent', 'key' => 'abcdefg', 'secret' => 'asdfasdfasd', 'domain' => 'http://sports.bocai108.com', 'cachefile' => ''];
  118. //$config = ['name' => 'test1agent', 'key' => 'abcdefg', 'secret' => 'asdfasdfasd', 'domain' => 'http://www.kaiyou-dev.com'];
  119. $config = ['name' => 'test1agent', 'key' => 'abcdefg', 'secret' => 'asdfasdfasd'];
  120. $proxy = new WagentProxy();
  121. $proxy->Init($config);
  122. $ret1 = $proxy->todaycr();
  123. print_r($ret1);
  124. //$ret2 = $proxy->caie('onmygod');
  125. //print_r($ret2);
  126. exit;
  127. $ret1 = DB::table('mtest')->get();
  128. print_r($ret1);
  129. $new = DB::table('mtest')->insert(['id' => rand(10000, 20000), 'cont' => json_encode(['name' => rand(100, 200), 'age' => rand(10, 30)])]);
  130. echo "asfa";
  131. exit;
  132. /*
  133. $pdo = DB::getPdo();
  134. $mict = microtime(true);
  135. $sql = [
  136. "update logfile set url='$mict', device_number='3610373' where id=3610373",
  137. "update logfile set url='$mict', device_number='3610374' where id=3610374",
  138. "update logfile set url='$mict', device_number='3610375' where id=3610375"
  139. ];
  140. $sqlStr = implode(";",$sql);
  141. $ret = $pdo->exec($sqlStr);
  142. var_dump($ret);
  143. exit ;
  144. */
  145. /*
  146. $id = 3 ;
  147. $obj = new SettlementWinFail();
  148. $ret = $obj->doRun($id);
  149. print_r($ret);
  150. echo "cost:" . (microtime(true) - floatval($_SERVER['REQUEST_TIME_FLOAT'])) .' 秒!';
  151. exit;
  152. */
  153. $oida = $this->getIds(1, 455, 'zq');
  154. $swf = new SettlementOrder();
  155. $ret = $swf->reSettlement($oida, 1, 2, 'zq', 455);
  156. var_dump($ret);
  157. echo "<hr/>";
  158. echo "cost:" . (microtime(true) - floatval($_SERVER['REQUEST_TIME_FLOAT'])) . ' 秒!';
  159. exit;
  160. /*
  161. $rule = new ZqRule();
  162. $model = DB::table('money_buy_match')->where(['id' => 320])->first();
  163. $reco = DB::table('st_zq_result')->where(['id' => 1317823])->get();
  164. print_r([$model,$reco]);
  165. $ret = $rule->first_ball_guest($model, $reco, []);
  166. print_r($ret);
  167. exit ;
  168. */
  169. $noticeid = 3592444;
  170. $matchid = 900;
  171. $order_ids = $this->getIds(1, $matchid, 'zq');
  172. $winorfalse = new SettlementWinFail();
  173. $ret1 = $winorfalse->doRun($noticeid);
  174. print_r(['ret1' => $ret1]);
  175. if ($ret1['status'] == 1) {
  176. $setOrder = new SettlementOrder();
  177. $ret2 = $setOrder->reSettlement($order_ids, 1, 2, 'zq', $matchid);
  178. print_r(['ret2' => $ret2]);
  179. }
  180. exit;
  181. $model = DB::table('st_zq_result')->where(['id' => 1317823])->first();
  182. echo json_decode($model->corner_ball);
  183. exit;
  184. }
  185. private function getIds($type, $match_id, $game_code = '')
  186. {
  187. $return = [];
  188. if ($type == 1) {
  189. $ret = DB::table('money_buy_simplex')->where(['match_id' => $match_id])->get();
  190. if ($ret) {
  191. foreach ($ret as $val) {
  192. $return[] = $val->order_id;
  193. }
  194. }
  195. return $return;
  196. } else {
  197. $ret = DB::table('money_buy_str')->leftJoin('money_buy_match', 'money_buy_match.batch_id', '=', 'money_buy_str.batch_id')->where(['money_buy_match.match_id' => $match_id, 'money_buy_match.game_code' => $game_code])->get();
  198. if ($ret) {
  199. foreach ($ret as $val) {
  200. $return[] = $val->order_id;
  201. }
  202. }
  203. return $return;
  204. }
  205. }
  206. }