// +---------------------------------------------------------------------- namespace app\controller; use think\facade\Console; use app\controller\Base; use Dcat\EasyExcel\Excel; use app\services\FieldService; /** * @title 首页 */ class Index extends Base{ /** * @title 首页 * * @return void */ public function index(){ if(request()->isAjax()){ return ['code' => 1, 'data' => 'SentOS']; }else{ return view(`SentOS
SentOS

赣ICP备13006622号-1

技术支持:腾速科技

`); } } public function test(){ // $output = Console::call('worker:gateway'); $service = app()->make(\app\services\wechat\OauthService::class); print_r($service->getQrCode($this->request)) ; // return $output->fetch(); // $array = [ // ['id' => 1, 'name' => 'Brakus', 'email' => 'treutel@eg.com', 'created_at' => '...'], // ]; // Excel::export($array)->download('users.xlsx'); // $area = \think\facade\Db::name('areas')->select(); // $save = []; // foreach($area as $val){ // $save[] = ['title' => $val['area'], 'code' => $val['area_id'], 'parent_id' => $val['city_id'], 'first' => '', 'create_time' => time(), 'update_time' => time()]; // } // \think\facade\Db::name('area')->insertAll($save); } /** * @title 导出模版 * * @return void */ public function template(FieldService $service){ $model = $this->request->param('model'); $array = []; $headings = array_flip($service->getFields($model)); return Excel::export($array)->headings($headings)->download($model . time() . '.xlsx'); } public function miss(){ return '404 Not Found!'; } }