Merge branch 'dev' of http://47.244.231.31:8099/zhl/globalso-v6 into dev
正在显示
19 个修改的文件
包含
308 行增加
和
94 行删除
| @@ -140,6 +140,11 @@ class Handler extends ExceptionHandler | @@ -140,6 +140,11 @@ class Handler extends ExceptionHandler | ||
| 140 | 'code' => $code, | 140 | 'code' => $code, |
| 141 | 'message' => $message | 141 | 'message' => $message |
| 142 | ]; | 142 | ]; |
| 143 | + // 调试模式 | ||
| 144 | + if(env('app_debug')){ | ||
| 145 | + $response['trace'] = $exception->getTrace(); | ||
| 146 | + } | ||
| 147 | + | ||
| 143 | //加密返回 | 148 | //加密返回 |
| 144 | if (config('app.params_encrypt')) { | 149 | if (config('app.params_encrypt')) { |
| 145 | $k = config('app.params_encrypt_key'); | 150 | $k = config('app.params_encrypt_key'); |
| @@ -111,16 +111,10 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K | @@ -111,16 +111,10 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K | ||
| 111 | * @param :platforms: "facebook", "fbg", "twitter", | 111 | * @param :platforms: "facebook", "fbg", "twitter", |
| 112 | * "linkedin", "instagram","youtube", "reddit" ,"telegram"" | 112 | * "linkedin", "instagram","youtube", "reddit" ,"telegram"" |
| 113 | */ | 113 | */ |
| 114 | - public function post_send_msg($param){ | ||
| 115 | - $param = [ | ||
| 116 | - 'post'=>$param['post'],//内容(帖子文本) | ||
| 117 | - 'platforms'=>$param['platforms'],//平台 | ||
| 118 | - 'idempotencyKey'=>$param['idempotencyKey'],//帖子唯一id | ||
| 119 | - 'mediaUrls'=>$param['mediaUrls'], | ||
| 120 | - ]; | 114 | + public function post_send_msg($param,$api_key){ |
| 121 | //平台参数处理 | 115 | //平台参数处理 |
| 122 | $this->headers['Accept-Encoding'] = 'gzip'; | 116 | $this->headers['Accept-Encoding'] = 'gzip'; |
| 123 | - $this->headers['Authorization'] = $this->headers['Authorization'].$param['profile_key']; | 117 | + $this->headers['Authorization'] = $this->headers['Authorization'].$api_key; |
| 124 | $url = $this->path.'/api/post'; | 118 | $url = $this->path.'/api/post'; |
| 125 | return $this->http_click('posts',$url,$param,$this->headers); | 119 | return $this->http_click('posts',$url,$param,$this->headers); |
| 126 | } | 120 | } |
| @@ -120,4 +120,17 @@ class Common | @@ -120,4 +120,17 @@ class Common | ||
| 120 | } | 120 | } |
| 121 | return true; | 121 | return true; |
| 122 | } | 122 | } |
| 123 | + | ||
| 124 | + /** | ||
| 125 | + * @name :(多维数组去重)array_deduplication | ||
| 126 | + * @author :lyh | ||
| 127 | + * @method :post | ||
| 128 | + * @time :2023/5/9 10:47 | ||
| 129 | + */ | ||
| 130 | + public static function uniqueMultiArray($arr) { | ||
| 131 | + $arr = array_map('serialize', $arr); | ||
| 132 | + $arr = array_unique($arr); | ||
| 133 | + $arr = array_map('unserialize', $arr); | ||
| 134 | + return $arr; | ||
| 135 | + } | ||
| 123 | } | 136 | } |
| @@ -21,14 +21,26 @@ class AyrShareController extends BaseController | @@ -21,14 +21,26 @@ class AyrShareController extends BaseController | ||
| 21 | */ | 21 | */ |
| 22 | public function lists(AyrShareModel $ayrShareModel){ | 22 | public function lists(AyrShareModel $ayrShareModel){ |
| 23 | $lists = $ayrShareModel->lists($this->map,$this->page,$this->row,'id',['*']); | 23 | $lists = $ayrShareModel->lists($this->map,$this->page,$this->row,'id',['*']); |
| 24 | - $ayrShareHelper = new AyrShareHelper(); | ||
| 25 | - foreach ($lists['list'] as $k=>$v){ | ||
| 26 | - $lists['list'][$k]['ayr'] = $ayrShareHelper->get_profiles_users($v['profile_key']); | ||
| 27 | - } | ||
| 28 | $this->response('列表',Code::SUCCESS,$lists); | 24 | $this->response('列表',Code::SUCCESS,$lists); |
| 29 | } | 25 | } |
| 30 | 26 | ||
| 31 | /** | 27 | /** |
| 28 | + * @name :(定时更新)save_account | ||
| 29 | + * @author :lyh | ||
| 30 | + * @method :post | ||
| 31 | + * @time :2023/5/9 14:39 | ||
| 32 | + */ | ||
| 33 | + public function save_account(AyrShareLogic $ayrShareLogic){ | ||
| 34 | + $info = $ayrShareLogic->ayr_share_info(); | ||
| 35 | + $ayrShareHelper = new AyrShareHelper(); | ||
| 36 | + $share_info = $ayrShareHelper->get_profiles_users($info['profile_key']); | ||
| 37 | + if(isset($share_info['activeSocialAccounts'])){ | ||
| 38 | + $str = json_encode($share_info['activeSocialAccounts']); | ||
| 39 | + $ayrShareLogic->ayr_share_edit(['bind_plat_from'=>$str]); | ||
| 40 | + } | ||
| 41 | + $this->response('success'); | ||
| 42 | + } | ||
| 43 | + /** | ||
| 32 | * @name :(创建ayr_share账户)create_account | 44 | * @name :(创建ayr_share账户)create_account |
| 33 | * @author :lyh | 45 | * @author :lyh |
| 34 | * @method :post | 46 | * @method :post |
| @@ -66,7 +78,7 @@ class AyrShareController extends BaseController | @@ -66,7 +78,7 @@ class AyrShareController extends BaseController | ||
| 66 | 'title'=>$info['title'], | 78 | 'title'=>$info['title'], |
| 67 | 'profileKey'=>$info['profile_key'] | 79 | 'profileKey'=>$info['profile_key'] |
| 68 | ]; | 80 | ]; |
| 69 | - //发送请求注册社交用户 | 81 | + //发送请求删除社交用户 |
| 70 | $ayrShareHelper = new AyrShareHelper(); | 82 | $ayrShareHelper = new AyrShareHelper(); |
| 71 | $res = $ayrShareHelper->deleted_profiles($data); | 83 | $res = $ayrShareHelper->deleted_profiles($data); |
| 72 | if($res['status'] == 'fail'){ | 84 | if($res['status'] == 'fail'){ |
| @@ -101,54 +113,4 @@ class AyrShareController extends BaseController | @@ -101,54 +113,4 @@ class AyrShareController extends BaseController | ||
| 101 | $this->response('success',Code::SUCCESS,$res); | 113 | $this->response('success',Code::SUCCESS,$res); |
| 102 | } | 114 | } |
| 103 | 115 | ||
| 104 | - /** | ||
| 105 | - * @name :(获取当前用户的配置文件)get_profiles | ||
| 106 | - * @author :lyh | ||
| 107 | - * @method :post | ||
| 108 | - * @time :2023/5/6 16:39 | ||
| 109 | - */ | ||
| 110 | - public function get_profiles(AyrShareLogic $ayrShareLogic){ | ||
| 111 | - $this->request->validate([ | ||
| 112 | - 'id'=>['required'] | ||
| 113 | - ],[ | ||
| 114 | - 'id.required' => 'ID不能为空' | ||
| 115 | - ]); | ||
| 116 | - $info = $ayrShareLogic->ayr_share_info(); | ||
| 117 | - //发送请求注册社交用户 | ||
| 118 | - $ayrShareHelper = new AyrShareHelper(); | ||
| 119 | - $data = [ | ||
| 120 | - 'title'=>$info['title'], | ||
| 121 | - 'refId'=>$info['ref_id'], | ||
| 122 | - 'profileKeys'=>$info['profile_keys'] | ||
| 123 | - ]; | ||
| 124 | - $res = $ayrShareHelper->post_generate_jwt($data); | ||
| 125 | - if($res['status'] == 'fail'){ | ||
| 126 | - $this->response($res['message'],Code::USER_ERROR); | ||
| 127 | - } | ||
| 128 | - $this->response('success',Code::SUCCESS,$res); | ||
| 129 | - } | ||
| 130 | - | ||
| 131 | - /** | ||
| 132 | - * @name :(上传图片到第三方)post_uploads | ||
| 133 | - * @author :lyh | ||
| 134 | - * @method :post | ||
| 135 | - * @time :2023/5/8 13:45 | ||
| 136 | - */ | ||
| 137 | - public function post_uploads(){ | ||
| 138 | - | ||
| 139 | - } | ||
| 140 | - /** | ||
| 141 | - * @name :(发布推文到第三方平台)send_api_post | ||
| 142 | - * @author :lyh | ||
| 143 | - * @method :post | ||
| 144 | - * @time :2023/5/8 13:37 | ||
| 145 | - */ | ||
| 146 | - public function send_api_post(AyrShareLogic $ayrShareLogic){ | ||
| 147 | - $this->request->validate([ | ||
| 148 | - 'id'=>['required'] | ||
| 149 | - ],[ | ||
| 150 | - 'id.required' => 'ID不能为空' | ||
| 151 | - ]); | ||
| 152 | - $info = $ayrShareLogic->ayr_share_info(); | ||
| 153 | - } | ||
| 154 | } | 116 | } |
| @@ -43,6 +43,15 @@ class BaseController extends Controller | @@ -43,6 +43,15 @@ class BaseController extends Controller | ||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | /** | 45 | /** |
| 46 | + * @name :ceshi | ||
| 47 | + * @author :lyh | ||
| 48 | + * @method :post | ||
| 49 | + * @time :2023/5/9 11:43 | ||
| 50 | + */ | ||
| 51 | + public function ceshi(){ | ||
| 52 | + | ||
| 53 | + } | ||
| 54 | + /** | ||
| 46 | * @name 参数过滤 | 55 | * @name 参数过滤 |
| 47 | * @return void | 56 | * @return void |
| 48 | * @author :liyuhang | 57 | * @author :liyuhang |
| @@ -142,7 +151,7 @@ class BaseController extends Controller | @@ -142,7 +151,7 @@ class BaseController extends Controller | ||
| 142 | * @author :liyuhang | 151 | * @author :liyuhang |
| 143 | * @method | 152 | * @method |
| 144 | */ | 153 | */ |
| 145 | - protected function _extents($data) { | 154 | + public function _extents($data) { |
| 146 | 155 | ||
| 147 | if (empty($data) || !is_array($data)) { | 156 | if (empty($data) || !is_array($data)) { |
| 148 | return empty($data) ? is_array($data) ? [] : '' : $data; | 157 | return empty($data) ? is_array($data) ? [] : '' : $data; |
| @@ -160,6 +169,15 @@ class BaseController extends Controller | @@ -160,6 +169,15 @@ class BaseController extends Controller | ||
| 160 | case 'image': | 169 | case 'image': |
| 161 | $data['image_link'] = url('/b/image/' . $v); | 170 | $data['image_link'] = url('/b/image/' . $v); |
| 162 | break; | 171 | break; |
| 172 | + case 'images': | ||
| 173 | + $v = explode(',',$v); | ||
| 174 | + foreach ($v as $k1=>$v1){ | ||
| 175 | + $data['images_link'][$k1] = url('/b/image/' . $v1); | ||
| 176 | + } | ||
| 177 | + break; | ||
| 178 | + case 'file': | ||
| 179 | + $data['file_link'] = url('/b/file_hash/' . $v); | ||
| 180 | + break; | ||
| 163 | case 'operator_id': | 181 | case 'operator_id': |
| 164 | if(!empty($v)){ | 182 | if(!empty($v)){ |
| 165 | $name = (new UserModel())->read(['operator_id'=>$v],['id','name']); | 183 | $name = (new UserModel())->read(['operator_id'=>$v],['id','name']); |
| @@ -11,6 +11,7 @@ use App\Http\Logic\Bside\Setting\WebSettingServiceLogic; | @@ -11,6 +11,7 @@ use App\Http\Logic\Bside\Setting\WebSettingServiceLogic; | ||
| 11 | */ | 11 | */ |
| 12 | class WebSettingServiceController extends BaseController | 12 | class WebSettingServiceController extends BaseController |
| 13 | { | 13 | { |
| 14 | + const TYPE_CODE = 6; | ||
| 14 | /** | 15 | /** |
| 15 | * @name :lists | 16 | * @name :lists |
| 16 | * @author :lyh | 17 | * @author :lyh |
| @@ -19,6 +20,12 @@ class WebSettingServiceController extends BaseController | @@ -19,6 +20,12 @@ class WebSettingServiceController extends BaseController | ||
| 19 | */ | 20 | */ |
| 20 | public function lists(WebSettingServiceLogic $webSettingServiceLogic){ | 21 | public function lists(WebSettingServiceLogic $webSettingServiceLogic){ |
| 21 | $lists = $webSettingServiceLogic->setting_service_list(); | 22 | $lists = $webSettingServiceLogic->setting_service_list(); |
| 23 | + foreach ($lists as $k => $v){ | ||
| 24 | + if($v['type'] == self::TYPE_CODE){ | ||
| 25 | + $v['values_link'] = url('/b/image/' . $v['values']); | ||
| 26 | + $lists[$k] = $v; | ||
| 27 | + } | ||
| 28 | + } | ||
| 22 | $this->response('success',Code::SUCCESS,$lists); | 29 | $this->response('success',Code::SUCCESS,$lists); |
| 23 | } | 30 | } |
| 24 | /** | 31 | /** |
| @@ -9,9 +9,7 @@ use App\Http\Controllers\Bside\json; | @@ -9,9 +9,7 @@ use App\Http\Controllers\Bside\json; | ||
| 9 | use App\Http\Logic\Bside\ProjectGroupLogic; | 9 | use App\Http\Logic\Bside\ProjectGroupLogic; |
| 10 | use App\Http\Logic\Bside\User\GroupLogic; | 10 | use App\Http\Logic\Bside\User\GroupLogic; |
| 11 | use App\Http\Requests\Bside\User\ProjectGroupRequest; | 11 | use App\Http\Requests\Bside\User\ProjectGroupRequest; |
| 12 | -use App\Models\ProjectGroup as ProjectGroupModel; | ||
| 13 | -use App\Models\User\User as UserModel; | ||
| 14 | -use Illuminate\Http\Request; | 12 | +use App\Models\User\ProjectGroup; |
| 15 | 13 | ||
| 16 | 14 | ||
| 17 | /** | 15 | /** |
| @@ -25,10 +23,18 @@ class ProjectGroupController extends BaseController | @@ -25,10 +23,18 @@ class ProjectGroupController extends BaseController | ||
| 25 | * @author :liyuhang | 23 | * @author :liyuhang |
| 26 | * @method | 24 | * @method |
| 27 | */ | 25 | */ |
| 28 | - public function lists(ProjectGroupModel $projectGroupModel) | 26 | + public function lists(ProjectGroup $projectGroup) |
| 29 | { | 27 | { |
| 30 | - $lists = $projectGroupModel->lists($this->map,$this->page,$this->row); | ||
| 31 | - $this->response('success',Code::SUCCESS,$lists); | 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); | ||
| 32 | } | 38 | } |
| 33 | 39 | ||
| 34 | /** | 40 | /** |
| @@ -4,6 +4,9 @@ namespace App\Http\Controllers\file; | @@ -4,6 +4,9 @@ namespace App\Http\Controllers\file; | ||
| 4 | 4 | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | use App\Models\File\File; | 6 | use App\Models\File\File; |
| 7 | +use App\Models\File\Image as ImageModel; | ||
| 8 | +use Illuminate\Http\Exceptions\HttpResponseException; | ||
| 9 | +use Illuminate\Http\JsonResponse; | ||
| 7 | 10 | ||
| 8 | class FileController | 11 | class FileController |
| 9 | { | 12 | { |
| @@ -30,10 +33,17 @@ class FileController | @@ -30,10 +33,17 @@ class FileController | ||
| 30 | { | 33 | { |
| 31 | $this->request = request(); | 34 | $this->request = request(); |
| 32 | $this->config = config('filesystems.disks.upload'); | 35 | $this->config = config('filesystems.disks.upload'); |
| 33 | - $this->path = $this->config['root']; | 36 | + $this->path = $this->config['root'].'/file/'; |
| 34 | } | 37 | } |
| 35 | 38 | ||
| 36 | - public function index($hash = '', $w = 0 ,$h = 0){ | 39 | + /** |
| 40 | + * @param :(获取文件)$hash | ||
| 41 | + * @name :index | ||
| 42 | + * @author :lyh | ||
| 43 | + * @method :post | ||
| 44 | + * @time :2023/5/9 9:15 | ||
| 45 | + */ | ||
| 46 | + public function index($hash = ''){ | ||
| 37 | if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH'])) { | 47 | if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH'])) { |
| 38 | header("HTTP/1.1 304 Not Modified"); | 48 | header("HTTP/1.1 304 Not Modified"); |
| 39 | exit; | 49 | exit; |
| @@ -51,4 +61,112 @@ class FileController | @@ -51,4 +61,112 @@ class FileController | ||
| 51 | $header['Content-Length'] = $info['size']; | 61 | $header['Content-Length'] = $info['size']; |
| 52 | return response($content, 200, $header); | 62 | return response($content, 200, $header); |
| 53 | } | 63 | } |
| 64 | + /** | ||
| 65 | + * 图片上传 | ||
| 66 | + */ | ||
| 67 | + public function upload() { | ||
| 68 | + $this->request->validate([ | ||
| 69 | + 'image'=>['required'], | ||
| 70 | + ],[ | ||
| 71 | + 'image.required'=>'图片必须填写', | ||
| 72 | + ]); | ||
| 73 | + $files = $this->request->file('file'); | ||
| 74 | + if (empty($files)) { | ||
| 75 | + $this->response('没有上传的文件!', 400); | ||
| 76 | + } | ||
| 77 | + $type = $this->request->post('type', 'single'); | ||
| 78 | + if ($type == 'multi') { | ||
| 79 | + return $this->multi($files); | ||
| 80 | + } else { | ||
| 81 | + return $this->single($files); | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + /** | ||
| 85 | + * @name :上传 | ||
| 86 | + * @return void | ||
| 87 | + * @author :liyuhang | ||
| 88 | + * @method | ||
| 89 | + */ | ||
| 90 | + public function single($files){ | ||
| 91 | + $hash = hash_file('md5', $files->getPathname()); | ||
| 92 | + //查看文件是否存在 | ||
| 93 | + $fileModel = new File(); | ||
| 94 | + $file_hash = $fileModel->read(['hash'=>$hash]); | ||
| 95 | + if($file_hash !== false){ | ||
| 96 | + return $hash; | ||
| 97 | + } | ||
| 98 | + $url = $this->path; | ||
| 99 | + $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension(); | ||
| 100 | + $res = $files->move($url,$fileName); | ||
| 101 | + if ($res === false) { | ||
| 102 | + return $this->response($files->getError(), Code::USER_ERROR); | ||
| 103 | + } | ||
| 104 | + $data = [ | ||
| 105 | + 'path' => $url.'/'.$fileName, | ||
| 106 | + 'created_at' => date('Y-m-d H:i:s',time()), | ||
| 107 | + 'size' => $res->getSize(), | ||
| 108 | + 'hash' => $hash, | ||
| 109 | + 'type'=>$files->getClientOriginalExtension(), | ||
| 110 | + ]; | ||
| 111 | + $rs = $fileModel->add($data); | ||
| 112 | + if ($rs === false) { | ||
| 113 | + return $this->response('添加失败', Code::USER_ERROR); | ||
| 114 | + } | ||
| 115 | + return $hash; | ||
| 116 | + } | ||
| 117 | + /** | ||
| 118 | + * 多文件上传 | ||
| 119 | + * @param type $files file对象集合 | ||
| 120 | + * @return type | ||
| 121 | + */ | ||
| 122 | + private function multi($files) { | ||
| 123 | + if (!is_array($files)) { | ||
| 124 | + $files = [$files]; | ||
| 125 | + } | ||
| 126 | + $save_data = []; | ||
| 127 | + $data = []; | ||
| 128 | + foreach ($files as $file) { | ||
| 129 | + $fileModel = new File(); | ||
| 130 | + $hash = hash_file('md5', $file->getPathname()); | ||
| 131 | + $file_hash = $fileModel->read(['hash'=>$hash]); | ||
| 132 | + if($file_hash !== false){ | ||
| 133 | + $data[] = $hash; | ||
| 134 | + continue; | ||
| 135 | + } | ||
| 136 | + $url = $this->path; | ||
| 137 | + $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension(); | ||
| 138 | + $res = $file->move($url,$fileName); | ||
| 139 | + if ($res === false) { | ||
| 140 | + return $this->response($file->getError(), Code::USER_ERROR); | ||
| 141 | + } | ||
| 142 | + $save_data[] = [ | ||
| 143 | + 'path' => $url.'/'.$fileName, | ||
| 144 | + 'created_at' => date('Y-m-d H:i:s',time()), | ||
| 145 | + 'size' => $res->getSize(), | ||
| 146 | + 'hash' => $hash, | ||
| 147 | + 'type'=>$files->getClientOriginalExtension(), | ||
| 148 | + ]; | ||
| 149 | + $data[] = $hash; | ||
| 150 | + } | ||
| 151 | + $fileModel->insert($save_data); | ||
| 152 | + return $data; | ||
| 153 | + } | ||
| 154 | + /** | ||
| 155 | + * @name 统一返回参数 | ||
| 156 | + * @return JsonResponse | ||
| 157 | + * @author :liyuhang | ||
| 158 | + * @method | ||
| 159 | + */ | ||
| 160 | + public function response($msg = null,string $code = Code::SUCCESS,$data = [],$result_code = 200,$type = 'application/json'): JsonResponse | ||
| 161 | + { | ||
| 162 | + $code = Code::fromValue($code); | ||
| 163 | + $result = [ | ||
| 164 | + 'msg' => $msg == ' ' ? $code->description : $msg, | ||
| 165 | + 'code' => $code->value, | ||
| 166 | + 'data' => $data, | ||
| 167 | + ]; | ||
| 168 | + $this->header['Content-Type'] = $type; | ||
| 169 | + $response = response($result,$result_code,$this->header); | ||
| 170 | + throw new HttpResponseException($response); | ||
| 171 | + } | ||
| 54 | } | 172 | } |
| @@ -80,6 +80,7 @@ class ImageController | @@ -80,6 +80,7 @@ class ImageController | ||
| 80 | $img_base64 = 'data:image/' . $img_type . ';base64,' . $content; | 80 | $img_base64 = 'data:image/' . $img_type . ';base64,' . $content; |
| 81 | return response($img_base64, 200, $header); | 81 | return response($img_base64, 200, $header); |
| 82 | } | 82 | } |
| 83 | + | ||
| 83 | /** | 84 | /** |
| 84 | * 图片上传 | 85 | * 图片上传 |
| 85 | */ | 86 | */ |
| @@ -100,6 +101,7 @@ class ImageController | @@ -100,6 +101,7 @@ class ImageController | ||
| 100 | return $this->single($files); | 101 | return $this->single($files); |
| 101 | } | 102 | } |
| 102 | } | 103 | } |
| 104 | + | ||
| 103 | /** | 105 | /** |
| 104 | * @name :上传图片 | 106 | * @name :上传图片 |
| 105 | * @return void | 107 | * @return void |
| @@ -115,13 +117,13 @@ class ImageController | @@ -115,13 +117,13 @@ class ImageController | ||
| 115 | return $hash; | 117 | return $hash; |
| 116 | } | 118 | } |
| 117 | $url = $this->path; | 119 | $url = $this->path; |
| 118 | - $filename = date('ymdHis').rand(10000,99999); | ||
| 119 | - $res = $this->request->file('image')->move($url); | 120 | + $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension(); |
| 121 | + $res = $files->move($url,$fileName); | ||
| 120 | if ($res === false) { | 122 | if ($res === false) { |
| 121 | return $this->response($files->getError(), Code::USER_ERROR); | 123 | return $this->response($files->getError(), Code::USER_ERROR); |
| 122 | } | 124 | } |
| 123 | $data = [ | 125 | $data = [ |
| 124 | - 'path' => $url.'/'.$res->getClientOriginalName(), | 126 | + 'path' => $url.'/'.$fileName, |
| 125 | 'created_at' => date('Y-m-d H:i:s',time()), | 127 | 'created_at' => date('Y-m-d H:i:s',time()), |
| 126 | 'size' => $res->getSize(), | 128 | 'size' => $res->getSize(), |
| 127 | 'hash' => $hash, | 129 | 'hash' => $hash, |
| @@ -153,6 +155,7 @@ class ImageController | @@ -153,6 +155,7 @@ class ImageController | ||
| 153 | * @return type | 155 | * @return type |
| 154 | */ | 156 | */ |
| 155 | private function multi($files) { | 157 | private function multi($files) { |
| 158 | + | ||
| 156 | if (!is_array($files)) { | 159 | if (!is_array($files)) { |
| 157 | $files = [$files]; | 160 | $files = [$files]; |
| 158 | } | 161 | } |
| @@ -167,17 +170,18 @@ class ImageController | @@ -167,17 +170,18 @@ class ImageController | ||
| 167 | continue; | 170 | continue; |
| 168 | } | 171 | } |
| 169 | $url = $this->path; | 172 | $url = $this->path; |
| 170 | - $filename = date('ymdHis').rand(10000,99999); | ||
| 171 | - $res = $file->move($url,$filename); | 173 | + $fileName = uniqid().rand(10000,99999).'.'.$file->getClientOriginalExtension(); |
| 174 | + $res = $file->move($url,$fileName); | ||
| 172 | if ($res === false) { | 175 | if ($res === false) { |
| 173 | return $this->response($file->getError(), Code::USER_ERROR); | 176 | return $this->response($file->getError(), Code::USER_ERROR); |
| 174 | } | 177 | } |
| 175 | $save_data[] = [ | 178 | $save_data[] = [ |
| 176 | - 'path' => $url.'/'.$filename, | 179 | + 'path' => $url.'/'.$fileName, |
| 177 | 'created_at' => date('Y-m-d H:i:s',time()), | 180 | 'created_at' => date('Y-m-d H:i:s',time()), |
| 181 | + 'updated_at'=>date('Y-m-d H:i:s',time()), | ||
| 178 | 'size' => $res->getSize(), | 182 | 'size' => $res->getSize(), |
| 179 | 'hash' => $hash, | 183 | 'hash' => $hash, |
| 180 | - 'type'=>$files->getClientOriginalExtension(), | 184 | + 'type'=>$file->getClientOriginalExtension(), |
| 181 | ]; | 185 | ]; |
| 182 | $data[] = $hash; | 186 | $data[] = $hash; |
| 183 | } | 187 | } |
| @@ -9,10 +9,11 @@ use App\Models\AyrShare\AyrShare; | @@ -9,10 +9,11 @@ use App\Models\AyrShare\AyrShare; | ||
| 9 | 9 | ||
| 10 | class AyrShareLogic extends BaseLogic | 10 | class AyrShareLogic extends BaseLogic |
| 11 | { | 11 | { |
| 12 | + | ||
| 13 | + | ||
| 12 | public function __construct() | 14 | public function __construct() |
| 13 | { | 15 | { |
| 14 | parent::__construct(); | 16 | parent::__construct(); |
| 15 | - | ||
| 16 | $this->model = new AyrShare(); | 17 | $this->model = new AyrShare(); |
| 17 | $this->param = $this->requestAll; | 18 | $this->param = $this->requestAll; |
| 18 | } | 19 | } |
| @@ -55,6 +56,19 @@ class AyrShareLogic extends BaseLogic | @@ -55,6 +56,19 @@ class AyrShareLogic extends BaseLogic | ||
| 55 | } | 56 | } |
| 56 | 57 | ||
| 57 | /** | 58 | /** |
| 59 | + * @name :(更新)ayr_share_edit | ||
| 60 | + * @author :lyh | ||
| 61 | + * @method :post | ||
| 62 | + * @time :2023/5/9 14:44 | ||
| 63 | + */ | ||
| 64 | + public function ayr_share_edit($param){ | ||
| 65 | + $rs = $this->model->edit($param,['id'=>$this->param['id']]); | ||
| 66 | + if($rs === false){ | ||
| 67 | + $this->fail('error'); | ||
| 68 | + } | ||
| 69 | + return $this->success(); | ||
| 70 | + } | ||
| 71 | + /** | ||
| 58 | * @name :(删除ayr数据并同步删除) | 72 | * @name :(删除ayr数据并同步删除) |
| 59 | * @author :lyh | 73 | * @author :lyh |
| 60 | * @method :post | 74 | * @method :post |
| @@ -40,6 +40,12 @@ class WebSettingFromLogic extends BaseLogic | @@ -40,6 +40,12 @@ class WebSettingFromLogic extends BaseLogic | ||
| 40 | try { | 40 | try { |
| 41 | //删除以前的数据 | 41 | //删除以前的数据 |
| 42 | $this->model->del(['project_id'=>$this->user['project_id']]); | 42 | $this->model->del(['project_id'=>$this->user['project_id']]); |
| 43 | + foreach ($this->param['data'] as $k => $v){ | ||
| 44 | + $v['created_at'] = date('Y-m-d H:i:s'); | ||
| 45 | + $v['updated_at'] = date('Y-m-d H:i:s'); | ||
| 46 | + $v['project_id'] = $this->user['project_id']; | ||
| 47 | + $this->param['data'][$k] = $v; | ||
| 48 | + } | ||
| 43 | //新增 | 49 | //新增 |
| 44 | $this->model->add_all($this->param['data']); | 50 | $this->model->add_all($this->param['data']); |
| 45 | }catch (\Exception $e){ | 51 | }catch (\Exception $e){ |
| @@ -37,6 +37,8 @@ class WebSettingReceivingLogic extends BaseLogic | @@ -37,6 +37,8 @@ class WebSettingReceivingLogic extends BaseLogic | ||
| 37 | $this->model->del(['project_id'=>$this->user['project_id']]); | 37 | $this->model->del(['project_id'=>$this->user['project_id']]); |
| 38 | foreach ($this->param['data'] as $k => $v){ | 38 | foreach ($this->param['data'] as $k => $v){ |
| 39 | $v['project_id'] = $this->user['project_id']; | 39 | $v['project_id'] = $this->user['project_id']; |
| 40 | + $v['created_at'] = date('Y-m-d H:i:s'); | ||
| 41 | + $v['updated_at'] = date('Y-m-d H:i:s'); | ||
| 40 | $this->param['data'][$k] = $v; | 42 | $this->param['data'][$k] = $v; |
| 41 | } | 43 | } |
| 42 | $this->model->add_all($this->param['data']); | 44 | $this->model->add_all($this->param['data']); |
| @@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Http\Logic\Bside\Setting; | 3 | namespace App\Http\Logic\Bside\Setting; |
| 4 | 4 | ||
| 5 | +use App\Helper\Common; | ||
| 5 | use App\Http\Logic\Bside\BaseLogic; | 6 | use App\Http\Logic\Bside\BaseLogic; |
| 6 | use App\Models\File\Image; | 7 | use App\Models\File\Image; |
| 7 | use App\Models\WebSetting\WebSettingService; | 8 | use App\Models\WebSetting\WebSettingService; |
| @@ -35,17 +36,20 @@ class WebSettingServiceLogic extends BaseLogic | @@ -35,17 +36,20 @@ class WebSettingServiceLogic extends BaseLogic | ||
| 35 | * @time :2023/5/4 11:10 | 36 | * @time :2023/5/4 11:10 |
| 36 | */ | 37 | */ |
| 37 | public function setting_service_save(){ | 38 | public function setting_service_save(){ |
| 38 | - try { | 39 | +// try { |
| 40 | + $this->param['data'] = Common::uniqueMultiArray($this->param['data']); | ||
| 39 | //删除以前的数据 | 41 | //删除以前的数据 |
| 40 | $this->model->del(['project_id'=>$this->user['project_id']]); | 42 | $this->model->del(['project_id'=>$this->user['project_id']]); |
| 41 | foreach ($this->param['data'] as $k => $v){ | 43 | foreach ($this->param['data'] as $k => $v){ |
| 42 | $v['project_id'] = $this->user['project_id']; | 44 | $v['project_id'] = $this->user['project_id']; |
| 45 | + $v['created_at'] = date('Y-m-d H:i:s'); | ||
| 46 | + $v['updated_at'] = date('Y-m-d H:i:s'); | ||
| 43 | $this->param['data'][$k] = $v; | 47 | $this->param['data'][$k] = $v; |
| 44 | } | 48 | } |
| 45 | $this->model->add_all($this->param['data']); | 49 | $this->model->add_all($this->param['data']); |
| 46 | - }catch (\Exception $e){ | ||
| 47 | - $this->fail('error'); | ||
| 48 | - } | 50 | +// }catch (\Exception $e){ |
| 51 | +// $this->fail('error'); | ||
| 52 | +// } | ||
| 49 | return $this->success(); | 53 | return $this->success(); |
| 50 | } | 54 | } |
| 51 | } | 55 | } |
| @@ -15,5 +15,22 @@ class AyrShareRequest extends FormRequest | @@ -15,5 +15,22 @@ class AyrShareRequest extends FormRequest | ||
| 15 | { | 15 | { |
| 16 | return true; | 16 | return true; |
| 17 | } | 17 | } |
| 18 | + /** | ||
| 19 | + * Get the validation rules that apply to the request. | ||
| 20 | + * | ||
| 21 | + * @return array | ||
| 22 | + */ | ||
| 23 | + public function rules() | ||
| 24 | + { | ||
| 25 | + return [ | ||
| 26 | + 'name'=>'required||unique:gl_ayr_share,name', | ||
| 27 | + ]; | ||
| 28 | + } | ||
| 18 | 29 | ||
| 30 | + public function messages() | ||
| 31 | + { | ||
| 32 | + return [ | ||
| 33 | + 'name.required'=>'请填写名称', | ||
| 34 | + ]; | ||
| 35 | + } | ||
| 19 | } | 36 | } |
| @@ -136,17 +136,12 @@ class Base extends Model | @@ -136,17 +136,12 @@ class Base extends Model | ||
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | /** | 138 | /** |
| 139 | - * @name :(批量插入)add_all | 139 | + * @name :(批量插入(data二维数组))add_all |
| 140 | * @author :lyh | 140 | * @author :lyh |
| 141 | * @method :post | 141 | * @method :post |
| 142 | * @time :2023/5/8 17:41 | 142 | * @time :2023/5/8 17:41 |
| 143 | */ | 143 | */ |
| 144 | public function add_all($data){ | 144 | public function add_all($data){ |
| 145 | - foreach ($data as $k => $v){ | ||
| 146 | - $v['created_at'] = date('Y-m-d H:i:s'); | ||
| 147 | - $v['updated_at'] = date('Y-m-d H:i:s'); | ||
| 148 | - $data[$k] = $v; | ||
| 149 | - } | ||
| 150 | return $this->insert($data); | 145 | return $this->insert($data); |
| 151 | } | 146 | } |
| 152 | /** | 147 | /** |
| @@ -11,7 +11,11 @@ define('LARAVEL_START', microtime(true)); | @@ -11,7 +11,11 @@ define('LARAVEL_START', microtime(true)); | ||
| 11 | | Composer provides a convenient, automatically generated class loader | 11 | | Composer provides a convenient, automatically generated class loader |
| 12 | | for our application. We just need to utilize it! We'll require it | 12 | | for our application. We just need to utilize it! We'll require it |
| 13 | | into the script here so that we do not have to worry about the | 13 | | into the script here so that we do not have to worry about the |
| 14 | +<<<<<<< HEAD | ||
| 14 | | loading of any of our classes manually. It's great to relax. | 15 | | loading of any of our classes manually. It's great to relax. |
| 16 | +======= | ||
| 17 | +| loading of any our classes "manually". Feels great to relax. | ||
| 18 | +>>>>>>> db84ec9e0ac005907f6868b371df2ccf8defd114 | ||
| 15 | | | 19 | | |
| 16 | */ | 20 | */ |
| 17 | 21 |
| @@ -124,6 +124,16 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w | @@ -124,6 +124,16 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w | ||
| 124 | }); | 124 | }); |
| 125 | }); | 125 | }); |
| 126 | 126 | ||
| 127 | + // 自定义页面 模板,头部底部 | ||
| 128 | + Route::prefix('template')->group(function () { | ||
| 129 | + Route::get('/', [\App\Http\Controllers\Aside\TemplateController::class, 'index'])->name('admin.template_header_footer'); | ||
| 130 | + Route::get('/edit', [\App\Http\Controllers\Aside\TemplateController::class, 'edit'])->name('admin.template_header_footer_edit'); | ||
| 131 | + Route::get('/insert', [\App\Http\Controllers\Aside\TemplateController::class, 'insert'])->name('admin.template_header_footer_insert'); | ||
| 132 | + Route::get('/delete', [\App\Http\Controllers\Aside\TemplateController::class, 'delete'])->name('admin.template_header_footer_system'); | ||
| 133 | + }); | ||
| 134 | + | ||
| 135 | + | ||
| 136 | + | ||
| 127 | }); | 137 | }); |
| 128 | 138 | ||
| 129 | //无需登录验证的路由组 | 139 | //无需登录验证的路由组 |
| @@ -192,7 +192,10 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -192,7 +192,10 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 192 | Route::prefix('images')->group(function () { | 192 | Route::prefix('images')->group(function () { |
| 193 | Route::post('/upload', [\App\Http\Controllers\file\ImageController::class, 'upload'])->name('image_upload'); | 193 | Route::post('/upload', [\App\Http\Controllers\file\ImageController::class, 'upload'])->name('image_upload'); |
| 194 | }); | 194 | }); |
| 195 | - | 195 | + //文件上传第三方操作 |
| 196 | + Route::prefix('files')->group(function () { | ||
| 197 | + Route::post('/upload', [\App\Http\Controllers\file\FileController::class, 'upload'])->name('files_upload'); | ||
| 198 | + }); | ||
| 196 | //精准询盘 | 199 | //精准询盘 |
| 197 | Route::prefix('inquiry')->group(function () { | 200 | Route::prefix('inquiry')->group(function () { |
| 198 | Route::get('/', [\App\Http\Controllers\Bside\InquiryController::class, 'index'])->name('inquiry'); | 201 | Route::get('/', [\App\Http\Controllers\Bside\InquiryController::class, 'index'])->name('inquiry'); |
| @@ -208,17 +211,47 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -208,17 +211,47 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 208 | 211 | ||
| 209 | //社交绑定 | 212 | //社交绑定 |
| 210 | Route::prefix('ayr')->group(function () { | 213 | Route::prefix('ayr')->group(function () { |
| 211 | - Route::any('/lists', [\App\Http\Controllers\Bside\AyrShare\AyrShareController::class, 'lists'])->name('ayr_lists'); | 214 | + Route::any('/', [\App\Http\Controllers\Bside\AyrShare\AyrShareController::class, 'lists'])->name('ayr_lists'); |
| 215 | + Route::any('/save', [\App\Http\Controllers\Bside\AyrShare\AyrShareController::class, 'save_account'])->name('ayr_save_account'); | ||
| 212 | Route::any('/create', [\App\Http\Controllers\Bside\AyrShare\AyrShareController::class, 'create_account'])->name('ayr_create_account'); | 216 | Route::any('/create', [\App\Http\Controllers\Bside\AyrShare\AyrShareController::class, 'create_account'])->name('ayr_create_account'); |
| 213 | Route::any('/del', [\App\Http\Controllers\Bside\AyrShare\AyrShareController::class, 'del_account'])->name('ayr_del_account'); | 217 | Route::any('/del', [\App\Http\Controllers\Bside\AyrShare\AyrShareController::class, 'del_account'])->name('ayr_del_account'); |
| 214 | Route::any('/bind', [\App\Http\Controllers\Bside\AyrShare\AyrShareController::class, 'bind_account'])->name('ayr_bind_account'); | 218 | Route::any('/bind', [\App\Http\Controllers\Bside\AyrShare\AyrShareController::class, 'bind_account'])->name('ayr_bind_account'); |
| 219 | + //社交绑定 | ||
| 220 | + Route::prefix('release')->group(function () { | ||
| 221 | + Route::any('/', [\App\Http\Controllers\Bside\AyrShare\AyrReleaseController::class, 'info'])->name('ayr_release_info'); | ||
| 222 | + }); | ||
| 223 | + }); | ||
| 224 | + | ||
| 225 | + | ||
| 226 | + | ||
| 227 | + | ||
| 228 | + // 自定义页面 | ||
| 229 | + Route::prefix('template')->group(function () { | ||
| 230 | + Route::get('/', [\App\Http\Controllers\Bside\TemplateController::class, 'index'])->name('template_header_footer'); | ||
| 231 | + Route::get('/edit', [\App\Http\Controllers\Bside\TemplateController::class, 'edit_html'])->name('template_header_footer_edit'); | ||
| 232 | + Route::post('/edit', [\App\Http\Controllers\Bside\TemplateController::class, 'edit_save'])->name('template_header_footer_edit_save'); | ||
| 233 | + Route::get('/system', [\App\Http\Controllers\Bside\TemplateController::class, 'system_all_html'])->name('template_header_footer_system'); | ||
| 234 | + Route::get('/custom', [\App\Http\Controllers\Bside\TemplateController::class, 'custom'])->name('template_custom'); | ||
| 235 | + }); | ||
| 236 | + | ||
| 237 | + // 导航栏编辑 | ||
| 238 | + Route::prefix('nav')->group(function () { | ||
| 239 | + Route::get('/', [\App\Http\Controllers\Bside\NavController::class, 'index'])->name('bside_nav'); | ||
| 240 | + Route::post('/create', [\App\Http\Controllers\Bside\NavController::class, 'create'])->name('bside_nav_create'); | ||
| 241 | + Route::post('/update', [\App\Http\Controllers\Bside\NavController::class, 'update'])->name('bside_nav_update'); | ||
| 242 | + Route::delete('/delete', [\App\Http\Controllers\Bside\NavController::class, 'delete'])->name('bside_nav_delete'); | ||
| 215 | }); | 243 | }); |
| 244 | + | ||
| 245 | + | ||
| 246 | + | ||
| 247 | + | ||
| 216 | }); | 248 | }); |
| 217 | 249 | ||
| 218 | //无需登录验证的路由组 | 250 | //无需登录验证的路由组 |
| 219 | Route::group([], function () { | 251 | Route::group([], function () { |
| 220 | Route::any('/login', [\App\Http\Controllers\Bside\ComController::class, 'login'])->name('login'); | 252 | Route::any('/login', [\App\Http\Controllers\Bside\ComController::class, 'login'])->name('login'); |
| 221 | - Route::any('/', [\App\Http\Controllers\Bside\ComController::class, 'get_country'])->name('get_country'); | 253 | +// Route::any('/', [\App\Http\Controllers\Bside\ComController::class, 'get_country'])->name('get_country'); |
| 222 | Route::get('/file/download', [\App\Http\Controllers\Bside\FileController::class, 'download'])->name('file_download'); | 254 | Route::get('/file/download', [\App\Http\Controllers\Bside\FileController::class, 'download'])->name('file_download'); |
| 223 | Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\file\ImageController::class,'index'])->name('image_show'); | 255 | Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\file\ImageController::class,'index'])->name('image_show'); |
| 256 | + Route::any('/file_hash/{hash}', [\App\Http\Controllers\file\FileController::class,'index'])->name('file_show'); | ||
| 224 | }); | 257 | }); |
-
请 注册 或 登录 后发表评论