|
|
@@ -50,6 +50,7 @@ use App\OrderPackageCountingRecord;
|
|
|
use App\OrderTracking;
|
|
|
use App\Owner;
|
|
|
use App\OwnerFeeDetail;
|
|
|
+use App\OwnerFeeDetailLogistic;
|
|
|
use App\OwnerPriceOperation;
|
|
|
use App\OwnerPriceOperationItem;
|
|
|
use App\Package;
|
|
|
@@ -200,6 +201,35 @@ class TestController extends Controller
|
|
|
dd("OK");
|
|
|
}
|
|
|
|
|
|
+ public function zzd2(){
|
|
|
+ ini_set('max_execution_time',2500);
|
|
|
+ ini_set('memory_limit','1526M');
|
|
|
+ $models = DB::select(DB::raw("SELECT * FROM owner_fee_details where logistic_fee is not null and(weight is null or weight <= 0) and type = '发货'"));
|
|
|
+ foreach ($models as $model){
|
|
|
+ $packages = OrderPackage::query()->with("order")->where("order_id",$model->outer_id)->get();
|
|
|
+ $weight = 0;
|
|
|
+ $volume = 0;
|
|
|
+ foreach ($packages as $package){
|
|
|
+ $provinceName = mb_substr($package->order->province,0,2);
|
|
|
+ $province = app(CacheService::class)->getOrExecute("province_".$provinceName,function ()use($provinceName){
|
|
|
+ return Province::query()->where("name","like",$provinceName."%")->first();
|
|
|
+ },86400);
|
|
|
+ OwnerFeeDetailLogistic::query()->where("owner_fee_detail_id",$model->id)
|
|
|
+ ->where("logistic_bill",$package->logistic_number)->update([
|
|
|
+ "volume" => $package->bulk,
|
|
|
+ "weight" => $package->weight,
|
|
|
+ "logistic_fee" => app("OwnerPriceExpressService")->matching($package->weight, $model->owner_id, $model->logistic_id, $province->id),
|
|
|
+ ]);
|
|
|
+ $weight += $package->weight;
|
|
|
+ $volume += $package->bulk;
|
|
|
+ }
|
|
|
+ OwnerFeeDetail::query()->where("id",$model->id)->update([
|
|
|
+ "volume" => $volume,
|
|
|
+ "weight" => $weight,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function test1(){
|
|
|
$cityIds = [2];
|
|
|
$parovince = "北京";
|