AdReplaceBookController.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * 广告修改书籍获取接口
  4. * @file:AdReplaceBookController.php
  5. * @Created by gnitif
  6. * @Date: 2022/9/27
  7. * @Time: 10:44
  8. */
  9. namespace App\Http\Controllers\QuickApp\SendOrder;
  10. use App\Http\Controllers\QuickApp\BaseController;
  11. use App\Modules\SendOrder\Models\QappSendOrder;
  12. use Illuminate\Http\Request;
  13. class AdReplaceBookController extends BaseController
  14. {
  15. public function getAdvReplaceBookInfo(Request $request)
  16. {
  17. $book = [];
  18. try {
  19. $package = $request->header('x-package', '');
  20. // 暂时关闭浩瀚书籍替换
  21. if($package == "com.beidao.kuaiying.haohannew"){
  22. return response()->success([]);
  23. }
  24. $send_order_id = $request->input('send_order_id',0);
  25. if ($send_order_id > 0){
  26. $extra_config = QappSendOrder::where(['send_order_id' => $send_order_id])->value('extra_config');
  27. $extra_config = empty($extra_config) ? [] : json_decode($extra_config,true);
  28. $status = $extra_config['replace_book_status'] ?? 0;
  29. $bid = $extra_config['replace_book_bid'] ?? "";
  30. $cid = $extra_config['replace_chapter_cid'] ?? 0;
  31. if ($status == 1){
  32. if(!empty($bid) && !empty($cid)){
  33. $book = ['bid' => $bid,'cid' => $cid];
  34. }else{
  35. myLog("SendOrderReplaceBookError")->info(['send_order_id' => $send_order_id,'extra_config' => $extra_config]);
  36. }
  37. }
  38. }
  39. }catch (\Exception $exception){
  40. $book = [];
  41. }
  42. return response()->success($book);
  43. }
  44. }