SettlementController.php 7.4 KB

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