Merge branch 'develop' into lms
正在显示
46 个修改的文件
包含
683 行增加
和
737 行删除
| @@ -23,6 +23,9 @@ class Kernel extends ConsoleKernel | @@ -23,6 +23,9 @@ class Kernel extends ConsoleKernel | ||
| 23 | $schedule->command('rank_data_recomm_domain')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次 | 23 | $schedule->command('rank_data_recomm_domain')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次 |
| 24 | $schedule->command('rank_data_week')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次 | 24 | $schedule->command('rank_data_week')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次 |
| 25 | $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次 | 25 | $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次 |
| 26 | + $schedule->command('visit', ['type' => 1])->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次 | ||
| 27 | + $schedule->command('visit', ['type' => 2])->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次 | ||
| 28 | + $schedule->command('visit', ['type' => 3])->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次 | ||
| 26 | } | 29 | } |
| 27 | 30 | ||
| 28 | /** | 31 | /** |
app/Exceptions/CsideGlobalException.php
已删除
100644 → 0
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Exceptions; | ||
| 4 | - | ||
| 5 | -use App\Enums\Common\Code; | ||
| 6 | -use Exception; | ||
| 7 | -use Throwable; | ||
| 8 | - | ||
| 9 | -/** | ||
| 10 | - * @notes: C端接口统一错误格式 | ||
| 11 | - * Class CsideGlobalException | ||
| 12 | - * @package App\Exceptions | ||
| 13 | - */ | ||
| 14 | -class CsideGlobalException extends Exception | ||
| 15 | -{ | ||
| 16 | - public function __construct($code = 0, $message = "", Throwable $previous = null) | ||
| 17 | - { | ||
| 18 | - $this->code = $code; | ||
| 19 | - $this->message = $message; | ||
| 20 | - if (empty($this->message)) { | ||
| 21 | - $this->message = Code::fromValue($code)->description; | ||
| 22 | - } | ||
| 23 | - } | ||
| 24 | -} |
| @@ -72,10 +72,6 @@ class Handler extends ExceptionHandler | @@ -72,10 +72,6 @@ class Handler extends ExceptionHandler | ||
| 72 | elseif($exception instanceof BsideGlobalException) { | 72 | elseif($exception instanceof BsideGlobalException) { |
| 73 | LogUtils::error("BsideGlobalException", [], $exceptionMessage); | 73 | LogUtils::error("BsideGlobalException", [], $exceptionMessage); |
| 74 | } | 74 | } |
| 75 | - //C端错误 | ||
| 76 | - elseif($exception instanceof CsideGlobalException) { | ||
| 77 | - LogUtils::error("CsideGlobalException", [], $exceptionMessage); | ||
| 78 | - } | ||
| 79 | //验证错误(非手动抛出) | 75 | //验证错误(非手动抛出) |
| 80 | elseif ($exception instanceof ValidationException) { | 76 | elseif ($exception instanceof ValidationException) { |
| 81 | LogUtils::error("参数验证失败", [], $exceptionMessage); | 77 | LogUtils::error("参数验证失败", [], $exceptionMessage); |
| @@ -114,9 +110,7 @@ class Handler extends ExceptionHandler | @@ -114,9 +110,7 @@ class Handler extends ExceptionHandler | ||
| 114 | $code = $exception->getCode(); | 110 | $code = $exception->getCode(); |
| 115 | }elseif ($exception instanceof BsideGlobalException) { | 111 | }elseif ($exception instanceof BsideGlobalException) { |
| 116 | $code = $exception->getCode(); | 112 | $code = $exception->getCode(); |
| 117 | - }elseif ($exception instanceof CsideGlobalException) { | ||
| 118 | - $code = $exception->getCode(); | ||
| 119 | - } elseif ($exception instanceof ValidationException) { | 113 | + }elseif ($exception instanceof ValidationException) { |
| 120 | $code = Code::USER_PARAMS_ERROE(); | 114 | $code = Code::USER_PARAMS_ERROE(); |
| 121 | $message = $code->description = Arr::first(Arr::first($exception->errors())); | 115 | $message = $code->description = Arr::first(Arr::first($exception->errors())); |
| 122 | } elseif ($exception instanceof NotFoundHttpException || $exception instanceof MethodNotAllowedHttpException) { | 116 | } elseif ($exception instanceof NotFoundHttpException || $exception instanceof MethodNotAllowedHttpException) { |
| @@ -103,6 +103,7 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K | @@ -103,6 +103,7 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K | ||
| 103 | return $this->http_click('get',$url,[],$this->headers); | 103 | return $this->http_click('get',$url,[],$this->headers); |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | + | ||
| 106 | /** | 107 | /** |
| 107 | * @name :(发帖)post_send_msg | 108 | * @name :(发帖)post_send_msg |
| 108 | * @author :lyh | 109 | * @author :lyh |
| @@ -113,12 +114,33 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K | @@ -113,12 +114,33 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K | ||
| 113 | */ | 114 | */ |
| 114 | public function post_send_msg($param,$api_key){ | 115 | public function post_send_msg($param,$api_key){ |
| 115 | //平台参数处理 | 116 | //平台参数处理 |
| 116 | - $this->headers['Accept-Encoding'] = 'gzip'; | ||
| 117 | - $this->headers['Authorization'] = $this->headers['Authorization'].$api_key; | 117 | +// $this->headers['Accept-Encoding'] = 'gzip'; |
| 118 | +// $this->headers['Authorization'] = $this->headers['Authorization'].$api_key; | ||
| 119 | + $param['idempotencyKey'] = uniqid().time(); | ||
| 118 | $url = $this->path.'/api/post'; | 120 | $url = $this->path.'/api/post'; |
| 119 | - return $this->http_click('posts',$url,$param,$this->headers); | 121 | + return $this->http_post_ayr($url,$param,$api_key); |
| 122 | + } | ||
| 123 | + public function http_post_ayr($url,$param,$api_key){ | ||
| 124 | + $curl = curl_init(); | ||
| 125 | + curl_setopt_array($curl, array( | ||
| 126 | + CURLOPT_URL => $url, | ||
| 127 | + CURLOPT_RETURNTRANSFER => true, | ||
| 128 | + CURLOPT_ENCODING => '', | ||
| 129 | + CURLOPT_MAXREDIRS => 10, | ||
| 130 | + CURLOPT_TIMEOUT => 0, | ||
| 131 | + CURLOPT_FOLLOWLOCATION => true, | ||
| 132 | + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, | ||
| 133 | + CURLOPT_CUSTOMREQUEST => 'POST', | ||
| 134 | + CURLOPT_POSTFIELDS => http_build_query($param), | ||
| 135 | + CURLOPT_HTTPHEADER => array( | ||
| 136 | + 'Authorization: Bearer '.$api_key, | ||
| 137 | + 'Accept-Encoding: gzip' | ||
| 138 | + ), | ||
| 139 | + )); | ||
| 140 | + $response = curl_exec($curl); | ||
| 141 | + curl_close($curl); | ||
| 142 | + return $response; | ||
| 120 | } | 143 | } |
| 121 | - | ||
| 122 | /** | 144 | /** |
| 123 | * @name :(上传图片或视频到ayr_share)post_media_upload | 145 | * @name :(上传图片或视频到ayr_share)post_media_upload |
| 124 | * @author :lyh | 146 | * @author :lyh |
app/Helper/FormGlobalsoApi.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +namespace App\Helper; | ||
| 5 | + | ||
| 6 | +use App\Utils\HttpUtils; | ||
| 7 | +use GuzzleHttp\Exception\GuzzleException; | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * Class FormGlobalsoApi | ||
| 12 | + * @package App\Helper | ||
| 13 | + * @author zbj | ||
| 14 | + * @date 2023/5/17 | ||
| 15 | + */ | ||
| 16 | +class FormGlobalsoApi | ||
| 17 | +{ | ||
| 18 | + //接口地址 | ||
| 19 | + protected $url = 'https://form.globalso.com'; | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 设置询盘通知 | ||
| 23 | + * @author zbj | ||
| 24 | + * @date 2023/5/17 | ||
| 25 | + */ | ||
| 26 | + public function setInquiry($domain, $emails, $phones) | ||
| 27 | + { | ||
| 28 | + $api_url = $this->url . '/api/external-project/save/dc77a54480b184c4'; | ||
| 29 | + | ||
| 30 | + $params = [ | ||
| 31 | + 'token' => md5($domain.$emails.$phones.date("Y-m-d")), | ||
| 32 | + 'domain' => $domain, | ||
| 33 | + 'email' => $emails, | ||
| 34 | + 'phone' => $phones, | ||
| 35 | + ]; | ||
| 36 | + | ||
| 37 | + try { | ||
| 38 | + $res = HttpUtils::get($api_url, $params); | ||
| 39 | + $res = Arr::s2a($res); | ||
| 40 | + } catch (\Exception | GuzzleException $e) { | ||
| 41 | + errorLog('设置询盘通知', $params, $e); | ||
| 42 | + return false; | ||
| 43 | + } | ||
| 44 | + return $res; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 询盘列表 | ||
| 49 | + * @author zbj | ||
| 50 | + * @date 2023/5/17 | ||
| 51 | + */ | ||
| 52 | + public function getInquiryList($domain, $search = '', $page = 1, $page_size = 20) | ||
| 53 | + { | ||
| 54 | + $api_url = $this->url . '/api/external-interface/6a1bd159b1fd60af'; | ||
| 55 | + | ||
| 56 | + $params = [ | ||
| 57 | + 'token' => md5($domain.$search.date("Y-m-d")), | ||
| 58 | + 'domain' => $domain, | ||
| 59 | + 'limit' => $page_size, | ||
| 60 | + 'page' => $page, | ||
| 61 | + 'source' => '1,3' //来源类型 新项目用1,3 | ||
| 62 | + ]; | ||
| 63 | + if($search){ | ||
| 64 | + $params['name'] = $search; | ||
| 65 | + } | ||
| 66 | + try { | ||
| 67 | + $res = HttpUtils::get($api_url, $params); | ||
| 68 | + $res = Arr::s2a($res); | ||
| 69 | + } catch (\Exception | GuzzleException $e) { | ||
| 70 | + errorLog('询盘列表', $params, $e); | ||
| 71 | + return false; | ||
| 72 | + } | ||
| 73 | + return $res; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * 设置询盘信息已读 | ||
| 78 | + * @author zbj | ||
| 79 | + * @date 2023/5/17 | ||
| 80 | + */ | ||
| 81 | + public function saveInquiryRead($domain, $id) | ||
| 82 | + { | ||
| 83 | + $api_url = $this->url . '/api/external-interface/save/d1483a8e57cb485a'; | ||
| 84 | + | ||
| 85 | + $params = [ | ||
| 86 | + 'token' => md5($domain.$id.date("Y-m-d")), | ||
| 87 | + 'domain' => $domain, | ||
| 88 | + 'id' => $id, | ||
| 89 | + ]; | ||
| 90 | + | ||
| 91 | + try { | ||
| 92 | + $res = HttpUtils::get($api_url, $params); | ||
| 93 | + $res = Arr::s2a($res); | ||
| 94 | + } catch (\Exception | GuzzleException $e) { | ||
| 95 | + errorLog('设置询盘信息已读', $params, $e); | ||
| 96 | + return false; | ||
| 97 | + } | ||
| 98 | + return $res; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + /** | ||
| 102 | + * 删除询盘信息 | ||
| 103 | + * @author zbj | ||
| 104 | + * @date 2023/5/17 | ||
| 105 | + */ | ||
| 106 | + public function delInquiry($domain, $ids) | ||
| 107 | + { | ||
| 108 | + $api_url = $this->url . '/api/external-interface/del/c4b11cf6f1508489'; | ||
| 109 | + $ids = Arr::arrToSet($ids); | ||
| 110 | + $params = [ | ||
| 111 | + 'token' => md5($domain.$ids.date("Y-m-d")), | ||
| 112 | + 'domain' => $domain, | ||
| 113 | + 'id' => $ids, | ||
| 114 | + ]; | ||
| 115 | + try { | ||
| 116 | + $res = HttpUtils::get($api_url, $params); | ||
| 117 | + $res = Arr::s2a($res); | ||
| 118 | + } catch (\Exception | GuzzleException $e) { | ||
| 119 | + errorLog('删除询盘信息', $params, $e); | ||
| 120 | + return false; | ||
| 121 | + } | ||
| 122 | + return $res; | ||
| 123 | + } | ||
| 124 | +} |
| @@ -64,7 +64,7 @@ if(!function_exists('http_post')){ | @@ -64,7 +64,7 @@ if(!function_exists('http_post')){ | ||
| 64 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | 64 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
| 65 | $res = curl_exec($ch); | 65 | $res = curl_exec($ch); |
| 66 | if (curl_errno($ch)) { | 66 | if (curl_errno($ch)) { |
| 67 | - Log::write(print_r(curl_errno($ch),1),'debug---1'); | 67 | + \Illuminate\Support\Facades\Log::write(print_r(curl_errno($ch),1),'debug---1'); |
| 68 | } | 68 | } |
| 69 | curl_close($ch); | 69 | curl_close($ch); |
| 70 | return json_decode($res, true); | 70 | return json_decode($res, true); |
| @@ -139,7 +139,7 @@ if (!function_exists('checkDomain')) { | @@ -139,7 +139,7 @@ if (!function_exists('checkDomain')) { | ||
| 139 | return false; | 139 | return false; |
| 140 | } | 140 | } |
| 141 | if (preg_match('/^(?:[-A-Za-z0-9]+\.)+[A-Za-z]{2,6}$/', $host)) { | 141 | if (preg_match('/^(?:[-A-Za-z0-9]+\.)+[A-Za-z]{2,6}$/', $host)) { |
| 142 | - return $scheme . '://' . $host; | 142 | + return $scheme . '://' . $host . '/'; |
| 143 | } else { | 143 | } else { |
| 144 | return false; | 144 | return false; |
| 145 | } | 145 | } |
| @@ -6,6 +6,7 @@ use App\Helper\Arr; | @@ -6,6 +6,7 @@ use App\Helper\Arr; | ||
| 6 | use App\Http\Controllers\Aside\BaseController; | 6 | use App\Http\Controllers\Aside\BaseController; |
| 7 | use App\Http\Logic\Aside\Project\ProjectLogic; | 7 | use App\Http\Logic\Aside\Project\ProjectLogic; |
| 8 | use App\Http\Requests\Aside\Project\ProjectRequest; | 8 | use App\Http\Requests\Aside\Project\ProjectRequest; |
| 9 | +use App\Models\InquirySet; | ||
| 9 | use App\Rules\Ids; | 10 | use App\Rules\Ids; |
| 10 | use Illuminate\Http\Request; | 11 | use Illuminate\Http\Request; |
| 11 | 12 | ||
| @@ -47,4 +48,34 @@ class ProjectController extends BaseController | @@ -47,4 +48,34 @@ class ProjectController extends BaseController | ||
| 47 | $data = $logic->save($this->param); | 48 | $data = $logic->save($this->param); |
| 48 | return $this->success($data); | 49 | return $this->success($data); |
| 49 | } | 50 | } |
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * 询盘通知设置 | ||
| 54 | + * @param ProjectRequest $request | ||
| 55 | + * @param ProjectLogic $logic | ||
| 56 | + * @return \Illuminate\Http\JsonResponse | ||
| 57 | + * @throws \Psr\Container\ContainerExceptionInterface | ||
| 58 | + * @throws \Psr\Container\NotFoundExceptionInterface | ||
| 59 | + * @author zbj | ||
| 60 | + * @date 2023/5/17 | ||
| 61 | + */ | ||
| 62 | + public function inquiry_set(Request $request, ProjectLogic $logic){ | ||
| 63 | + $request->validate([ | ||
| 64 | + 'project_id'=>'required' | ||
| 65 | + ],[ | ||
| 66 | + 'project_id.required' => '项目ID不能为空' | ||
| 67 | + ]); | ||
| 68 | + if($request->isMethod('get')){ | ||
| 69 | + $data = InquirySet::where('project_id', $request->project_id)->first(); | ||
| 70 | + if(!$data){ | ||
| 71 | + $data = ['emails' => '', 'phones' => '']; | ||
| 72 | + }else{ | ||
| 73 | + $data = $data->toArray(); | ||
| 74 | + } | ||
| 75 | + return $this->success($data); | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + $data = $logic->saveInquirySet($this->param); | ||
| 79 | + return $this->success($data); | ||
| 80 | + } | ||
| 50 | } | 81 | } |
| @@ -7,7 +7,7 @@ use App\Helper\AyrShare as AyrShareHelper; | @@ -7,7 +7,7 @@ use App\Helper\AyrShare as AyrShareHelper; | ||
| 7 | use App\Http\Controllers\Bside\BaseController; | 7 | use App\Http\Controllers\Bside\BaseController; |
| 8 | use App\Http\Logic\Bside\AyrShare\AyrReleaseLogic; | 8 | use App\Http\Logic\Bside\AyrShare\AyrReleaseLogic; |
| 9 | use App\Http\Logic\Bside\AyrShare\AyrShareLogic; | 9 | use App\Http\Logic\Bside\AyrShare\AyrShareLogic; |
| 10 | -use App\Http\Requests\Bside\AyrRelease\AyrReleaseRequest; | 10 | +use App\Http\Requests\Bside\AyrShare\AyrReleaseRequest; |
| 11 | 11 | ||
| 12 | /** | 12 | /** |
| 13 | * @name:社交发布 | 13 | * @name:社交发布 |
| @@ -34,7 +34,7 @@ class AyrReleaseController extends BaseController | @@ -34,7 +34,7 @@ class AyrReleaseController extends BaseController | ||
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | /** | 36 | /** |
| 37 | - * @name :(获取当前用户已绑定的社交链接)info | 37 | + * @name :(获取当前用户已绑定的社交链接) |
| 38 | * @author :lyh | 38 | * @author :lyh |
| 39 | * @method :post | 39 | * @method :post |
| 40 | * @time :2023/5/9 16:00 | 40 | * @time :2023/5/9 16:00 |
| @@ -61,24 +61,29 @@ class AyrReleaseController extends BaseController | @@ -61,24 +61,29 @@ class AyrReleaseController extends BaseController | ||
| 61 | $share_info = $ayrShareLogic->ayr_share_info($this->param['share_id']); | 61 | $share_info = $ayrShareLogic->ayr_share_info($this->param['share_id']); |
| 62 | //验证发送平台 | 62 | //验证发送平台 |
| 63 | $ayrShareLogic->verify_param($share_info); | 63 | $ayrShareLogic->verify_param($share_info); |
| 64 | - $data = [ | ||
| 65 | - 'images'=>$this->param['images'], | ||
| 66 | - 'files'=>$this->param['video'], | ||
| 67 | - ]; | 64 | + if(isset($this->param['video']) && !empty($this->param['video'])){ |
| 65 | + $data['files'] = $this->param['video']; | ||
| 66 | + } | ||
| 67 | + if(isset($this->param['images']) && !empty($this->param['images'])){ | ||
| 68 | + $data['images'] = $this->param['images']; | ||
| 69 | + } | ||
| 68 | //参数处理 | 70 | //参数处理 |
| 69 | - $this->param['mediaUrls'] = $ayrReleaseLogic->image_file_param($data);; | 71 | + $this->param['mediaUrls'] = $ayrReleaseLogic->image_file_param($data); |
| 72 | + //时间处理 | ||
| 73 | + $datetime = new \DateTime($this->param['schedule_date']); | ||
| 74 | + $formattedTime = $datetime->format("Y-m-d\TH:i:s\Z"); | ||
| 70 | //统一生成发布 | 75 | //统一生成发布 |
| 71 | $param = [ | 76 | $param = [ |
| 72 | 'post'=>$this->param['content'], | 77 | 'post'=>$this->param['content'], |
| 73 | 'platforms'=>$this->param['platforms'], | 78 | 'platforms'=>$this->param['platforms'], |
| 74 | 'mediaUrls'=>$this->param['mediaUrls'],//参数处理 | 79 | 'mediaUrls'=>$this->param['mediaUrls'],//参数处理 |
| 75 | - 'idempotencyKey'=>$this->param['idempotency_key'],//时间(如是过去时间,立即发布) | 80 | + 'scheduleDate'=>$formattedTime,//时间(如是过去时间,立即发布) |
| 76 | ]; | 81 | ]; |
| 77 | //发送请求发布社交文章 | 82 | //发送请求发布社交文章 |
| 78 | $res = $ayrShare->post_send_msg($param,$share_info['profile_key']); | 83 | $res = $ayrShare->post_send_msg($param,$share_info['profile_key']); |
| 79 | //保存数据库 | 84 | //保存数据库 |
| 80 | $ayrReleaseLogic->release_add(); | 85 | $ayrReleaseLogic->release_add(); |
| 81 | - $this->response('success',Code::SUCCESS,$res); | 86 | + $this->response('success',Code::SUCCESS,json_decode($res)); |
| 82 | } | 87 | } |
| 83 | 88 | ||
| 84 | /** | 89 | /** |
| @@ -95,19 +100,16 @@ class AyrReleaseController extends BaseController | @@ -95,19 +100,16 @@ class AyrReleaseController extends BaseController | ||
| 95 | 'share_id.required' => 'SHARE_ID不能为空', | 100 | 'share_id.required' => 'SHARE_ID不能为空', |
| 96 | 'hash.required' => 'HASH不能为空' | 101 | 'hash.required' => 'HASH不能为空' |
| 97 | ]); | 102 | ]); |
| 98 | - $image_info = $ayrShareLogic->save_img_info($this->param['hash']); | ||
| 99 | - if(empty($image_info['ayr_id'])){ | ||
| 100 | - //获取发送账号详情 | ||
| 101 | - $share_info = $ayrShareLogic->ayr_share_info(); | ||
| 102 | - //向第三方存储图片 | ||
| 103 | - $param = [ | ||
| 104 | - 'file'=>$ayrShareLogic->base_img_content($this->param['hash']),//base64编码 | ||
| 105 | - ]; | ||
| 106 | - $param_data = $ayrShare->post_media_upload($param,$share_info['profile_key']); | ||
| 107 | - //更新图片库 | ||
| 108 | - $ayrShareLogic->save_img($param_data); | ||
| 109 | - } | ||
| 110 | - $this->response('success',Code::SUCCESS,$image_info); | 103 | + //获取发送账号详情 |
| 104 | + $share_info = $ayrShareLogic->ayr_share_info(); | ||
| 105 | + //向第三方存储图片 | ||
| 106 | + $param = [ | ||
| 107 | + 'file'=>$ayrShareLogic->base_img_content($this->param['hash']),//base64编码 | ||
| 108 | + ]; | ||
| 109 | + $param_data = $ayrShare->post_media_upload($param,$share_info['profile_key']); | ||
| 110 | + //更新图片库 | ||
| 111 | + $ayrShareLogic->save_img($param_data); | ||
| 112 | + $this->response('success',Code::SUCCESS,$param_data); | ||
| 111 | } | 113 | } |
| 112 | 114 | ||
| 113 | /** | 115 | /** |
| @@ -124,18 +126,15 @@ class AyrReleaseController extends BaseController | @@ -124,18 +126,15 @@ class AyrReleaseController extends BaseController | ||
| 124 | 'share_id.required' => 'SHARE_ID不能为空', | 126 | 'share_id.required' => 'SHARE_ID不能为空', |
| 125 | 'hash.required' => 'HASH不能为空' | 127 | 'hash.required' => 'HASH不能为空' |
| 126 | ]); | 128 | ]); |
| 127 | - $image_info = $ayrShareLogic->save_file_info($this->param['hash']); | ||
| 128 | - if(empty($image_info['ayr_id'])){ | ||
| 129 | - //获取发送账号详情 | ||
| 130 | - $share_info = $ayrShareLogic->ayr_share_info(); | ||
| 131 | - //向第三方存储图片 | ||
| 132 | - $param = [ | ||
| 133 | - 'file'=>$ayrShareLogic->base_img_content($this->param['hash']),//base64编码 | ||
| 134 | - ]; | ||
| 135 | - $param_data = $ayrShare->post_media_upload($param,$share_info['profile_key']); | ||
| 136 | - //更新图片库 | ||
| 137 | - $ayrShareLogic->save_file($param_data); | ||
| 138 | - } | 129 | + //获取发送账号详情 |
| 130 | + $share_info = $ayrShareLogic->ayr_share_info(); | ||
| 131 | + //向第三方存储图片 | ||
| 132 | + $param = [ | ||
| 133 | + 'file'=>$ayrShareLogic->base_img_content($this->param['hash']),//base64编码 | ||
| 134 | + ]; | ||
| 135 | + $param_data = $ayrShare->post_media_upload($param,$share_info['profile_key']); | ||
| 136 | + //更新图片库 | ||
| 137 | + $ayrShareLogic->save_file($param_data); | ||
| 139 | $this->response('success'); | 138 | $this->response('success'); |
| 140 | } | 139 | } |
| 141 | } | 140 | } |
| @@ -2,16 +2,12 @@ | @@ -2,16 +2,12 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Http\Controllers\Bside; | 3 | namespace App\Http\Controllers\Bside; |
| 4 | 4 | ||
| 5 | -use App\Exceptions\BsideGlobalException; | ||
| 6 | -use App\Helper\Arr; | 5 | + |
| 7 | use App\Http\Logic\Bside\InquiryLogic; | 6 | use App\Http\Logic\Bside\InquiryLogic; |
| 8 | -use App\Http\Requests\Bside\InquiryRequest; | ||
| 9 | use App\Rules\Ids; | 7 | use App\Rules\Ids; |
| 10 | use App\Services\BatchExportService; | 8 | use App\Services\BatchExportService; |
| 11 | use Illuminate\Http\Request; | 9 | use Illuminate\Http\Request; |
| 12 | use Illuminate\Support\Facades\Storage; | 10 | use Illuminate\Support\Facades\Storage; |
| 13 | -use Illuminate\Validation\ValidationException; | ||
| 14 | -use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; | ||
| 15 | 11 | ||
| 16 | /** | 12 | /** |
| 17 | * 精准询盘 | 13 | * 精准询盘 |
| @@ -25,23 +21,18 @@ class InquiryController extends BaseController | @@ -25,23 +21,18 @@ class InquiryController extends BaseController | ||
| 25 | 21 | ||
| 26 | public function index(InquiryLogic $logic) | 22 | public function index(InquiryLogic $logic) |
| 27 | { | 23 | { |
| 28 | - $map = []; | ||
| 29 | - if(!empty($this->param['search'])){ | ||
| 30 | - $map[] = ['name|email|content', 'like', "%{$this->param['search']}%"]; | ||
| 31 | - } | ||
| 32 | - $sort = ['id' => 'desc']; | ||
| 33 | - $data = $logic->getList($map, $sort, ['id', 'name', 'email', 'phone', 'url', 'ip', 'ip_country', 'status', 'created_at']); | 24 | + $data = $logic->getApiList(); |
| 34 | return $this->success($data); | 25 | return $this->success($data); |
| 35 | } | 26 | } |
| 36 | 27 | ||
| 37 | public function info(Request $request, InquiryLogic $logic){ | 28 | public function info(Request $request, InquiryLogic $logic){ |
| 38 | $request->validate([ | 29 | $request->validate([ |
| 39 | - 'id'=>'required' | 30 | + 'id' => 'required', |
| 40 | ],[ | 31 | ],[ |
| 41 | 'id.required' => 'ID不能为空' | 32 | 'id.required' => 'ID不能为空' |
| 42 | ]); | 33 | ]); |
| 43 | $data = $logic->getInfo($this->param['id']); | 34 | $data = $logic->getInfo($this->param['id']); |
| 44 | - return $this->success(Arr::twoKeepKeys($data, ['id', 'name', 'email', 'phone', 'url', 'ip', 'ip_country', 'status', 'content', 'trans_content', 'created_at'])); | 35 | + return $this->success($data); |
| 45 | } | 36 | } |
| 46 | 37 | ||
| 47 | public function delete(Request $request, InquiryLogic $logic) | 38 | public function delete(Request $request, InquiryLogic $logic) |
| @@ -52,8 +43,8 @@ class InquiryController extends BaseController | @@ -52,8 +43,8 @@ class InquiryController extends BaseController | ||
| 52 | 'ids.required' => 'ID不能为空' | 43 | 'ids.required' => 'ID不能为空' |
| 53 | ]); | 44 | ]); |
| 54 | 45 | ||
| 55 | - $data = $logic->delete($this->param['ids']); | ||
| 56 | - return $this->success($data); | 46 | + $logic->delete($this->param['ids']); |
| 47 | + return $this->success(); | ||
| 57 | } | 48 | } |
| 58 | 49 | ||
| 59 | /** | 50 | /** |
| @@ -66,22 +57,20 @@ class InquiryController extends BaseController | @@ -66,22 +57,20 @@ class InquiryController extends BaseController | ||
| 66 | */ | 57 | */ |
| 67 | public function export(InquiryLogic $logic) | 58 | public function export(InquiryLogic $logic) |
| 68 | { | 59 | { |
| 69 | - $sort = ['id' => 'desc']; | ||
| 70 | - //最多到1w条 | ||
| 71 | - $data = $logic->getList([], $sort, ['name', 'email', 'phone', 'url', 'ip', 'ip_country', 'content', 'created_at'], 10000); | 60 | + $data = $logic->getApiList(true); |
| 72 | $data = $data['list'] ?? []; | 61 | $data = $data['list'] ?? []; |
| 73 | foreach ($data as &$item){ | 62 | foreach ($data as &$item){ |
| 74 | - $item['ip_address'] = "{$item['ip_country']}({$item['ip']})"; | 63 | + $item['ip_address'] = "{$item['country']}({$item['ip']})"; |
| 75 | } | 64 | } |
| 76 | 65 | ||
| 77 | $map = [ | 66 | $map = [ |
| 78 | - 'created_at' => '询盘发送时间', | 67 | + 'submit_time' => '询盘发送时间', |
| 79 | 'name' => '姓名', | 68 | 'name' => '姓名', |
| 80 | 'email' => '邮箱', | 69 | 'email' => '邮箱', |
| 81 | 'phone' => '电话', | 70 | 'phone' => '电话', |
| 82 | 'ip_address' => '访问国家/地区(IP)', | 71 | 'ip_address' => '访问国家/地区(IP)', |
| 83 | - 'url' => '发送页面', | ||
| 84 | - 'content' => '询盘内容', | 72 | + 'refer' => '发送页面', |
| 73 | + 'message' => '询盘内容', | ||
| 85 | ]; | 74 | ]; |
| 86 | 75 | ||
| 87 | //生成文件,发送到客户端 | 76 | //生成文件,发送到客户端 |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Bside\User; | ||
| 4 | + | ||
| 5 | +use App\Enums\Common\Code; | ||
| 6 | +use App\Http\Controllers\Bside\BaseController; | ||
| 7 | +use App\Http\Logic\Bside\User\DeptUserLogic; | ||
| 8 | +use App\Http\Logic\Bside\User\UserLogic; | ||
| 9 | +use App\Models\User\DeptUser; | ||
| 10 | +use App\Models\User\ViewDeptUser; | ||
| 11 | + | ||
| 12 | +class DeptUserController extends BaseController | ||
| 13 | +{ | ||
| 14 | + | ||
| 15 | + /** | ||
| 16 | + * @param ViewDeptUser $viewDeptUser | ||
| 17 | + * @name :(详情)info | ||
| 18 | + * @author :lyh | ||
| 19 | + * @method :post | ||
| 20 | + * @time :2023/5/18 9:32 | ||
| 21 | + */ | ||
| 22 | + public function info(ViewDeptUser $viewDeptUser){ | ||
| 23 | + $this->request->validate([ | ||
| 24 | + 'id'=>['required'] | ||
| 25 | + ],[ | ||
| 26 | + 'id.required' => 'id不能为空' | ||
| 27 | + ]); | ||
| 28 | + $info = $viewDeptUser->read($this->param); | ||
| 29 | + $this->response('success',Code::SUCCESS,$info); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * @name :(部门添加与更新用户)add | ||
| 34 | + * @author :lyh | ||
| 35 | + * @method :post | ||
| 36 | + * @time :2023/5/17 17:36 | ||
| 37 | + */ | ||
| 38 | + public function save(DeptUserLogic $deptUserLogic){ | ||
| 39 | + $this->request->validate([ | ||
| 40 | + 'dept_id'=>['required'], | ||
| 41 | + 'user_id'=>['required'] | ||
| 42 | + ],[ | ||
| 43 | + 'dept_id.required' => '组织架构id不能为空', | ||
| 44 | + 'user_id.required' => '用户id不能为空', | ||
| 45 | + ]); | ||
| 46 | + $deptUserLogic->dept_user_save(); | ||
| 47 | + $this->response('success'); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * @name :(设置管理员)set_admin | ||
| 52 | + * @author :lyh | ||
| 53 | + * @method :post | ||
| 54 | + * @time :2023/5/18 10:32 | ||
| 55 | + */ | ||
| 56 | + public function set_admin(DeptUserLogic $deptUserLogic){ | ||
| 57 | + $this->request->validate([ | ||
| 58 | + 'id'=>['required'], | ||
| 59 | + 'is_admin'=>['required'], | ||
| 60 | + ],[ | ||
| 61 | + 'id.required' => 'id不能为空', | ||
| 62 | + 'is_admin.required' => 'is_admin不能为空', | ||
| 63 | + ]); | ||
| 64 | + $deptUserLogic->dept_user_edit(); | ||
| 65 | + $this->response('success'); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * @name :(设置用户角色)set_role | ||
| 70 | + * @author :lyh | ||
| 71 | + * @method :post | ||
| 72 | + * @time :2023/5/19 9:32 | ||
| 73 | + */ | ||
| 74 | + public function set_role(DeptUserLogic $deptUserLogic){ | ||
| 75 | + $this->request->validate([ | ||
| 76 | + 'id'=>['required'], | ||
| 77 | + 'role_id'=>['required'], | ||
| 78 | + ],[ | ||
| 79 | + 'id.required' => '用户id不能为空', | ||
| 80 | + 'role_id.required' => 'role_id不能为空', | ||
| 81 | + ]); | ||
| 82 | + $deptUserLogic->user_edit_role(); | ||
| 83 | + $this->response('success'); | ||
| 84 | + } | ||
| 85 | +} |
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Http\Controllers\Bside\User; | ||
| 4 | - | ||
| 5 | -use App\Enums\Common\Code; | ||
| 6 | -use App\Http\Controllers\Bside\BaseController; | ||
| 7 | -use App\Http\Controllers\Bside\Ids; | ||
| 8 | -use App\Http\Controllers\Bside\json; | ||
| 9 | -use App\Http\Logic\Bside\ProjectGroupLogic; | ||
| 10 | -use App\Http\Logic\Bside\User\GroupLogic; | ||
| 11 | -use App\Http\Requests\Bside\User\ProjectGroupRequest; | ||
| 12 | -use App\Models\User\ProjectGroup; | ||
| 13 | - | ||
| 14 | - | ||
| 15 | -/** | ||
| 16 | - * @name:用户组相关 | ||
| 17 | - */ | ||
| 18 | -class ProjectGroupController extends BaseController | ||
| 19 | -{ | ||
| 20 | - /** | ||
| 21 | - * @name :用户组列表 | ||
| 22 | - * @return json | ||
| 23 | - * @author :liyuhang | ||
| 24 | - * @method | ||
| 25 | - */ | ||
| 26 | - public function lists(ProjectGroup $projectGroup) | ||
| 27 | - { | ||
| 28 | - $lists = $projectGroup->list($this->map,'id',['name','user_list','pid','id']); | ||
| 29 | - $menu = []; | ||
| 30 | - foreach ($lists as $k => $v){ | ||
| 31 | - $v = (array)$v; | ||
| 32 | - if ($v['pid'] == 0) { | ||
| 33 | - $v['sub'] = _get_child($v['id'], $lists); | ||
| 34 | - $menu[] = $v; | ||
| 35 | - } | ||
| 36 | - } | ||
| 37 | - $this->response('success',Code::SUCCESS,$menu); | ||
| 38 | - } | ||
| 39 | - | ||
| 40 | - /** | ||
| 41 | - * @name :详情 | ||
| 42 | - * @return json | ||
| 43 | - * @author :liyuhang | ||
| 44 | - * @method | ||
| 45 | - */ | ||
| 46 | - public function info(GroupLogic $groupLogic){ | ||
| 47 | - $this->request->validate([ | ||
| 48 | - 'id'=>['required', new Ids()], | ||
| 49 | - ],[ | ||
| 50 | - 'id.required' => 'ID不能为空', | ||
| 51 | - ]); | ||
| 52 | - $groupLogic->group_info(); | ||
| 53 | - $this->response('success'); | ||
| 54 | - } | ||
| 55 | - /** | ||
| 56 | - * @name:添加用户组获取用户列表 | ||
| 57 | - * @return void | ||
| 58 | - * @author :liyuhang | ||
| 59 | - * @method | ||
| 60 | - */ | ||
| 61 | - public function get_user_lists(GroupLogic $groupLogic){ | ||
| 62 | - $lists = $groupLogic->user_list(); | ||
| 63 | - $this->response('success',Code::SUCCESS,$lists); | ||
| 64 | - } | ||
| 65 | - /** | ||
| 66 | - * @param ProjectGroupRequest $request | ||
| 67 | - * @param ProjectGroupLogic $logic | ||
| 68 | - * @name : 添加用户组 | ||
| 69 | - * @return void | ||
| 70 | - * @author :liyuhang | ||
| 71 | - * @method | ||
| 72 | - */ | ||
| 73 | - public function add(ProjectGroupRequest $request,GroupLogic $groupLogic){ | ||
| 74 | - $request->validated(); | ||
| 75 | - $groupLogic->group_add(); | ||
| 76 | - $this->response('success'); | ||
| 77 | - } | ||
| 78 | - | ||
| 79 | - /** | ||
| 80 | - * @param ProjectGroupRequest $request | ||
| 81 | - * @param ProjectGroupLogic $logic | ||
| 82 | - * @name :编辑用户组 | ||
| 83 | - * @return void | ||
| 84 | - * @author :liyuhang | ||
| 85 | - * @method | ||
| 86 | - */ | ||
| 87 | - public function edit(ProjectGroupRequest $request,GroupLogic $groupLogic){ | ||
| 88 | - $request->validate([ | ||
| 89 | - 'id'=>['required'], | ||
| 90 | - ],[ | ||
| 91 | - 'id.required' => 'ID不能为空', | ||
| 92 | - ]); | ||
| 93 | - $groupLogic->group_edit(); | ||
| 94 | - $this->response('success'); | ||
| 95 | - } | ||
| 96 | - | ||
| 97 | - /** | ||
| 98 | - * @name :删除用户组 | ||
| 99 | - * @return void | ||
| 100 | - * @author :liyuhang | ||
| 101 | - * @method | ||
| 102 | - */ | ||
| 103 | - public function del(GroupLogic $groupLogic){ | ||
| 104 | - $this->request->validate([ | ||
| 105 | - 'id'=>['required','array'], | ||
| 106 | - ],[ | ||
| 107 | - 'id.required' => 'ID不能为空', | ||
| 108 | - 'id.array' => 'ID为数组', | ||
| 109 | - ]); | ||
| 110 | - $groupLogic->group_del(); | ||
| 111 | - $this->response('success'); | ||
| 112 | - } | ||
| 113 | -} |
| @@ -7,7 +7,9 @@ use App\Http\Controllers\Bside\BaseController; | @@ -7,7 +7,9 @@ use App\Http\Controllers\Bside\BaseController; | ||
| 7 | use App\Http\Controllers\Bside\json; | 7 | use App\Http\Controllers\Bside\json; |
| 8 | use App\Http\Logic\Bside\User\UserLogic; | 8 | use App\Http\Logic\Bside\User\UserLogic; |
| 9 | use App\Http\Requests\Bside\User\UserRequest; | 9 | use App\Http\Requests\Bside\User\UserRequest; |
| 10 | +use App\Models\User\ProjectRole; | ||
| 10 | use App\Models\User\User as UserModel; | 11 | use App\Models\User\User as UserModel; |
| 12 | +use App\Models\User\ViewDeptUser; | ||
| 11 | use Illuminate\Http\Request; | 13 | use Illuminate\Http\Request; |
| 12 | use Illuminate\Support\Facades\Cache; | 14 | use Illuminate\Support\Facades\Cache; |
| 13 | 15 | ||
| @@ -19,17 +21,24 @@ class UserController extends BaseController | @@ -19,17 +21,24 @@ class UserController extends BaseController | ||
| 19 | * @author :liyuhang | 21 | * @author :liyuhang |
| 20 | * @method | 22 | * @method |
| 21 | */ | 23 | */ |
| 22 | - public function lists(UserModel $userModel){ | ||
| 23 | - //TODO::搜索参数统一处理 | 24 | + public function lists(ViewDeptUser $viewDeptUser){ |
| 24 | $this->map['project_id'] = $this->user['project_id']; | 25 | $this->map['project_id'] = $this->user['project_id']; |
| 25 | - $lists = $userModel->lists($this->map,$this->page,$this->row,$this->order,['id','name','mobile','created_at','wechat','status']); | ||
| 26 | - if(empty($lists)){ | ||
| 27 | - $this->response('error',Code::USER_ERROR,[]); | ||
| 28 | - } | 26 | + $lists = $viewDeptUser->lists($this->map,$this->page,$this->row,'user_id'); |
| 29 | $this->response('success',Code::SUCCESS,$lists); | 27 | $this->response('success',Code::SUCCESS,$lists); |
| 30 | } | 28 | } |
| 31 | 29 | ||
| 32 | /** | 30 | /** |
| 31 | + * @name :(添加管理员获取角色菜单)role_list | ||
| 32 | + * @author :lyh | ||
| 33 | + * @method :post | ||
| 34 | + * @time :2023/5/18 17:04 | ||
| 35 | + */ | ||
| 36 | + public function role_list(ProjectRole $projectRole){ | ||
| 37 | + $list = $projectRole->list(['status'=>0,'project_id'=>$this->user['project_id']],'id'); | ||
| 38 | + $this->response('success',Code::SUCCESS,$list); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + /** | ||
| 33 | * @name :添加管理员 | 42 | * @name :添加管理员 |
| 34 | * @return void | 43 | * @return void |
| 35 | * @author :liyuhang | 44 | * @author :liyuhang |
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Http\Controllers\Cside; | ||
| 4 | - | ||
| 5 | -use App\Enums\Common\Code; | ||
| 6 | -use App\Http\Controllers\Controller; | ||
| 7 | -use Illuminate\Http\JsonResponse; | ||
| 8 | -use Illuminate\Http\Request; | ||
| 9 | -use Illuminate\Http\Exceptions\HttpResponseException; | ||
| 10 | -use Illuminate\Support\Facades\Cache; | ||
| 11 | -use Illuminate\Support\Facades\Session; | ||
| 12 | - | ||
| 13 | -class BaseController extends Controller | ||
| 14 | -{ | ||
| 15 | - protected $param = [];//所有请求参数 | ||
| 16 | - protected $token = ''; //token | ||
| 17 | - protected $request = [];//助手函数 | ||
| 18 | - protected $project = [];//当前登录用户详情 | ||
| 19 | - /** | ||
| 20 | - * 获取所有参数 | ||
| 21 | - */ | ||
| 22 | - public function __construct(Request $request) | ||
| 23 | - { | ||
| 24 | - $this->request = $request; | ||
| 25 | - $this->param = $this->request->all(); | ||
| 26 | - $this->token = $this->request->header('token'); | ||
| 27 | - if(!empty($this->token) && !empty(Cache::get($this->token))){ | ||
| 28 | - $info = Cache::get($this->token); | ||
| 29 | - $this->user = $info; | ||
| 30 | - $this->uid = $info['id']; | ||
| 31 | - } | ||
| 32 | - | ||
| 33 | - } | ||
| 34 | - | ||
| 35 | - | ||
| 36 | - /** | ||
| 37 | - * 成功返回 | ||
| 38 | - * @param array $data | ||
| 39 | - * @param string $code | ||
| 40 | - * @param bool $objectData | ||
| 41 | - * @return JsonResponse | ||
| 42 | - * @throws \Psr\Container\ContainerExceptionInterface | ||
| 43 | - * @throws \Psr\Container\NotFoundExceptionInterface | ||
| 44 | - */ | ||
| 45 | - function success(array $data = [], string $code = Code::SUCCESS, bool $objectData = false): JsonResponse | ||
| 46 | - { | ||
| 47 | - if ($objectData) { | ||
| 48 | - $data = (object)$data; | ||
| 49 | - } | ||
| 50 | - $code = Code::fromValue($code); | ||
| 51 | - $response = [ | ||
| 52 | - 'code' => $code->value, | ||
| 53 | - 'data' => $data, | ||
| 54 | - 'msg' => $code->description, | ||
| 55 | - ]; | ||
| 56 | - return response()->json($response,200); | ||
| 57 | - } | ||
| 58 | -} |
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Http\Controllers\Cside; | ||
| 4 | - | ||
| 5 | -use App\Http\Logic\Cside\InquiryLogic; | ||
| 6 | -use App\Http\Requests\Cside\InquiryRequest; | ||
| 7 | - | ||
| 8 | -/** | ||
| 9 | - * 精准询盘 | ||
| 10 | - * Class InquiryController | ||
| 11 | - * @package App\Http\Controllers\Bside | ||
| 12 | - * @author zbj | ||
| 13 | - * @date 2023/5/4 | ||
| 14 | - */ | ||
| 15 | -class InquiryController extends BaseController | ||
| 16 | -{ | ||
| 17 | - | ||
| 18 | - public function save(InquiryRequest $request, InquiryLogic $logic) | ||
| 19 | - { | ||
| 20 | - $data = $logic->save($this->param); | ||
| 21 | - return $this->success($data); | ||
| 22 | - } | ||
| 23 | -} |
| @@ -44,7 +44,7 @@ class FileController | @@ -44,7 +44,7 @@ class FileController | ||
| 44 | * @method :post | 44 | * @method :post |
| 45 | * @time :2023/5/9 9:15 | 45 | * @time :2023/5/9 9:15 |
| 46 | */ | 46 | */ |
| 47 | - public function index($hash = '', $type = 1) | 47 | + public function index($hash = '', $w = 1) |
| 48 | { | 48 | { |
| 49 | // 检查是否有修改日期或ETag头部 | 49 | // 检查是否有修改日期或ETag头部 |
| 50 | if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH'])) { | 50 | if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH'])) { |
| @@ -11,7 +11,6 @@ use App\Http\Middleware\Bside\EnableCrossRequestMiddleware; | @@ -11,7 +11,6 @@ use App\Http\Middleware\Bside\EnableCrossRequestMiddleware; | ||
| 11 | use App\Http\Middleware\Bside\ParamMiddleware as BsideParamMiddleware; | 11 | use App\Http\Middleware\Bside\ParamMiddleware as BsideParamMiddleware; |
| 12 | use App\Http\Middleware\Aside\LoginAuthMiddleware as AsideLoginAuthMiddleware; | 12 | use App\Http\Middleware\Aside\LoginAuthMiddleware as AsideLoginAuthMiddleware; |
| 13 | use App\Http\Middleware\Bside\LoginAuthMiddleware as BsideLoginAuthMiddleware; | 13 | use App\Http\Middleware\Bside\LoginAuthMiddleware as BsideLoginAuthMiddleware; |
| 14 | -use App\Http\Middleware\Cside\ParamMiddleware as CsideParamMiddleware; | ||
| 15 | use App\Http\Middleware\PreventRepeatQuitCallMiddleware; | 14 | use App\Http\Middleware\PreventRepeatQuitCallMiddleware; |
| 16 | use Illuminate\Foundation\Http\Kernel as HttpKernel; | 15 | use Illuminate\Foundation\Http\Kernel as HttpKernel; |
| 17 | 16 | ||
| @@ -77,11 +76,6 @@ class Kernel extends HttpKernel | @@ -77,11 +76,6 @@ class Kernel extends HttpKernel | ||
| 77 | //允许跨域请求 | 76 | //允许跨域请求 |
| 78 | EnableCrossRequestMiddleware::class | 77 | EnableCrossRequestMiddleware::class |
| 79 | ], | 78 | ], |
| 80 | - //C端中间件组 | ||
| 81 | - 'cside'=>[ | ||
| 82 | - //参数处理中间件--涉及-参数记录-参数加解密等 | ||
| 83 | - CsideParamMiddleware::class, | ||
| 84 | - ] | ||
| 85 | ]; | 79 | ]; |
| 86 | 80 | ||
| 87 | /** | 81 | /** |
| @@ -20,7 +20,7 @@ class DomainInfoLogic extends BaseLogic | @@ -20,7 +20,7 @@ class DomainInfoLogic extends BaseLogic | ||
| 20 | public function getDomainInfo($project_id) | 20 | public function getDomainInfo($project_id) |
| 21 | { | 21 | { |
| 22 | $project = app(ProjectLogic::class)->getInfo($project_id); | 22 | $project = app(ProjectLogic::class)->getInfo($project_id); |
| 23 | - $domain = $project['deploy_optimize']['domain']; | 23 | + $domain = $project['deploy_optimize']['domain'] ?? ''; |
| 24 | $info = $this->model->where('project_id', $project_id)->first(); | 24 | $info = $this->model->where('project_id', $project_id)->first(); |
| 25 | //不存在或时间过期了 重新获取信息 | 25 | //不存在或时间过期了 重新获取信息 |
| 26 | $expiration_date = $info['domain_info']['expiration_date'] ?? ''; | 26 | $expiration_date = $info['domain_info']['expiration_date'] ?? ''; |
| @@ -4,11 +4,14 @@ namespace App\Http\Logic\Aside\Project; | @@ -4,11 +4,14 @@ namespace App\Http\Logic\Aside\Project; | ||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | use App\Helper\Arr; | 6 | use App\Helper\Arr; |
| 7 | +use App\Helper\FormGlobalsoApi; | ||
| 7 | use App\Http\Logic\Aside\BaseLogic; | 8 | use App\Http\Logic\Aside\BaseLogic; |
| 9 | +use App\Models\InquirySet; | ||
| 8 | use App\Models\Project\DeployBuild; | 10 | use App\Models\Project\DeployBuild; |
| 9 | use App\Models\Project\DeployOptimize; | 11 | use App\Models\Project\DeployOptimize; |
| 10 | use App\Models\Project\Payment; | 12 | use App\Models\Project\Payment; |
| 11 | use App\Models\Project\Project; | 13 | use App\Models\Project\Project; |
| 14 | +use Illuminate\Database\Eloquent\Model; | ||
| 12 | use Illuminate\Support\Facades\DB; | 15 | use Illuminate\Support\Facades\DB; |
| 13 | 16 | ||
| 14 | /** | 17 | /** |
| @@ -39,15 +42,15 @@ class ProjectLogic extends BaseLogic | @@ -39,15 +42,15 @@ class ProjectLogic extends BaseLogic | ||
| 39 | } | 42 | } |
| 40 | 43 | ||
| 41 | public function save($param){ | 44 | public function save($param){ |
| 42 | - if(!empty($param['test_domain'])){ | ||
| 43 | - $param['test_domain'] = checkDomain($param['test_domain']); | ||
| 44 | - if(!$param['test_domain']){ | 45 | + if(!empty($param['deploy_build']['test_domain'])){ |
| 46 | + $param['deploy_build']['test_domain'] = checkDomain($param['deploy_build']['test_domain']); | ||
| 47 | + if(!$param['deploy_build']['test_domain']){ | ||
| 45 | $this->fail('测试域名格式不正确'); | 48 | $this->fail('测试域名格式不正确'); |
| 46 | } | 49 | } |
| 47 | } | 50 | } |
| 48 | - if(!empty($param['domain'])){ | ||
| 49 | - $param['domain'] = checkDomain($param['domain']); | ||
| 50 | - if(!$param['domain']){ | 51 | + if(!empty($param['deploy_optimize']['domain'])){ |
| 52 | + $param['deploy_optimize']['domain'] = checkDomain($param['deploy_optimize']['domain']); | ||
| 53 | + if(!$param['deploy_optimize']['domain']){ | ||
| 51 | $this->fail('正式域名格式不正确'); | 54 | $this->fail('正式域名格式不正确'); |
| 52 | } | 55 | } |
| 53 | } | 56 | } |
| @@ -122,4 +125,38 @@ class ProjectLogic extends BaseLogic | @@ -122,4 +125,38 @@ class ProjectLogic extends BaseLogic | ||
| 122 | parent::setWith(['payment', 'deploy_build', 'deploy_optimize']); | 125 | parent::setWith(['payment', 'deploy_build', 'deploy_optimize']); |
| 123 | parent::clearCache($id); | 126 | parent::clearCache($id); |
| 124 | } | 127 | } |
| 128 | + | ||
| 129 | + /** | ||
| 130 | + * 保存询盘通知设置 | ||
| 131 | + * @author zbj | ||
| 132 | + * @date 2023/5/17 | ||
| 133 | + */ | ||
| 134 | + public function saveInquirySet($param) | ||
| 135 | + { | ||
| 136 | + $project = $this->getCacheInfo($param['project_id']); | ||
| 137 | + | ||
| 138 | + //同步到接口 | ||
| 139 | + $domain = parse_url($project['deploy_optimize']['domain'])['host']; | ||
| 140 | + $emails = Arr::arrToSet($param['emails']??'', 'trim'); | ||
| 141 | + $phones = Arr::arrToSet($param['phones']??'', 'trim'); | ||
| 142 | + $form_globalso_api = new FormGlobalsoApi(); | ||
| 143 | + $res = $form_globalso_api->setInquiry($domain, $emails, $phones); | ||
| 144 | + | ||
| 145 | + if (!$res) { | ||
| 146 | + $this->fail('保存失败'); | ||
| 147 | + } | ||
| 148 | + if ($res['status'] != 200) { | ||
| 149 | + $this->fail($res['message'] ?? '保存失败'); | ||
| 150 | + } | ||
| 151 | + //保存 | ||
| 152 | + $set = InquirySet::where('project_id', $param['project_id'])->first(); | ||
| 153 | + if (!$set) { | ||
| 154 | + $set = new InquirySet(); | ||
| 155 | + } | ||
| 156 | + $set->project_id = $param['project_id']; | ||
| 157 | + $set->emails = $emails; | ||
| 158 | + $set->phones = $phones; | ||
| 159 | + $set->save(); | ||
| 160 | + return $this->success(); | ||
| 161 | + } | ||
| 125 | } | 162 | } |
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Http\Logic\Aside\User; | ||
| 4 | - | ||
| 5 | -use App\Http\Logic\Aside\BaseLogic; | ||
| 6 | -use App\Models\User\ProjectMenu; | ||
| 7 | - | ||
| 8 | -class ProjectGroupLogic extends BaseLogic | ||
| 9 | -{ | ||
| 10 | - public function __construct() | ||
| 11 | - { | ||
| 12 | - parent::__construct(); | ||
| 13 | - | ||
| 14 | - $this->model = new ProjectMenu(); | ||
| 15 | - $this->param = $this->requestAll; | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | - /** | ||
| 19 | - * @name :详情 | ||
| 20 | - * @return void | ||
| 21 | - * @author :liyuhang | ||
| 22 | - * @method | ||
| 23 | - */ | ||
| 24 | - public function group_info(){ | ||
| 25 | - $info = $this->info($this->param); | ||
| 26 | - return $this->success($info); | ||
| 27 | - } | ||
| 28 | - | ||
| 29 | - /** | ||
| 30 | - * @name :添加 | ||
| 31 | - * @return void | ||
| 32 | - * @author :liyuhang | ||
| 33 | - * @method | ||
| 34 | - */ | ||
| 35 | - public function group_add(){ | ||
| 36 | - //查看当前用户组是否存在 | ||
| 37 | - $this->model->read(['name'=>$this->param['name'],'create_id'=>$this->user['id']]); | ||
| 38 | - $rs = $this->model->add($this->param); | ||
| 39 | - if($rs === false){ | ||
| 40 | - $this->fail('error'); | ||
| 41 | - } | ||
| 42 | - return $this->success(); | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - /** | ||
| 46 | - * @name :编辑 | ||
| 47 | - * @return void | ||
| 48 | - * @author :liyuhang | ||
| 49 | - * @method | ||
| 50 | - */ | ||
| 51 | - public function group_edit(){ | ||
| 52 | - //查看当前用户组是否存在 | ||
| 53 | - $rs = $this->model->read(['name'=>$this->param['name'],'create_id'=>$this->user['id']]); | ||
| 54 | - if($rs === false){ | ||
| 55 | - $this->fail('error'); | ||
| 56 | - } | ||
| 57 | - return $this->success(); | ||
| 58 | - } | ||
| 59 | - | ||
| 60 | - /** | ||
| 61 | - * @name :删除 | ||
| 62 | - * @return void | ||
| 63 | - * @author :liyuhang | ||
| 64 | - * @method | ||
| 65 | - */ | ||
| 66 | - public function group_del(){ | ||
| 67 | - $this->param['id'] = ['in',$this->param['id']]; | ||
| 68 | - $rs = $this->model->del($this->param); | ||
| 69 | - if($rs === false){ | ||
| 70 | - $this->fail('error'); | ||
| 71 | - } | ||
| 72 | - return $this->success(); | ||
| 73 | - } | ||
| 74 | -} |
| @@ -40,6 +40,8 @@ class AyrReleaseLogic extends BaseLogic | @@ -40,6 +40,8 @@ class AyrReleaseLogic extends BaseLogic | ||
| 40 | public function release_add(){ | 40 | public function release_add(){ |
| 41 | $this->param['project_id'] = $this->user['project_id']; | 41 | $this->param['project_id'] = $this->user['project_id']; |
| 42 | $this->param['operator_id'] = $this->user['id']; | 42 | $this->param['operator_id'] = $this->user['id']; |
| 43 | + $this->param['images'] = implode(',',$this->param['images']); | ||
| 44 | + $this->param['platforms'] = json_encode($this->param['platforms']); | ||
| 43 | $rs = $this->model->add($this->param); | 45 | $rs = $this->model->add($this->param); |
| 44 | if($rs === false){ | 46 | if($rs === false){ |
| 45 | $this->fail('error'); | 47 | $this->fail('error'); |
| @@ -61,17 +63,17 @@ class AyrReleaseLogic extends BaseLogic | @@ -61,17 +63,17 @@ class AyrReleaseLogic extends BaseLogic | ||
| 61 | $imageModel = new Image(); | 63 | $imageModel = new Image(); |
| 62 | $list = $imageModel->list(['hash'=>['in',$images]],'id'); | 64 | $list = $imageModel->list(['hash'=>['in',$images]],'id'); |
| 63 | foreach ($list as $v1){ | 65 | foreach ($list as $v1){ |
| 64 | - $arr[] = $v1['ayr_url']; | 66 | + $filename = basename($v1['path']); |
| 67 | + $arr[] = url('/upload/images/'.$filename); | ||
| 65 | } | 68 | } |
| 66 | }else{ | 69 | }else{ |
| 67 | - $arr[] = url('/b/file_hash/' . $v.rand(10000,99999).'mp4');; | 70 | + $fileModel = new File(); |
| 71 | + $info = $fileModel->read(['hash'=>$v]); | ||
| 72 | + $filename = basename($info['path']); | ||
| 73 | + $arr[] = url('/upload/files/'.$filename); | ||
| 68 | } | 74 | } |
| 69 | } | 75 | } |
| 70 | return $this->success($arr); | 76 | return $this->success($arr); |
| 71 | } | 77 | } |
| 72 | 78 | ||
| 73 | - | ||
| 74 | - public function platforms_request(){ | ||
| 75 | - | ||
| 76 | - } | ||
| 77 | } | 79 | } |
| @@ -209,16 +209,19 @@ class AyrShareLogic extends BaseLogic | @@ -209,16 +209,19 @@ class AyrShareLogic extends BaseLogic | ||
| 209 | if(!in_array($v,json_decode($info['bind_platforms']))){ | 209 | if(!in_array($v,json_decode($info['bind_platforms']))){ |
| 210 | $this->fail('未绑定平台'); | 210 | $this->fail('未绑定平台'); |
| 211 | } | 211 | } |
| 212 | + if($v == 'reddit' && isset($this->param['video'])){ | ||
| 213 | + $this->fail('不支持视频'); | ||
| 214 | + } | ||
| 212 | //验证图片数 | 215 | //验证图片数 |
| 213 | $img_num = count($this->param['images']); | 216 | $img_num = count($this->param['images']); |
| 214 | if($img_num > $this->send_num[$v]){ | 217 | if($img_num > $this->send_num[$v]){ |
| 215 | $this->fail('发布图片数量超过最大限制,'.$v.'只允许'.$this->send_num[$v].'张图'); | 218 | $this->fail('发布图片数量超过最大限制,'.$v.'只允许'.$this->send_num[$v].'张图'); |
| 216 | } | 219 | } |
| 217 | //验证图片数 | 220 | //验证图片数 |
| 218 | - $img_num = count($this->param['video']); | ||
| 219 | - if($img_num > 1){ | ||
| 220 | - $this->fail('发布视频数量超过最大限制,'.$v.'只允许'.$this->send_num[$v].'个视频'); | ||
| 221 | - } | 221 | +// $img_num = count($this->param['video']); |
| 222 | +// if($img_num > 1){ | ||
| 223 | +// $this->fail('发布视频数量超过最大限制,'.$v.'只允许'.$this->send_num[$v].'个视频'); | ||
| 224 | +// } | ||
| 222 | } | 225 | } |
| 223 | return $this->success(); | 226 | return $this->success(); |
| 224 | } | 227 | } |
| @@ -3,7 +3,10 @@ | @@ -3,7 +3,10 @@ | ||
| 3 | namespace App\Http\Logic\Bside; | 3 | namespace App\Http\Logic\Bside; |
| 4 | 4 | ||
| 5 | use App\Helper\Arr; | 5 | use App\Helper\Arr; |
| 6 | -use App\Models\Inquiry; | 6 | +use App\Helper\FormGlobalsoApi; |
| 7 | +use App\Helper\Translate; | ||
| 8 | +use App\Http\Logic\Aside\Project\ProjectLogic; | ||
| 9 | +use App\Models\InquirySet; | ||
| 7 | 10 | ||
| 8 | /** | 11 | /** |
| 9 | * Class InquiryLogic | 12 | * Class InquiryLogic |
| @@ -11,25 +14,72 @@ use App\Models\Inquiry; | @@ -11,25 +14,72 @@ use App\Models\Inquiry; | ||
| 11 | * @author zbj | 14 | * @author zbj |
| 12 | * @date 2023/5/4 | 15 | * @date 2023/5/4 |
| 13 | */ | 16 | */ |
| 14 | -class InquiryLogic extends BaseLogic | 17 | +class InquiryLogic extends BaseLogic |
| 15 | { | 18 | { |
| 19 | + protected $form_globalso_api; | ||
| 20 | + | ||
| 16 | public function __construct() | 21 | public function __construct() |
| 17 | { | 22 | { |
| 18 | parent::__construct(); | 23 | parent::__construct(); |
| 19 | 24 | ||
| 20 | - $this->model = new Inquiry(); | 25 | + $this->form_globalso_api = new FormGlobalsoApi(); |
| 26 | + } | ||
| 27 | + | ||
| 28 | + public function getApiList($export = false) | ||
| 29 | + { | ||
| 30 | + $page_size = $export ? 1000 : 20; | ||
| 31 | + $search = $this->request['search'] ?: ''; | ||
| 32 | + $page = $this->request['page'] ?: 1; | ||
| 33 | + $project = (new ProjectLogic())->getInfo($this->user['project_id']); | ||
| 34 | + $domain = $project['deploy_optimize']['domain'] ?? ''; | ||
| 35 | + $list = $this->form_globalso_api->getInquiryList($domain, $search, $page, $page_size); | ||
| 36 | + //处理格式 免得前端又改 | ||
| 37 | + $data = [ | ||
| 38 | + "list" => [], | ||
| 39 | + "total" => 0, | ||
| 40 | + "page" => $page, | ||
| 41 | + "total_page" => 1, | ||
| 42 | + "size" => $page_size | ||
| 43 | + ]; | ||
| 44 | + if (!empty($list['status']) && $list['status'] == 200) { | ||
| 45 | + foreach ($list['data']['data'] as $item) { | ||
| 46 | + $data['list'][] = $item; | ||
| 47 | + } | ||
| 48 | + $data['total'] = $list['data']['total']; | ||
| 49 | + $data['total_page'] = $list['data']['last_page']; | ||
| 50 | + } | ||
| 51 | + return $this->success($data); | ||
| 21 | } | 52 | } |
| 22 | 53 | ||
| 23 | public function getInfo($id) | 54 | public function getInfo($id) |
| 24 | { | 55 | { |
| 25 | - $info = $this->getCacheInfo($id); | ||
| 26 | - if(!$info){ | ||
| 27 | - $this->fail('数据不存在或者已经删除'); | 56 | + $project = (new ProjectLogic())->getInfo($this->user['project_id']); |
| 57 | + $domain = $project['deploy_optimize']['domain'] ?: ''; | ||
| 58 | + //修改状态为已读 | ||
| 59 | + if($this->request['read_status']){ | ||
| 60 | + $this->form_globalso_api->saveInquiryRead($domain, $id); | ||
| 28 | } | 61 | } |
| 29 | - //标记已读 | ||
| 30 | - if($info->status == Inquiry::STATUS_UNREAD){ | ||
| 31 | - parent::save(['id' => $info['id'], 'status' => Inquiry::STATUS_READ]); | 62 | + //翻译 |
| 63 | + $trans_message = ''; | ||
| 64 | + if($this->request['message']){ | ||
| 65 | + $trans_message = Translate::tran($this->request['message'], 'zh'); | ||
| 32 | } | 66 | } |
| 33 | - return $this->success($info->toArray()); | 67 | + return $this->success(['trans_message' => $trans_message]); |
| 34 | } | 68 | } |
| 69 | + | ||
| 70 | + public function delete($ids, $map = []) | ||
| 71 | + { | ||
| 72 | + $project = (new ProjectLogic())->getInfo($this->user['project_id']); | ||
| 73 | + $domain = $project['deploy_optimize']['domain'] ?: ''; | ||
| 74 | + $ids = array_filter(Arr::splitFilterToArray($ids), 'intval'); | ||
| 75 | + if(!$ids){ | ||
| 76 | + $this->fail('ID不能为空'); | ||
| 77 | + } | ||
| 78 | + $this->form_globalso_api->delInquiry($domain, $ids); | ||
| 79 | + return $this->success(); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + | ||
| 83 | + | ||
| 84 | + | ||
| 35 | } | 85 | } |
| @@ -55,10 +55,10 @@ class RankDataLogic extends BaseLogic | @@ -55,10 +55,10 @@ class RankDataLogic extends BaseLogic | ||
| 55 | //项目信息 | 55 | //项目信息 |
| 56 | $data['project'] = [ | 56 | $data['project'] = [ |
| 57 | 'company' => $project['company'], | 57 | 'company' => $project['company'], |
| 58 | - 'domain' => $project['deploy_optimize']['domain'], | 58 | + 'domain' => $project['deploy_optimize']['domain'] ?? '', |
| 59 | 'domain_info' => ($domain_info['domain_info']['creation_date'] ?? '') . ' - ' . ($domain_info['domain_info']['expiration_date'] ?? ''), | 59 | 'domain_info' => ($domain_info['domain_info']['creation_date'] ?? '') . ' - ' . ($domain_info['domain_info']['expiration_date'] ?? ''), |
| 60 | 'cert_info' => ($domain_info['ssl']['start_time'] ?? '') . ' - ' . ($domain_info['ssl']['end_time'] ?? ''), | 60 | 'cert_info' => ($domain_info['ssl']['start_time'] ?? '') . ' - ' . ($domain_info['ssl']['end_time'] ?? ''), |
| 61 | - 'plan' => str_replace('营销大师-', '全球搜-', $project['deploy_build']['plan'][0]), | 61 | + 'plan' => str_replace('营销大师-', '全球搜-', $project['deploy_build']['plan'][0] ?? ''), |
| 62 | 'keyword_num' => $project['deploy_build']['keyword_num'], | 62 | 'keyword_num' => $project['deploy_build']['keyword_num'], |
| 63 | 'compliance_day' => $rank['compliance_day'] ?? 0, | 63 | 'compliance_day' => $rank['compliance_day'] ?? 0, |
| 64 | 'remain_day' => $project['deploy_build']['service_duration'] - ($rank['compliance_day'] ?? 0), | 64 | 'remain_day' => $project['deploy_build']['service_duration'] - ($rank['compliance_day'] ?? 0), |
| @@ -69,7 +69,7 @@ class RankDataLogic extends BaseLogic | @@ -69,7 +69,7 @@ class RankDataLogic extends BaseLogic | ||
| 69 | $lang_data = $quanqiusou_api->getLangRankData($api_no); | 69 | $lang_data = $quanqiusou_api->getLangRankData($api_no); |
| 70 | $lang_data = Arr::setValueToKey($lang_data, 'language'); | 70 | $lang_data = Arr::setValueToKey($lang_data, 'language'); |
| 71 | $data['langs'] = []; | 71 | $data['langs'] = []; |
| 72 | - foreach($project['deploy_optimize']['minor_languages'] as $lang){ | 72 | + foreach($project['deploy_optimize']['minor_languages']??[] as $lang){ |
| 73 | $remain_day = $lang_data[$lang['tl']]['dabiao_day'] ?? 0; | 73 | $remain_day = $lang_data[$lang['tl']]['dabiao_day'] ?? 0; |
| 74 | $data['langs'][$lang['tl'] ?? ''] = [ | 74 | $data['langs'][$lang['tl'] ?? ''] = [ |
| 75 | 'lang_text' => Translate::getTls($lang['tl'] ?? ''), | 75 | 'lang_text' => Translate::getTls($lang['tl'] ?? ''), |
| @@ -96,6 +96,7 @@ class RankDataLogic extends BaseLogic | @@ -96,6 +96,7 @@ class RankDataLogic extends BaseLogic | ||
| 96 | ]; | 96 | ]; |
| 97 | 97 | ||
| 98 | //外链引荐域名 | 98 | //外链引荐域名 |
| 99 | + $recomm_domain = $recomm_domain ? $recomm_domain->toArray() : []; | ||
| 99 | $data['external_links_domain_chat'] = [ | 100 | $data['external_links_domain_chat'] = [ |
| 100 | 'labels' => array_map(function ($item) { | 101 | 'labels' => array_map(function ($item) { |
| 101 | return Str::substrReplace($item, '***', 2, 3); | 102 | return Str::substrReplace($item, '***', 2, 3); |
| @@ -120,8 +121,8 @@ class RankDataLogic extends BaseLogic | @@ -120,8 +121,8 @@ class RankDataLogic extends BaseLogic | ||
| 120 | } | 121 | } |
| 121 | //关键词排名分析图 | 122 | //关键词排名分析图 |
| 122 | $data['rank_chat'] = [ | 123 | $data['rank_chat'] = [ |
| 123 | - 'data' => $rank_week['data'], | ||
| 124 | - 'labels' => $rank_week['date'], | 124 | + 'data' => $rank_week['data'] ?? [], |
| 125 | + 'labels' => $rank_week['date'] ?? [], | ||
| 125 | ]; | 126 | ]; |
| 126 | 127 | ||
| 127 | return $data; | 128 | return $data; |
| @@ -4,7 +4,7 @@ namespace App\Http\Logic\Bside\User; | @@ -4,7 +4,7 @@ namespace App\Http\Logic\Bside\User; | ||
| 4 | 4 | ||
| 5 | use App\Helper\Arr; | 5 | use App\Helper\Arr; |
| 6 | use App\Http\Logic\Bside\BaseLogic; | 6 | use App\Http\Logic\Bside\BaseLogic; |
| 7 | -use App\Models\ProjectDept; | 7 | +use App\Models\User\ProjectDept; |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| 10 | * Class DeptLogic | 10 | * Class DeptLogic |
app/Http/Logic/Bside/User/DeptUserLogic.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Logic\Bside\User; | ||
| 4 | + | ||
| 5 | +use App\Http\Logic\Bside\BaseLogic; | ||
| 6 | +use App\Models\User\DeptUser; | ||
| 7 | +use App\Models\User\User as UserModel; | ||
| 8 | + | ||
| 9 | +class DeptUserLogic extends BaseLogic | ||
| 10 | +{ | ||
| 11 | + public function __construct() | ||
| 12 | + { | ||
| 13 | + parent::__construct(); | ||
| 14 | + | ||
| 15 | + $this->model = new DeptUser(); | ||
| 16 | + $this->param = $this->requestAll; | ||
| 17 | + } | ||
| 18 | + /** | ||
| 19 | + * @name :(部门用户)dept_user_add | ||
| 20 | + * @author :lyh | ||
| 21 | + * @method :post | ||
| 22 | + * @time :2023/5/18 10:21 | ||
| 23 | + */ | ||
| 24 | + public function dept_user_save(){ | ||
| 25 | + if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 26 | + $rs = $this->dept_user_edit($this->param); | ||
| 27 | + }else{ | ||
| 28 | + $rs = $this->dept_user_add(); | ||
| 29 | + } | ||
| 30 | + if ($rs === false) { | ||
| 31 | + $this->fail('部门添加成员失败'); | ||
| 32 | + } | ||
| 33 | + return $this->success(); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * @name :(部门添加用户)dept_user_add | ||
| 38 | + * @author :lyh | ||
| 39 | + * @method :post | ||
| 40 | + * @time :2023/5/18 10:21 | ||
| 41 | + */ | ||
| 42 | + public function dept_user_add(){ | ||
| 43 | + $param = [ | ||
| 44 | + 'dept_id'=> $this->param['dept_id'], | ||
| 45 | + 'project_id'=>$this->user['project_id'], | ||
| 46 | + 'user_id'=>$this->param['user_id'], | ||
| 47 | + 'operator_id'=>$this->user['id'], | ||
| 48 | + 'create_id'=>$this->user['id'] | ||
| 49 | + ]; | ||
| 50 | + $rs = $this->model->add($param); | ||
| 51 | + if($rs === false){ | ||
| 52 | + $this->fail('部门添加成员失败'); | ||
| 53 | + } | ||
| 54 | + return $this->success(); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * @name :(用户更改部门)dept_user_edit | ||
| 59 | + * @author :lyh | ||
| 60 | + * @method :post | ||
| 61 | + * @time :2023/5/17 17:54 | ||
| 62 | + */ | ||
| 63 | + public function dept_user_edit($param){ | ||
| 64 | + $rs = $this->model->edit($param,['id'=>$this->param['id']]); | ||
| 65 | + if($rs === false){ | ||
| 66 | + $this->fail('error'); | ||
| 67 | + } | ||
| 68 | + return $this->success(); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * @name :(用户设置角色)user_edit_role | ||
| 73 | + * @author :lyh | ||
| 74 | + * @method :post | ||
| 75 | + * @time :2023/5/19 9:35 | ||
| 76 | + */ | ||
| 77 | + public function user_edit_role(){ | ||
| 78 | + $userModel = new UserModel(); | ||
| 79 | + $rs = $userModel->edit(['role_id'=>$this->param['role_id']],['id'=>$this->param['id']]); | ||
| 80 | + if($rs === false){ | ||
| 81 | + $this->fail('error'); | ||
| 82 | + } | ||
| 83 | + return $this->success(); | ||
| 84 | + } | ||
| 85 | +} |
| @@ -4,6 +4,8 @@ namespace App\Http\Logic\Bside\User; | @@ -4,6 +4,8 @@ namespace App\Http\Logic\Bside\User; | ||
| 4 | 4 | ||
| 5 | use App\Http\Logic\Bside\BaseLogic; | 5 | use App\Http\Logic\Bside\BaseLogic; |
| 6 | use App\Models\User\ProjectGroup; | 6 | use App\Models\User\ProjectGroup; |
| 7 | +use App\Models\User\User as UserModel; | ||
| 8 | +use Illuminate\Support\Facades\DB; | ||
| 7 | 9 | ||
| 8 | class GroupLogic extends BaseLogic | 10 | class GroupLogic extends BaseLogic |
| 9 | { | 11 | { |
| @@ -15,52 +17,86 @@ class GroupLogic extends BaseLogic | @@ -15,52 +17,86 @@ class GroupLogic extends BaseLogic | ||
| 15 | $this->param = $this->requestAll; | 17 | $this->param = $this->requestAll; |
| 16 | } | 18 | } |
| 17 | /** | 19 | /** |
| 18 | - * @name :添加 | 20 | + * @name :添加用户组 |
| 19 | * @return void | 21 | * @return void |
| 20 | * @author :liyuhang | 22 | * @author :liyuhang |
| 21 | * @method | 23 | * @method |
| 22 | */ | 24 | */ |
| 23 | public function group_add(){ | 25 | public function group_add(){ |
| 24 | $this->param['project_id'] = $this->user['project_id']; | 26 | $this->param['project_id'] = $this->user['project_id']; |
| 25 | - $this->param['admin_id'] = $this->user['admin_id']; | ||
| 26 | - $this->param['create_id'] = $this->user['create_id']; | ||
| 27 | - $this->param['operator_id'] = $this->user['operator_id']; | ||
| 28 | - $this->param['user_list'] = ','.trim($this->param['user_list'],',').','; | 27 | + $this->param['admin_id'] = $this->user['id']; |
| 28 | + $this->param['create_id'] = $this->user['id']; | ||
| 29 | + $this->param['operator_id'] = $this->user['id']; | ||
| 29 | $rs = $this->model->add($this->param); | 30 | $rs = $this->model->add($this->param); |
| 30 | if($rs === false){ | 31 | if($rs === false){ |
| 31 | $this->fail('error'); | 32 | $this->fail('error'); |
| 32 | } | 33 | } |
| 33 | - if(isset($this->param['pid']) && !empty($this->param['pid'])){ | ||
| 34 | - $this->add_update_parent($this->param); | ||
| 35 | - } | ||
| 36 | return $this->success(); | 34 | return $this->success(); |
| 37 | } | 35 | } |
| 38 | 36 | ||
| 39 | /** | 37 | /** |
| 38 | + * @name :(添加成员)group_add_user | ||
| 39 | + * @author :lyh | ||
| 40 | + * @method :post | ||
| 41 | + * @time :2023/5/17 15:58 | ||
| 42 | + */ | ||
| 43 | + public function group_add_user(){ | ||
| 44 | + $info = $this->model->read(['id'=>$this->param['id']]); | ||
| 45 | + //组装数据 | ||
| 46 | + $str = ltrim($info['user_list'],',').$this->param['user_list']; | ||
| 47 | + $arr = array_unique(explode(',',$str)); | ||
| 48 | + sort($arr); | ||
| 49 | + $str = ','.implode(',',$arr).','; | ||
| 50 | + DB::beginTransaction(); | ||
| 51 | + try { | ||
| 52 | + $this->model->edit(['user_list'=>$str],['id'=>$this->param['id']]); | ||
| 53 | + //更新父类 | ||
| 54 | + $this->update_parent($this->param,$info); | ||
| 55 | + DB::commit(); | ||
| 56 | + }catch (\Exception $e){ | ||
| 57 | + DB::rollBack(); | ||
| 58 | + $this->fail('添加成员失败'); | ||
| 59 | + } | ||
| 60 | + return $this->success(); | ||
| 61 | + } | ||
| 62 | + /** | ||
| 40 | * @name :编辑 | 63 | * @name :编辑 |
| 41 | * @return void | 64 | * @return void |
| 42 | * @author :liyuhang | 65 | * @author :liyuhang |
| 43 | * @method | 66 | * @method |
| 44 | */ | 67 | */ |
| 45 | public function group_edit(){ | 68 | public function group_edit(){ |
| 46 | - $this->param['user_list'] = ','.trim($this->param['user_list'],',').','; | ||
| 47 | $rs = $this->edit($this->param,['id'=>$this->param['id']]); | 69 | $rs = $this->edit($this->param,['id'=>$this->param['id']]); |
| 48 | if($rs === false){ | 70 | if($rs === false){ |
| 49 | $this->fail('error'); | 71 | $this->fail('error'); |
| 50 | } | 72 | } |
| 51 | - //更新父类 | ||
| 52 | - $this->update_parent($this->param,$this->param['id']); | ||
| 53 | return $this->success(); | 73 | return $this->success(); |
| 54 | } | 74 | } |
| 55 | 75 | ||
| 56 | /** | 76 | /** |
| 77 | + * @name :(获取成员列表)user_list | ||
| 78 | + * @author :lyh | ||
| 79 | + * @method :post | ||
| 80 | + * @time :2023/5/17 14:51 | ||
| 81 | + */ | ||
| 82 | + public function user_list($data = [],$order = 'id'){ | ||
| 83 | + unset($this->param['id']); | ||
| 84 | + $userModel = new UserModel(); | ||
| 85 | + $data = array_merge($data,$this->param); | ||
| 86 | + $lists = $userModel->list($data,$order,['id','name','mobile','created_at']); | ||
| 87 | + return $this->success($lists); | ||
| 88 | + } | ||
| 89 | + /** | ||
| 57 | * @name :详情 | 90 | * @name :详情 |
| 58 | * @return void | 91 | * @return void |
| 59 | * @author :liyuhang | 92 | * @author :liyuhang |
| 60 | * @method | 93 | * @method |
| 61 | */ | 94 | */ |
| 62 | - public function group_info(){ | ||
| 63 | - $info = $this->info($this->param); | 95 | + public function group_info($param = []){ |
| 96 | + if(empty($param)){ | ||
| 97 | + $param = $this->param; | ||
| 98 | + } | ||
| 99 | + $info = $this->model->read($this->param); | ||
| 64 | return $this->success($info); | 100 | return $this->success($info); |
| 65 | } | 101 | } |
| 66 | 102 | ||
| @@ -76,7 +112,7 @@ class GroupLogic extends BaseLogic | @@ -76,7 +112,7 @@ class GroupLogic extends BaseLogic | ||
| 76 | if($info !== false){ | 112 | if($info !== false){ |
| 77 | $this->fail('当前删除组织拥有下级组织,不允许删除'); | 113 | $this->fail('当前删除组织拥有下级组织,不允许删除'); |
| 78 | } | 114 | } |
| 79 | - $rs = $this->model->del($this->param); | 115 | + $rs = $this->del($this->param); |
| 80 | if($rs === false){ | 116 | if($rs === false){ |
| 81 | $this->fail('error'); | 117 | $this->fail('error'); |
| 82 | } | 118 | } |
| @@ -89,26 +125,51 @@ class GroupLogic extends BaseLogic | @@ -89,26 +125,51 @@ class GroupLogic extends BaseLogic | ||
| 89 | * @method :post | 125 | * @method :post |
| 90 | * @time :2023/5/17 9:22 | 126 | * @time :2023/5/17 9:22 |
| 91 | */ | 127 | */ |
| 92 | - public function update_parent($param,$id = ''){ | ||
| 93 | - if(!empty($id)){ | ||
| 94 | - $param = $this->model->read(['id'=>$id]); | ||
| 95 | - } | 128 | + public function update_parent($param,$info){ |
| 96 | //查询当前组是否拥有父类 | 129 | //查询当前组是否拥有父类 |
| 97 | - if($param['pid'] != 0){ | ||
| 98 | - $parent_info = $this->model->read(['id'=>$param['pid']]); | 130 | + if($info['pid'] != 0){ |
| 131 | + $parent_info = $this->model->read(['id'=>$info['pid']]); | ||
| 99 | //把添加成员合并到上级 | 132 | //把添加成员合并到上级 |
| 100 | - $str = trim($param['user_list'].$parent_info['user_list'],','); | ||
| 101 | - $mergedString = ','.implode(',', array_unique(explode(',', $str))).','; | 133 | + $str = trim(trim($param['user_list'],',').$parent_info['user_list'],','); |
| 134 | + $arr = array_unique(explode(',', $str)); | ||
| 135 | + sort($arr); | ||
| 136 | + $mergedString = ','.implode(',', $arr).','; | ||
| 102 | $rs = $this->model->edit(['user_list'=>$mergedString],['id'=>$parent_info['id']]); | 137 | $rs = $this->model->edit(['user_list'=>$mergedString],['id'=>$parent_info['id']]); |
| 103 | if($rs === false){ | 138 | if($rs === false){ |
| 104 | $this->fail('更新父级失败'); | 139 | $this->fail('更新父级失败'); |
| 105 | } | 140 | } |
| 106 | //查看当前父级是否还拥有父级 | 141 | //查看当前父级是否还拥有父级 |
| 107 | if($parent_info['pid'] != 0){ | 142 | if($parent_info['pid'] != 0){ |
| 108 | - $rs = $this->update_parent($parent_info); | 143 | + return $this->update_parent($param,$parent_info); |
| 109 | } | 144 | } |
| 110 | } | 145 | } |
| 111 | - return $this->success($rs); | 146 | + return $this->success(); |
| 112 | } | 147 | } |
| 113 | 148 | ||
| 149 | + /** | ||
| 150 | + * @name :(更新子类,同时清空子集成员)edit_son | ||
| 151 | + * @author :lyh | ||
| 152 | + * @method :post | ||
| 153 | + * @time :2023/5/17 13:52 | ||
| 154 | + */ | ||
| 155 | + public function update_son($param,$id){ | ||
| 156 | + //当前数据详情 | ||
| 157 | + $info = $this->model->read(['id'=>$id]); | ||
| 158 | + //子集详情 | ||
| 159 | + $son_list = $this->model->list(['pid'=>$info['id']],'id'); | ||
| 160 | + if(!empty($son_list)){ | ||
| 161 | + //循环查询 | ||
| 162 | + foreach ($son_list as $k => $v){ | ||
| 163 | + $son_data = explode(',',trim($v['user_list'],',')); | ||
| 164 | + $son_str = ''; | ||
| 165 | + foreach ($son_data as $v1){ | ||
| 166 | + if(strpos($param['user_list'],','.$v1.',') > -1){ | ||
| 167 | + $son_str .= $v1.','; | ||
| 168 | + } | ||
| 169 | + } | ||
| 170 | + $this->model->edit(['user_list'=>','.$son_str],['id'=>$v['id']]); | ||
| 171 | + } | ||
| 172 | + } | ||
| 173 | + return true; | ||
| 174 | + } | ||
| 114 | } | 175 | } |
| @@ -22,7 +22,7 @@ class UserLogic extends BaseLogic | @@ -22,7 +22,7 @@ class UserLogic extends BaseLogic | ||
| 22 | * @method | 22 | * @method |
| 23 | */ | 23 | */ |
| 24 | public function user_info(){ | 24 | public function user_info(){ |
| 25 | - $info = $this->info($this->param); | 25 | + $info = $this->model->read($this->param); |
| 26 | return $this->success($info); | 26 | return $this->success($info); |
| 27 | } | 27 | } |
| 28 | /** | 28 | /** |
| @@ -97,9 +97,9 @@ class UserLogic extends BaseLogic | @@ -97,9 +97,9 @@ class UserLogic extends BaseLogic | ||
| 97 | * @method | 97 | * @method |
| 98 | */ | 98 | */ |
| 99 | public function user_del(){ | 99 | public function user_del(){ |
| 100 | - $ids = $this->param['id']; | ||
| 101 | $this->param['id'] = ['in',$this->param['id']]; | 100 | $this->param['id'] = ['in',$this->param['id']]; |
| 102 | - $this->del($this->param,$ids); | 101 | + $this->model->del($this->param); |
| 102 | + //对应删除组织架构 | ||
| 103 | return $this->success(); | 103 | return $this->success(); |
| 104 | } | 104 | } |
| 105 | 105 |
app/Http/Logic/Cside/BaseLogic.php
已删除
100644 → 0
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Http\Logic\Cside; | ||
| 4 | - | ||
| 5 | - | ||
| 6 | -use App\Enums\Common\Common; | ||
| 7 | -use App\Exceptions\BsideGlobalException; | ||
| 8 | -use App\Http\Logic\Logic; | ||
| 9 | - | ||
| 10 | -/** | ||
| 11 | - * @notes: 逻辑层基类 控制器调用 统一返回 统一抛出异常 | ||
| 12 | - */ | ||
| 13 | -class BaseLogic extends Logic | ||
| 14 | -{ | ||
| 15 | - | ||
| 16 | - protected $requestAll; | ||
| 17 | - | ||
| 18 | - protected $param; | ||
| 19 | - | ||
| 20 | - protected $request; | ||
| 21 | - | ||
| 22 | - protected $project; | ||
| 23 | - | ||
| 24 | - protected $side = Common::C; | ||
| 25 | - | ||
| 26 | - public function __construct() | ||
| 27 | - { | ||
| 28 | - $this->request = request(); | ||
| 29 | - $this->requestAll = request()->all(); | ||
| 30 | - $this->project = $this->request->get('project'); | ||
| 31 | - } | ||
| 32 | - | ||
| 33 | - | ||
| 34 | - /** | ||
| 35 | - * 列表 | ||
| 36 | - * @param array $map | ||
| 37 | - * @param array $sort | ||
| 38 | - * @param array $columns | ||
| 39 | - * @param int $limit | ||
| 40 | - * @return array | ||
| 41 | - * @author zbj | ||
| 42 | - * @date 2023/4/13 | ||
| 43 | - */ | ||
| 44 | - public function getList(array $map = [], array $sort = ['id' => 'desc'], array $columns = ['*'], int $limit = 20) | ||
| 45 | - { | ||
| 46 | - $map[] = ['project_id' => $this->project['id']]; | ||
| 47 | - return parent::getList($map, $sort, $columns, $limit); | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - /** | ||
| 51 | - * @param $id | ||
| 52 | - * @return mixed | ||
| 53 | - * @author zbj | ||
| 54 | - * @date 2023/4/15 | ||
| 55 | - */ | ||
| 56 | - public function getCacheInfo($id) | ||
| 57 | - { | ||
| 58 | - $info = parent::getCacheInfo($id); | ||
| 59 | - if ($info && $info['project_id'] != $this->project['id']) { | ||
| 60 | - $info = null; | ||
| 61 | - } | ||
| 62 | - return $info; | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - /** | ||
| 66 | - * 保存 | ||
| 67 | - * @param $param | ||
| 68 | - * @return array | ||
| 69 | - * @throws BsideGlobalException | ||
| 70 | - * @author zbj | ||
| 71 | - * @date 2023/4/13 | ||
| 72 | - */ | ||
| 73 | - public function save($param) | ||
| 74 | - { | ||
| 75 | - $param['project_id'] = $this->project['id']; | ||
| 76 | - return parent::save($param); | ||
| 77 | - } | ||
| 78 | - | ||
| 79 | - /** | ||
| 80 | - * 批量删除 | ||
| 81 | - * @param $ids | ||
| 82 | - * @param array $map | ||
| 83 | - * @return array | ||
| 84 | - * @author zbj | ||
| 85 | - * @date 2023/4/13 | ||
| 86 | - */ | ||
| 87 | - public function delete($ids, $map = []) | ||
| 88 | - { | ||
| 89 | - $map[] = ['project_id' => $this->project['id']]; | ||
| 90 | - return parent::delete($ids, $map); | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | -} |
app/Http/Logic/Cside/InquiryLogic.php
已删除
100644 → 0
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Http\Logic\Cside; | ||
| 4 | - | ||
| 5 | -use App\Helper\Arr; | ||
| 6 | -use App\Models\Inquiry; | ||
| 7 | - | ||
| 8 | -/** | ||
| 9 | - * Class InquiryLogic | ||
| 10 | - * @package App\Http\Logic\Bside | ||
| 11 | - * @author zbj | ||
| 12 | - * @date 2023/5/4 | ||
| 13 | - */ | ||
| 14 | -class InquiryLogic extends BaseLogic | ||
| 15 | -{ | ||
| 16 | - public function __construct() | ||
| 17 | - { | ||
| 18 | - parent::__construct(); | ||
| 19 | - | ||
| 20 | - $this->model = new Inquiry(); | ||
| 21 | - } | ||
| 22 | - | ||
| 23 | - public function save($param) | ||
| 24 | - { | ||
| 25 | - $param['ip_info'] = Arr::s2a($param['ip_info']); | ||
| 26 | - $param['ip'] = $param['ip_info']['ip'] ?? ''; | ||
| 27 | - $param['ip_country'] = $param['ip_info']['country'] ?? ''; | ||
| 28 | - return parent::save($param); | ||
| 29 | - } | ||
| 30 | - | ||
| 31 | -} |
| @@ -4,7 +4,6 @@ namespace App\Http\Logic; | @@ -4,7 +4,6 @@ namespace App\Http\Logic; | ||
| 4 | 4 | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | use App\Enums\Common\Common; | 6 | use App\Enums\Common\Common; |
| 7 | -use App\Exceptions\CsideGlobalException; | ||
| 8 | use \App\Helper\Common as CommonHelper; | 7 | use \App\Helper\Common as CommonHelper; |
| 9 | use App\Exceptions\AsideGlobalException; | 8 | use App\Exceptions\AsideGlobalException; |
| 10 | use App\Exceptions\BsideGlobalException; | 9 | use App\Exceptions\BsideGlobalException; |
| @@ -46,9 +45,6 @@ class Logic | @@ -46,9 +45,6 @@ class Logic | ||
| 46 | if((request()->path()[0]) == Common::B){ | 45 | if((request()->path()[0]) == Common::B){ |
| 47 | throw new BsideGlobalException($code, $message); | 46 | throw new BsideGlobalException($code, $message); |
| 48 | } | 47 | } |
| 49 | - if((request()->path()[0]) == Common::C){ | ||
| 50 | - throw new CsideGlobalException($code, $message); | ||
| 51 | - } | ||
| 52 | throw new AsideGlobalException($code, $message); | 48 | throw new AsideGlobalException($code, $message); |
| 53 | } | 49 | } |
| 54 | 50 |
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Http\Middleware\Cside; | ||
| 4 | - | ||
| 5 | -use App\Enums\Common\Code; | ||
| 6 | -use App\Models\Project\Project; | ||
| 7 | -use App\Services\ProjectServer; | ||
| 8 | -use Closure; | ||
| 9 | -use Illuminate\Http\Request; | ||
| 10 | - | ||
| 11 | -class ParamMiddleware | ||
| 12 | -{ | ||
| 13 | - protected $param = []; | ||
| 14 | - | ||
| 15 | - protected $project = []; | ||
| 16 | - | ||
| 17 | - /** | ||
| 18 | - * Handle an incoming request. | ||
| 19 | - * | ||
| 20 | - * @param \Illuminate\Http\Request $request | ||
| 21 | - * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next | ||
| 22 | - * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse | ||
| 23 | - */ | ||
| 24 | - public function handle(Request $request, Closure $next) | ||
| 25 | - { | ||
| 26 | - $this->param = $request->all(); | ||
| 27 | - $domain = $request->header('domain'); | ||
| 28 | - if(!isset($domain) || empty($domain)){ | ||
| 29 | - return response(['code'=>Code::USER_ERROR,'msg'=>'非法请求']); | ||
| 30 | - } | ||
| 31 | - $project = Project::getProjectByDomain($domain); | ||
| 32 | - if(empty($project)){ | ||
| 33 | - return response(['code'=>Code::USER_ERROR,'msg'=>'非法请求']); | ||
| 34 | - } | ||
| 35 | - // 设置数据信息 | ||
| 36 | -// $project = ProjectServer::useProject($project['id']); | ||
| 37 | -// if($project){ | ||
| 38 | -// return response(['code'=>Code::USER_ERROR,'msg'=>'数据库未配置']); | ||
| 39 | -// } | ||
| 40 | - $request->attributes->add(['project' => $project]); | ||
| 41 | - return $next($request); | ||
| 42 | - } | ||
| 43 | -} |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | -namespace App\Http\Requests\Bside\AyrRelease; | 3 | +namespace App\Http\Requests\Bside\AyrShare; |
| 4 | 4 | ||
| 5 | use Illuminate\Foundation\Http\FormRequest; | 5 | use Illuminate\Foundation\Http\FormRequest; |
| 6 | 6 | ||
| @@ -24,12 +24,12 @@ class AyrReleaseRequest extends FormRequest | @@ -24,12 +24,12 @@ class AyrReleaseRequest extends FormRequest | ||
| 24 | { | 24 | { |
| 25 | return [ | 25 | return [ |
| 26 | 'title'=>'required', | 26 | 'title'=>'required', |
| 27 | - 'images'=>'required|array', | ||
| 28 | - 'video'=>'required', | 27 | +// 'images'=>'required|array', |
| 28 | +// 'video'=>'required', | ||
| 29 | 'content'=>'required', | 29 | 'content'=>'required', |
| 30 | 'share_id'=>'required', | 30 | 'share_id'=>'required', |
| 31 | 'platforms'=>'required|array', | 31 | 'platforms'=>'required|array', |
| 32 | - 'idempotency_key'=>'required', | 32 | +// 'schedule_date'=>'required', |
| 33 | ]; | 33 | ]; |
| 34 | } | 34 | } |
| 35 | 35 |
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Http\Requests\Cside; | ||
| 4 | - | ||
| 5 | -use Illuminate\Foundation\Http\FormRequest; | ||
| 6 | - | ||
| 7 | -/** | ||
| 8 | - * Class InquiryRequest | ||
| 9 | - * @package App\Http\Requests\Cside | ||
| 10 | - * @author zbj | ||
| 11 | - * @date 2023/5/4 | ||
| 12 | - */ | ||
| 13 | -class InquiryRequest extends FormRequest | ||
| 14 | -{ | ||
| 15 | - /** | ||
| 16 | - * Determine if the user is authorized to make this request. | ||
| 17 | - * | ||
| 18 | - * @return bool | ||
| 19 | - */ | ||
| 20 | - public function authorize() | ||
| 21 | - { | ||
| 22 | - return true; | ||
| 23 | - } | ||
| 24 | - | ||
| 25 | - /** | ||
| 26 | - * Get the validation rules that apply to the request. | ||
| 27 | - * | ||
| 28 | - * @return array | ||
| 29 | - */ | ||
| 30 | - public function rules() | ||
| 31 | - { | ||
| 32 | - return [ | ||
| 33 | - 'name' => 'required|max:200', | ||
| 34 | - 'email' => 'required|email|max:200', | ||
| 35 | - 'phone' => 'max:200', | ||
| 36 | - 'content' => 'required', | ||
| 37 | - ]; | ||
| 38 | - } | ||
| 39 | - | ||
| 40 | - public function messages() | ||
| 41 | - { | ||
| 42 | - return []; | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | -} |
| @@ -187,7 +187,7 @@ class Base extends Model | @@ -187,7 +187,7 @@ class Base extends Model | ||
| 187 | // in查询 ['id'=>['in',[1,2,3]]] | 187 | // in查询 ['id'=>['in',[1,2,3]]] |
| 188 | $query->orWhere($k, $v[1]); | 188 | $query->orWhere($k, $v[1]); |
| 189 | break; | 189 | break; |
| 190 | - case 'no in': | 190 | + case 'not in': |
| 191 | // in查询 ['id'=>['not in',[1,2,3]]] | 191 | // in查询 ['id'=>['not in',[1,2,3]]] |
| 192 | $query->whereNotIn($k, $v[1]); | 192 | $query->whereNotIn($k, $v[1]); |
| 193 | break; | 193 | break; |
app/Models/Inquiry.php
已删除
100644 → 0
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Models; | ||
| 4 | - | ||
| 5 | -use App\Helper\Arr; | ||
| 6 | -use Illuminate\Database\Eloquent\SoftDeletes; | ||
| 7 | - | ||
| 8 | -/** | ||
| 9 | - * Class Inquiry | ||
| 10 | - * @package App\Models | ||
| 11 | - * @author zbj | ||
| 12 | - * @date 2023/5/4 | ||
| 13 | - */ | ||
| 14 | -class Inquiry extends Base | ||
| 15 | -{ | ||
| 16 | - use SoftDeletes; | ||
| 17 | - | ||
| 18 | - //设置关联表名 | ||
| 19 | - protected $table = 'gl_inquiry'; | ||
| 20 | - | ||
| 21 | - const STATUS_UNREAD = 0; | ||
| 22 | - const STATUS_READ = 1; | ||
| 23 | - | ||
| 24 | - public function setIpInfoAttribute($value){ | ||
| 25 | - $this->attributes['ip_info'] = Arr::a2s($value); | ||
| 26 | - } | ||
| 27 | - | ||
| 28 | - public function getIpInfoAttribute($value){ | ||
| 29 | - return Arr::s2a($value); | ||
| 30 | - } | ||
| 31 | -} |
app/Models/InquirySet.php
0 → 100644
| @@ -4,10 +4,7 @@ namespace App\Models\User; | @@ -4,10 +4,7 @@ namespace App\Models\User; | ||
| 4 | 4 | ||
| 5 | use App\Models\Base; | 5 | use App\Models\Base; |
| 6 | 6 | ||
| 7 | -class ProjectGroup extends Base | 7 | +class DeptUser extends Base |
| 8 | { | 8 | { |
| 9 | - //设置关联表名 | ||
| 10 | - protected $table = 'gl_project_group'; | ||
| 11 | - //自动维护create_at创建时间 updated_at修改时间 | ||
| 12 | - public $timestamps = true; | 9 | + protected $table = 'gl_project_dept_user'; |
| 13 | } | 10 | } |
app/Models/User/ViewDeptUser.php
0 → 100644
| @@ -40,7 +40,6 @@ class RouteServiceProvider extends ServiceProvider | @@ -40,7 +40,6 @@ class RouteServiceProvider extends ServiceProvider | ||
| 40 | //预定义两个端的API路由 | 40 | //预定义两个端的API路由 |
| 41 | $this->mapAsideRoute(); | 41 | $this->mapAsideRoute(); |
| 42 | $this->mapBsideRoute(); | 42 | $this->mapBsideRoute(); |
| 43 | - $this->mapCsideRoute(); | ||
| 44 | 43 | ||
| 45 | // 暂时无用 | 44 | // 暂时无用 |
| 46 | $this->routes(function () { | 45 | $this->routes(function () { |
| @@ -75,16 +74,6 @@ class RouteServiceProvider extends ServiceProvider | @@ -75,16 +74,6 @@ class RouteServiceProvider extends ServiceProvider | ||
| 75 | ->namespace($this->namespace . '\Bside') | 74 | ->namespace($this->namespace . '\Bside') |
| 76 | ->group(base_path('routes/bside.php')); | 75 | ->group(base_path('routes/bside.php')); |
| 77 | } | 76 | } |
| 78 | - /** | ||
| 79 | - *C端API路由 | ||
| 80 | - * @return void | ||
| 81 | - */ | ||
| 82 | - protected function mapCsideRoute(){ | ||
| 83 | - Route::middleware('cside') | ||
| 84 | - ->prefix('c') | ||
| 85 | - ->namespace($this->namespace . '\Cside') | ||
| 86 | - ->group(base_path('routes/cside.php')); | ||
| 87 | - } | ||
| 88 | 77 | ||
| 89 | /** | 78 | /** |
| 90 | * Configure the rate limiters for the application. | 79 | * Configure the rate limiters for the application. |
| @@ -60,12 +60,6 @@ return [ | @@ -60,12 +60,6 @@ return [ | ||
| 60 | 'via' => \App\Factory\LogFormatterFactory::class, | 60 | 'via' => \App\Factory\LogFormatterFactory::class, |
| 61 | 'prefix' => 'bside', | 61 | 'prefix' => 'bside', |
| 62 | ], | 62 | ], |
| 63 | - //自定义B端错误日志 | ||
| 64 | - 'cside' => [ | ||
| 65 | - 'driver' => 'custom', | ||
| 66 | - 'via' => \App\Factory\LogFormatterFactory::class, | ||
| 67 | - 'prefix' => 'cside', | ||
| 68 | - ], | ||
| 69 | 63 | ||
| 70 | 'stack' => [ | 64 | 'stack' => [ |
| 71 | 'driver' => 'stack', | 65 | 'driver' => 'stack', |
| @@ -19,14 +19,14 @@ return [ | @@ -19,14 +19,14 @@ return [ | ||
| 19 | 'size' => [ | 19 | 'size' => [ |
| 20 | 'max' => 1024*1024*2, // 2M | 20 | 'max' => 1024*1024*2, // 2M |
| 21 | ], | 21 | ], |
| 22 | - 'path' => '/image' | 22 | + 'path' => '/images' |
| 23 | ], | 23 | ], |
| 24 | //默认视频 | 24 | //默认视频 |
| 25 | 'default_file' =>[ | 25 | 'default_file' =>[ |
| 26 | 'size' => [ | 26 | 'size' => [ |
| 27 | 'max' => 1024*1024*20, // 2M | 27 | 'max' => 1024*1024*20, // 2M |
| 28 | ], | 28 | ], |
| 29 | - 'path' => '/file' | 29 | + 'path' => '/files' |
| 30 | ], | 30 | ], |
| 31 | //博客图 | 31 | //博客图 |
| 32 | 'blog' =>[ | 32 | 'blog' =>[ |
| @@ -104,6 +104,7 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w | @@ -104,6 +104,7 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w | ||
| 104 | Route::get('/', [Aside\Project\ProjectController::class, 'list'])->name('admin.project'); | 104 | Route::get('/', [Aside\Project\ProjectController::class, 'list'])->name('admin.project'); |
| 105 | Route::get('/info', [Aside\Project\ProjectController::class, 'info'])->name('admin.project_info'); | 105 | Route::get('/info', [Aside\Project\ProjectController::class, 'info'])->name('admin.project_info'); |
| 106 | Route::post('/save', [Aside\Project\ProjectController::class, 'save'])->name('admin.project_save'); | 106 | Route::post('/save', [Aside\Project\ProjectController::class, 'save'])->name('admin.project_save'); |
| 107 | + Route::any('/inquiry_set', [Aside\Project\ProjectController::class, 'inquiry_set'])->name('admin.project_inquiry_set'); | ||
| 107 | }); | 108 | }); |
| 108 | 109 | ||
| 109 | //工单管理 | 110 | //工单管理 |
| @@ -21,6 +21,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -21,6 +21,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 21 | Route::any('/edit', [\App\Http\Controllers\Bside\User\UserController::class, 'edit'])->name('user_edit'); | 21 | Route::any('/edit', [\App\Http\Controllers\Bside\User\UserController::class, 'edit'])->name('user_edit'); |
| 22 | Route::any('/status', [\App\Http\Controllers\Bside\User\UserController::class, 'status'])->name('user_status'); | 22 | Route::any('/status', [\App\Http\Controllers\Bside\User\UserController::class, 'status'])->name('user_status'); |
| 23 | Route::any('/info', [\App\Http\Controllers\Bside\User\UserController::class, 'info'])->name('user_info'); | 23 | Route::any('/info', [\App\Http\Controllers\Bside\User\UserController::class, 'info'])->name('user_info'); |
| 24 | + Route::any('/role_list', [\App\Http\Controllers\Bside\User\UserController::class, 'role_list'])->name('user_role_list'); | ||
| 24 | Route::any('/del', [\App\Http\Controllers\Bside\User\UserController::class, 'del'])->name('user_del'); | 25 | Route::any('/del', [\App\Http\Controllers\Bside\User\UserController::class, 'del'])->name('user_del'); |
| 25 | }); | 26 | }); |
| 26 | 27 | ||
| @@ -42,16 +43,6 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -42,16 +43,6 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 42 | Route::any('/get_user_list', [\App\Http\Controllers\Bside\User\ProjectRoleController::class, 'get_user_list'])->name('project_role_get_user_list'); | 43 | Route::any('/get_user_list', [\App\Http\Controllers\Bside\User\ProjectRoleController::class, 'get_user_list'])->name('project_role_get_user_list'); |
| 43 | }); | 44 | }); |
| 44 | 45 | ||
| 45 | - //group相关路 | ||
| 46 | - Route::prefix('group')->group(function () { | ||
| 47 | - Route::any('/', [\App\Http\Controllers\Bside\User\ProjectGroupController::class, 'lists'])->name('project_group_lists'); | ||
| 48 | - Route::any('/add', [\App\Http\Controllers\Bside\User\ProjectGroupController::class, 'add'])->name('project_group_add'); | ||
| 49 | - Route::any('/edit', [\App\Http\Controllers\Bside\User\ProjectGroupController::class, 'edit'])->name('project_group_edit'); | ||
| 50 | - Route::any('/info', [\App\Http\Controllers\Bside\User\ProjectGroupController::class, 'info'])->name('project_group_info'); | ||
| 51 | - Route::any('/del', [\App\Http\Controllers\Bside\User\ProjectGroupController::class, 'del'])->name('project_group_del'); | ||
| 52 | - Route::any('/get_user_lists', [\App\Http\Controllers\Bside\User\ProjectGroupController::class, 'get_user_lists'])->name('project_group_get_user_lists'); | ||
| 53 | - }); | ||
| 54 | - | ||
| 55 | //新闻相关路由 | 46 | //新闻相关路由 |
| 56 | Route::prefix('news')->group(function () { | 47 | Route::prefix('news')->group(function () { |
| 57 | //分类 | 48 | //分类 |
| @@ -106,7 +97,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -106,7 +97,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 106 | //公用ai自动生成 | 97 | //公用ai自动生成 |
| 107 | Route::any('/ai_http_post', [\App\Http\Controllers\Bside\Ai\AiCommandController::class, 'ai_http_post'])->name('ai_http_post'); | 98 | Route::any('/ai_http_post', [\App\Http\Controllers\Bside\Ai\AiCommandController::class, 'ai_http_post'])->name('ai_http_post'); |
| 108 | }); | 99 | }); |
| 109 | - //ai指令 | 100 | + //网站设置 |
| 110 | Route::prefix('setting')->group(function () { | 101 | Route::prefix('setting')->group(function () { |
| 111 | //首页设置 | 102 | //首页设置 |
| 112 | Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingController::class, 'lists'])->name('web_setting_lists'); | 103 | Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingController::class, 'lists'])->name('web_setting_lists'); |
| @@ -182,6 +173,14 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -182,6 +173,14 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 182 | Route::get('/info', [\App\Http\Controllers\Bside\User\DeptController::class, 'info'])->name('dept_info'); | 173 | Route::get('/info', [\App\Http\Controllers\Bside\User\DeptController::class, 'info'])->name('dept_info'); |
| 183 | Route::post('/save', [\App\Http\Controllers\Bside\User\DeptController::class, 'save'])->name('dept_save'); | 174 | Route::post('/save', [\App\Http\Controllers\Bside\User\DeptController::class, 'save'])->name('dept_save'); |
| 184 | Route::any('/delete', [\App\Http\Controllers\Bside\User\DeptController::class, 'delete'])->name('dept_delete'); | 175 | Route::any('/delete', [\App\Http\Controllers\Bside\User\DeptController::class, 'delete'])->name('dept_delete'); |
| 176 | + //成员管理 | ||
| 177 | + //组织架构 | ||
| 178 | + Route::prefix('user')->group(function () { | ||
| 179 | + Route::any('/save', [\App\Http\Controllers\Bside\User\DeptUserController::class, 'save'])->name('dept_user_add'); | ||
| 180 | + Route::any('/info', [\App\Http\Controllers\Bside\User\DeptUserController::class, 'info'])->name('dept_user_info'); | ||
| 181 | + Route::any('/set_admin', [\App\Http\Controllers\Bside\User\DeptUserController::class, 'set_admin'])->name('dept_user_set_admin'); | ||
| 182 | + Route::any('/set_role', [\App\Http\Controllers\Bside\User\DeptUserController::class, 'set_role'])->name('dept_user_set_role'); | ||
| 183 | + }); | ||
| 185 | }); | 184 | }); |
| 186 | 185 | ||
| 187 | //文件操作 | 186 | //文件操作 |
| @@ -270,5 +269,5 @@ Route::group([], function () { | @@ -270,5 +269,5 @@ Route::group([], function () { | ||
| 270 | // Route::any('/', [\App\Http\Controllers\Bside\ComController::class, 'get_country'])->name('get_country'); | 269 | // Route::any('/', [\App\Http\Controllers\Bside\ComController::class, 'get_country'])->name('get_country'); |
| 271 | Route::get('/file/download', [\App\Http\Controllers\Bside\FileController::class, 'download'])->name('file_download'); | 270 | Route::get('/file/download', [\App\Http\Controllers\Bside\FileController::class, 'download'])->name('file_download'); |
| 272 | Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\File\ImageController::class,'index'])->name('image_show'); | 271 | Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\File\ImageController::class,'index'])->name('image_show'); |
| 273 | - Route::any('/file_hash/{hash}/', [\App\Http\Controllers\File\FileController::class,'index'])->name('file_show'); | 272 | + Route::any('/file_hash/{hash}', [\App\Http\Controllers\File\FileController::class,'index'])->name('file_show'); |
| 274 | }); | 273 | }); |
routes/cside.php
已删除
100644 → 0
-
请 注册 或 登录 后发表评论