|
@@ -57,15 +57,13 @@ class Index extends Api
|
|
$upincome =$moenylog= [];
|
|
$upincome =$moenylog= [];
|
|
foreach ($admindata as $k => $vl) {
|
|
foreach ($admindata as $k => $vl) {
|
|
if (isset($temp[$vl['id']])) {
|
|
if (isset($temp[$vl['id']])) {
|
|
- $upincome[] = ['id' => $vl['id'], 'money' => $vl['money'] + $temp[$vl['id']]];
|
|
|
|
|
|
+ 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'];
|
|
$moenylog[]=['user_id'=>$vl['id'],'money' =>$temp[$vl['id']],'before' => $vl['money'], 'after' => $vl['money'] + $temp[$vl['id']], 'memo' => 'upincome'];
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if ($upincome) {
|
|
if ($upincome) {
|
|
$returndata = '123';
|
|
$returndata = '123';
|
|
- $this->adminModel->saveAll($upincome);
|
|
|
|
|
|
+// $this->adminModel->saveAll($upincome);
|
|
$this->moneyLogModel->saveAll($moenylog);
|
|
$this->moneyLogModel->saveAll($moenylog);
|
|
$this->recordModel->where("id", "<=", $maxId)->where(['status' => 0])->update(['status' => 1]);
|
|
$this->recordModel->where("id", "<=", $maxId)->where(['status' => 0])->update(['status' => 1]);
|
|
}
|
|
}
|
|
@@ -109,21 +107,7 @@ class Index extends Api
|
|
$savedata = $userlinkdata = [];
|
|
$savedata = $userlinkdata = [];
|
|
foreach ($userlink as $key => $val) {
|
|
foreach ($userlink as $key => $val) {
|
|
|
|
|
|
- $unit = 1;
|
|
|
|
- for($i=1;; $i++) {
|
|
|
|
- $unit = bcpow(10, $i, 10);
|
|
|
|
- $tmp = bcmul($val['minincome'], $unit, 10);
|
|
|
|
- if (floor($tmp) < $tmp ) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
-// if (bccomp("1", bcmul($val['minincome'].'', $unit, 10), 10) !== 1) {
|
|
|
|
-// break;
|
|
|
|
-// }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ $unit = bcpow(10, 10);
|
|
// $income = mt_rand( * $unit, $val['maxincome'] * $unit) / $unit;
|
|
// $income = mt_rand( * $unit, $val['maxincome'] * $unit) / $unit;
|
|
$income = bcdiv(mt_rand(bcmul($val['minincome'], $unit, 10), bcmul($val['maxincome'], $unit, 10)), $unit, 10);
|
|
$income = bcdiv(mt_rand(bcmul($val['minincome'], $unit, 10), bcmul($val['maxincome'], $unit, 10)), $unit, 10);
|
|
$savedata[] = ['income' => $income,
|
|
$savedata[] = ['income' => $income,
|
|
@@ -135,7 +119,6 @@ class Index extends Api
|
|
$userlinkdata[] = ['id' => $val['userlinkid'], 'income' => $val['income'] + $income];
|
|
$userlinkdata[] = ['id' => $val['userlinkid'], 'income' => $val['income'] + $income];
|
|
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
$this->userlinkModel->saveAll($userlinkdata);
|
|
$this->userlinkModel->saveAll($userlinkdata);
|
|
$this->recordModel->saveAll($savedata);
|
|
$this->recordModel->saveAll($savedata);
|
|
$returndata = 'insert ' . count($savedata) . ' record';
|
|
$returndata = 'insert ' . count($savedata) . ' record';
|