|
@@ -10,6 +10,7 @@ use Hyperf\RpcServer\Annotation\RpcService;
|
|
use App\Tools\Result;
|
|
use App\Tools\Result;
|
|
use Hyperf\DbConnection\Db;
|
|
use Hyperf\DbConnection\Db;
|
|
use PhpParser\Node\Expr\Clone_;
|
|
use PhpParser\Node\Expr\Clone_;
|
|
|
|
+use Overtrue\Pinyin\Pinyin;
|
|
|
|
|
|
#[RpcService(name: "FooterService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
|
|
#[RpcService(name: "FooterService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
|
|
class FooterService implements FooterServiceInterface
|
|
class FooterService implements FooterServiceInterface
|
|
@@ -58,6 +59,14 @@ 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
|
|
|
|
+ // $result = WebsiteCategory::where($where)->first();
|
|
|
|
+ // $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{
|
|
@@ -72,6 +81,7 @@ class FooterService implements FooterServiceInterface
|
|
return Result::error("该底部导航名称已存在!");
|
|
return Result::error("该底部导航名称已存在!");
|
|
}
|
|
}
|
|
$result = FooterCategory::insertGetId($data);
|
|
$result = FooterCategory::insertGetId($data);
|
|
|
|
+ $data['alias_pinyin'] = $pinyin->permalink($data['name'], '') . $result;
|
|
}
|
|
}
|
|
if(empty($result)){
|
|
if(empty($result)){
|
|
return Result::error("添加失败!");
|
|
return Result::error("添加失败!");
|