修复插件配置问题

This commit is contained in:
2022-08-17 12:56:26 +08:00
parent 6632d8cea1
commit 916507d7f2
5 changed files with 205 additions and 26 deletions

View File

@ -60,11 +60,18 @@ class ProgramAppendConstructController extends BaseController
}
public function from_list(Request $request) {
$query = ProgramAppends::query()->groupBy("from")->select("from")->selectRaw("count(1) as total_count")->orderByDesc("total_count");
if ($request->has("value")) {
$keyword = $request->get("value");
$query->where("from", "like", "%{$keyword}%");
}
return $query->get()->toArray();
$query = ProgramAppends::query()->groupBy("from")
->select("from")
->selectRaw("count(1) as total_count")
->having("total_count", ">", 1)
->orderByDesc("total_count");
return $query->get()->map(function ($item) {
return [
"text" => $item["from"],
"value" => $item["from"],
"alias" => implode("", \pinyin($item["from"], PINYIN_NO_TONE)),
"abbr" => \pinyin_abbr($item["from"]),
];
})->toArray();
}
}