| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2019/5/23
- * Time: 17:42
- */
- define('START_TIME', microtime(true));
- require __DIR__ . '/../vendor/autoload.php';
- \datainf\lib\boot::init();
- use App\Lib\ModelBase;
- use Illuminate\Database\Capsule\Manager as DB;
- ModelBase::init();
- //var_dump($obj);
- //var_dump(DB::table('datainf_log')->where('id',766)->first());
- //ModelBase::init()->getConnection()->disconnect();
- echo "---------------------\n\n";
- //$obj->getConnection()->disconnect();
- //var_dump(DB::table('datainf_log')->where('id',766)->first());
- /*
- $sql = "select * from datainf_log where id in (766,767) ";
- $pdo = ModelBase::init()->getConnection()->getPdo();
- foreach ($pdo->query($sql ) as $row) {
- print_r($row); //你可以用 echo($GLOBAL); 来看到这些值
- }
- */
- /*
- try{
- ModelBase::beginTransaction();
- $model = new \App\Http\Model\StZqResult();
- $ret = $model->where(['id'=>4314])->first();
- print_r($ret);
- ModelBase::commit();
- }catch (\Exception $e){
- echo $e->getMessage();
- ModelBase::rollBack();
- }
- $model = new App\Lib\TestModel();
- $model->name = 'name_'.mt_rand(1000,99999) ;
- $model->sex = '男';
- $model->age = mt_rand(10,50);
- $ret = $model->save();
- print_r([$ret,$model->toArray()]);
- */
- function getIds($type, $match_id, $game_code = '')
- {
- $return = [];
- if ($type == 1) {
- $ret = DB::table('money_buy_simplex')->where(['match_id' => $match_id])->get();
- if ($ret) {
- foreach ($ret as $val) {
- $return[] = $val->order_id;
- }
- }
- return $return;
- } else {
- $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();
- if ($ret) {
- foreach ($ret as $val) {
- $return[] = $val->order_id;
- }
- }
- return $return;
- }
- }
- $ids = getIds(1, 830, 'zg');
- echo "ids_len:" . count($ids) . "\n";
- 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);
- $data = curl_exec($ch);//运行curl
- curl_close($ch);
- return $data;
- }
- $data = [
- 'token' => 'DmYo5x15595307615cf48d09ad67b',
- //'order_ids' => implode(",", $ids),
- 'order_ids' => '',
- 'bettype' => 1,
- 'settype' => 2,
- 'game_code' => 'zq',
- 'match_id' => 483,
- 'change_status' => 1
- ];
- //$ret = request_post('http://stadmin.bocai108.com:9094/Settelement', $data);
- $ret = request_post('http://192.168.2.220:9094/Settelement', $data);
- echo "返回:" . print_r($ret, true) . "\n\n";
- /*
- $rconf = \datainf\lib\GlobConfigs::getKey('redis');
- $redis = new \Redis();
- $r = $redis->connect($rconf['host'], $rconf['port']);
- if (!$r) {
- echo "连接redis失败\n";
- return;
- }
- $r = $redis->auth($rconf['passwd']);
- if (!$r) {
- echo "auth false;";
- return;
- }
- $redis->select($rconf['db']);
- for ($i = 1; $i <= 10; $i++) {
- //$redis->del("test_" . $i);
- $redis->hset('test', "test_" . $i, date("Y-m-d H:i:s"));
- }
- echo "值:" . $r . "\n";
- */
- /*
- $str = '';
- $arr = json_decode($str,true);
- $arr2 = json_decode( $arr['0']['data'] ,true);
- foreach ($arr2 as $val){
- print_r($val);
- echo "\n\n";
- }
- */
|