正在显示
10 个修改的文件
包含
45 行增加
和
8 行删除
| @@ -32,8 +32,8 @@ class AiCommandController extends BaseController | @@ -32,8 +32,8 @@ class AiCommandController extends BaseController | ||
| 32 | * @author :liyuhang | 32 | * @author :liyuhang |
| 33 | * @method | 33 | * @method |
| 34 | */ | 34 | */ |
| 35 | - public function info(Request $request,AiCommandLogic $aiCommandLogic){ | ||
| 36 | - $request->validate([ | 35 | + public function info(AiCommandLogic $aiCommandLogic){ |
| 36 | + $this->request->validate([ | ||
| 37 | 'id'=>'required' | 37 | 'id'=>'required' |
| 38 | ],[ | 38 | ],[ |
| 39 | 'id.required' => 'ID不能为空' | 39 | 'id.required' => 'ID不能为空' |
| @@ -86,17 +86,15 @@ class AyrReleaseController extends BaseController | @@ -86,17 +86,15 @@ class AyrReleaseController extends BaseController | ||
| 86 | if(empty($image_info['ayr_id'])){ | 86 | if(empty($image_info['ayr_id'])){ |
| 87 | //获取发送账号详情 | 87 | //获取发送账号详情 |
| 88 | $share_info = $ayrShareLogic->ayr_share_info(); | 88 | $share_info = $ayrShareLogic->ayr_share_info(); |
| 89 | - //获取当前图片数据是否已上传到第三方 | ||
| 90 | - $arr = (new ImageController())->index($this->param['hash']); | ||
| 91 | //向第三方存储图片 | 89 | //向第三方存储图片 |
| 92 | $param = [ | 90 | $param = [ |
| 93 | - 'file'=>($arr->original),//base64编码 | 91 | + 'file'=>$ayrShareLogic->base_img_content($this->param['hash']),//base64编码 |
| 94 | ]; | 92 | ]; |
| 95 | $param_data = $ayrShare->post_media_upload($param,$share_info['profile_key']); | 93 | $param_data = $ayrShare->post_media_upload($param,$share_info['profile_key']); |
| 96 | //更新图片库 | 94 | //更新图片库 |
| 97 | $ayrShareLogic->save_img($param_data); | 95 | $ayrShareLogic->save_img($param_data); |
| 98 | } | 96 | } |
| 99 | - $this->response('success'); | 97 | + $this->response('success',Code::SUCCESS,$image_info); |
| 100 | } | 98 | } |
| 101 | 99 | ||
| 102 | /** | 100 | /** |
| @@ -94,7 +94,7 @@ class AyrShareLogic extends BaseLogic | @@ -94,7 +94,7 @@ class AyrShareLogic extends BaseLogic | ||
| 94 | if($info === false){ | 94 | if($info === false){ |
| 95 | $this->fail('error'); | 95 | $this->fail('error'); |
| 96 | } | 96 | } |
| 97 | - return $this->success(); | 97 | + return $this->success($info); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | /** | 100 | /** |
| @@ -109,7 +109,7 @@ class AyrShareLogic extends BaseLogic | @@ -109,7 +109,7 @@ class AyrShareLogic extends BaseLogic | ||
| 109 | if($info === false){ | 109 | if($info === false){ |
| 110 | $this->fail('error'); | 110 | $this->fail('error'); |
| 111 | } | 111 | } |
| 112 | - return $this->success(); | 112 | + return $this->success($info); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | /** | 115 | /** |
| @@ -134,6 +134,24 @@ class AyrShareLogic extends BaseLogic | @@ -134,6 +134,24 @@ class AyrShareLogic extends BaseLogic | ||
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | /** | 136 | /** |
| 137 | + * @name :(获取图片的base64)base_img_content | ||
| 138 | + * @author :lyh | ||
| 139 | + * @method :post | ||
| 140 | + * @time :2023/5/12 9:28 | ||
| 141 | + */ | ||
| 142 | + public function base_img_content($hash){ | ||
| 143 | + $imageModel = new ImageModel(); | ||
| 144 | + $info = $imageModel->read(['hash'=>$hash]); | ||
| 145 | + if($info === false){ | ||
| 146 | + $this->fail('当前数据不存在'); | ||
| 147 | + } | ||
| 148 | + $content = file_get_contents($info['path']); | ||
| 149 | + $img_type = $info['type']; | ||
| 150 | + $content = base64_encode($content); | ||
| 151 | + $img_base64 = 'data:image/' . $img_type . ';base64,' . $content; | ||
| 152 | + return $img_base64; | ||
| 153 | + } | ||
| 154 | + /** | ||
| 137 | * @name :(更新文件库)save_img | 155 | * @name :(更新文件库)save_img |
| 138 | * @author :lyh | 156 | * @author :lyh |
| 139 | * @method :post | 157 | * @method :post |
| @@ -7,4 +7,7 @@ use App\Models\Base; | @@ -7,4 +7,7 @@ use App\Models\Base; | ||
| 7 | class WebSettingCountry extends Base | 7 | class WebSettingCountry extends Base |
| 8 | { | 8 | { |
| 9 | protected $table = 'gl_web_setting_country'; | 9 | protected $table = 'gl_web_setting_country'; |
| 10 | + | ||
| 11 | + //连接数据库 | ||
| 12 | +// protected $connection = 'custom_mysql'; | ||
| 10 | } | 13 | } |
| @@ -7,4 +7,7 @@ use App\Models\Base; | @@ -7,4 +7,7 @@ use App\Models\Base; | ||
| 7 | class WebSettingForm extends Base | 7 | class WebSettingForm extends Base |
| 8 | { | 8 | { |
| 9 | protected $table = 'gl_web_setting_from'; | 9 | protected $table = 'gl_web_setting_from'; |
| 10 | + | ||
| 11 | + //连接数据库 | ||
| 12 | +// protected $connection = 'custom_mysql'; | ||
| 10 | } | 13 | } |
| @@ -7,4 +7,7 @@ use App\Models\Base; | @@ -7,4 +7,7 @@ use App\Models\Base; | ||
| 7 | class WebSettingHtml extends Base | 7 | class WebSettingHtml extends Base |
| 8 | { | 8 | { |
| 9 | protected $table = 'gl_web_setting_html'; | 9 | protected $table = 'gl_web_setting_html'; |
| 10 | + | ||
| 11 | + //连接数据库 | ||
| 12 | +// protected $connection = 'custom_mysql'; | ||
| 10 | } | 13 | } |
| @@ -7,4 +7,7 @@ use App\Models\Base; | @@ -7,4 +7,7 @@ use App\Models\Base; | ||
| 7 | class WebSettingReceiving extends Base | 7 | class WebSettingReceiving extends Base |
| 8 | { | 8 | { |
| 9 | protected $table = 'gl_web_setting_receiving'; | 9 | protected $table = 'gl_web_setting_receiving'; |
| 10 | + | ||
| 11 | + //连接数据库 | ||
| 12 | +// protected $connection = 'custom_mysql'; | ||
| 10 | } | 13 | } |
| @@ -7,4 +7,7 @@ use App\Models\Base; | @@ -7,4 +7,7 @@ use App\Models\Base; | ||
| 7 | class WebSettingService extends Base | 7 | class WebSettingService extends Base |
| 8 | { | 8 | { |
| 9 | protected $table = 'gl_web_setting_service'; | 9 | protected $table = 'gl_web_setting_service'; |
| 10 | + | ||
| 11 | + //连接数据库 | ||
| 12 | +// protected $connection = 'custom_mysql'; | ||
| 10 | } | 13 | } |
| @@ -8,6 +8,9 @@ class WebSettingText extends Base | @@ -8,6 +8,9 @@ class WebSettingText extends Base | ||
| 8 | { | 8 | { |
| 9 | protected $table = 'gl_web_setting_text'; | 9 | protected $table = 'gl_web_setting_text'; |
| 10 | 10 | ||
| 11 | + //连接数据库 | ||
| 12 | +// protected $connection = 'custom_mysql'; | ||
| 13 | + | ||
| 11 | //定义常量参数 | 14 | //定义常量参数 |
| 12 | const TYPE_PAGE = 1; | 15 | const TYPE_PAGE = 1; |
| 13 | const TYPE_PRODUCT = 2; | 16 | const TYPE_PRODUCT = 2; |
-
请 注册 或 登录 后发表评论