程旭源 8 月之前
父節點
當前提交
fdd49c653e
共有 1 個文件被更改,包括 7 次插入8 次删除
  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;