*
Showing
15 changed files
with
115 additions
and
32 deletions
| ... | @@ -4,8 +4,11 @@ namespace App\Http\Controllers\Musician; | ... | @@ -4,8 +4,11 @@ namespace App\Http\Controllers\Musician; |
| 4 | 4 | ||
| 5 | use App\Http\Controllers\Controller; | 5 | use App\Http\Controllers\Controller; |
| 6 | use App\Services\MusicianAgreementService; | 6 | use App\Services\MusicianAgreementService; |
| 7 | use Illuminate\Http\Request; | ||
| 8 | 7 | ||
| 8 | /** | ||
| 9 | * Class MusicianAgreementController | ||
| 10 | * @package App\Http\Controllers\Musician | ||
| 11 | */ | ||
| 9 | class MusicianAgreementController extends Controller | 12 | class MusicianAgreementController extends Controller |
| 10 | { | 13 | { |
| 11 | /** | 14 | /** |
| ... | @@ -23,7 +26,10 @@ class MusicianAgreementController extends Controller | ... | @@ -23,7 +26,10 @@ class MusicianAgreementController extends Controller |
| 23 | $this->musicianAgreementService = $musicianAgreementService; | 26 | $this->musicianAgreementService = $musicianAgreementService; |
| 24 | } | 27 | } |
| 25 | 28 | ||
| 26 | 29 | /** | |
| 30 | * 我的合约列表 | ||
| 31 | * @return \Illuminate\Http\JsonResponse | ||
| 32 | */ | ||
| 27 | public function list() | 33 | public function list() |
| 28 | { | 34 | { |
| 29 | return $this->musicianAgreementService->agreementList(); | 35 | return $this->musicianAgreementService->agreementList(); | ... | ... |
| ... | @@ -4,7 +4,6 @@ namespace App\Http\Controllers\Musician; | ... | @@ -4,7 +4,6 @@ namespace App\Http\Controllers\Musician; |
| 4 | 4 | ||
| 5 | use App\Http\Controllers\Controller; | 5 | use App\Http\Controllers\Controller; |
| 6 | use App\Services\MusicianBalanceService; | 6 | use App\Services\MusicianBalanceService; |
| 7 | use Illuminate\Http\Request; | ||
| 8 | 7 | ||
| 9 | class MusicianBalanceController extends Controller | 8 | class MusicianBalanceController extends Controller |
| 10 | { | 9 | { |
| ... | @@ -24,7 +23,7 @@ class MusicianBalanceController extends Controller | ... | @@ -24,7 +23,7 @@ class MusicianBalanceController extends Controller |
| 24 | 23 | ||
| 25 | /** | 24 | /** |
| 26 | * 账户详情 | 25 | * 账户详情 |
| 27 | * @return mixed | 26 | * @return \Illuminate\Http\JsonResponse |
| 28 | */ | 27 | */ |
| 29 | public function account() | 28 | public function account() |
| 30 | { | 29 | { |
| ... | @@ -33,7 +32,7 @@ class MusicianBalanceController extends Controller | ... | @@ -33,7 +32,7 @@ class MusicianBalanceController extends Controller |
| 33 | 32 | ||
| 34 | /** | 33 | /** |
| 35 | * 提现详情 | 34 | * 提现详情 |
| 36 | * @return \Psr\Http\Message\ResponseInterface | 35 | * @return \Illuminate\Http\JsonResponse |
| 37 | */ | 36 | */ |
| 38 | public function accountDetail() | 37 | public function accountDetail() |
| 39 | { | 38 | { | ... | ... |
| ... | @@ -4,7 +4,6 @@ namespace App\Http\Controllers\Musician; | ... | @@ -4,7 +4,6 @@ namespace App\Http\Controllers\Musician; |
| 4 | 4 | ||
| 5 | use App\Http\Controllers\Controller; | 5 | use App\Http\Controllers\Controller; |
| 6 | use App\Services\MusicianIncomeService; | 6 | use App\Services\MusicianIncomeService; |
| 7 | use Illuminate\Http\Request; | ||
| 8 | 7 | ||
| 9 | class MusicianIncomeController extends Controller | 8 | class MusicianIncomeController extends Controller |
| 10 | { | 9 | { |
| ... | @@ -24,7 +23,7 @@ class MusicianIncomeController extends Controller | ... | @@ -24,7 +23,7 @@ class MusicianIncomeController extends Controller |
| 24 | 23 | ||
| 25 | /** | 24 | /** |
| 26 | * 入账收益图表 | 25 | * 入账收益图表 |
| 27 | * @return \Psr\Http\Message\ResponseInterface | 26 | * @return \Illuminate\Http\JsonResponse |
| 28 | */ | 27 | */ |
| 29 | public function income() | 28 | public function income() |
| 30 | { | 29 | { |
| ... | @@ -33,7 +32,7 @@ class MusicianIncomeController extends Controller | ... | @@ -33,7 +32,7 @@ class MusicianIncomeController extends Controller |
| 33 | 32 | ||
| 34 | /** | 33 | /** |
| 35 | * 入账明细 | 34 | * 入账明细 |
| 36 | * @return \Psr\Http\Message\ResponseInterface | 35 | * @return \Illuminate\Http\JsonResponse |
| 37 | */ | 36 | */ |
| 38 | public function billCollate() | 37 | public function billCollate() |
| 39 | { | 38 | { |
| ... | @@ -42,7 +41,7 @@ class MusicianIncomeController extends Controller | ... | @@ -42,7 +41,7 @@ class MusicianIncomeController extends Controller |
| 42 | 41 | ||
| 43 | /** | 42 | /** |
| 44 | * 入账明细详情 | 43 | * 入账明细详情 |
| 45 | * @return \Psr\Http\Message\ResponseInterface | 44 | * @return \Illuminate\Http\JsonResponse |
| 46 | */ | 45 | */ |
| 47 | public function billCollateDetail() | 46 | public function billCollateDetail() |
| 48 | { | 47 | { | ... | ... |
| ... | @@ -24,7 +24,7 @@ class MusicianSongController extends Controller | ... | @@ -24,7 +24,7 @@ class MusicianSongController extends Controller |
| 24 | 24 | ||
| 25 | /** | 25 | /** |
| 26 | * 授权歌曲列表 | 26 | * 授权歌曲列表 |
| 27 | * @return \Psr\Http\Message\ResponseInterface | 27 | * @return \Illuminate\Http\JsonResponse |
| 28 | */ | 28 | */ |
| 29 | public function list() | 29 | public function list() |
| 30 | { | 30 | { |
| ... | @@ -33,7 +33,8 @@ class MusicianSongController extends Controller | ... | @@ -33,7 +33,8 @@ class MusicianSongController extends Controller |
| 33 | 33 | ||
| 34 | /** | 34 | /** |
| 35 | * 发行歌曲详情 | 35 | * 发行歌曲详情 |
| 36 | * @return \Psr\Http\Message\ResponseInterface | 36 | * @param $song_id |
| 37 | * @return \Illuminate\Http\JsonResponse | ||
| 37 | */ | 38 | */ |
| 38 | public function detail($song_id) | 39 | public function detail($song_id) |
| 39 | { | 40 | { |
| ... | @@ -43,7 +44,7 @@ class MusicianSongController extends Controller | ... | @@ -43,7 +44,7 @@ class MusicianSongController extends Controller |
| 43 | /** | 44 | /** |
| 44 | * 歌曲权益 | 45 | * 歌曲权益 |
| 45 | * @param $song_id | 46 | * @param $song_id |
| 46 | * @return mixed | 47 | * @return \Illuminate\Http\JsonResponse |
| 47 | */ | 48 | */ |
| 48 | public function right($song_id) | 49 | public function right($song_id) |
| 49 | { | 50 | { | ... | ... |
| ... | @@ -24,7 +24,7 @@ class MusicianTreatyController extends Controller | ... | @@ -24,7 +24,7 @@ class MusicianTreatyController extends Controller |
| 24 | 24 | ||
| 25 | /** | 25 | /** |
| 26 | * 经纪合约 | 26 | * 经纪合约 |
| 27 | * @return \Psr\Http\Message\ResponseInterface | 27 | * @return \Illuminate\Http\JsonResponse |
| 28 | */ | 28 | */ |
| 29 | public function list() | 29 | public function list() |
| 30 | { | 30 | { | ... | ... |
| ... | @@ -21,6 +21,10 @@ class MusicianWithdrawController extends Controller | ... | @@ -21,6 +21,10 @@ class MusicianWithdrawController extends Controller |
| 21 | $this->musicianWithdrawService = $musicianWithdrawService; | 21 | $this->musicianWithdrawService = $musicianWithdrawService; |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | /** | ||
| 25 | * 冻结资金 | ||
| 26 | * @return \Illuminate\Http\JsonResponse | ||
| 27 | */ | ||
| 24 | public function prepare() | 28 | public function prepare() |
| 25 | { | 29 | { |
| 26 | return $this->musicianWithdrawService->prepare(); | 30 | return $this->musicianWithdrawService->prepare(); | ... | ... |
| ... | @@ -58,8 +58,7 @@ class BaseModel extends Model | ... | @@ -58,8 +58,7 @@ class BaseModel extends Model |
| 58 | */ | 58 | */ |
| 59 | public function scopeIdentify(Builder $builder) | 59 | public function scopeIdentify(Builder $builder) |
| 60 | { | 60 | { |
| 61 | $builder = $builder->whereIn('stakeholder_id', request()->get('identifier')->identifier); | 61 | return $builder->whereIn('stakeholder_id', [request()->get('identifier')->identifier]); |
| 62 | return $builder; | ||
| 63 | } | 62 | } |
| 64 | 63 | ||
| 65 | } | 64 | } | ... | ... |
| ... | @@ -13,6 +13,8 @@ class SongStakeholder extends BaseModel | ... | @@ -13,6 +13,8 @@ class SongStakeholder extends BaseModel |
| 13 | { | 13 | { |
| 14 | use HasFactory; | 14 | use HasFactory; |
| 15 | 15 | ||
| 16 | protected $table = 'song_stakeholder'; | ||
| 17 | |||
| 16 | /** | 18 | /** |
| 17 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo | 19 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
| 18 | */ | 20 | */ | ... | ... |
| 1 | <?php | ||
| 2 | |||
| 3 | namespace App\Providers; | ||
| 4 | |||
| 5 | use Carbon\Carbon; | ||
| 6 | use Illuminate\Database\Events\TransactionBeginning; | ||
| 7 | use Illuminate\Database\Events\TransactionCommitted; | ||
| 8 | use Illuminate\Database\Events\TransactionRolledBack; | ||
| 9 | use Illuminate\Support\Facades\DB; | ||
| 10 | use Illuminate\Support\Facades\Event; | ||
| 11 | use Illuminate\Support\Facades\Log; | ||
| 12 | use Illuminate\Support\ServiceProvider; | ||
| 13 | |||
| 14 | class DataBaseQueryServiceProvider extends ServiceProvider | ||
| 15 | { | ||
| 16 | /** | ||
| 17 | * Register services. | ||
| 18 | * | ||
| 19 | * @return void | ||
| 20 | */ | ||
| 21 | public function register() | ||
| 22 | { | ||
| 23 | if (config('logging.sql.enable') === false) { | ||
| 24 | return; | ||
| 25 | } | ||
| 26 | |||
| 27 | DB::listen(function ($query): void { | ||
| 28 | $sql = $query->sql; | ||
| 29 | |||
| 30 | foreach ($query->bindings as $binding) { | ||
| 31 | if (is_string($binding)) { | ||
| 32 | $binding = "'{$binding}'"; | ||
| 33 | } elseif (is_bool($binding)) { | ||
| 34 | $binding = $binding ? '1' : '0'; | ||
| 35 | } elseif (is_int($binding)) { | ||
| 36 | $binding = (string) $binding; | ||
| 37 | } elseif ($binding === null) { | ||
| 38 | $binding = 'NULL'; | ||
| 39 | } elseif ($binding instanceof Carbon) { | ||
| 40 | $binding = "'{$binding->toDateTimeString()}'"; | ||
| 41 | } elseif ($binding instanceof \DateTime) { | ||
| 42 | $binding = "'{$binding->format('Y-m-d H:i:s')}'"; | ||
| 43 | } | ||
| 44 | |||
| 45 | $sql = preg_replace('/\\?/', $binding, $sql, 1); | ||
| 46 | } | ||
| 47 | |||
| 48 | Log::channel('sql')->debug('SQL', ['sql' => $sql, 'time' => "{$query->time} ms"]); | ||
| 49 | }); | ||
| 50 | |||
| 51 | Event::listen(TransactionBeginning::class, function (TransactionBeginning $event): void { | ||
| 52 | Log::channel('sql')->debug('START TRANSACTION'); | ||
| 53 | }); | ||
| 54 | |||
| 55 | Event::listen(TransactionCommitted::class, function (TransactionCommitted $event): void { | ||
| 56 | Log::channel('sql')->debug('COMMIT'); | ||
| 57 | }); | ||
| 58 | |||
| 59 | Event::listen(TransactionRolledBack::class, function (TransactionRolledBack $event): void { | ||
| 60 | Log::channel('sql')->debug('ROLLBACK'); | ||
| 61 | }); | ||
| 62 | } | ||
| 63 | |||
| 64 | /** | ||
| 65 | * Bootstrap services. | ||
| 66 | * | ||
| 67 | * @return void | ||
| 68 | */ | ||
| 69 | public function boot() | ||
| 70 | { | ||
| 71 | // | ||
| 72 | } | ||
| 73 | } |
| ... | @@ -34,7 +34,7 @@ class MusicianAgreementService extends Service | ... | @@ -34,7 +34,7 @@ class MusicianAgreementService extends Service |
| 34 | return Response::success($res); | 34 | return Response::success($res); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | /* | 37 | |
| 38 | /** | 38 | /** |
| 39 | * 我的合约列表 | 39 | * 我的合约列表 |
| 40 | * @return \Psr\Http\Message\ResponseInterface | 40 | * @return \Psr\Http\Message\ResponseInterface | ... | ... |
| ... | @@ -23,7 +23,11 @@ class MusicianSongService extends Service | ... | @@ -23,7 +23,11 @@ class MusicianSongService extends Service |
| 23 | */ | 23 | */ |
| 24 | public function releaseSong() | 24 | public function releaseSong() |
| 25 | { | 25 | { |
| 26 | |||
| 26 | $song_ids = array_unique(SongStakeholder::query()->identify()->pluck('song_id')->toArray()); | 27 | $song_ids = array_unique(SongStakeholder::query()->identify()->pluck('song_id')->toArray()); |
| 28 | |||
| 29 | if (empty($song_ids)) return Response::success(); | ||
| 30 | |||
| 27 | $song_table = Song::table(); | 31 | $song_table = Song::table(); |
| 28 | $songip_table = SongsIp::table(); | 32 | $songip_table = SongsIp::table(); |
| 29 | 33 | ... | ... |
| ... | @@ -175,6 +175,8 @@ return [ | ... | @@ -175,6 +175,8 @@ return [ |
| 175 | App\Providers\EventServiceProvider::class, | 175 | App\Providers\EventServiceProvider::class, |
| 176 | App\Providers\RouteServiceProvider::class, | 176 | App\Providers\RouteServiceProvider::class, |
| 177 | 177 | ||
| 178 | \App\Providers\DataBaseQueryServiceProvider::class, | ||
| 179 | |||
| 178 | ], | 180 | ], |
| 179 | 181 | ||
| 180 | /* | 182 | /* | ... | ... |
| ... | @@ -17,7 +17,7 @@ return [ | ... | @@ -17,7 +17,7 @@ return [ |
| 17 | | | 17 | | |
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | 'default' => env('LOG_CHANNEL', 'stack'), | 20 | 'default' => env('LOG_CHANNEL', 'daily'), |
| 21 | 21 | ||
| 22 | /* | 22 | /* |
| 23 | |-------------------------------------------------------------------------- | 23 | |-------------------------------------------------------------------------- |
| ... | @@ -100,6 +100,14 @@ return [ | ... | @@ -100,6 +100,14 @@ return [ |
| 100 | 'emergency' => [ | 100 | 'emergency' => [ |
| 101 | 'path' => storage_path('logs/laravel.log'), | 101 | 'path' => storage_path('logs/laravel.log'), |
| 102 | ], | 102 | ], |
| 103 | |||
| 104 | 'sql' => [ | ||
| 105 | 'enable' => env('LOG_SQL_ENABLE', false), | ||
| 106 | 'driver' => 'daily', | ||
| 107 | 'path' => storage_path('logs/laravel-sql.log'), | ||
| 108 | 'level' => env('LOG_LEVEL', 'debug'), | ||
| 109 | 'days' => 14, | ||
| 110 | ], | ||
| 103 | ], | 111 | ], |
| 104 | 112 | ||
| 105 | ]; | 113 | ]; | ... | ... |
| ... | @@ -17,7 +17,7 @@ use App\Http\Controllers\Api; | ... | @@ -17,7 +17,7 @@ use App\Http\Controllers\Api; |
| 17 | Route::group([], function (){ | 17 | Route::group([], function (){ |
| 18 | 18 | ||
| 19 | //首页-音乐人 | 19 | //首页-音乐人 |
| 20 | Route::get('musician_song', 'MusicianWithdrawController@list'); | 20 | Route::get('musician_song', 'MusicianSongController@list'); |
| 21 | Route::get('musician_song/{song_id}', 'MusicianSongController@detail'); | 21 | Route::get('musician_song/{song_id}', 'MusicianSongController@detail'); |
| 22 | Route::get('musician_song/{song_id}/right', 'MusicianSongController@right'); | 22 | Route::get('musician_song/{song_id}/right', 'MusicianSongController@right'); |
| 23 | //经纪约列表 | 23 | //经纪约列表 |
| ... | @@ -37,7 +37,6 @@ Route::group([], function (){ | ... | @@ -37,7 +37,6 @@ Route::group([], function (){ |
| 37 | //提现请求 | 37 | //提现请求 |
| 38 | Route::post('musician/withdraw_prepare', 'App\Controller\Musician\MusicianWithdrawController@prepare'); | 38 | Route::post('musician/withdraw_prepare', 'App\Controller\Musician\MusicianWithdrawController@prepare'); |
| 39 | 39 | ||
| 40 | Route::get('musician/test', 'MusicianTestController@test'); | ||
| 41 | 40 | ||
| 42 | 41 | ||
| 43 | }); | 42 | }); | ... | ... |
-
Please register or sign in to post a comment