正在显示
1 个修改的文件
包含
31 行增加
和
0 行删除
| @@ -9,7 +9,9 @@ | @@ -9,7 +9,9 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Console\Commands\CropImage; | 10 | namespace App\Console\Commands\CropImage; |
| 11 | 11 | ||
| 12 | +use App\Enums\Common\Code; | ||
| 12 | use App\Models\Domain\DomainInfo; | 13 | use App\Models\Domain\DomainInfo; |
| 14 | +use App\Models\File\Image; | ||
| 13 | use App\Models\WebSetting\AggregationSetting; | 15 | use App\Models\WebSetting\AggregationSetting; |
| 14 | use App\Models\WebSetting\WebSettingImage; | 16 | use App\Models\WebSetting\WebSettingImage; |
| 15 | use App\Services\CosService; | 17 | use App\Services\CosService; |
| @@ -139,6 +141,35 @@ class CropImage extends Command | @@ -139,6 +141,35 @@ class CropImage extends Command | ||
| 139 | } | 141 | } |
| 140 | 142 | ||
| 141 | /** | 143 | /** |
| 144 | + * @remark :写入数据库 | ||
| 145 | + * @name :saveMysql | ||
| 146 | + * @author :lyh | ||
| 147 | + * @method :post | ||
| 148 | + * @time :2025/5/8 14:59 | ||
| 149 | + */ | ||
| 150 | + public function saveMysql($size,$image_type,$fileName,$hash,$is_cos = 0,$mime = '', $name=''){ | ||
| 151 | + $imageModel = new Image(); | ||
| 152 | + $data = [ | ||
| 153 | + 'path' => $this->path.'/'.$fileName, | ||
| 154 | + 'created_at' => date('Y-m-d H:i:s',time()), | ||
| 155 | + 'size' => $size, | ||
| 156 | + 'hash' => $hash, | ||
| 157 | + 'type'=>$image_type, | ||
| 158 | + 'refer'=>$this->param['refer'] ?? 0, | ||
| 159 | + 'is_cos'=>($is_cos == 0) ? 1 : 0, | ||
| 160 | + 'mime'=>$mime, | ||
| 161 | + 'project_id'=>$this->cache['project_id'] ?? 0, | ||
| 162 | + 'name'=>$name, | ||
| 163 | + 'en_name'=>$fileName | ||
| 164 | + ]; | ||
| 165 | + $rs = $imageModel->add($data); | ||
| 166 | + if ($rs === false) { | ||
| 167 | + return $this->response('添加失败', Code::USER_ERROR); | ||
| 168 | + } | ||
| 169 | + return true; | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + /** | ||
| 142 | * @remark :记录日志 | 173 | * @remark :记录日志 |
| 143 | * @name :output | 174 | * @name :output |
| 144 | * @author :lyh | 175 | * @author :lyh |
-
请 注册 或 登录 后发表评论