diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php index 24c615e..deeded8 100755 --- a/application/api/controller/Index.php +++ b/application/api/controller/Index.php @@ -3,7 +3,7 @@ namespace app\api\controller; use app\common\controller\Api; - +use think\Db; /** * 首页接口 */ @@ -18,6 +18,12 @@ class Index extends Api */ 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('请求成功'); } }