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

48 lines
1005 B

1 year ago
<?php
namespace app\api\controller;
use app\common\controller\Api;
11 months ago
use think\Db;
1 year ago
/**
* 首页接口
*/
11 months ago
1 year ago
class Index extends Api
{
protected $noNeedLogin = ['*'];
protected $noNeedRight = ['*'];
/**
* 首页
*
*/
11 months ago
1 year ago
public function index()
11 months ago
1 year ago
{
11 months ago
$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";
1 year ago
}
}