lqmac 1 year ago
parent a7db2d00ed
commit 7e3949936f
  1. 8
      application/api/controller/Index.php

@ -3,7 +3,7 @@
namespace app\api\controller; namespace app\api\controller;
use app\common\controller\Api; use app\common\controller\Api;
use think\Db;
/** /**
* 首页接口 * 首页接口
*/ */
@ -18,6 +18,12 @@ class Index extends Api
*/ */
public function index() public function index()
{ {
$list = Db::name('user')->where('status','normal')->select();
foreach ($list as $key => $value) {
$amount = Db::name('transaction_record')->where('type',2)->where('user_id', $value['id'])->sum('amount');
$ret = Db::name('user')->where('id', $value['id'])->update(['profit_amount' => $amount]);
var_dump($ret);
}
$this->success('请求成功'); $this->success('请求成功');
} }
} }

Loading…
Cancel
Save