data["active_test"] = "active"; } public function method(Request $request, $method) { return call_user_func([$this, $method], $request); } function packageFromLog(Request $request) { //x $packagesBatch=Package::where('batch_number',$batch_number)->first(); ini_set('max_execution_time', 2500); ini_set('memory_limit', '1526M'); $uploaded = 0; $count = DB::table('logs')->where('operation', 'like', "%PackageController::new_%") ->where('created_at', '>', "2020-06-08 15:46:00") ->where('created_at', '<', "2020-06-08 15:47:00") ->where('type', "request_new_") ->count(); $requests = DB::table('logs')->where('operation', 'like', "%PackageController::new_%") ->where('created_at', '>', "2020-06-08 15:46:00") ->where('created_at', '<', "2020-06-08 15:47:00") ->where('type', "request_new_") ->get(); $requests->each(function ($request) use (&$uploaded) { $requestJson = json_decode($request->description, true); $response = Zttp::withHeaders(['content-type' => 'application/json', ])->post('https://was.baoshi56.com/api/thirdPart/flux/package/new', $requestJson ); if ($response->json() && $response->json()['response'] && $response->json()['response']['flag'] == 'Y') $uploaded += 1; }); dd($uploaded . '/' . $count); } function t2(Request $request) { //x $packagesBatch=Package::where('batch_number',$batch_number)->first(); $uploaded = 0; $count = DB::table('logs')->where('operation', 'like', "%PackageController::new_%") ->where('created_at', '>', "2020-06-03 14:02:00") ->where('created_at', '<', "2020-06-03 15:05:00") ->where('type', "request_new_") ->where('description', 'like', "%W200603000117%") ->count(); $requests = DB::table('logs')->where('operation', 'like', "%PackageController::new_%") ->where('created_at', '>', "2020-06-03 14:02:00") ->where('created_at', '<', "2020-06-03 15:05:00") ->where('description', 'like', "%W200603000117%") ->where('type', "request_new_") ->get(); $requests->each(function ($request) use (&$uploaded) { $requestJson = json_decode($request->description, true); $response = Zttp::withHeaders(['content-type' => 'application/json', ])->post('https://was.baoshi56.com/api/thirdPart/flux/package/new', $requestJson ); if ($response->json() && $response->json()['response'] && $response->json()['response']['flag'] == 'Y') $uploaded += 1; }); dd($uploaded . '/' . $count); } function t1(Request $request) { } function tj(Request $request) { $waybills = Waybill::where('created_at', 'like', '%2020-05-25%')->orWhere('created_at', 'like', '%2020-05-30%')->get(); $controller = (new WaybillController()); $waybills->each(function ($waybill) use ($controller) { $controller->accomplishToWMS($waybill); }); dd($waybills->count()); } function injectJS(Request $request) { $items = RejectedBillItem::whereHas('rejectedBill', function ($query) { return $query->where('id_owner', 2); })->where('created_at', '>', '2019-12-23 18:11:00')->where('created_at', '<', '2019-12-24 11:25:00')->get(); (new RejectedBillItemController())->collectionsToPackConfirm($items); } public function tj2(Request $request) { $rejected = Rejected::find(10); $rejectedJianshang = new \App\Http\Controllers\api\jianshang\RejectedController(); dd($rejectedJianshang->sendRejected($rejected)); } public function excelIt() { $excel = new ExcelController(); return $excel->makeExcel(); } public function featureIt() { LogisticNumberFeatureController::loadRecentRejectedsToFeatures(5, 2500); } public function newSku() { $url = 'http://bswcs/api/sorting/flux/newSku'; $response = Zttp::post($url, [ 'request' => [ [ "SKU" => "1234567890", "NAME" => "瑞士莲**巧克力", "Alternate_SKU1" => "1122334455", "GrossWeight" => "1.2", "Cube" => "0.75", "SKULength" => "0.25", "SKUWidth" => "0.15", "SKUHigh" => "0.05" ], [ "SKU" => "1234567892", "NAME" => "跳跳饼", "Alternate_SKU1" => "", "GrossWeight" => "1.3", "Cube" => "0.75", "SKULength" => "0.25", "SKUWidth" => "0.15", "SKUHigh" => "0.25" ], ] ]); return $response->json(); } public function changePackage() { $packages = Package::where('delivery_number', '<>', null)->where('logistic_id', null)->get(); dd($packages); $packages = Package::whereRaw('delivery_number IS NOT NULL AND logistic_id IS NULL')->get(); $logistics = Logistic::get(); $packages->each(function ($package) use ($logistics) { $logistics->each(function ($logistic) use ($package) { if ($package->WMSReflectPackage->CarrierID == $logistic->code) { $package->logistic_id = $logistic->id; return; } }); }); return "OK"; } public function tNull() { } public function deletePackageAuthority() { $authorities = Authority::where('name', 'like', '%包裹信息%')->get(); $authorities->each(function ($authority) { $authority->delete(); }); } /*1*/ function test() {/**/ $data=[]; $data['destination_city_id']=1; $data['destination']="陕西省零鲁区鲱鱼大街404号260"; $waybill=Waybill::find(1); if ($data['destination_city_id'] && $waybill->destination_city_id != $data['destination_city_id']){ $city=City::find($data['destination_city_id']); if ($city && (mb_strpos($data['destination'],$city->name)===false || mb_strpos($data['destination'],$city->province_name)===false)){ if (mb_strpos($data['destination'],$city->name)===false && mb_strpos($data['destination'],$city->province_name)===false){ $data['destination']=$city->province_name.$city->name.$data['destination']; goto sign; } if (mb_strpos($data['destination'],$city->province_name)===false){ $data['destination']=$city->province_name.$data['destination']; } if (mb_strpos($data['destination'],$city->name)===false){var_dump(3); $province_name=$city->province_name; $start_index=mb_strpos($data['destination'],$city->province_name.'省'); if ($start_index===false)$start_index=mb_strpos($data['destination'],$city->province_name); else $province_name=$province_name.'省'; $strBefore=mb_substr($data['destination'],$start_index,mb_strlen($province_name)); $strAfter=mb_substr($data['destination'],$start_index+mb_strlen($province_name)); $data['destination']=$strBefore.$city->name.$strAfter; } } } sign: } }