|
@@ -2658,30 +2658,30 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
/**
|
|
/**
|
|
* 自助建站-随机生成模板
|
|
* 自助建站-随机生成模板
|
|
*/
|
|
*/
|
|
- public function randomWebTemplate(array $data): array
|
|
|
|
- {
|
|
|
|
- // $where['website_id'] = $data['website_id'];
|
|
|
|
- $web = Website::where('id',$data['website_id'])->first();
|
|
|
|
-
|
|
|
|
- if(empty($web)){
|
|
|
|
- return Result::error('网站不存在!');
|
|
|
|
- }
|
|
|
|
- $where['template_id'] = $data['template_id'];
|
|
|
|
- $template = Template::where($where)->first();
|
|
|
|
- if(empty($template)){
|
|
|
|
- return Result::error('模板不存在!');
|
|
|
|
- }
|
|
|
|
- $rule = TemplateRule::first();
|
|
|
|
- if(empty($rule)){
|
|
|
|
- return Result::error('模板规则不存在!');
|
|
|
|
- }
|
|
|
|
- $index_rule = json_decode($rule->index_rule,true);
|
|
|
|
- $index = $this->getRandomIndex($index_rule,$template);
|
|
|
|
- return Result::success($index);
|
|
|
|
- }
|
|
|
|
- public function getRandomIndex($index_rule,$template){
|
|
|
|
- // $where = ['page_type','like','%'.1.'%'];
|
|
|
|
- $index = Sector::where('template_id',$template->template_id)->where('page_type','like','%1%')->limit(10)->get();
|
|
|
|
- return $index;
|
|
|
|
- }
|
|
|
|
|
|
+ // public function randomWebTemplate(array $data): array
|
|
|
|
+ // {
|
|
|
|
+ // // $where['website_id'] = $data['website_id'];
|
|
|
|
+ // $web = Website::where('id',$data['website_id'])->first();
|
|
|
|
+
|
|
|
|
+ // if(empty($web)){
|
|
|
|
+ // return Result::error('网站不存在!');
|
|
|
|
+ // }
|
|
|
|
+ // $where['template_id'] = $data['template_id'];
|
|
|
|
+ // $template = Template::where($where)->first();
|
|
|
|
+ // if(empty($template)){
|
|
|
|
+ // return Result::error('模板不存在!');
|
|
|
|
+ // }
|
|
|
|
+ // $rule = TemplateRule::first();
|
|
|
|
+ // if(empty($rule)){
|
|
|
|
+ // return Result::error('模板规则不存在!');
|
|
|
|
+ // }
|
|
|
|
+ // $index_rule = json_decode($rule->index_rule,true);
|
|
|
|
+ // $index = $this->getRandomIndex($index_rule,$template);
|
|
|
|
+ // return Result::success($index);
|
|
|
|
+ // }
|
|
|
|
+ // public function getRandomIndex($index_rule,$template){
|
|
|
|
+ // // $where = ['page_type','like','%'.1.'%'];
|
|
|
|
+ // $index = Sector::where('template_id',$template->template_id)->where('page_type','like','%1%')->limit(10)->get();
|
|
|
|
+ // return $index;
|
|
|
|
+ // }
|
|
}
|
|
}
|