柳建 9 hónapja
szülő
commit
bf3ecc6865
1 módosított fájl, 6 hozzáadás és 1 törlés
  1. 6 1
      application/api/controller/Index.php

+ 6 - 1
application/api/controller/Index.php

@@ -20,6 +20,7 @@ class Index extends Api
         $this->recordModel = new \app\admin\model\greenroom\Record;
         $this->adminModel = new \app\admin\model\Admin;
         $this->userlinkModel = new \app\admin\model\greenroom\Userlink;
+        $this->moneyLogModel = new \app\common\model\MoneyLog;
     }
 
     /**
@@ -53,15 +54,19 @@ class Index extends Api
                 $userids[] = $val['id'];
             }
             $admindata = db('admin')->where(['id' => ['in', $userids]])->select();
-            $upincome = [];
+            $upincome =$moenylog= [];
             foreach ($admindata as $k => $vl) {
                 if (isset($temp[$vl['id']])) {
                     $upincome[] = ['id' => $vl['id'], 'money' => $vl['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';
                 $this->adminModel->saveAll($upincome);
+                $this->moneyLogModel->saveAll($moenylog);
                 $this->recordModel->where("id", "<=", $maxId)->where(['status' => 0])->update(['status' => 1]);
             }
         }