hrjy 2 years ago
parent
commit
a2018ea9d4
2 changed files with 9 additions and 7 deletions
  1. 7 5
      app/api/controller/water/WaterQueryController.php
  2. 2 2
      route/api/route.php

+ 7 - 5
app/api/controller/water/WaterQueryController.php

@@ -30,7 +30,9 @@ class WaterQueryController
             ['wide', ''],// 宽
             ['high', ''],// 高
             ['is_warm', ''], // 是否保温
+            ['warm', ''], // 是否保温
             ['is_channel', ''], // 是否需要槽钢
+            ['channel', ''], // 是否需要槽钢
             ['is_human_ladder', ''] ,// 是否需要人梯
             ['is_gc', ''] ,// 公差
             ['roof', ''], // 顶板厚度
@@ -117,7 +119,7 @@ class WaterQueryController
         $table = [];
         $zj = 0; //总价
         $zzl = 0; // 总重量
-        $where[] = [];
+        $where = [];
 //        if ($data['is_gc'] > 0){
 //            $where[] = ['is_gc', '=' ,1];
 //        }else{
@@ -225,17 +227,17 @@ class WaterQueryController
         //保温
         foreach ($calculation['warm'] as $k => $v){
             if ($k == 'warm1' and $v > 0){
-                $details = WaterMaterialScience::where('cate_id', $data['is_warm'])->where([['long', '=', 1], ['wide', '=', 1]])->where($where)->find();
+                $details = WaterMaterialScience::where('cate_id', $data['warm'])->where([['long', '=', 1], ['wide', '=', 1]])->where($where)->find();
                 $zj += $details['unit_price'] * $v;
                 $zzl += $details['weight'] * $v;
                 $table[] = ['title' => '保温板' , 'name' => $details['name'], 'specifications' => '1*1', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 7];
             }elseif ($k == 'warm2' and $v > 0){
-                $details = WaterMaterialScience::where('cate_id', $data['is_warm'])->where([['long', '=', 1], ['wide', '=', 0.5]])->where($where)->find();
+                $details = WaterMaterialScience::where('cate_id', $data['warm'])->where([['long', '=', 1], ['wide', '=', 0.5]])->where($where)->find();
                 $zj += $details['unit_price'] * $v;
                 $zzl += $details['weight'] * $v;
                 $table[] = ['title' => '保温板' , 'name' => $details['name'], 'specifications' => '1*0.5', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 7];
             }elseif ($k == 'warm3' and $v > 0){
-                $details = WaterMaterialScience::where('cate_id', $data['is_warm'])->where([['long', '=', 0.5], ['wide', '=', 0.5]])->where($where)->find();
+                $details = WaterMaterialScience::where('cate_id', $data['warm'])->where([['long', '=', 0.5], ['wide', '=', 0.5]])->where($where)->find();
                 $zj += $details['unit_price'] * $v;
                 $zzl += $details['weight'] * $v;
                 $table[] = ['title' => '保温板' , 'name' => $details['name'], 'specifications' => '0.5*0.5', 'number' => $v, 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $v, 'weight' => $details['weight'] * $v , 'type' => 7];
@@ -244,7 +246,7 @@ class WaterQueryController
         }
         //槽钢
         if ($data['is_channel'] > 0){
-            $details = WaterMaterialScience::where('cate_id', $data['is_channel'])->where($where)->find();
+            $details = WaterMaterialScience::where('cate_id', $data['channel'])->where($where)->find();
             $zj += $details['unit_price'] * $calculation['channel_number'];
             $zzl += $details['weight'] * $calculation['channel_number'];
             $table[] = ['title' => '槽钢' , 'name' => $details['name'], 'specifications' => '1', 'number' => $calculation['channel_number'], 'unit_price' => $details['unit_price'], 'company' => $details['company'], 'ot_price' => $details['unit_price'] * $calculation['channel_number'], 'weight' => $details['weight'] * $calculation['channel_number'] , 'type' => 8];

+ 2 - 2
route/api/route.php

@@ -169,6 +169,8 @@ Route::group(function () {
     //充值类
     Route::post('card/routine', 'user.UserCardController/routine')->name('CardRoutine');//小程序购买会员卡
     Route::post('card/wechat', 'user.UserCardController/wechat')->name('CardWechat');//公众号购买会员卡
+    // 获取材料
+    Route::get('water/list', 'water.WaterQueryController/list')->name('waterList');
 })->middleware(\app\http\middleware\AllowOriginMiddleware::class)->middleware(\app\http\middleware\AuthTokenMiddleware::class, true);
 //未授权接口
 Route::group(function () {
@@ -236,8 +238,6 @@ Route::group(function () {
     Route::get('store_list', 'PublicController/store_list')->name('storeList');
     //获取城市列表
     Route::get('city_list', 'PublicController/city_list')->name('cityList');
-    // 获取材料
-    Route::get('water/list', 'water.WaterQueryController/list')->name('waterList');
     //会员卡
     Route::get('card/list', 'user.UserCardController/list')->name('cardList');
     //每月发放次数