国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

[已解決]模型里發(fā)送curl請(qǐng)求,就會(huì)導(dǎo)致多次重復(fù)執(zhí)行

帝國(guó)大將

問(wèn)題描述

問(wèn)題已自行解決,原因是回調(diào)里有代碼一直調(diào)用模型導(dǎo)致的

只要進(jìn)行了curl請(qǐng)求,就會(huì)導(dǎo)致多次重復(fù)執(zhí)行

程序代碼或配置

//開(kāi)始執(zhí)行
  $ids = (new PingtaiModel())->chadianbiaoxinxi;
            $res = (new PingtaiUseModel())->whereIn('config_id',$ids)->where(['status'=>2,'id'=>11])->select()->each(function ($v){
                (new DianbiaoModel())->tongbu($v['code']);
            });

//這是模型內(nèi)的邏輯
$dianchong = (new DianbiaoChongModel())->where(['code' => $code,'status'=>1])->find();
                if(!$dianchong)break;
                if($dianchong['status'] == 2)break;
                if($dianchong['money'] <= 0)break;

                $dianbiao = (new DianbiaoModel())->where(['id' => $dianchong['dianbiao_id']])->find();
                if(!$dianbiao)break;
                $dianbiao = (new DianbiaoModel())->simple($dianbiao);
                $use = (new PingtaiUseModel())
                    ->where([
                        ['admin_id','=',$dianbiao['admin_id']],
                        ['status','=',2],
                        ['dianbiao_ids','like',"%.{$dianbiao['id']}.%"],
                    ])
                    ->find();
                if(!$use)break;

                $bill = (new UserBillModel())->where(['code'=>$code,'status'=>1])->find();
                if($bill){
                    if($bill['status'] == 2)break;
                    if($bill['money'] <= 0)break;
                }

                $json = json_decode($use['json'],true);
                $auth = '';
                $nonce = '';

                foreach ($json as $v){
                    foreach ($v as $key => $val){
                        if($key == 'auth'){
                            $auth = $val;
                        }
                        if($key == 'nonce'){
                            $nonce = $val;
                        }
                    }
                }
                if($auth == '' || $nonce == ''){
                    (new Base())->yichang('口令或混淆字符串缺失');
                }
                $url = $use['url'];
                $time = time();

                (new BiaoNotifyModel())->save([
                    'code' => $code,
                    'name' => '電表充值',
                    'admin_id' => $dianbiao['admin_id'],
                    'cate' => (new BiaoNotifyModel())->dianbiao,
                ]);

                $request_content = [
                    [
                        "opr_id" => "$code",
                        "time_out" => 0,
                        "must_online" => false,
                        "retry_times" => 1,
                        "cid" => "{$dianbiao['base']['collectorid']}",
                        "address" => "{$dianbiao['base']['address']}",
                        "params" => [
                            "money" => $dianchong['money']
                        ]
                    ]
                ];

                $request_content = json_encode($request_content);
                $arr = [
                    'auth_code' => "{$auth}",
                    'timestamp' => $time,
                    'request_content' => $request_content,
                    'notify_url' => (new Base())->https."/api/notifyBiao/dianbiaoCharge?sn={$dianbiao['sn']}"
                ];
                $sign = $this->getSign($arr,$nonce);
                $arr['sign'] = $sign;
                $postdata = http_build_query($arr);
                $options = array(
                    'http' => array(
                        'method' => 'POST',
                        'header' => 'Content-type:application/x-www-form-urlencoded',
                        'content' => $postdata,
                        'timeout' => 15 * 60 // 超時(shí)時(shí)間(單位:s)
                    )
                );

                $context = stream_context_create($options);

                //這里就是問(wèn)題的來(lái)源
                $res = file_get_contents($url, false, $context);

                $status = 1;

                (new BiaoNotifyModel())->where(['code' => $code])->save([
                    'param' => json_encode($arr, JSON_UNESCAPED_UNICODE),
                    'json' => $res,
                    'status' => $status
                ]);

重現(xiàn)問(wèn)題的步驟

操作系統(tǒng)環(huán)境及workerman/webman等具體版本

"workerman/webman-framework": "^1.5.0",
centos7.8

1519 1 0
1個(gè)回答

帝國(guó)大將

break是因?yàn)橥饷嫖疫€進(jìn)行了switch,那部分就不粘貼了

年代過(guò)于久遠(yuǎn),無(wú)法發(fā)表回答
??