作者 赵彬吉

Merge branch 'dev' of http://47.244.231.31:8099/zhl/globalso-v6 into dev

正在显示 48 个修改的文件 包含 809 行增加168 行删除
@@ -9,42 +9,138 @@ use GuzzleHttp\Client; @@ -9,42 +9,138 @@ use GuzzleHttp\Client;
9 */ 9 */
10 class AyrShare 10 class AyrShare
11 { 11 {
12 - public $path = 'https://app.ayrshare.com/api'; 12 + public $path = 'https://app.ayrshare.com';
13 //api_key 13 //api_key
14 public $api_key = 'G8GQW3X-XBTMGXW-QPDDZ9A-WE1Z5SB'; 14 public $api_key = 'G8GQW3X-XBTMGXW-QPDDZ9A-WE1Z5SB';
15 //系统设置 15 //系统设置
16 public $config = [ 16 public $config = [
17 - 17 + 'facebook'=>'#best https://www.facebook.com',
  18 + 'google'=>'#best https://www.google.com',
  19 + 'instagram'=>'#best https://www.instagram.com',
  20 + 'linkedin'=>'#best https://www.linkedin.com',
  21 + 'twitter'=>'#best https://www.twitter.com',
  22 + 'telegram'=>'#best https://www.telegram.com',
  23 + 'tiktok'=>'#bestvideo',
18 ]; 24 ];
19 //profile_key 25 //profile_key
20 - public $profile_key = "-----BEGIN RSA PRIVATE KEY-----  
21 - MIICWgIBAAKBgGFatMeBeaw7QJrqmylMLZlwuuO0FA/EZg5/g7Rrqu+FgpwvFkJq  
22 - 9twEZJY+aIdDH8/RVrCZQGR/xUxKw9v4ows+sLwi4g41m8KRKDXUcJwQvSlwsHAi  
23 - h9hPGZxDsRK0Nv4pZ7XqGgh0Wb0VypX/+Q1dhX9BnXQmvEKayk8GQWQxAgMBAAEC  
24 - gYAFqOJNnudV7fPpja4LjpQwEW+sATIRYJeWTC9587ByUE6xicM/hTxouhCm82Xc  
25 - Rzi4OjFR/vbRYOQ1dTtBtIi18fdRrseQNyR/N2NZjw1X8n5aZcw5NVaa3d3YTQNa  
26 - uzjnYF5eYSOD4pNKKIDc35VHdmvGCV/JXwQKMTgu1+4AAQJBAL5jjN3kvMKFF8vG  
27 - DyYR8k+wPG9iXAdR0HjVNB3OzxKVW0MTwM32pJBXCmF1MOziL8WC48VHQL48hVRa  
28 - 52xRqAECQQCC53rrrOPhPCLIb6kBfgqnxCojqlUK9paFL7NYTPtLYcOajY6+NiKT  
29 - CG1gaOwZh4r34HF7I59l/Ds98Z4nQDwxAkAC4/oIiGeBQIoK8vfZ6R3XreJNAp5J  
30 - EinrG7mN1kz4iEH5c7xSpDL9agTjU+cpQYneIs2Yeit2d+7CSBsJXvgBAkBDFsfU  
31 - yYLxCJT7DN8dOK/VU6AVL1Luj3qNP+k2tB2GgNBzAWHK8ou9t2/3HU8DtofuikUe  
32 - yx8Cccca9B4OF8nBAkAgIUZKGmVNFcGnFFo55vSJInNXFo4HCJ2o4DunBORVtQ/j  
33 - zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K  
34 - -----END RSA PRIVATE KEY-----"; 26 + public $profile_key = '';
35 //设置请求头 27 //设置请求头
36 public $headers = [ 28 public $headers = [
37 'Authorization' => 'Bearer ', 29 'Authorization' => 'Bearer ',
38 'Content-Type' => 'application/json', 30 'Content-Type' => 'application/json',
39 -// 'Accept-Encoding' => 'deflate, gzip',  
40 ]; 31 ];
  32 + //私钥
  33 + private $private_key = "-----BEGIN RSA PRIVATE KEY-----
  34 +MIICWgIBAAKBgGFatMeBeaw7QJrqmylMLZlwuuO0FA/EZg5/g7Rrqu+FgpwvFkJq
  35 +9twEZJY+aIdDH8/RVrCZQGR/xUxKw9v4ows+sLwi4g41m8KRKDXUcJwQvSlwsHAi
  36 +h9hPGZxDsRK0Nv4pZ7XqGgh0Wb0VypX/+Q1dhX9BnXQmvEKayk8GQWQxAgMBAAEC
  37 +gYAFqOJNnudV7fPpja4LjpQwEW+sATIRYJeWTC9587ByUE6xicM/hTxouhCm82Xc
  38 +Rzi4OjFR/vbRYOQ1dTtBtIi18fdRrseQNyR/N2NZjw1X8n5aZcw5NVaa3d3YTQNa
  39 +uzjnYF5eYSOD4pNKKIDc35VHdmvGCV/JXwQKMTgu1+4AAQJBAL5jjN3kvMKFF8vG
  40 +DyYR8k+wPG9iXAdR0HjVNB3OzxKVW0MTwM32pJBXCmF1MOziL8WC48VHQL48hVRa
  41 +52xRqAECQQCC53rrrOPhPCLIb6kBfgqnxCojqlUK9paFL7NYTPtLYcOajY6+NiKT
  42 +CG1gaOwZh4r34HF7I59l/Ds98Z4nQDwxAkAC4/oIiGeBQIoK8vfZ6R3XreJNAp5J
  43 +EinrG7mN1kz4iEH5c7xSpDL9agTjU+cpQYneIs2Yeit2d+7CSBsJXvgBAkBDFsfU
  44 +yYLxCJT7DN8dOK/VU6AVL1Luj3qNP+k2tB2GgNBzAWHK8ou9t2/3HU8DtofuikUe
  45 +yx8Cccca9B4OF8nBAkAgIUZKGmVNFcGnFFo55vSJInNXFo4HCJ2o4DunBORVtQ/j
  46 +zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K
  47 +-----END RSA PRIVATE KEY-----";
41 48
42 /** 49 /**
43 - * @name :参数构建 50 + * @name :(创建子账户配置文件)post_create_profiles
  51 + * @author :lyh
  52 + * @method :post
  53 + * @time :2023/5/5 15:16
44 */ 54 */
45 - public function __construct()  
46 - {  
47 - $this->headers['Authorization'] = $this->headers['Authorization'].$this->api_key; 55 + public function post_create_profiles($data){
  56 + $param = [
  57 + 'title'=>$data['title'],
  58 + ];
  59 + $url = $this->path.'/api/profiles/profile';
  60 + return $this->http_click('post',$url,$param);
  61 + }
  62 + /**
  63 + * @name :(删除子账户配置文件)deleted_profiles
  64 + * @author :lyh
  65 + * @method :post
  66 + * @time :2023/5/5 15:16
  67 + */
  68 + public function deleted_profiles($data){
  69 + $param = [
  70 + 'title'=>$data['title'],
  71 + 'profileKey'=>$this->profile_key,
  72 + ];
  73 + $url = $this->path.'/api/profiles/profile';
  74 + return $this->http_click('delete',$url,$param);
  75 + }
  76 +
  77 + /**
  78 + * @name :(跳转第三方生成jwt令牌)post_generate_jwt
  79 + * @author :lyh
  80 + * @method :post
  81 + * @time :2023/5/5 18:07 https://app.ayrshare.com/api/profiles/generateJWT
  82 + */
  83 + public function post_generate_jwt($data,$domain = 'globalso'){
  84 + $param = [
  85 + 'domain'=>$domain,
  86 + 'privateKey'=>$this->private_key,
  87 + 'profileKey'=>$data['profileKey'],
  88 +// 'logout'=>true
  89 + ];
  90 + $url = $this->path.'/api/profiles/generateJWT';
  91 + return $this->http_click('post',$url,$param);
  92 + }
  93 +
  94 + /**
  95 + * @name :(获取指定api_key的配置文件)get_profiles_users
  96 + * @author :lyh
  97 + * @method :post
  98 + * @time :2023/5/6 16:44
  99 + */
  100 + public function get_profiles_users($api_key){
  101 + $this->headers['Authorization'] = $this->headers['Authorization'].$api_key;
  102 + $url = $this->path.'/api/user';
  103 + return $this->http_click('get',$url,[],$this->headers);
  104 + }
  105 +
  106 + /**
  107 + * @name :(发帖)post_send_msg
  108 + * @author :lyh
  109 + * @method :post
  110 + * @time :2023/5/8 9:22
  111 + * @param :platforms: "facebook", "fbg", "twitter",
  112 + * "linkedin", "instagram","youtube", "reddit" ,"telegram""
  113 + */
  114 + public function post_send_msg($param){
  115 + $param = [
  116 + 'post'=>$param['post'],//内容(帖子文本)
  117 + 'platforms'=>$param['platforms'],//平台
  118 + 'idempotencyKey'=>$param['idempotencyKey'],//帖子唯一id
  119 + 'mediaUrls'=>$param['mediaUrls'],
  120 + ];
  121 + //平台参数处理
  122 + $this->headers['Accept-Encoding'] = 'gzip';
  123 + $this->headers['Authorization'] = $this->headers['Authorization'].$param['profile_key'];
  124 + $url = $this->path.'/api/post';
  125 + return $this->http_click('posts',$url,$param,$this->headers);
  126 + }
  127 +
  128 + /**
  129 + * @name :(上传图片或视频到ayr_share)post_media_upload
  130 + * @author :lyh
  131 + * @method :post
  132 + * @time :2023/5/8 9:47
  133 + * https://app.ayrshare.com/api/media/upload
  134 + */
  135 + public function post_media_upload($data){
  136 + $param = [
  137 + 'file'=>$data['file'],//base64编码
  138 + 'fileName'=>$data['file_name'],//生成图片名称
  139 + 'description'=>$data['description'],//描述
  140 + ];
  141 + $this->headers['Authorization'] = $this->headers['Authorization'].$data['profile_key'];
  142 + $url = $this->path.'/api/media/upload';
  143 + return $this->http_click('posts',$url,$param,$this->headers);
48 } 144 }
49 145
50 /** 146 /**
@@ -133,7 +229,7 @@ class AyrShare @@ -133,7 +229,7 @@ class AyrShare
133 * @method :post 229 * @method :post
134 * @time :2023/5/5 15:00 230 * @time :2023/5/5 15:00
135 */ 231 */
136 - public function post_user($data){ 232 + public function post_profiles($data){
137 $param = [ 233 $param = [
138 'post'=>$data['post'], 234 'post'=>$data['post'],
139 'platforms'=>$data['platforms'], 235 'platforms'=>$data['platforms'],
@@ -145,57 +241,6 @@ class AyrShare @@ -145,57 +241,6 @@ class AyrShare
145 } 241 }
146 242
147 /** 243 /**
148 - * @name :(创建子账户相关操作)post_create_profiles  
149 - * @author :lyh  
150 - * @method :post  
151 - * @time :2023/5/5 15:16  
152 - */  
153 - public function post_create_profiles($data){  
154 - $param = [  
155 - 'title'=>$data['title'],  
156 - ];  
157 - $url = $this->path.'/profiles/profile';  
158 - return $this->http_click('post',$url,$param);  
159 - }  
160 - /**  
161 - * @name :(删除子账户相关操作)post_create_profiles  
162 - * @author :lyh  
163 - * @method :post  
164 - * @time :2023/5/5 15:16  
165 - */  
166 - public function deleted_create_profiles($data){  
167 - $param = [  
168 - 'title'=>$data['title'],  
169 - 'profileKey'=>$this->profile_key,  
170 - ];  
171 - $url = $this->path.'/profiles/profile';  
172 - return $this->http_click('delete',$url,$param);  
173 - }  
174 -  
175 - public function put_update_profiles($data){  
176 - $param = [  
177 - 'title'=>$data['title'],  
178 - 'profileKey'=>$this->profile_key,  
179 - ];  
180 - $url = $this->path.'/profiles/profile';  
181 - return $this->http_click('put',$url,$param);  
182 - }  
183 - /**  
184 - * @name :(获取有关用户社交资料的分析和人口统计,例如印象,视图和关注着)post_social  
185 - * @author :lyh  
186 - * @method :post  
187 - * @time :2023/5/5 10:37  
188 - */  
189 - public function api_user(){  
190 - $post_data = [  
191 - 'platforms' => ['facebook', 'instagram', 'twitter', 'linkedin', 'pinterest', 'youtube', 'tiktok'],  
192 - ];  
193 - $url = $this->path.'/api/user';  
194 - return $this->http_click('post',$url,$post_data);  
195 - }  
196 -  
197 -  
198 - /**  
199 * 发送http post,get,put,delete请求 244 * 发送http post,get,put,delete请求
200 * @param type $url 245 * @param type $url
201 * @param type $post_data 246 * @param type $post_data
@@ -205,13 +250,16 @@ class AyrShare @@ -205,13 +250,16 @@ class AyrShare
205 if(!empty($param)){ 250 if(!empty($param)){
206 $post_data['json'] = $param; 251 $post_data['json'] = $param;
207 } 252 }
  253 + if(empty($header)){
  254 + $this->headers['Authorization'] = $this->headers['Authorization'].$this->api_key;
  255 + }
208 $post_data['headers'] = !empty($header) ? $header : $this->headers; 256 $post_data['headers'] = !empty($header) ? $header : $this->headers;
209 $client = new Client(); 257 $client = new Client();
210 try { 258 try {
211 $res = $client->request(strtoupper($method), $url, $post_data)->getBody()->getContents(); 259 $res = $client->request(strtoupper($method), $url, $post_data)->getBody()->getContents();
212 - return $res; 260 + return (array)json_decode($res);
213 } catch (\Exception $e) { 261 } catch (\Exception $e) {
214 - return json_encode(["status"=>"fail","message"=>$e->getMessage()]); 262 + return ["status"=>"fail","message"=>$e->getMessage()];
215 } 263 }
216 } 264 }
217 } 265 }
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Bside\AyrShare;
  4 +
  5 +use App\Enums\Common\Code;
  6 +use App\Helper\AyrShare as AyrShareHelper;
  7 +use App\Http\Controllers\Bside\BaseController;
  8 +use App\Http\Logic\Bside\AyrShare\AyrShareLogic;
  9 +use App\Models\AyrShare\AyrShare as AyrShareModel;
  10 +
  11 +/**
  12 + * @name:社交绑定
  13 + */
  14 +class AyrShareController extends BaseController
  15 +{
  16 + /**
  17 + * @name :(社交列表)lists
  18 + * @author :lyh
  19 + * @method :post
  20 + * @time :2023/5/5 16:06
  21 + */
  22 + public function lists(AyrShareModel $ayrShareModel){
  23 + $lists = $ayrShareModel->lists($this->map,$this->page,$this->row,'id',['*']);
  24 + $ayrShareHelper = new AyrShareHelper();
  25 + foreach ($lists['list'] as $k=>$v){
  26 + $lists['list'][$k]['ayr'] = $ayrShareHelper->get_profiles_users($v['profile_key']);
  27 + }
  28 + $this->response('列表',Code::SUCCESS,$lists);
  29 + }
  30 +
  31 + /**
  32 + * @name :(创建ayr_share账户)create_account
  33 + * @author :lyh
  34 + * @method :post
  35 + * @time :2023/5/5 16:44
  36 + */
  37 + public function create_account(AyrShareLogic $ayrShareLogic){
  38 + $param = [
  39 + 'title'=>md5(uniqid().time()),
  40 + ];
  41 + //发送请求注册社交用户
  42 + $ayrShareHelper = new AyrShareHelper();
  43 + $res = $ayrShareHelper->post_create_profiles($param);
  44 + if($res['status'] == 'fail'){
  45 + $this->response('同步绑定失败');
  46 + }
  47 + //执行数据库操作
  48 + $ayrShareLogic->ayr_share_add($res);
  49 + $this->response('success');
  50 + }
  51 +
  52 + /**
  53 + * @name :(删除用户账号并同步ayr_share账号)edit_account
  54 + * @author :lyh
  55 + * @method :post
  56 + * @time :2023/5/6 10:11
  57 + */
  58 + public function del_account(AyrShareLogic $ayrShareLogic){
  59 + $this->request->validate([
  60 + 'id'=>['required']
  61 + ],[
  62 + 'id.required' => 'ID不能为空'
  63 + ]);
  64 + $info = $ayrShareLogic->ayr_share_info();
  65 + $data = [
  66 + 'title'=>$info['title'],
  67 + 'profileKey'=>$info['profile_key']
  68 + ];
  69 + //发送请求注册社交用户
  70 + $ayrShareHelper = new AyrShareHelper();
  71 + $res = $ayrShareHelper->deleted_profiles($data);
  72 + if($res['status'] == 'fail'){
  73 + $this->response('同步删除失败');
  74 + }
  75 + $ayrShareLogic->ayr_share_del();
  76 + $this->response('success');
  77 + }
  78 +
  79 + /**
  80 + * @name :(授权绑定第三方平台,生成jwt令牌)ayr_share_bind
  81 + * @author :lyh
  82 + * @method :post
  83 + * @time :2023/5/6 10:24
  84 + */
  85 + public function bind_account(AyrShareLogic $ayrShareLogic){
  86 + $this->request->validate([
  87 + 'id'=>['required']
  88 + ],[
  89 + 'id.required' => 'ID不能为空'
  90 + ]);
  91 + $info = $ayrShareLogic->ayr_share_info();
  92 + //发送请求注册社交用户
  93 + $ayrShareHelper = new AyrShareHelper();
  94 + $data = [
  95 + 'profileKey'=>$info['profile_key']
  96 + ];
  97 + $res = $ayrShareHelper->post_generate_jwt($data);
  98 + if($res['status'] == 'fail'){
  99 + $this->response($res['message'],Code::USER_ERROR);
  100 + }
  101 + $this->response('success',Code::SUCCESS,$res);
  102 + }
  103 +
  104 + /**
  105 + * @name :(获取当前用户的配置文件)get_profiles
  106 + * @author :lyh
  107 + * @method :post
  108 + * @time :2023/5/6 16:39
  109 + */
  110 + public function get_profiles(AyrShareLogic $ayrShareLogic){
  111 + $this->request->validate([
  112 + 'id'=>['required']
  113 + ],[
  114 + 'id.required' => 'ID不能为空'
  115 + ]);
  116 + $info = $ayrShareLogic->ayr_share_info();
  117 + //发送请求注册社交用户
  118 + $ayrShareHelper = new AyrShareHelper();
  119 + $data = [
  120 + 'title'=>$info['title'],
  121 + 'refId'=>$info['ref_id'],
  122 + 'profileKeys'=>$info['profile_keys']
  123 + ];
  124 + $res = $ayrShareHelper->post_generate_jwt($data);
  125 + if($res['status'] == 'fail'){
  126 + $this->response($res['message'],Code::USER_ERROR);
  127 + }
  128 + $this->response('success',Code::SUCCESS,$res);
  129 + }
  130 +
  131 + /**
  132 + * @name :(上传图片到第三方)post_uploads
  133 + * @author :lyh
  134 + * @method :post
  135 + * @time :2023/5/8 13:45
  136 + */
  137 + public function post_uploads(){
  138 +
  139 + }
  140 + /**
  141 + * @name :(发布推文到第三方平台)send_api_post
  142 + * @author :lyh
  143 + * @method :post
  144 + * @time :2023/5/8 13:37
  145 + */
  146 + public function send_api_post(AyrShareLogic $ayrShareLogic){
  147 + $this->request->validate([
  148 + 'id'=>['required']
  149 + ],[
  150 + 'id.required' => 'ID不能为空'
  151 + ]);
  152 + $info = $ayrShareLogic->ayr_share_info();
  153 + }
  154 +}
@@ -21,7 +21,7 @@ class BlogCategoryController extends BaseController @@ -21,7 +21,7 @@ class BlogCategoryController extends BaseController
21 //搜索条件 21 //搜索条件
22 $this->map['project_id'] = $this->user['project_id']; 22 $this->map['project_id'] = $this->user['project_id'];
23 $lists = $blogCategoryModel->lists($this->map,$this->page,$this->row,$this->order, 23 $lists = $blogCategoryModel->lists($this->map,$this->page,$this->row,$this->order,
24 - ['id','pid','name','num','status','sort','remark','created_at','updated_at']); 24 + ['id','pid','name','num','alias','status','sort','remark','created_at','updated_at']);
25 if(!empty($lists['list'])){ 25 if(!empty($lists['list'])){
26 $blogModel = new BlogModel(); 26 $blogModel = new BlogModel();
27 foreach ($lists['list'] as $k => $v){ 27 foreach ($lists['list'] as $k => $v){
@@ -21,7 +21,7 @@ class NewsCategoryController extends BaseController @@ -21,7 +21,7 @@ class NewsCategoryController extends BaseController
21 //搜索条件 21 //搜索条件
22 $this->map['project_id'] = $this->user['project_id']; 22 $this->map['project_id'] = $this->user['project_id'];
23 $lists = $newsCategory->lists($this->map,$this->page,$this->row,$this->order, 23 $lists = $newsCategory->lists($this->map,$this->page,$this->row,$this->order,
24 - ['id','pid','name','num','status','sort','remark','created_at','updated_at']); 24 + ['id','pid','name','num','alias','status','sort','remark','created_at','updated_at']);
25 if(!empty($lists['list'])){ 25 if(!empty($lists['list'])){
26 $newsModel = new NewsModel(); 26 $newsModel = new NewsModel();
27 foreach ($lists['list'] as $k => $v){ 27 foreach ($lists['list'] as $k => $v){
@@ -6,6 +6,9 @@ use App\Enums\Common\Code; @@ -6,6 +6,9 @@ use App\Enums\Common\Code;
6 use App\Http\Controllers\Bside\BaseController; 6 use App\Http\Controllers\Bside\BaseController;
7 use App\Http\Logic\Bside\Setting\ProjectCountryLogic; 7 use App\Http\Logic\Bside\Setting\ProjectCountryLogic;
8 8
  9 +/**
  10 + * @name:项目配置多语言设置
  11 + */
9 class ProjectCountryController extends BaseController 12 class ProjectCountryController extends BaseController
10 { 13 {
11 /** 14 /**
@@ -6,6 +6,9 @@ use App\Enums\Common\Code; @@ -6,6 +6,9 @@ use App\Enums\Common\Code;
6 use App\Http\Controllers\Bside\BaseController; 6 use App\Http\Controllers\Bside\BaseController;
7 use App\Http\Logic\Bside\Setting\WebSettingLogic; 7 use App\Http\Logic\Bside\Setting\WebSettingLogic;
8 8
  9 +/**
  10 + * @name:项目首页设置
  11 + */
9 class WebSettingController extends BaseController 12 class WebSettingController extends BaseController
10 { 13 {
11 /** 14 /**
@@ -7,6 +7,9 @@ use App\Http\Controllers\Bside\BaseController; @@ -7,6 +7,9 @@ use App\Http\Controllers\Bside\BaseController;
7 use App\Http\Logic\Bside\Setting\WebSettingCountryLogic; 7 use App\Http\Logic\Bside\Setting\WebSettingCountryLogic;
8 use App\Models\Project\Country as CountryModel; 8 use App\Models\Project\Country as CountryModel;
9 9
  10 +/**
  11 + * @name:多语言国家配置列
  12 + */
10 class WebSettingCountryController extends BaseController 13 class WebSettingCountryController extends BaseController
11 { 14 {
12 /** 15 /**
@@ -6,6 +6,9 @@ use App\Enums\Common\Code; @@ -6,6 +6,9 @@ use App\Enums\Common\Code;
6 use App\Http\Controllers\Bside\BaseController; 6 use App\Http\Controllers\Bside\BaseController;
7 use App\Http\Logic\Bside\Setting\WebSettingFromLogic; 7 use App\Http\Logic\Bside\Setting\WebSettingFromLogic;
8 8
  9 +/**
  10 + * @name:表单设置
  11 + */
9 class WebSettingFromController extends BaseController 12 class WebSettingFromController extends BaseController
10 { 13 {
11 /** 14 /**
@@ -26,30 +29,7 @@ class WebSettingFromController extends BaseController @@ -26,30 +29,7 @@ class WebSettingFromController extends BaseController
26 * @time :2023/4/28 14:41 29 * @time :2023/4/28 14:41
27 */ 30 */
28 public function save(WebSettingFromLogic $webSettingFromLogic){ 31 public function save(WebSettingFromLogic $webSettingFromLogic){
29 - if(isset($this->param['id']) && !empty($this->param['id'])){  
30 - $this->request->validate([  
31 - 'id'=>'required'  
32 - ],[  
33 - 'id.required' => 'ID不能为空'  
34 - ]);  
35 - }  
36 $webSettingFromLogic->setting_from_save(); 32 $webSettingFromLogic->setting_from_save();
37 $this->response('success'); 33 $this->response('success');
38 } 34 }
39 -  
40 - /**  
41 - * @name :(删除表单)del  
42 - * @author :lyh  
43 - * @method :post  
44 - * @time :2023/5/4 13:38  
45 - */  
46 - public function del(WebSettingFromLogic $webSettingFromLogic){  
47 - $this->request->validate([  
48 - 'id'=>'required'  
49 - ],[  
50 - 'id.required' => 'ID不能为空'  
51 - ]);  
52 - $webSettingFromLogic->setting_from_del();  
53 - $this->response('success');  
54 - }  
55 } 35 }
@@ -6,6 +6,9 @@ use App\Enums\Common\Code; @@ -6,6 +6,9 @@ use App\Enums\Common\Code;
6 use App\Http\Controllers\Bside\BaseController; 6 use App\Http\Controllers\Bside\BaseController;
7 use App\Http\Logic\Bside\Setting\WebSettingHtmlLogic; 7 use App\Http\Logic\Bside\Setting\WebSettingHtmlLogic;
8 8
  9 +/**
  10 + * @name:第三方代码设置
  11 + */
9 class WebSettingHtmlController extends BaseController 12 class WebSettingHtmlController extends BaseController
10 { 13 {
11 /** 14 /**
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Bside\Setting;
  4 +
  5 +use App\Enums\Common\Code;
  6 +use App\Http\Controllers\Bside\BaseController;
  7 +use App\Http\Logic\Bside\Setting\WebSettingReceivingLogic;
  8 +
  9 +/**
  10 + * @name:项目收信设置
  11 + */
  12 +class WebSettingReceivingController extends BaseController
  13 +{
  14 + /**
  15 + * @name :(收信设置列表)lists
  16 + * @author :lyh
  17 + * @method :post
  18 + * @time :2023/5/8 16:22
  19 + */
  20 + public function lists(WebSettingReceivingLogic $webSettingReceivingLogic){
  21 + $lists = $webSettingReceivingLogic->setting_receiving_lists();
  22 + $this->response('success',Code::SUCCESS,$lists);
  23 + }
  24 +
  25 + /**
  26 + * @name :(更新)save
  27 + * @author :lyh
  28 + * @method :post
  29 + * @time :2023/5/8 16:23
  30 + */
  31 + public function save(WebSettingReceivingLogic $webSettingReceivingLogic){
  32 + $lists = $webSettingReceivingLogic->setting_receiving_save();
  33 + $this->response('success');
  34 + }
  35 +}
@@ -6,6 +6,9 @@ use App\Enums\Common\Code; @@ -6,6 +6,9 @@ use App\Enums\Common\Code;
6 use App\Http\Controllers\Bside\BaseController; 6 use App\Http\Controllers\Bside\BaseController;
7 use App\Http\Logic\Bside\Setting\WebSettingServiceLogic; 7 use App\Http\Logic\Bside\Setting\WebSettingServiceLogic;
8 8
  9 +/**
  10 + * @name:客服设置
  11 + */
9 class WebSettingServiceController extends BaseController 12 class WebSettingServiceController extends BaseController
10 { 13 {
11 /** 14 /**
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Bside\Setting;
  4 +
  5 +use App\Enums\Common\Code;
  6 +use App\Http\Controllers\Bside\BaseController;
  7 +use App\Http\Logic\Bside\Setting\WebSettingTextLogic;
  8 +
  9 +/**
  10 + * @name:描文本设置
  11 + */
  12 +class WebSettingTextController extends BaseController
  13 +{
  14 + /**
  15 + * @name :lists
  16 + * @author :lyh
  17 + * @method :post
  18 + * @time :2023/5/4 11:28
  19 + */
  20 + public function lists(WebSettingTextLogic $webSettingTextLogic){
  21 + $lists = $webSettingTextLogic->setting_text_lists();
  22 + $this->response('success',Code::SUCCESS,$lists);
  23 + }
  24 + /**
  25 + * @name :save
  26 + * @author :lyh
  27 + * @method :post
  28 + * @time :2023/4/28 14:46
  29 + */
  30 + public function save(WebSettingTextLogic $webSettingTextLogic){
  31 + $webSettingTextLogic->setting_text_save();
  32 + $this->response('success');
  33 + }
  34 +
  35 +
  36 +}
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\file;
  4 +
  5 +use App\Enums\Common\Code;
  6 +use App\Models\File\File;
  7 +
  8 +class FileController
  9 +{
  10 + public $upload_img = [
  11 + //设置静态缓存参数(304)
  12 + 'header' => [
  13 + 'Cache-Control' => 'max-age=2592000',
  14 + 'Pragma' => 'cache',
  15 + 'Expires' => "%Expires%", // cache 1 month
  16 + 'etag' => "%etag%",
  17 + 'Last-Modified' => "%Last-Modified%",
  18 + 'Content-Description' => 'File Transfer',
  19 + ],
  20 + ];
  21 + public $path = '';
  22 +
  23 + public $config = '';
  24 +
  25 + public $thr_path = '';
  26 +
  27 + public $request = '';
  28 +
  29 + public function __construct()
  30 + {
  31 + $this->request = request();
  32 + $this->config = config('filesystems.disks.upload');
  33 + $this->path = $this->config['root'];
  34 + }
  35 +
  36 + public function index($hash = '', $w = 0 ,$h = 0){
  37 + if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
  38 + header("HTTP/1.1 304 Not Modified");
  39 + exit;
  40 + }
  41 + $file_model = new File();
  42 + $info = $file_model->read(['hash'=>$hash]);
  43 + if ($info === false) {
  44 + $this->response('指定文件不存在!', Code::USER_ERROR);
  45 + }
  46 + $path = $info['path'];
  47 + if (!is_file($path)) {
  48 + $this->response('指定文件已被系统删除!', Code::USER_ERROR);
  49 + }
  50 + $content = file_get_contents($path);
  51 + $header['Content-Length'] = $info['size'];
  52 + return response($content, 200, $header);
  53 + }
  54 +}
1 <?php 1 <?php
2 2
3 -namespace App\Http\Controllers; 3 +namespace App\Http\Controllers\file;
4 4
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 -use App\Models\Image as ImageModel; 6 +use App\Http\Controllers\type;
  7 +use App\Http\Controllers\统一返回参数;
  8 +use App\Models\File\Image as ImageModel;
7 use Illuminate\Http\Exceptions\HttpResponseException; 9 use Illuminate\Http\Exceptions\HttpResponseException;
8 use Illuminate\Http\JsonResponse; 10 use Illuminate\Http\JsonResponse;
9 use Illuminate\Support\Facades\Storage; 11 use Illuminate\Support\Facades\Storage;
@@ -114,12 +116,12 @@ class ImageController @@ -114,12 +116,12 @@ class ImageController
114 } 116 }
115 $url = $this->path; 117 $url = $this->path;
116 $filename = date('ymdHis').rand(10000,99999); 118 $filename = date('ymdHis').rand(10000,99999);
117 - $res = $this->request->file('image')->move($url,$filename); 119 + $res = $this->request->file('image')->move($url);
118 if ($res === false) { 120 if ($res === false) {
119 return $this->response($files->getError(), Code::USER_ERROR); 121 return $this->response($files->getError(), Code::USER_ERROR);
120 } 122 }
121 $data = [ 123 $data = [
122 - 'path' => $url.'/'.$filename, 124 + 'path' => $url.'/'.$res->getClientOriginalName(),
123 'created_at' => date('Y-m-d H:i:s',time()), 125 'created_at' => date('Y-m-d H:i:s',time()),
124 'size' => $res->getSize(), 126 'size' => $res->getSize(),
125 'hash' => $hash, 127 'hash' => $hash,
  1 +<?php
  2 +
  3 +namespace App\Http\Logic\Bside\AyrShare;
  4 +
  5 +use App\Helper\AyrShare as AyrShareHelper;
  6 +use App\Http\Controllers\file\ImageController;
  7 +use App\Http\Logic\Bside\BaseLogic;
  8 +use App\Models\AyrShare\AyrShare;
  9 +
  10 +class AyrShareLogic extends BaseLogic
  11 +{
  12 + public function __construct()
  13 + {
  14 + parent::__construct();
  15 +
  16 + $this->model = new AyrShare();
  17 + $this->param = $this->requestAll;
  18 + }
  19 +
  20 + /**
  21 + * @name :(创建账号并绑定写入数据库)ayr_add
  22 + * @author :lyh
  23 + * @method :post
  24 + * @time :2023/5/6 9:19
  25 + */
  26 + public function ayr_share_add($res){
  27 + //插入数据库
  28 + $param = [
  29 + 'title'=>$res['title'],
  30 + 'ref_id'=>$res['refId'],
  31 + 'profile_key'=>$res['profileKey'],
  32 + 'user_id'=>$this->user['id'],
  33 + 'project_id'=>$this->user['project_id'],
  34 + 'name'=>$this->param['name'],
  35 + ];
  36 + $rs = $this->model->add($param);
  37 + if($rs === false){
  38 + $this->fail('error');
  39 + }
  40 + return $this->success();
  41 + }
  42 +
  43 + /**
  44 + * @name :(获取当前数据详情)ayr_share_del
  45 + * @author :lyh
  46 + * @method :post
  47 + * @time :2023/5/6 10:16
  48 + */
  49 + public function ayr_share_info(){
  50 + $info = $this->model->read(['id'=>$this->param['id']]);
  51 + if($info === false){
  52 + $this->fail('当前数据不存在或已被删除');
  53 + }
  54 + return $this->success($info);
  55 + }
  56 +
  57 + /**
  58 + * @name :(删除ayr数据并同步删除)
  59 + * @author :lyh
  60 + * @method :post
  61 + * @time :2023/5/6 10:18
  62 + */
  63 + public function ayr_share_del(){
  64 + $this->param['id'] = ['in',$this->param['id']];
  65 + $rs = $this->model->del($this->param);
  66 + if($rs === false){
  67 + $this->fail('删出失败');
  68 + }
  69 + return $this->success();
  70 + }
  71 +
  72 + /**
  73 + * @name :(向第三方平台发布帖子)api_public_msg
  74 + * @author :lyh
  75 + * @method :post
  76 + * @time :2023/5/8 9:11
  77 + */
  78 + public function send_public_post($param){
  79 + //获取图片
  80 + $image_c = new ImageController();
  81 + $image_info = $image_c->index($param['hash']);
  82 + $param = [
  83 + 'post'=>$param['text'],
  84 + 'mediaUrls'=>$image_info,
  85 + 'platforms'=>$this->param['platforms'],
  86 + ];
  87 + //发布帖子
  88 + $ayrShareHelper = new AyrShareHelper();
  89 + $res = $ayrShareHelper->post_send_msg($param);
  90 + $this->success($res);
  91 + }
  92 +}
  93 +
  94 +
  95 +
@@ -5,7 +5,7 @@ namespace App\Http\Logic\Bside; @@ -5,7 +5,7 @@ namespace App\Http\Logic\Bside;
5 5
6 use App\Enums\Common\Common; 6 use App\Enums\Common\Common;
7 use App\Exceptions\BsideGlobalException; 7 use App\Exceptions\BsideGlobalException;
8 -use App\Http\Controllers\ImageController; 8 +use App\Http\Controllers\file\ImageController;
9 use App\Http\Logic\Logic; 9 use App\Http\Logic\Logic;
10 use Illuminate\Support\Facades\Cache; 10 use Illuminate\Support\Facades\Cache;
11 11
@@ -101,8 +101,9 @@ class BlogCategoryLogic extends BaseLogic @@ -101,8 +101,9 @@ class BlogCategoryLogic extends BaseLogic
101 if($info !== false){ 101 if($info !== false){
102 $this->fail('当前分类名称已存在'); 102 $this->fail('当前分类名称已存在');
103 } 103 }
  104 +
104 $this->param['operator_id'] = $this->user['id']; 105 $this->param['operator_id'] = $this->user['id'];
105 - $this->edit($this->param,$this->param['id']); 106 + $this->edit($this->param,['id'=>$this->param['id']]);
106 return $this->success(); 107 return $this->success();
107 } 108 }
108 109
@@ -7,7 +7,6 @@ use App\Helper\Common; @@ -7,7 +7,6 @@ use App\Helper\Common;
7 use App\Http\Logic\Bside\BaseLogic; 7 use App\Http\Logic\Bside\BaseLogic;
8 use App\Models\Blog\Blog; 8 use App\Models\Blog\Blog;
9 use App\Models\Blog\BlogCategory as BlogCategoryModel; 9 use App\Models\Blog\BlogCategory as BlogCategoryModel;
10 -use App\Models\Image;  
11 use App\Models\RouteMap; 10 use App\Models\RouteMap;
12 use Illuminate\Support\Facades\DB; 11 use Illuminate\Support\Facades\DB;
13 12
@@ -105,14 +104,6 @@ class BlogLogic extends BaseLogic @@ -105,14 +104,6 @@ class BlogLogic extends BaseLogic
105 try { 104 try {
106 //是否有图片更新 105 //是否有图片更新
107 if(isset($this->param['image']) && is_file($this->param['image'])){ 106 if(isset($this->param['image']) && is_file($this->param['image'])){
108 - //查看当前用户是否已有头像  
109 - if($info !== false && !empty($info['image'])){  
110 - //TODO::删除资源  
111 - $imageModel = new Image();  
112 - $image_info = $imageModel->read(['hash'=>$info['image']],['id','path']);  
113 - shell_exec('sudo rm -rf '.$image_info['path'] .' ./../uploads/images/cache_'. $info['image'] . '*');  
114 - $imageModel->del(['hash'=>$info['image']]);  
115 - }  
116 $this->param['image'] = $this->upload(); 107 $this->param['image'] = $this->upload();
117 } 108 }
118 RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $this->param['id'], $this->user['project_id']); 109 RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $this->param['id'], $this->user['project_id']);
@@ -173,7 +164,7 @@ class BlogLogic extends BaseLogic @@ -173,7 +164,7 @@ class BlogLogic extends BaseLogic
173 */ 164 */
174 public function blog_status(){ 165 public function blog_status(){
175 $this->param['operator_id'] = $this->user['id']; 166 $this->param['operator_id'] = $this->user['id'];
176 - $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); 167 + $rs = $this->model->edit($this->param,['id'=>['in',$this->param['id']]]);
177 if($rs === false){ 168 if($rs === false){
178 $this->fail('error'); 169 $this->fail('error');
179 } 170 }
@@ -5,7 +5,6 @@ namespace App\Http\Logic\Bside\News; @@ -5,7 +5,6 @@ namespace App\Http\Logic\Bside\News;
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 use App\Helper\Common; 6 use App\Helper\Common;
7 use App\Http\Logic\Bside\BaseLogic; 7 use App\Http\Logic\Bside\BaseLogic;
8 -use App\Models\Image;  
9 use App\Models\News\News; 8 use App\Models\News\News;
10 use App\Models\News\NewsCategory as NewsCategoryModel; 9 use App\Models\News\NewsCategory as NewsCategoryModel;
11 use App\Models\RouteMap; 10 use App\Models\RouteMap;
@@ -60,19 +59,19 @@ class NewsLogic extends BaseLogic @@ -60,19 +59,19 @@ class NewsLogic extends BaseLogic
60 $this->param['project_id'] = $this->user['project_id']; 59 $this->param['project_id'] = $this->user['project_id'];
61 $this->param['created_at'] = date('Y-m-d H:i:s',time()); 60 $this->param['created_at'] = date('Y-m-d H:i:s',time());
62 $this->param['updated_at'] = date('Y-m-d H:i:s',time()); 61 $this->param['updated_at'] = date('Y-m-d H:i:s',time());
63 -// DB::beginTransaction();  
64 -// try { 62 + DB::beginTransaction();
  63 + try {
65 if(isset($this->param['image'])){ 64 if(isset($this->param['image'])){
66 $data = $this->upload(); 65 $data = $this->upload();
67 $this->param['image'] = $data; 66 $this->param['image'] = $data;
68 } 67 }
69 $rs = $this->model->insertGetId($this->param); 68 $rs = $this->model->insertGetId($this->param);
70 RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $rs, $this->user['project_id']); 69 RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $rs, $this->user['project_id']);
71 -// DB::commit();  
72 -// }catch (\Exception $e){  
73 -// DB::rollBack();  
74 -// $this->fail('添加失败');  
75 -// } 70 + DB::commit();
  71 + }catch (\Exception $e){
  72 + DB::rollBack();
  73 + $this->fail('添加失败');
  74 + }
76 return $this->success(); 75 return $this->success();
77 } 76 }
78 77
@@ -134,7 +133,7 @@ class NewsLogic extends BaseLogic @@ -134,7 +133,7 @@ class NewsLogic extends BaseLogic
134 */ 133 */
135 public function news_status(){ 134 public function news_status(){
136 $this->param['operator_id'] = $this->user['id']; 135 $this->param['operator_id'] = $this->user['id'];
137 - $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); 136 + $rs = $this->model->edit($this->param,['id'=>['in',$this->param['id']]]);
138 if($rs === false){ 137 if($rs === false){
139 $this->fail('error'); 138 $this->fail('error');
140 } 139 }
@@ -22,7 +22,7 @@ class WebSettingFromLogic extends BaseLogic @@ -22,7 +22,7 @@ class WebSettingFromLogic extends BaseLogic
22 * @time :2023/5/4 13:43 22 * @time :2023/5/4 13:43
23 */ 23 */
24 public function setting_from_info(){ 24 public function setting_from_info(){
25 - $info = $this->model->read(['project_id'=>$this->user['project_id']]); 25 + $info = $this->model->list(['project_id'=>$this->user['project_id']],'created_at');
26 if($info === false){ 26 if($info === false){
27 $this->fail('当前数据不存在,或者已被删除'); 27 $this->fail('当前数据不存在,或者已被删除');
28 } 28 }
@@ -39,10 +39,9 @@ class WebSettingFromLogic extends BaseLogic @@ -39,10 +39,9 @@ class WebSettingFromLogic extends BaseLogic
39 public function setting_from_save(){ 39 public function setting_from_save(){
40 try { 40 try {
41 //删除以前的数据 41 //删除以前的数据
42 - $param['project_id'] = ['in',$this->user['project_id']];  
43 - $this->model->del($param); 42 + $this->model->del(['project_id'=>$this->user['project_id']]);
44 //新增 43 //新增
45 - $this->model->add($this->param); 44 + $this->model->add($this->param['data']);
46 }catch (\Exception $e){ 45 }catch (\Exception $e){
47 $this->fail('error'); 46 $this->fail('error');
48 } 47 }
@@ -44,7 +44,6 @@ class WebSettingLogic extends BaseLogic @@ -44,7 +44,6 @@ class WebSettingLogic extends BaseLogic
44 //查看数据是否存在 44 //查看数据是否存在
45 $info = $this->model->read(['project_id'=>$this->user['project_id']]); 45 $info = $this->model->read(['project_id'=>$this->user['project_id']]);
46 if($info === false){ 46 if($info === false){
47 - $this->param['operator_id'] = $this->user['id'];  
48 $this->param['project_id'] = $this->user['project_id']; 47 $this->param['project_id'] = $this->user['project_id'];
49 $rs = $this->model->add($this->param); 48 $rs = $this->model->add($this->param);
50 }else{ 49 }else{
  1 +<?php
  2 +
  3 +namespace App\Http\Logic\Bside\Setting;
  4 +
  5 +use App\Http\Logic\Bside\BaseLogic;
  6 +use App\Models\WebSetting\WebSettingReceiving;
  7 +use App\Models\WebSetting\WebSettingText;
  8 +
  9 +class WebSettingReceivingLogic extends BaseLogic
  10 +{
  11 + public function __construct()
  12 + {
  13 + parent::__construct();
  14 + $this->model = new WebSettingReceiving();
  15 + $this->param = $this->requestAll;
  16 + }
  17 +
  18 + /**
  19 + * @name :(列表数据)setting_receiving_lists
  20 + * @author :lyh
  21 + * @method :post
  22 + * @time :2023/5/8 16:17
  23 + */
  24 + public function setting_receiving_lists(){
  25 + $lists = $this->model->list(['project_id'=>$this->user['project_id']]);
  26 + return $this->success($lists);
  27 + }
  28 +
  29 + /**
  30 + * @name :(设置收信账号)setting_receiving_save
  31 + * @author :lyh
  32 + * @method :post
  33 + * @time :2023/5/8 16:26
  34 + */
  35 + public function setting_receiving_save(){
  36 + try {
  37 + $this->model->del(['project_id'=>$this->user['project_id']]);
  38 + foreach ($this->param['data'] as $k => $v){
  39 + $v['project_id'] = $this->user['project_id'];
  40 + $this->param['data'][$k] = $v;
  41 + }
  42 + $this->model->add($this->param['data']);
  43 + }catch (\Exception $e){
  44 + $this->fail('error');
  45 + }
  46 + return $this->success();
  47 + }
  48 +}
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 namespace App\Http\Logic\Bside\Setting; 3 namespace App\Http\Logic\Bside\Setting;
4 4
5 use App\Http\Logic\Bside\BaseLogic; 5 use App\Http\Logic\Bside\BaseLogic;
6 -use App\Models\Image; 6 +use App\Models\File\Image;
7 use App\Models\WebSetting\WebSettingService; 7 use App\Models\WebSetting\WebSettingService;
8 use Illuminate\Support\Facades\DB; 8 use Illuminate\Support\Facades\DB;
9 9
@@ -37,35 +37,15 @@ class WebSettingServiceLogic extends BaseLogic @@ -37,35 +37,15 @@ class WebSettingServiceLogic extends BaseLogic
37 public function setting_service_save(){ 37 public function setting_service_save(){
38 try { 38 try {
39 //删除以前的数据 39 //删除以前的数据
40 - $param['project_id'] = $this->user['project_id'];  
41 - $this->model->del($param); 40 + $this->model->del(['project_id'=>$this->user['project_id']]);
  41 + foreach ($this->param['data'] as $k => $v){
  42 + $v['project_id'] = $this->user['project_id'];
  43 + $this->param['data'][$k] = $v;
  44 + }
42 $this->model->add($this->param['data']); 45 $this->model->add($this->param['data']);
43 }catch (\Exception $e){ 46 }catch (\Exception $e){
44 $this->fail('error'); 47 $this->fail('error');
45 } 48 }
46 return $this->success(); 49 return $this->success();
47 } 50 }
48 -  
49 -  
50 - /**  
51 - * @name :(删除客服图片)setting_service_del  
52 - * @author :lyh  
53 - * @method :post  
54 - * @time :2023/5/4 11:29  
55 - */  
56 - public function setting_service_del(){  
57 - DB::beginTransaction();  
58 - try {  
59 - //获取当前图片资源  
60 - $image = new Image();  
61 - $info = $image->read(['hash'=>$this->param['hash']]);  
62 - if($info !== false){  
63 - $image->del(['id'=>$info['id']]);  
64 - }  
65 - DB::commit();  
66 - }catch (\Exception $e){  
67 - DB::rollBack();  
68 - $this->fail('error');  
69 - }  
70 - }  
71 } 51 }
  1 +<?php
  2 +
  3 +namespace App\Http\Logic\Bside\Setting;
  4 +
  5 +use App\Http\Logic\Bside\BaseLogic;
  6 +use App\Models\WebSetting\WebSetting;
  7 +use App\Models\WebSetting\WebSettingText;
  8 +use Illuminate\Support\Facades\DB;
  9 +
  10 +class WebSettingTextLogic extends BaseLogic
  11 +{
  12 + public function __construct()
  13 + {
  14 + parent::__construct();
  15 +
  16 + $this->model = new WebSettingText();
  17 + $this->param = $this->requestAll;
  18 + }
  19 +
  20 + /**
  21 + * @name :(查询设置详情)setting_read
  22 + * @author :lyh
  23 + * @method :post
  24 + * @time :2023/5/8 15:56
  25 + */
  26 + public function setting_read(){
  27 + $web_setting = new WebSetting();
  28 + $setting_info = $web_setting->read(['project_id'=>$this->user['project_id']],['anchor_setting','anchor_is_enable','anchor_num']);
  29 + return $setting_info;
  30 + }
  31 +
  32 + /**
  33 + * @name :(描文本详情)setting_text_lists
  34 + * @author :lyh
  35 + * @method :post
  36 + * @time :2023/5/8 14:18
  37 + */
  38 + public function setting_text_lists(){
  39 + $lists['data'] = $this->model->list(['project_id'=>$this->user['project_id']],'created_at',['key_words','url']);
  40 + $lists['anchor_info'] = $this->setting_read();
  41 + $anchor_text = $this->model->anchor_text;
  42 + $lists['anchor_text'] = $anchor_text;
  43 + return $this->success($lists);
  44 + }
  45 +
  46 + /**
  47 + * @name :(设置描文本)setting_text_save
  48 + * @author :lyh
  49 + * @method :post
  50 + * @time :2023/5/8 14:39
  51 + */
  52 + public function setting_text_save(){
  53 + $web_setting = new WebSetting();
  54 + $setting_info = $this->setting_read();
  55 + if(count($this->param['data']) > $setting_info['anchor_num']){
  56 + $this->fail('超过最大设置限制');
  57 + }
  58 + DB::beginTransaction();
  59 + try {
  60 + //更新描文本设置
  61 + $data = [
  62 + 'anchor_setting'=>$this->param['anchor_setting'],
  63 + 'anchor_is_enable'=>$this->param['anchor_is_enable'],
  64 + 'anchor_num'=>$this->param['anchor_num']
  65 + ];
  66 + $web_setting->edit($data,['project_id'=>$this->user['project_id']]);
  67 + $this->model->del(['project_id'=>$this->user['project_id']]);
  68 + foreach ($this->param['data'] as $k => $v){
  69 + $v['project_id'] = $this->user['project_id'];
  70 + $this->param['data'][$k] = $v;
  71 + }
  72 + $this->model->add($this->param['data']);
  73 + DB::commit();
  74 + }catch (\Exception $e){
  75 + DB::rollBack();
  76 + $this->fail('更新失败');
  77 + }
  78 + $this->success();
  79 + }
  80 +}
@@ -3,9 +3,7 @@ @@ -3,9 +3,7 @@
3 namespace App\Http\Logic\Bside\User; 3 namespace App\Http\Logic\Bside\User;
4 4
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 -use App\Helper\Common;  
7 use App\Http\Logic\Bside\BaseLogic; 6 use App\Http\Logic\Bside\BaseLogic;
8 -use App\Models\Image;  
9 use App\Models\User\User; 7 use App\Models\User\User;
10 8
11 class UserLogic extends BaseLogic 9 class UserLogic extends BaseLogic
  1 +<?php
  2 +
  3 +namespace App\Http\Requests\Bside\AyrShare;
  4 +
  5 +use Illuminate\Foundation\Http\FormRequest;
  6 +
  7 +class AyrShareRequest extends FormRequest
  8 +{
  9 + /**
  10 + * Determine if the user is authorized to make this request.
  11 + *
  12 + * @return bool
  13 + */
  14 + public function authorize()
  15 + {
  16 + return true;
  17 + }
  18 +
  19 +}
@@ -26,7 +26,7 @@ class BlogCategoryRequest extends FormRequest @@ -26,7 +26,7 @@ class BlogCategoryRequest extends FormRequest
26 return [ 26 return [
27 'name'=>'required|max:100', 27 'name'=>'required|max:100',
28 'remark'=>'required|max:255', 28 'remark'=>'required|max:255',
29 - 'alias'=>'required|max:10|unique:gl_blog_category,alias', 29 + 'alias'=>'required|max:10',
30 ]; 30 ];
31 } 31 }
32 32
@@ -37,8 +37,8 @@ class BlogCategoryRequest extends FormRequest @@ -37,8 +37,8 @@ class BlogCategoryRequest extends FormRequest
37 'name.max'=>'名称最大100字', 37 'name.max'=>'名称最大100字',
38 'remark.required'=>'请填写简介', 38 'remark.required'=>'请填写简介',
39 'remark.max'=>'简介最大255字', 39 'remark.max'=>'简介最大255字',
40 - 'remark.required'=>'请填写别名',  
41 - 'remark.max'=>'别名最大10字', 40 + 'alias.required'=>'请填写别名',
  41 + 'alias.max'=>'别名最大10字',
42 ]; 42 ];
43 } 43 }
44 } 44 }
@@ -26,7 +26,7 @@ class NewsCategoryRequest extends FormRequest @@ -26,7 +26,7 @@ class NewsCategoryRequest extends FormRequest
26 return [ 26 return [
27 'name'=>'required|max:100', 27 'name'=>'required|max:100',
28 'remark'=>'required|max:255', 28 'remark'=>'required|max:255',
29 - 'alias'=>'required|max:10|unique:gl_news_category,alias', 29 + 'alias'=>'required|max:10',
30 ]; 30 ];
31 } 31 }
32 32
@@ -37,8 +37,8 @@ class NewsCategoryRequest extends FormRequest @@ -37,8 +37,8 @@ class NewsCategoryRequest extends FormRequest
37 'name.max'=>'名称最大100字', 37 'name.max'=>'名称最大100字',
38 'remark.required'=>'请填写简介', 38 'remark.required'=>'请填写简介',
39 'remark.max'=>'简介最大255字', 39 'remark.max'=>'简介最大255字',
40 - 'remark.required'=>'请填写别名',  
41 - 'remark.max'=>'别名最大10字', 40 + 'alias.required'=>'请填写一下别名',
  41 + 'alias.max'=>'别名最大10字',
42 ]; 42 ];
43 } 43 }
44 } 44 }
  1 +<?php
  2 +
  3 +namespace App\Models\AyrShare;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +class AyrRelease extends Base
  8 +{
  9 + protected $table = 'gl_ayr_release';
  10 +}
  1 +<?php
  2 +
  3 +namespace App\Models\AyrShare;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +class AyrShare extends Base
  8 +{
  9 + protected $table = 'gl_ayr_share';
  10 +}
@@ -112,6 +112,17 @@ class Base extends Model @@ -112,6 +112,17 @@ class Base extends Model
112 $info = $info->toArray(); 112 $info = $info->toArray();
113 return $info; 113 return $info;
114 } 114 }
  115 +
  116 + /**
  117 + * @name :(获取数据条数)count
  118 + * @author :lyh
  119 + * @method :post
  120 + * @time :2023/5/8 15:51
  121 + */
  122 + public function get_count($condition){
  123 + $query = $this->formatQuery($condition);
  124 + $query->count();
  125 + }
115 /** 126 /**
116 * @name :新增 127 * @name :新增
117 * @return void 128 * @return void
@@ -130,6 +141,9 @@ class Base extends Model @@ -130,6 +141,9 @@ class Base extends Model
130 * @method post 141 * @method post
131 */ 142 */
132 public function edit($data,$condition){ 143 public function edit($data,$condition){
  144 + if(isset($data['id']) && !empty($data['id'])){
  145 + unset($data['id']);
  146 + }
133 $query = $this->formatQuery($condition); 147 $query = $this->formatQuery($condition);
134 $data['updated_at'] = date('Y-m-d H:i:s'); 148 $data['updated_at'] = date('Y-m-d H:i:s');
135 return $query->update($data); 149 return $query->update($data);
  1 +<?php
  2 +
  3 +namespace App\Models\File;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +class File extends Base
  8 +{
  9 + protected $table = 'gl_file';
  10 +}
1 <?php 1 <?php
2 2
3 -namespace App\Models; 3 +namespace App\Models\File;
  4 +
  5 +use App\Models\Base;
4 6
5 class Image extends Base 7 class Image extends Base
6 { 8 {
@@ -7,4 +7,5 @@ use App\Models\Base; @@ -7,4 +7,5 @@ use App\Models\Base;
7 class WebSetting extends Base 7 class WebSetting extends Base
8 { 8 {
9 protected $table = 'gl_web_setting'; 9 protected $table = 'gl_web_setting';
  10 +
10 } 11 }
  1 +<?php
  2 +
  3 +namespace App\Models\WebSetting;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +class WebSettingReceiving extends Base
  8 +{
  9 + protected $table = 'gl_web_setting_receiving';
  10 +}
  1 +<?php
  2 +
  3 +namespace App\Models\WebSetting;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +class WebSettingText extends Base
  8 +{
  9 + protected $table = 'gl_web_setting_text';
  10 +
  11 + //定义常量参数
  12 + const TYPE_PAGE = 1;
  13 + const TYPE_PRODUCT = 2;
  14 + const TYPE_KEYWORD = 3;
  15 + const TYPE_NEWS = 4;
  16 + const TYPE_BLOG = 6;
  17 + /**
  18 + * @var :描文本设置
  19 + */
  20 + public $anchor_text = [
  21 + self::TYPE_PAGE => '单页面',
  22 + self::TYPE_PRODUCT=>'产品页',
  23 + self::TYPE_KEYWORD=>'关键词页',
  24 + self::TYPE_NEWS=>'新闻页',
  25 + self::TYPE_BLOG=>'博客页',
  26 + ];
  27 +}
  1 +<?php
  2 +
  3 +return [
  4 +
  5 +];
@@ -131,6 +131,16 @@ Route::middleware(['bloginauth'])->group(function () { @@ -131,6 +131,16 @@ Route::middleware(['bloginauth'])->group(function () {
131 Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingServiceController::class, 'lists'])->name('web_setting_service_lists'); 131 Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingServiceController::class, 'lists'])->name('web_setting_service_lists');
132 Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingServiceController::class, 'save'])->name('web_setting_service_save'); 132 Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingServiceController::class, 'save'])->name('web_setting_service_save');
133 }); 133 });
  134 + //客服设置
  135 + Route::prefix('text')->group(function () {
  136 + Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingTextController::class, 'lists'])->name('web_setting_text_lists');
  137 + Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingTextController::class, 'save'])->name('web_setting_text_save');
  138 + });
  139 + //收信设置
  140 + Route::prefix('receiving')->group(function () {
  141 + Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingReceivingController::class, 'lists'])->name('web_setting_receiving_lists');
  142 + Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingReceivingController::class, 'save'])->name('web_setting_receiving_save');
  143 + });
