我用webman-admin,生成了一個(gè)前臺(tái)模塊,
是基于上表生成的,
運(yùn)行很正常,
但是,我在首頁寫如下代碼,卻不行
<?php
namespace app\controller;
use support\Request;
use support\Response;
use app\model\Buy;
use plugin\admin\app\controller\Crud;
use support\exception\BusinessException;
class IndexController extends Crud
{
public function index(Request $request)
{
// Webman 使用 ThinkORM 進(jìn)行查詢
$zj = Db::table('fg_buy')
->field('yh, SUM(xse) as total_xse')
->group('yh')
->order('total_xse', 'desc')
->limit(10)
->select();
return json(['code' => 0, 'msg' => 'ok','data' =>$zj]);
}
}
完全運(yùn)行不了,請(qǐng)問各位大咖,我該怎么寫?