|
@@ -59,17 +59,17 @@ class FooterService implements FooterServiceInterface
|
|
*/
|
|
*/
|
|
public function addFooterCategory(array $data): array
|
|
public function addFooterCategory(array $data): array
|
|
{
|
|
{
|
|
- $alias = $data['alias'];
|
|
|
|
- // 引入 Pinyin 类
|
|
|
|
- $pinyin = new Pinyin();
|
|
|
|
- $alias_pinyin = $pinyin->permalink($alias, '');
|
|
|
|
|
|
+
|
|
//从WebsiteCategory取出alis ,并转成拼音存放到alias_pinyin
|
|
//从WebsiteCategory取出alis ,并转成拼音存放到alias_pinyin
|
|
// $result = WebsiteCategory::where($where)->first();
|
|
// $result = WebsiteCategory::where($where)->first();
|
|
// $result = $result->toArray();
|
|
// $result = $result->toArray();
|
|
-
|
|
|
|
if(empty($data)){
|
|
if(empty($data)){
|
|
$result = Website::select('website_name','id')->get();
|
|
$result = Website::select('website_name','id')->get();
|
|
}else{
|
|
}else{
|
|
|
|
+ // $alias = $data['name'];
|
|
|
|
+ // 引入 Pinyin 类
|
|
|
|
+
|
|
|
|
+ // $alias_pinyin = $pinyin->permalink($alias, '');
|
|
// 底部导航类型 0:内容型;1:列表型;
|
|
// 底部导航类型 0:内容型;1:列表型;
|
|
$webid = Website::select('website_name','id')->where('id',$data['website_id'])->first();
|
|
$webid = Website::select('website_name','id')->where('id',$data['website_id'])->first();
|
|
if(empty($webid)){
|
|
if(empty($webid)){
|
|
@@ -80,13 +80,15 @@ class FooterService implements FooterServiceInterface
|
|
if(!empty($name)){
|
|
if(!empty($name)){
|
|
return Result::error("该底部导航名称已存在!");
|
|
return Result::error("该底部导航名称已存在!");
|
|
}
|
|
}
|
|
|
|
+ $pinyin = new Pinyin();
|
|
$result = FooterCategory::insertGetId($data);
|
|
$result = FooterCategory::insertGetId($data);
|
|
- $data['alias_pinyin'] = $pinyin->permalink($data['name'], '') . $result;
|
|
|
|
|
|
+ $name_pinyin['name_pinyin'] = $pinyin->permalink($data['name'], '') . $result;
|
|
|
|
+ $result = FooterCategory::where('id', $result)->update($name_pinyin);
|
|
}
|
|
}
|
|
if(empty($result)){
|
|
if(empty($result)){
|
|
return Result::error("添加失败!");
|
|
return Result::error("添加失败!");
|
|
}else{
|
|
}else{
|
|
- return Result::success($result);
|
|
|
|
|
|
+ return Result::success($data);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
@@ -123,6 +125,8 @@ class FooterService implements FooterServiceInterface
|
|
if(empty($webid)){
|
|
if(empty($webid)){
|
|
return Result::error("该网站不存在!");
|
|
return Result::error("该网站不存在!");
|
|
}
|
|
}
|
|
|
|
+ $pinyin = new Pinyin();
|
|
|
|
+ $data['name_pinyin'] = $pinyin->permalink($data['name'], ''). $data['id'];
|
|
$result = FooterCategory::where('id', $data['id'])->update($data);
|
|
$result = FooterCategory::where('id', $data['id'])->update($data);
|
|
}
|
|
}
|
|
if (empty($result)) {
|
|
if (empty($result)) {
|