正在显示
4 个修改的文件
包含
37 行增加
和
8 行删除
| @@ -426,6 +426,10 @@ if (!function_exists('getImageUrl')) { | @@ -426,6 +426,10 @@ if (!function_exists('getImageUrl')) { | ||
| 426 | } | 426 | } |
| 427 | }else{ | 427 | }else{ |
| 428 | $imageModel = new Image(); | 428 | $imageModel = new Image(); |
| 429 | + if (strpos($hash, '.') !== false) { | ||
| 430 | + $info = $imageModel->read(['path'=>['like','%'.$hash.'%']]); | ||
| 431 | + $hash = $info['hash']; | ||
| 432 | + } | ||
| 429 | $info = $imageModel->read(['hash'=>$hash]); | 433 | $info = $imageModel->read(['hash'=>$hash]); |
| 430 | if(!empty($info)){ | 434 | if(!empty($info)){ |
| 431 | if($info['is_cos'] == 1){ | 435 | if($info['is_cos'] == 1){ |
| @@ -171,7 +171,15 @@ class LoginController extends BaseController | @@ -171,7 +171,15 @@ class LoginController extends BaseController | ||
| 171 | $data = $this->wechatLogin($message->FromUserName); | 171 | $data = $this->wechatLogin($message->FromUserName); |
| 172 | $socket = new Socket(); | 172 | $socket = new Socket(); |
| 173 | $socket->socket(json_encode($data)); | 173 | $socket->socket(json_encode($data)); |
| 174 | - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($message, true) . PHP_EOL, FILE_APPEND); | 174 | + $arr = [ |
| 175 | + 'ToUserName' => 'gh_27174ac5c9d8', | ||
| 176 | + 'FromUserName' => 'oMbcI6gRzvfrU8ssGsEyvzXOO94w', | ||
| 177 | + 'CreateTime' => '1693385898', | ||
| 178 | + 'MsgType' => 'event', | ||
| 179 | + 'Event' => 'subscribe', | ||
| 180 | + 'EventKey' => 'qrscene_global-v6_v6', | ||
| 181 | + 'Ticket' => 'gQF27zwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyWnppdHhWTlRjOEcxTlBpTE5BY2IAAgRjBO9kAwQQDgAA', | ||
| 182 | + ]; | ||
| 175 | return "<xml> | 183 | return "<xml> |
| 176 | <ToUserName><![CDATA[$message->FromUserName]]></ToUserName> | 184 | <ToUserName><![CDATA[$message->FromUserName]]></ToUserName> |
| 177 | <FromUserName><![CDATA[$message->ToUserName]]></FromUserName> | 185 | <FromUserName><![CDATA[$message->ToUserName]]></FromUserName> |
| @@ -253,7 +261,9 @@ class LoginController extends BaseController | @@ -253,7 +261,9 @@ class LoginController extends BaseController | ||
| 253 | 'code'=>Code::USER_LOGIN_ERROE, | 261 | 'code'=>Code::USER_LOGIN_ERROE, |
| 254 | 'message'=>'当前用户未绑定账户,请绑定后', | 262 | 'message'=>'当前用户未绑定账户,请绑定后', |
| 255 | ]; | 263 | ]; |
| 256 | - $socket = new Socket(); | ||
| 257 | - return $socket->socket(json_encode($data)); | 264 | + $webSocket = new Socket(); |
| 265 | + $webSocket->send('hello'); | ||
| 266 | + $response = $webSocket->receive(); | ||
| 267 | + $webSocket->close(); | ||
| 258 | } | 268 | } |
| 259 | } | 269 | } |
| @@ -3,9 +3,8 @@ | @@ -3,9 +3,8 @@ | ||
| 3 | namespace App\Http\Logic\Aside\Template; | 3 | namespace App\Http\Logic\Aside\Template; |
| 4 | 4 | ||
| 5 | use App\Http\Logic\Aside\BaseLogic; | 5 | use App\Http\Logic\Aside\BaseLogic; |
| 6 | +use App\Models\File\Image; | ||
| 6 | use App\Models\Template\TemplateModule; | 7 | use App\Models\Template\TemplateModule; |
| 7 | -use App\Models\Template\BSetting; | ||
| 8 | -use App\Models\Template\TemplateType; | ||
| 9 | 8 | ||
| 10 | /** | 9 | /** |
| 11 | * @remark :左侧模块管理 | 10 | * @remark :左侧模块管理 |
| @@ -65,12 +64,12 @@ class ATemplateModuleLogic extends BaseLogic | @@ -65,12 +64,12 @@ class ATemplateModuleLogic extends BaseLogic | ||
| 65 | */ | 64 | */ |
| 66 | public function setAttribute($param){ | 65 | public function setAttribute($param){ |
| 67 | if(isset($param['image']) && !empty($param['image'])){ | 66 | if(isset($param['image']) && !empty($param['image'])){ |
| 68 | - $param['image'] = basename($param['image']); | 67 | + $param['image'] = $this->imageName(basename($param['image'])); |
| 69 | } | 68 | } |
| 70 | if(isset($param['images']) && !empty($param['images'])){ | 69 | if(isset($param['images']) && !empty($param['images'])){ |
| 71 | $arr_images = []; | 70 | $arr_images = []; |
| 72 | foreach ($param['images'] as $v){ | 71 | foreach ($param['images'] as $v){ |
| 73 | - $arr_images[] = basename($v); | 72 | + $arr_images[] = $this->imageName(basename($v));; |
| 74 | } | 73 | } |
| 75 | $param['images'] = implode(',',$arr_images); | 74 | $param['images'] = implode(',',$arr_images); |
| 76 | } | 75 | } |
| @@ -115,5 +114,19 @@ class ATemplateModuleLogic extends BaseLogic | @@ -115,5 +114,19 @@ class ATemplateModuleLogic extends BaseLogic | ||
| 115 | return $this->success(); | 114 | return $this->success(); |
| 116 | } | 115 | } |
| 117 | 116 | ||
| 118 | - | 117 | + /** |
| 118 | + * @remark :如果是图片名称返回图片hash值 | ||
| 119 | + * @name :imageName | ||
| 120 | + * @author :lyh | ||
| 121 | + * @method :post | ||
| 122 | + * @time :2023/8/31 11:49 | ||
| 123 | + */ | ||
| 124 | + public function imageName($string){ | ||
| 125 | + $imageModel = new Image(); | ||
| 126 | + if (strpos($string, '.') !== false) { | ||
| 127 | + $info = $imageModel->read(['path'=>['like','%'.$string.'%']]); | ||
| 128 | + $string = $info['hash']; | ||
| 129 | + } | ||
| 130 | + return $string; | ||
| 131 | + } | ||
| 119 | } | 132 | } |
-
请 注册 或 登录 后发表评论