Commit bb31d074 by 孙龙

标签

parent 7919aef4
<?php
namespace App\Http\Controllers;
use App\Model\TemplateExtendModel;
Class ApiController extends Controller
{
public function getUserLabels(){
$list = \DB::connection("label")->table("template_list")->where("template_list.status",1)->leftJoin("template_extend","template_list.id","=","template_extend.template_id")->select("template_list.id","template_list.template_name","template_extend.html","template_extend.attribute")->get();
$list = collect($list)->toArray();
$arr = [];
foreach($list as $k=>$item){
$arr[$k]["template_id"] = $item->id;
$arr[$k]["template_name"] = $item->template_name;
$arr[$k]["html"] = $item->html;
$arr[$k]["attribute"] = $item->attribute;
}
return ['code'=>0, 'count'=>count($arr),'data'=>$arr];
}
}
\ No newline at end of file
......@@ -28,6 +28,8 @@ Route::pattern('roleId', '[0-9]+');
|
*/
Route::get('/api/get_user_labels', 'ApiController@getUserLabels');
Route::group(['middleware' => 'web'], function () {
Route::get('/', 'WebController@index');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment