Merge remote-tracking branch 'origin/master' into akun
正在显示
8 个修改的文件
包含
148 行增加
和
26 行删除
| @@ -79,7 +79,7 @@ class PushAiccData extends Command | @@ -79,7 +79,7 @@ class PushAiccData extends Command | ||
| 79 | $data['friend_id'] = $isExists->friend_id; | 79 | $data['friend_id'] = $isExists->friend_id; |
| 80 | $data['user_id'] = $isExists->user_id; | 80 | $data['user_id'] = $isExists->user_id; |
| 81 | 81 | ||
| 82 | - $url = env('AICC_URL'); | 82 | + $url = env('AICC_URL') . env('AICC_PUSH_API_URL'); |
| 83 | $msg = http_post($url, json_encode(compact('data'))); | 83 | $msg = http_post($url, json_encode(compact('data'))); |
| 84 | $status_code = 0; | 84 | $status_code = 0; |
| 85 | if ($msg) { | 85 | if ($msg) { |
| @@ -105,7 +105,7 @@ class PushAiccData extends Command | @@ -105,7 +105,7 @@ class PushAiccData extends Command | ||
| 105 | 105 | ||
| 106 | public function post_data($data) | 106 | public function post_data($data) |
| 107 | { | 107 | { |
| 108 | - $url = env('AICC_URL'); | 108 | + $url = env('AICC_URL') . env('AICC_PUSH_API_URL'); |
| 109 | $msg = http_post($url, json_encode(compact('data'))); | 109 | $msg = http_post($url, json_encode(compact('data'))); |
| 110 | print_r($msg); | 110 | print_r($msg); |
| 111 | } | 111 | } |
| @@ -24,21 +24,55 @@ class FileManageController extends BaseController | @@ -24,21 +24,55 @@ class FileManageController extends BaseController | ||
| 24 | public function __construct(Request $request) | 24 | public function __construct(Request $request) |
| 25 | { | 25 | { |
| 26 | parent::__construct($request); | 26 | parent::__construct($request); |
| 27 | - //判断是否开启 | ||
| 28 | - $project = Project::find($this->user['project_id']); | ||
| 29 | - if(empty($project['is_upload_manage'])){ | ||
| 30 | - $this->fail('文件上传管理功能未开启'); | 27 | + if(!empty($this->user)){ |
| 28 | + $project = Project::find($this->user['project_id']); | ||
| 29 | + if(empty($project['is_upload_manage'])){ | ||
| 30 | + $this->fail('文件上传管理功能未开启'); | ||
| 31 | + } | ||
| 32 | + //判断是否开启 | ||
| 33 | + $this->upload_config = $project['upload_config']; | ||
| 31 | } | 34 | } |
| 32 | - $this->upload_config = $project['upload_config']; | ||
| 33 | } | 35 | } |
| 34 | 36 | ||
| 37 | + /** | ||
| 38 | + * @remark :列表 | ||
| 39 | + * @name :index | ||
| 40 | + * @author :lyh | ||
| 41 | + * @method :post | ||
| 42 | + * @time :2023/12/28 17:03 | ||
| 43 | + */ | ||
| 35 | public function index(FileManage $fileManage){ | 44 | public function index(FileManage $fileManage){ |
| 36 | $this->map['project_id'] = $this->user['project_id']; | 45 | $this->map['project_id'] = $this->user['project_id']; |
| 37 | $this->request['name'] && $this->map['name'] = ['like','%'.$this->request['name'].'%']; | 46 | $this->request['name'] && $this->map['name'] = ['like','%'.$this->request['name'].'%']; |
| 38 | $lists = $fileManage->lists($this->map, $this->page, $this->row); | 47 | $lists = $fileManage->lists($this->map, $this->page, $this->row); |
| 48 | + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($lists, true) . PHP_EOL, FILE_APPEND); | ||
| 49 | + if(!empty($lists) && !empty($lists['list'])){ | ||
| 50 | + foreach ($lists['list'] as $k => $v){ | ||
| 51 | + $v['download_url'] = url('b/file_manager_downLoad?path='.$v['path']); | ||
| 52 | + $lists['list'][$k] = $v; | ||
| 53 | + } | ||
| 54 | + } | ||
| 39 | $this->response('success',Code::SUCCESS,$lists); | 55 | $this->response('success',Code::SUCCESS,$lists); |
| 40 | } | 56 | } |
| 41 | 57 | ||
| 58 | + /** | ||
| 59 | + * @remark :下载方法 | ||
| 60 | + * @name :downLoad | ||
| 61 | + * @author :lyh | ||
| 62 | + * @method :post | ||
| 63 | + * @time :2023/12/28 17:18 | ||
| 64 | + */ | ||
| 65 | + public function downLoad(){ | ||
| 66 | + $username = basename($this->param['path']); | ||
| 67 | + $fileUrl = 'https://file.globalso.com'.$this->param['path']; | ||
| 68 | + // 设置响应头 | ||
| 69 | + header('Content-Description: File Transfer'); | ||
| 70 | + header('Content-Type: application/octet-stream'); | ||
| 71 | + header('Content-Disposition: attachment; filename="' . $username . '"'); | ||
| 72 | + // 下载文件 | ||
| 73 | + readfile($fileUrl); | ||
| 74 | + } | ||
| 75 | + | ||
| 42 | public function upload(Request $request, FileManage $fileManage){ | 76 | public function upload(Request $request, FileManage $fileManage){ |
| 43 | $request->validate([ | 77 | $request->validate([ |
| 44 | 'file'=>['required'], | 78 | 'file'=>['required'], |
| @@ -6,7 +6,9 @@ use App\Enums\Common\Code; | @@ -6,7 +6,9 @@ use App\Enums\Common\Code; | ||
| 6 | use App\Exceptions\BsideGlobalException; | 6 | use App\Exceptions\BsideGlobalException; |
| 7 | use App\Http\Controllers\Bside\BaseController; | 7 | use App\Http\Controllers\Bside\BaseController; |
| 8 | use App\Http\Logic\Aside\ProjectAssociation\ProjectAssociationLogic; | 8 | use App\Http\Logic\Aside\ProjectAssociation\ProjectAssociationLogic; |
| 9 | +use App\Models\ProjectAssociation\ProjectAssociation; | ||
| 9 | use Illuminate\Http\Request; | 10 | use Illuminate\Http\Request; |
| 11 | +use Illuminate\Support\Facades\DB; | ||
| 10 | use Psr\Container\ContainerExceptionInterface; | 12 | use Psr\Container\ContainerExceptionInterface; |
| 11 | use Psr\Container\NotFoundExceptionInterface; | 13 | use Psr\Container\NotFoundExceptionInterface; |
| 12 | 14 | ||
| @@ -31,9 +33,9 @@ class ProjectAssociationController extends BaseController | @@ -31,9 +33,9 @@ class ProjectAssociationController extends BaseController | ||
| 31 | if (empty($project_id)) { | 33 | if (empty($project_id)) { |
| 32 | $this->fail('请选择项目!', Code::USER_PARAMS_ERROE); | 34 | $this->fail('请选择项目!', Code::USER_PARAMS_ERROE); |
| 33 | } | 35 | } |
| 34 | - $status = (bool)request()->post('status', 1); # 1 - 正常, 0 - 禁用 | 36 | + $status = (bool)request()->post('status', 1); # 1 - 正常, 0 - 禁用 |
| 35 | 37 | ||
| 36 | - $user_id = (int)env('AICC_WECHAT_USER_ID') ?? 0; | 38 | + $user_id = (int)env('AICC_WECHAT_USER_ID') ?? 0; |
| 37 | if (empty($user_id) && $status) { | 39 | if (empty($user_id) && $status) { |
| 38 | $this->fail('请选择要绑定的AICC用户!', Code::USER_PARAMS_ERROE); | 40 | $this->fail('请选择要绑定的AICC用户!', Code::USER_PARAMS_ERROE); |
| 39 | } | 41 | } |
| @@ -44,8 +46,68 @@ class ProjectAssociationController extends BaseController | @@ -44,8 +46,68 @@ class ProjectAssociationController extends BaseController | ||
| 44 | $nickname = request()->post('nickname', ''); | 46 | $nickname = request()->post('nickname', ''); |
| 45 | $user_name = request()->post('user_name', ''); | 47 | $user_name = request()->post('user_name', ''); |
| 46 | $image = request()->post('image', ''); | 48 | $image = request()->post('image', ''); |
| 47 | - $data = compact('project_id', 'user_id', 'friend_id', 'nickname', 'user_name', 'image'); | 49 | + $data = compact('project_id', 'user_id', 'friend_id', 'nickname', 'user_name', 'image'); |
| 48 | $this->ProjectAssociationLogic->saveWeChatData($data); | 50 | $this->ProjectAssociationLogic->saveWeChatData($data); |
| 49 | $this->response('success'); | 51 | $this->response('success'); |
| 50 | } | 52 | } |
| 53 | + | ||
| 54 | + public function check() | ||
| 55 | + { | ||
| 56 | + $project_id = (int)request()->input('project_id', 0); | ||
| 57 | + $status = request()->input('status'); | ||
| 58 | + // 重载redis缓存 | ||
| 59 | + $cache = request()->input('cache'); | ||
| 60 | + if (isset($status)) { | ||
| 61 | + $status = (int)$status ? ProjectAssociation::STATUS_NORMAL : ProjectAssociation::STATUS_DISABLED; | ||
| 62 | + } | ||
| 63 | + $isRes = $this->ProjectAssociationLogic->normal($project_id); | ||
| 64 | + DB::beginTransaction(); | ||
| 65 | + try { | ||
| 66 | + // 当数据不存在时并开启状态,自动添加一条数据 | ||
| 67 | + if (is_null($isRes) && (!is_null($status) && $status)) { | ||
| 68 | + $isRes = $this->ProjectAssociationLogic->disabled($project_id); | ||
| 69 | + if (is_null($isRes)) { | ||
| 70 | + $isRes = new ProjectAssociation(); | ||
| 71 | + } | ||
| 72 | + $isRes->project_id = $project_id; | ||
| 73 | + $isRes->user_id = (int)env('AICC_WECHAT_USER_ID'); | ||
| 74 | + $isRes->status = $status; | ||
| 75 | + $isRes->save(); | ||
| 76 | + DB::commit(); | ||
| 77 | + } // 关闭状态 | ||
| 78 | + elseif (!is_null($isRes) && (!is_null($status) && empty($status))) { | ||
| 79 | + $isRes->status = $status; | ||
| 80 | + $isRes->save(); | ||
| 81 | + DB::commit(); | ||
| 82 | + return [ | ||
| 83 | + 'code' => Code::SUCCESS, | ||
| 84 | + 'data' => [], | ||
| 85 | + 'message' => '关闭AICC绑定成功!', | ||
| 86 | + ]; | ||
| 87 | + } | ||
| 88 | + } catch (\Exception $exception) { | ||
| 89 | + DB::rollBack(); | ||
| 90 | + $this->response('数据错误,请重试!', Code::SERVER_ERROR); | ||
| 91 | + } | ||
| 92 | + if (is_null($isRes)) { | ||
| 93 | + $this->response('请开启AICC绑定!', Code::USER_ERROR, []); | ||
| 94 | + } | ||
| 95 | + $redis_key = 'aicc_friend_lists_' . (int)env('AICC_WECHAT_USER_ID'); | ||
| 96 | + $result = isset($cache) ? false : redis_get($redis_key); | ||
| 97 | + if (empty($result)) { | ||
| 98 | + $url = env('AICC_URL') . env('AICC_WECHAT_FRIEND_API_URL'); | ||
| 99 | + $result = curlGet($url); | ||
| 100 | + redis_set($redis_key, json_encode($result)); | ||
| 101 | + } else { | ||
| 102 | + $result = json_decode($result, true); | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + $result['info'] = [ | ||
| 106 | + 'friend_id' => $isRes->friend_id ?? 0, | ||
| 107 | + 'nickname' => $isRes->nickname ?? '', | ||
| 108 | + 'user_name' => $isRes->user_name ?? '', | ||
| 109 | + 'image' => $isRes->image ?? '', | ||
| 110 | + ]; | ||
| 111 | + $this->response('success', Code::SUCCESS, $result); | ||
| 112 | + } | ||
| 51 | } | 113 | } |
| @@ -110,26 +110,23 @@ class DomainInfoLogic extends BaseLogic | @@ -110,26 +110,23 @@ class DomainInfoLogic extends BaseLogic | ||
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | /** | 112 | /** |
| 113 | - * @remark :删除域名 | ||
| 114 | - * @name :delDomain | ||
| 115 | - * @author :lyh | ||
| 116 | - * @method :post | ||
| 117 | - * @time :2023/8/1 15:41 | 113 | + * 删除域名 |
| 114 | + * @return array | ||
| 115 | + * @throws \App\Exceptions\AsideGlobalException | ||
| 116 | + * @throws \App\Exceptions\BsideGlobalException | ||
| 118 | */ | 117 | */ |
| 119 | public function delDomain(){ | 118 | public function delDomain(){ |
| 120 | $ids = $this->param['id']; | 119 | $ids = $this->param['id']; |
| 120 | + // 初始化数据 | ||
| 121 | + if (FALSE == is_array($ids)) | ||
| 122 | + $ids = [$ids]; | ||
| 121 | foreach ($ids as $k => $v){ | 123 | foreach ($ids as $k => $v){ |
| 122 | - $info = $this->model->read(['id'=>$v]); | ||
| 123 | - $deployOptimizeModel = new DeployOptimize(); | ||
| 124 | - $domainInfo = $deployOptimizeModel->read(['domain'=>$info['domain']]); | ||
| 125 | - if($domainInfo !== false){ | ||
| 126 | - $this->fail('当前域名正在使用中'); | ||
| 127 | - } | ||
| 128 | - } | ||
| 129 | - $this->param['id'] = ['in',$ids]; | ||
| 130 | - $rs = $this->model->del($this->param); | ||
| 131 | - if($rs === false){ | ||
| 132 | - $this->fail('error'); | 124 | + $domain = DomainInfo::where(['id' => $v])->first(); |
| 125 | + if (empty($domain)) | ||
| 126 | + continue; | ||
| 127 | + if (FALSE == empty($domain['project_id'])) | ||
| 128 | + $this->fail($domain->domain . '域名正在使用中, 删除失败!'); | ||
| 129 | + $domain->delete(); | ||
| 133 | } | 130 | } |
| 134 | return $this->success(); | 131 | return $this->success(); |
| 135 | } | 132 | } |
| @@ -5,6 +5,8 @@ namespace App\Http\Logic\Aside\ProjectAssociation; | @@ -5,6 +5,8 @@ namespace App\Http\Logic\Aside\ProjectAssociation; | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | use App\Http\Logic\Logic; | 6 | use App\Http\Logic\Logic; |
| 7 | use App\Models\ProjectAssociation\ProjectAssociation; | 7 | use App\Models\ProjectAssociation\ProjectAssociation; |
| 8 | +use Illuminate\Database\Eloquent\Builder; | ||
| 9 | +use Illuminate\Database\Eloquent\Model; | ||
| 8 | use Illuminate\Support\Facades\DB; | 10 | use Illuminate\Support\Facades\DB; |
| 9 | 11 | ||
| 10 | class ProjectAssociationLogic extends Logic | 12 | class ProjectAssociationLogic extends Logic |
| @@ -24,4 +26,25 @@ class ProjectAssociationLogic extends Logic | @@ -24,4 +26,25 @@ class ProjectAssociationLogic extends Logic | ||
| 24 | } | 26 | } |
| 25 | return $status; | 27 | return $status; |
| 26 | } | 28 | } |
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * status - 正常 | ||
| 32 | + * @param $project_id | ||
| 33 | + * @return ProjectAssociation|Builder|Model|object|null | ||
| 34 | + */ | ||
| 35 | + public function normal($project_id) | ||
| 36 | + { | ||
| 37 | + return ProjectAssociation::query()->whereProjectId($project_id)->whereStatus(ProjectAssociation::STATUS_NORMAL)->first(); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * status - 禁用 | ||
| 43 | + * @param $project_id | ||
| 44 | + * @return ProjectAssociation|Builder|Model|object|null | ||
| 45 | + */ | ||
| 46 | + public function disabled($project_id) | ||
| 47 | + { | ||
| 48 | + return ProjectAssociation::query()->whereProjectId($project_id)->whereStatus(ProjectAssociation::STATUS_DISABLED)->first(); | ||
| 49 | + } | ||
| 27 | } | 50 | } |
| @@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
| 10 | namespace App\Http\Logic\Bside\BTemplate; | 10 | namespace App\Http\Logic\Bside\BTemplate; |
| 11 | 11 | ||
| 12 | use App\Http\Logic\Bside\BaseLogic; | 12 | use App\Http\Logic\Bside\BaseLogic; |
| 13 | +use App\Models\RouteMap\RouteMap; | ||
| 13 | use App\Models\Service\Service as ServiceSettingModel; | 14 | use App\Models\Service\Service as ServiceSettingModel; |
| 14 | use App\Models\Template\BTemplate; | 15 | use App\Models\Template\BTemplate; |
| 15 | use App\Models\Template\BTemplateCommon; | 16 | use App\Models\Template\BTemplateCommon; |
| @@ -109,6 +110,8 @@ class InitHtmlLogic extends BaseLogic | @@ -109,6 +110,8 @@ class InitHtmlLogic extends BaseLogic | ||
| 109 | $bTemplateMainModel->edit($data,['id'=>$mainInfo['id']]); | 110 | $bTemplateMainModel->edit($data,['id'=>$mainInfo['id']]); |
| 110 | } | 111 | } |
| 111 | $this->saveDetailCommonHtml($this->param['html'],$this->param['type'],$template_id,$is_custom,$is_list); | 112 | $this->saveDetailCommonHtml($this->param['html'],$this->param['type'],$template_id,$is_custom,$is_list); |
| 113 | + $route = RouteMap::getRoute('all',0,$this->user['project_id']); | ||
| 114 | + $this->curlDelRoute(['route'=>$route,'new_route'=>$route]); | ||
| 112 | return $this->success(); | 115 | return $this->success(); |
| 113 | } | 116 | } |
| 114 | /** | 117 | /** |
| @@ -73,6 +73,8 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -73,6 +73,8 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 73 | Route::any('/log', [Aside\Ai\AiLogController::class, 'lists'])->name('admin.lists'); | 73 | Route::any('/log', [Aside\Ai\AiLogController::class, 'lists'])->name('admin.lists'); |
| 74 | // 绑定AICC微信应用 | 74 | // 绑定AICC微信应用 |
| 75 | Route::post('/wechat', [ProjectAssociationController::class, 'saveWeChatData'])->name('admin.aicc.wechat'); | 75 | Route::post('/wechat', [ProjectAssociationController::class, 'saveWeChatData'])->name('admin.aicc.wechat'); |
| 76 | + // OA后台开启关闭AICC用户绑定 | ||
| 77 | + Route::post('/check', [ProjectAssociationController::class, 'check'])->name('admin.aicc.check'); | ||
| 76 | }); | 78 | }); |
| 77 | //特殊模块权限设置 | 79 | //特殊模块权限设置 |
| 78 | Route::prefix('special')->group(function () { | 80 | Route::prefix('special')->group(function () { |
| @@ -470,6 +470,7 @@ Route::group([], function () { | @@ -470,6 +470,7 @@ Route::group([], function () { | ||
| 470 | Route::any('/login', [\App\Http\Controllers\Bside\LoginController::class, 'login'])->name('login'); | 470 | Route::any('/login', [\App\Http\Controllers\Bside\LoginController::class, 'login'])->name('login'); |
| 471 | Route::any('/projectLogin', [\App\Http\Controllers\Bside\LoginController::class, 'projectLogin'])->name('projectLogin'); | 471 | Route::any('/projectLogin', [\App\Http\Controllers\Bside\LoginController::class, 'projectLogin'])->name('projectLogin'); |
| 472 | Route::any('/ceshi', [\App\Http\Controllers\Bside\LoginController::class, 'ceshi'])->name('ceshi'); | 472 | Route::any('/ceshi', [\App\Http\Controllers\Bside\LoginController::class, 'ceshi'])->name('ceshi'); |
| 473 | + Route::any('/file_manager_downLoad', [\App\Http\Controllers\Bside\FileManage\FileManageController::class, 'downLoad'])->name('file_manager_downLoad'); | ||
| 473 | Route::any('/stringTranslation', [\App\Http\Controllers\Bside\LoginController::class, 'stringTranslation'])->name('stringTranslation'); | 474 | Route::any('/stringTranslation', [\App\Http\Controllers\Bside\LoginController::class, 'stringTranslation'])->name('stringTranslation'); |
| 474 | Route::any('/sendLoginSms', [\App\Http\Controllers\Bside\LoginController::class, 'sendLoginSms'])->name('sendLoginSms'); | 475 | Route::any('/sendLoginSms', [\App\Http\Controllers\Bside\LoginController::class, 'sendLoginSms'])->name('sendLoginSms'); |
| 475 | Route::any('/autologin', [\App\Http\Controllers\Bside\LoginController::class, 'autologin'])->name('autologin'); | 476 | Route::any('/autologin', [\App\Http\Controllers\Bside\LoginController::class, 'autologin'])->name('autologin'); |
-
请 注册 或 登录 后发表评论