134 144
135 }); 145 });
136 //产品 146 //产品
@@ -178,8 +188,9 @@ Route::middleware(['bloginauth'])->group(function () { @@ -178,8 +188,9 @@ Route::middleware(['bloginauth'])->group(function () {
178 Route::prefix('file')->group(function () { 188 Route::prefix('file')->group(function () {
179 Route::post('/upload', [\App\Http\Controllers\Bside\FileController::class, 'upload'])->name('file_upload'); 189 Route::post('/upload', [\App\Http\Controllers\Bside\FileController::class, 'upload'])->name('file_upload');
180 }); 190 });
  191 + //图片操作
181 Route::prefix('images')->group(function () { 192 Route::prefix('images')->group(function () {
182 - Route::post('/upload', [\App\Http\Controllers\ImageController::class, 'upload'])->name('image_upload'); 193 + Route::post('/upload', [\App\Http\Controllers\file\ImageController::class, 'upload'])->name('image_upload');
183 }); 194 });
184 195
185 //精准询盘 196 //精准询盘
@@ -194,6 +205,14 @@ Route::middleware(['bloginauth'])->group(function () { @@ -194,6 +205,14 @@ Route::middleware(['bloginauth'])->group(function () {
194 Route::prefix('route')->group(function () { 205 Route::prefix('route')->group(function () {
195 Route::any('/create', [\App\Http\Controllers\Bside\RouteController::class, 'create'])->name('create_route'); 206 Route::any('/create', [\App\Http\Controllers\Bside\RouteController::class, 'create'])->name('create_route');
196 }); 207 });
  208 +
  209 + //社交绑定
  210 + Route::prefix('ayr')->group(function () {
  211 + Route::any('/lists', [\App\Http\Controllers\Bside\AyrShare\AyrShareController::class, 'lists'])->name('ayr_lists');
  212 + Route::any('/create', [\App\Http\Controllers\Bside\AyrShare\AyrShareController::class, 'create_account'])->name('ayr_create_account');
  213 + Route::any('/del', [\App\Http\Controllers\Bside\AyrShare\AyrShareController::class, 'del_account'])->name('ayr_del_account');
  214 + Route::any('/bind', [\App\Http\Controllers\Bside\AyrShare\AyrShareController::class, 'bind_account'])->name('ayr_bind_account');
  215 + });
197 }); 216 });
198 217
199 //无需登录验证的路由组 218 //无需登录验证的路由组
@@ -201,5 +220,5 @@ Route::group([], function () { @@ -201,5 +220,5 @@ Route::group([], function () {
201 Route::any('/login', [\App\Http\Controllers\Bside\ComController::class, 'login'])->name('login'); 220 Route::any('/login', [\App\Http\Controllers\Bside\ComController::class, 'login'])->name('login');
202 Route::any('/', [\App\Http\Controllers\Bside\ComController::class, 'get_country'])->name('get_country'); 221 Route::any('/', [\App\Http\Controllers\Bside\ComController::class, 'get_country'])->name('get_country');
203 Route::get('/file/download', [\App\Http\Controllers\Bside\FileController::class, 'download'])->name('file_download'); 222 Route::get('/file/download', [\App\Http\Controllers\Bside\FileController::class, 'download'])->name('file_download');
204 - Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\ImageController::class,'index'])->name('image_show'); 223 + Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\file\ImageController::class,'index'])->name('image_show');
205 }); 224 });