程旭源 hai 8 meses
pai
achega
fdd49c653e
Modificáronse 1 ficheiros con 7 adicións e 8 borrados
  1. 7 8
      application/api/controller/Index.php

+ 7 - 8
application/api/controller/Index.php

@@ -55,22 +55,21 @@ class Index extends Api
             }
             $admindata = db('admin')->where(['id' => ['in', $userids]])->select();
 
-            var_dump($admindata);
-            Db::rollback();
-            die;
             $upincome =$moenylog= [];
             foreach ($admindata as $k => $vl) {
                 if (isset($temp[$vl['id']])) {
+                    $upincome = true;
                     db("admin")->where('id', $vl['id'])->setInc("money",$temp[$vl['id']]);
                     $moenylog[]=['user_id'=>$vl['id'],'money' =>$temp[$vl['id']],'before' => $vl['money'], 'after' => $vl['money'] + $temp[$vl['id']], 'memo' => 'upincome'];
                 }
             }
-            if ($upincome) {
-                $returndata = '123';
+            // 逻辑在这块出错了
+//            if ($upincome) {
+//                $returndata = '123';
 //                $this->adminModel->saveAll($upincome);
-                $this->moneyLogModel->saveAll($moenylog);
-                $this->recordModel->where("id", "<=", $maxId)->where(['status' => 0])->update(['status' => 1]);
-            }
+            $this->moneyLogModel->saveAll($moenylog);
+            $this->recordModel->where("id", "<=", $maxId)->where(['status' => 0])->update(['status' => 1]);
+//            }
         }
         Db::commit();
         return $returndata;