| 
@@ -172,6 +172,24 @@ trait DbQuery { | 
 | 
@@ -172,6 +172,24 @@ trait DbQuery { | 
| 
172
 | 
      */
 | 
172
 | 
      */
 | 
| 
173
 | 
     public function insert(string $table, array $data, $timeauto = true):int {
 | 
173
 | 
     public function insert(string $table, array $data, $timeauto = true):int {
 | 
| 
174
 | 
 
 | 
174
 | 
 
 | 
| 
 | 
   | 
175
 | 
+        if($this->create($table,  $data, $timeauto)){
 | 
| 
 | 
   | 
176
 | 
+            return $this->getClient()->lastInsertId();
 | 
| 
 | 
   | 
177
 | 
+        }
 | 
| 
 | 
   | 
178
 | 
+
 | 
| 
 | 
   | 
179
 | 
+        return 0;
 | 
| 
 | 
   | 
180
 | 
+    }
 | 
| 
 | 
   | 
181
 | 
+
 | 
| 
 | 
   | 
182
 | 
+    /**
 | 
| 
 | 
   | 
183
 | 
+     * 插入数据
 | 
| 
 | 
   | 
184
 | 
+     * @param string $table
 | 
| 
 | 
   | 
185
 | 
+     * @param array $data
 | 
| 
 | 
   | 
186
 | 
+     * @param bool $timeauto
 | 
| 
 | 
   | 
187
 | 
+     * @return int
 | 
| 
 | 
   | 
188
 | 
+     * @author:dc
 | 
| 
 | 
   | 
189
 | 
+     * @time 2023/2/17 14:04
 | 
| 
 | 
   | 
190
 | 
+     */
 | 
| 
 | 
   | 
191
 | 
+    public function create(string $table, array $data, $timeauto = true):int {
 | 
| 
 | 
   | 
192
 | 
+
 | 
| 
175
 | 
         if($timeauto){
 | 
193
 | 
         if($timeauto){
 | 
| 
176
 | 
             $data['created_at'] = empty($data['created_at']) ? date('Y-m-d H:i:s') : $data['created_at'];
 | 
194
 | 
             $data['created_at'] = empty($data['created_at']) ? date('Y-m-d H:i:s') : $data['created_at'];
 | 
| 
177
 | 
         }
 | 
195
 | 
         }
 | 
 | 
@@ -183,10 +201,10 @@ trait DbQuery { | 
 | 
@@ -183,10 +201,10 @@ trait DbQuery { | 
| 
183
 | 
         $query = $this->query([$sql,$data]);
 | 
201
 | 
         $query = $this->query([$sql,$data]);
 | 
| 
184
 | 
 
 | 
202
 | 
 
 | 
| 
185
 | 
         if($query){
 | 
203
 | 
         if($query){
 | 
| 
186
 | 
-            return $this->getClient()->lastInsertId();
 | 
204
 | 
+            return true;
 | 
| 
187
 | 
         }
 | 
205
 | 
         }
 | 
| 
188
 | 
 
 | 
206
 | 
 
 | 
| 
189
 | 
-        return 0;
 | 
207
 | 
+        return false;
 | 
| 
190
 | 
     }
 | 
208
 | 
     }
 | 
| 
191
 | 
 
 | 
209
 | 
 
 | 
| 
192
 | 
     /**
 | 
210
 | 
     /**
 |