zengjun пре 3 година
родитељ
комит
2c571edebb

+ 28 - 28
app/Services/LogService.php

@@ -18,34 +18,34 @@ class LogService
 
     static public function log($class, $method, $description, $id_user = null, $type = 'log')
     {
-        $passingMethods = config('logging.passing_methods');
-        foreach ($passingMethods as $passingMethod) {
-            if ($passingMethod == $method) return;
-        }
-        if (!$id_user) {
-            $id_user = '';
-            $user = auth()->user();
-            if ($user) $id_user = $user['id'];
-        }
-        $log = new Log([
-            'class' => $class,
-            'method' => $method,
-            'description' => $description,
-            'id_user' => $id_user,
-            'ip' => request()->ip(),
-            'type' => $type,
-        ]);
-        try {
-            Redis::LLEN('LOGS');
-        } catch (Exception $e) {
-            //redis出现异常直接保存到数据库中
-            $log->save();
-            return;
-        }
-        $date = date('Y-m-d H:i:s');
-        $log['created_at'] = $date;
-        $log['updated_at'] = $date;
-        Redis::LPUSH('LOGS', $log);
+//        $passingMethods = config('logging.passing_methods');
+//        foreach ($passingMethods as $passingMethod) {
+//            if ($passingMethod == $method) return;
+//        }
+//        if (!$id_user) {
+//            $id_user = '';
+//            $user = auth()->user();
+//            if ($user) $id_user = $user['id'];
+//        }
+//        $log = new Log([
+//            'class' => $class,
+//            'method' => $method,
+//            'description' => $description,
+//            'id_user' => $id_user,
+//            'ip' => request()->ip(),
+//            'type' => $type,
+//        ]);
+//        try {
+//            Redis::LLEN('LOGS');
+//        } catch (Exception $e) {
+//            //redis出现异常直接保存到数据库中
+//            $log->save();
+//            return;
+//        }
+//        $date = date('Y-m-d H:i:s');
+//        $log['created_at'] = $date;
+//        $log['updated_at'] = $date;
+//        Redis::LPUSH('LOGS', $log);
     }
 
     public static function syncRedisLogs()

+ 2 - 6
app/Services/OrderCommodityService.php

@@ -23,12 +23,8 @@ class OrderCommodityService
         if(!$innerParams)return false;
         if(count($innerParams)==0)return false;
         try {
-            $bool = OrderCommodity::query()->insert($innerParams);
-            if ($bool) app('LogService')->log(__METHOD__, __FUNCTION__, '批量添加 OrderCommodities SUCCESS' . ' || ' . count($innerParams) . ' || ' . json_encode($innerParams));
-            else app('LogService')->log(__METHOD__, __FUNCTION__, '批量添加 OrderCommodities FAULT' . ' || ' . count($innerParams) . ' || ' . json_encode($innerParams));
-            return $bool;
+            return OrderCommodity::query()->insert($innerParams);
         } catch (\Exception $e) {
-            app('LogService')->log(__METHOD__, __FUNCTION__, '批量添加 OrderCommodities ERROR'. ' || ' . count($innerParams) . ' || ' . json_encode($innerParams).' || '.json_encode($e->getMessage()).' || '.json_encode($e->getTraceAsString()));
             return false;
         }
     }
@@ -114,7 +110,7 @@ class OrderCommodityService
         if(count($delete_ids)==0)return;
         $this->deleteByIds($delete_ids);
 //        OrderCommodity::query()->whereIn('id',$delete_ids)->delete();
-        app('LogService')->log(__METHOD__,__FUNCTION__,"delete OrderCommodity ".json_encode($delete_ids));
+//        app('LogService')->log(__METHOD__,__FUNCTION__,"delete OrderCommodity ".json_encode($delete_ids));
         unset($delete_ids);
     }
 

+ 2 - 1
app/Services/OrderPackageService.php

@@ -199,7 +199,8 @@ class OrderPackageService
             try {
                 $inner_array = array_chunk($inner_params, 200);
                 foreach ($inner_array as $params) {
-                    $bool = $this->insert($params);
+                    OrderPackage::query()->insert($params);
+//                    $this->insert($params);
                 }
             } catch (\Exception $e) {
             }