|
...
|
...
|
@@ -53,33 +53,26 @@ class AyrReleaseController extends BaseController |
|
|
|
* @time :2023/5/9 9:36
|
|
|
|
*/
|
|
|
|
public function send_post(AyrReleaseLogic $ayrReleaseLogic,AyrShareLogic $ayrShareLogic,AyrShareHelper $ayrShare){
|
|
|
|
// DB::beginTransaction();
|
|
|
|
// try {
|
|
|
|
//获取发送账号详情
|
|
|
|
$share_info = $ayrShareLogic->ayr_share_info();
|
|
|
|
$data = [
|
|
|
|
'images'=>$this->param['image'],
|
|
|
|
'files'=>$this->param['file'],
|
|
|
|
];
|
|
|
|
//参数处理
|
|
|
|
$this->param['mediaUrls'] = $ayrReleaseLogic->image_file_param($data);;
|
|
|
|
//统一生成链接
|
|
|
|
$param = [
|
|
|
|
'post'=>$this->param['content'],
|
|
|
|
'platforms'=>$this->param['platforms'],
|
|
|
|
'mediaUrls'=>$this->param['mediaUrls'],//参数处理
|
|
|
|
'idempotencyKey'=>$this->param['idempotencyKey'],//时间(如是过去时间,立即发布)
|
|
|
|
];
|
|
|
|
//发送请求注册社交用户
|
|
|
|
$res = $ayrShare->post_send_msg($param,$share_info['profile_key']);
|
|
|
|
$this->response('success',Code::SUCCESS,$res);
|
|
|
|
//保存数据库
|
|
|
|
$ayrReleaseLogic->release_add();
|
|
|
|
// DB::commit();
|
|
|
|
// }catch (\Exception $e){
|
|
|
|
// DB::rollBack();
|
|
|
|
// $this->response('error',Code::USER_ERROR);
|
|
|
|
// }
|
|
|
|
//获取发送账号详情
|
|
|
|
$share_info = $ayrShareLogic->ayr_share_info();
|
|
|
|
$data = [
|
|
|
|
'images'=>$this->param['images'],
|
|
|
|
'files'=>$this->param['video'],
|
|
|
|
];
|
|
|
|
//参数处理
|
|
|
|
$this->param['mediaUrls'] = $ayrReleaseLogic->image_file_param($data);;
|
|
|
|
//统一生成发布
|
|
|
|
$param = [
|
|
|
|
'post'=>$this->param['content'],
|
|
|
|
'platforms'=>$this->param['platforms'],
|
|
|
|
'mediaUrls'=>$this->param['mediaUrls'],//参数处理
|
|
|
|
'idempotencyKey'=>$this->param['idempotency_key'],//时间(如是过去时间,立即发布)
|
|
|
|
];
|
|
|
|
//发送请求发布社交文章
|
|
|
|
$res = $ayrShare->post_send_msg($param,$share_info['profile_key']);
|
|
|
|
//保存数据库
|
|
|
|
$ayrReleaseLogic->release_add();
|
|
|
|
$this->response('success',Code::SUCCESS,$res);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|