public function actionGet() { set_time_limit(0); $id = 10000; $end = 12000; for ($id; $id < $end; $id++) { $imgUrl = 'http://www.qccr.com/store/getStoreList.jhtml?psize=10000&areaId=' . $id; $arr = Tool::get_contents($imgUrl); $json = json_decode($arr); if ($json->msg == '成功') { $list = $json->info->list; foreach ($list as $k => $v) { $imgUrl = $id; $address = $v->store->sa; $name = $v->store->sn; $phone = $v->store->st; $contract = $v->store->so; $province = $v->store->opb; if (!(new Stroe())->addCustomer($imgUrl, $address, $name, $phone, $contract)) { continue; } } } } }
static function getExpressInfoByOrder($expressCode, $expressNo) { if (!($expressCode && $expressNo)) { return false; } // $kuaidi100Api='http://m.kuaidi100.com/query?type='.$expressCode.'&postid='.$expressNo; $aikuaidi = 'http://www.aikuaidi.cn/rest/?key=699133d413ee49c9a58a915494614446&order=' . $expressNo . '&id=' . $expressCode . '&ord=desc&show=json'; $res = Tool::get_contents($aikuaidi); $json = json_decode($res); if (!$res) { return false; } //status 订单跟踪状态: //0:查询出错(即errCode!=0), //1:暂无记录, //2:在途中, //3:派送中, //4:已签收, //5:拒收, //6:疑难件 //7:退回 if ($json->errCode == '3') { Yii::getLogger()->log('快递接口访问次数达到最大额度', Logger::LEVEL_INFO); return false; } if ($json->errCode != '0') { return false; } // $list=[]; // foreach($json->data as $k=>$v){ // array_push($list,[ // 'time'=>$v->time, // 'context'=>$v->context // ]); // } return $json; }