Commit 1e758226 by 孙龙

获取销售的标签列表

parent dfae2965
......@@ -4,15 +4,17 @@ namespace App\Http\Controllers;
use App\Model\TemplateExtendModel;
use App\Services\LabelService;
use Illuminate\Http\Request;
Class ApiController extends Controller
{
public function getUserLabels(){
public function getUserLabels(Request $request){
$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();
$user_id = $request->input("user_id",0);
$list = LabelService::getUserLabels($user_id);
$list = collect($list)->toArray();
$arr = [];
......
......@@ -164,4 +164,16 @@ class LabelService {
return false;
}
}
public static function getUserLabels($user_id){
$list = \DB::connection("label")->table("template_list")->where("template_list.status",1)
->leftJoin("template_extend","template_list.id","=","template_extend.template_id")
->where(function($q) use($user_id){
$q->where("create_userid",$user_id)->orWhere("create_userid",1000);
})
->select("template_list.id","template_list.template_name","template_extend.html","template_extend.attribute")
->get();
return $list;
}
}
\ No newline at end of file
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