Commit dc59533e dc59533ed75750fdc73ebe974e7a42614f50cd9e by lemon

*

1 parent d79cfd47
<?php
namespace App\Helper;
use Illuminate\Support\Str;
use Qcloud\Cos\Client;
class CosHelper
{
protected $client;
protected $bucket;
public function __construct()
{
$secretId = env('COS_SECRET_ID'); //"云 API 密钥 SecretId";
$secretKey = env('COS_SECRET_KEY'); //"云 API 密钥 SecretKey";
$region = env('COS_REGION'); //设置一个默认的存储桶地域
$cosClient = new Client(
array(
'region' => $region,
'schema' => 'https', //协议头部,默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
$this->client = $cosClient;
$this->bucket = env('COS_BUCKET');
}
/**
* 预览文档 ———— 同步转换为html
* @param string $key
* @param int $expire
* @return string
*/
public function getPreviewUrl(string $key, int $expire = 10) : string
{
$url = $this->client->getObjectUrl($this->bucket, $key, "+{$expire}minutes");
return $url;
// return $url . "ci-process=doc-preview&dstType=html";
}
}
......@@ -2,10 +2,12 @@
namespace App\Services;
use App\Helper\CosHelper;
use App\Helper\Response;
use App\Models\Legal\Contract;
use App\Models\Legal\StakeholderContract;
use App\Models\Legal\Treaty;
use Qcloud\Cos\Client;
/**
* Class MusicianAgreementService
......@@ -18,17 +20,24 @@ class MusicianAgreementService extends Service
*/
public function treatyList()
{
$res = Treaty::query()->whereIn('party_b', $this->stakeholder_ids)->where('deadline_date', '>', $this->now)->with(['file:id,treaty_id,file_id', 'file.fileInfo:id,location'])
$res = Treaty::query()->whereIn('party_b', $this->stakeholder_ids)->where('deadline_date', '>', $this->now)->with(['file:id,treaty_id,file_id', 'file.fileInfo:id,key'])
->select(['id', 'treaty_name', 'treaty_type', 'service_type', 'deadline_date', 'music_no'])->orderByDesc('created_at')->paginate($this->pageSize);
$client = new CosHelper();
foreach ($res as &$item) {
$item_res = $item->toArray();
$files = [];
if (!empty($item_res['file'])) {
foreach ($item_res['file'] as $file_item) {
!empty($file_item['file_info']['location']) && $files[] = $file_item['file_info']['location'];
!empty($file_item['file_info']['key']) && $files[] = $file_item['file_info']['key'];
}
}
foreach ($files as &$file) {
$file = $client->getPreviewUrl($file);
}
$item->setAttribute('files', $files);
unset($item->file);
}
......
......@@ -48,43 +48,6 @@ class MusicianWithdrawService extends Service
}
/**
* 修改提现状态
* @return \Illuminate\Http\JsonResponse|mixed
*/
public function changeStatus()
{
$withdraw_status = '';
$query = StakeholderIncomeSyncAppDetails::query()->where(['sync_status'=>1, 'identifier'=>$this->identifier->identifier])
->whereIn('serial_no', $this->request->input('busi_id'));
switch ($this->request->input('type')) {
case 'confirm': //已确认
$withdraw_status = 1;
$query = $query->where(['withdraw_status'=>0]);
break;
case 'fail': //提现失败 -> 待提现
$withdraw_status = 1;
$query = $query->where(['withdraw_status'=>2]);
break;
case 'advance': //提现中
$withdraw_status = 2;
$query = $query->where(['withdraw_status'=>1]);
break;
case 'success': //提现完成
$withdraw_status = 3;
$query = $query->where(['withdraw_status'=>2]);
break;
}
if ($query->update(['withdraw_status'=>$withdraw_status])) {
return Response::success();
} else {
return Response::error();
}
}
/**
* 确认账单
* @return \Illuminate\Http\JsonResponse
*/
......@@ -147,4 +110,22 @@ class MusicianWithdrawService extends Service
}
}
/**
* 修改提现状态
* @return \Illuminate\Http\JsonResponse|mixed
*/
public function changeStatus()
{
$withdraw_status = '';
$query = StakeholderIncomeSyncAppDetails::query()->where(['sync_status'=>1, 'identifier'=>$this->identifier->identifier])
->whereIn('serial_no', $this->request->input('busi_id'));
if ($query->update(['withdraw_status'=>$withdraw_status])) {
return Response::success();
} else {
return Response::error();
}
}
}
......
......@@ -14,7 +14,8 @@
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.40",
"laravel/tinker": "^2.5",
"phpseclib/phpseclib": "~3.0"
"phpseclib/phpseclib": "~3.0",
"qcloud/vod-sdk-v5": "^2.4"
},
"require-dev": {
"facade/ignition": "^2.5",
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "a4efc4c63ff2de523232f0fe790550fb",
"content-hash": "e28041a4bc9847dee62a3829f3824c85",
"packages": [
{
"name": "asm89/stack-cors",
......@@ -744,6 +744,93 @@
"time": "2020-04-13T13:17:36+00:00"
},
{
"name": "guzzlehttp/command",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/command.git",
"reference": "04b06e7f5ef37d814aeb3f4b6015b65a9d4412c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/command/zipball/04b06e7f5ef37d814aeb3f4b6015b65a9d4412c5",
"reference": "04b06e7f5ef37d814aeb3f4b6015b65a9d4412c5",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"guzzlehttp/guzzle": "^7.3",
"guzzlehttp/promises": "^1.3",
"guzzlehttp/psr7": "^1.7 || ^2.0",
"php": "^7.2.5 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^8.5.19"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Command\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Jeremy Lindblom",
"email": "jeremeamia@gmail.com",
"homepage": "https://github.com/jeremeamia"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
}
],
"description": "Provides the foundation for building command-based web service clients",
"support": {
"issues": "https://github.com/guzzle/command/issues",
"source": "https://github.com/guzzle/command/tree/1.2.1"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/command",
"type": "tidelift"
}
],
"time": "2021-09-05T19:12:19+00:00"
},
{
"name": "guzzlehttp/guzzle",
"version": "7.3.0",
"source": {
......@@ -853,6 +940,97 @@
"time": "2021-03-23T11:33:13+00:00"
},
{
"name": "guzzlehttp/guzzle-services",
"version": "1.3.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle-services.git",
"reference": "3731f120ce6856f4c71fff7cb2a27e263fe69f84"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle-services/zipball/3731f120ce6856f4c71fff7cb2a27e263fe69f84",
"reference": "3731f120ce6856f4c71fff7cb2a27e263fe69f84",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"guzzlehttp/command": "^1.2",
"guzzlehttp/guzzle": "^7.3",
"guzzlehttp/psr7": "^1.7 || ^2.0",
"guzzlehttp/uri-template": "^0.2 || ^1.0",
"php": "^7.2.5 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^8.5.19 || ^9.5.8"
},
"suggest": {
"gimler/guzzle-description-loader": "^0.0.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Command\\Guzzle\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Stefano Kowalke",
"email": "blueduck@mail.org",
"homepage": "https://github.com/Konafets"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
}
],
"description": "Provides an implementation of the Guzzle Command library that uses Guzzle service descriptions to describe web services, serialize requests, and parse responses into easy to use model structures.",
"support": {
"issues": "https://github.com/guzzle/guzzle-services/issues",
"source": "https://github.com/guzzle/guzzle-services/tree/1.3.1"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle-services",
"type": "tidelift"
}
],
"time": "2021-10-07T13:01:35+00:00"
},
{
"name": "guzzlehttp/promises",
"version": "1.4.1",
"source": {
......@@ -995,6 +1173,96 @@
"time": "2021-04-26T09:17:50+00:00"
},
{
"name": "guzzlehttp/uri-template",
"version": "v1.0.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/uri-template.git",
"reference": "b945d74a55a25a949158444f09ec0d3c120d69e2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/uri-template/zipball/b945d74a55a25a949158444f09ec0d3c120d69e2",
"reference": "b945d74a55a25a949158444f09ec0d3c120d69e2",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^7.2.5 || ^8.0",
"symfony/polyfill-php80": "^1.17"
},
"require-dev": {
"phpunit/phpunit": "^8.5.19 || ^9.5.8",
"uri-template/tests": "1.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\UriTemplate\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "George Mponos",
"email": "gmponos@gmail.com",
"homepage": "https://github.com/gmponos"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
}
],
"description": "A polyfill class for uri_template of PHP",
"keywords": [
"guzzlehttp",
"uri-template"
],
"support": {
"issues": "https://github.com/guzzle/uri-template/issues",
"source": "https://github.com/guzzle/uri-template/tree/v1.0.1"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/uri-template",
"type": "tidelift"
}
],
"time": "2021-10-07T12:57:01+00:00"
},
{
"name": "laravel/framework",
"version": "v8.48.2",
"source": {
......@@ -2588,6 +2856,124 @@
"time": "2021-04-10T16:23:39+00:00"
},
{
"name": "qcloud/cos-sdk-v5",
"version": "v2.4.0",
"source": {
"type": "git",
"url": "https://github.com/tencentyun/cos-php-sdk-v5.git",
"reference": "57e8e354ff94cfadabf13b1aacca1c6a20252595"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tencentyun/cos-php-sdk-v5/zipball/57e8e354ff94cfadabf13b1aacca1c6a20252595",
"reference": "57e8e354ff94cfadabf13b1aacca1c6a20252595",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"ext-curl": "*",
"ext-json": "*",
"guzzlehttp/guzzle": ">=6.2.1",
"guzzlehttp/guzzle-services": ">=1.1",
"guzzlehttp/psr7": "<=2.1",
"php": ">=5.6"
},
"type": "library",
"autoload": {
"psr-4": {
"Qcloud\\Cos\\": "src/Qcloud/Cos/"
},
"files": [
"src/Qcloud/Cos/Common.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "yaozongyou",
"email": "yaozongyou@vip.qq.com"
},
{
"name": "lewzylu",
"email": "327874225@qq.com"
},
{
"name": "tuunalai",
"email": "550566181@qq.com"
}
],
"description": "PHP SDK for QCloud COS",
"keywords": [
"cos",
"php",
"qcloud"
],
"support": {
"issues": "https://github.com/tencentyun/cos-php-sdk-v5/issues",
"source": "https://github.com/tencentyun/cos-php-sdk-v5/tree/v2.4.0"
},
"time": "2021-10-28T14:01:51+00:00"
},
{
"name": "qcloud/vod-sdk-v5",
"version": "v2.4.4",
"source": {
"type": "git",
"url": "https://github.com/tencentyun/vod-php-sdk-v5.git",
"reference": "a2af6b9662c2b33f88ba78e8e5bb9a2a76b4e178"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tencentyun/vod-php-sdk-v5/zipball/a2af6b9662c2b33f88ba78e8e5bb9a2a76b4e178",
"reference": "a2af6b9662c2b33f88ba78e8e5bb9a2a76b4e178",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.6.33",
"qcloud/cos-sdk-v5": "^v2.0.0",
"tencentcloud/tencentcloud-sdk-php": "^3.0.166"
},
"require-dev": {
"phpunit/phpunit": "^5.7"
},
"type": "library",
"autoload": {
"psr-4": {
"Vod\\": "src/Vod/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "xujianguo",
"email": "450846733@qq.com"
}
],
"description": "VOD SDK For PHP",
"support": {
"issues": "https://github.com/tencentyun/vod-php-sdk-v5/issues",
"source": "https://github.com/tencentyun/vod-php-sdk-v5"
},
"time": "2021-03-10T11:51:50+00:00"
},
{
"name": "ralouphie/getallheaders",
"version": "3.0.3",
"source": {
......@@ -5236,6 +5622,59 @@
"time": "2021-06-06T09:51:56+00:00"
},
{
"name": "tencentcloud/tencentcloud-sdk-php",
"version": "3.0.519",
"source": {
"type": "git",
"url": "https://github.com/TencentCloud/tencentcloud-sdk-php.git",
"reference": "6bc48a35816095f823384afe3fedc5ee776f1be9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/TencentCloud/tencentcloud-sdk-php/zipball/6bc48a35816095f823384afe3fedc5ee776f1be9",
"reference": "6bc48a35816095f823384afe3fedc5ee776f1be9",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"guzzlehttp/guzzle": "^6.3 || ^7.0",
"php": ">=5.6.0"
},
"type": "library",
"autoload": {
"classmap": [
"src/QcloudApi/QcloudApi.php"
],
"psr-4": {
"TencentCloud\\": "./src/TencentCloud"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "coolli",
"email": "tencentcloudapi@tencent.com",
"homepage": "https://cloud.tencent.com/document/sdk/PHP",
"role": "Developer"
}
],
"description": "TencentCloudApi php sdk",
"homepage": "https://github.com/TencentCloud/tencentcloud-sdk-php",
"support": {
"issues": "https://github.com/TencentCloud/tencentcloud-sdk-php/issues",
"source": "https://github.com/TencentCloud/tencentcloud-sdk-php/tree/3.0.519"
},
"time": "2021-11-15T00:42:17+00:00"
},
{
"name": "tijsverkoyen/css-to-inline-styles",
"version": "2.2.3",
"source": {
......