AdjustController.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace App\Http\Controllers\Api;
  3. use App\Http\Controllers\Controller;
  4. use App\Models\AccountsInfo;
  5. use App\Models\AccountsSource;
  6. use App\Util;
  7. use Illuminate\Http\Request;
  8. use Illuminate\Support\Facades\Log;
  9. class AdjustController extends Controller
  10. {
  11. public function report(Request $request)
  12. {
  13. Util::WriteLog('adjust_report', $request->all());
  14. $adID = $request->input('ad_id');
  15. $campaignName = $request->input('campaign_name');
  16. $AdChannel = 0;
  17. preg_match('/\*\d+/', $campaignName, $result);
  18. if (isset($result[0])) {
  19. $AdChannel = explode('*', $result[0])[1] ?? 0;
  20. }
  21. // $accountInfo = AccountsInfo::lock('with(nolock)')->where('Accounts', $adID)->first();
  22. // if (!$accountInfo) {
  23. // Log::info('adjust_report account not found', [
  24. // 'adid' => $adID
  25. // ]);
  26. // return apiReturnFail(__('messages.api.adjust.not_found'));
  27. // }
  28. // $accountSource = AccountsSource::where('UserID', $accountInfo->UserID)->lock('with(nolock)')->first();
  29. // if (!$accountSource) {
  30. // $accountSource = new AccountsSource();
  31. // $accountSource->UserID = $accountInfo->UserID;
  32. // $accountSource->Source = $campaignName;
  33. // $accountSource->AdChannel = $AdChannel;
  34. // $accountSource->save();
  35. // }
  36. return apiReturnSuc();
  37. }
  38. }