You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
ymww_backend/application/api/controller/Index.php

47 lines
1005 B

<?php
namespace app\api\controller;
use app\common\controller\Api;
use think\Db;
/**
* 首页接口
*/
class Index extends Api
{
protected $noNeedLogin = ['*'];
protected $noNeedRight = ['*'];
/**
* 首页
*
*/
public function index()
{
$this->test1();
echo "7766677767";
exit();
$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('请求成功!');
}
public function test1(){
$x=5; // 全局变量
$y=10; // 局部变量
echo "<p>测试函数内变量:<p>";
echo "变量 x 为: $x";
echo "<br>";
echo "变量 y 为: $y";
}
}