123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- /**
- * 广告修改书籍获取接口
- * @file:AdReplaceBookController.php
- * @Created by gnitif
- * @Date: 2022/9/27
- * @Time: 10:44
- */
- namespace App\Http\Controllers\QuickApp\SendOrder;
- use App\Http\Controllers\QuickApp\BaseController;
- use App\Modules\SendOrder\Models\QappSendOrder;
- use Illuminate\Http\Request;
- class AdReplaceBookController extends BaseController
- {
- public function getAdvReplaceBookInfo(Request $request)
- {
- $book = [];
- try {
- $package = $request->header('x-package', '');
- // 暂时关闭浩瀚书籍替换
- if($package == "com.beidao.kuaiying.haohannew"){
- return response()->success([]);
- }
- $send_order_id = $request->input('send_order_id',0);
- if ($send_order_id > 0){
- $extra_config = QappSendOrder::where(['send_order_id' => $send_order_id])->value('extra_config');
- $extra_config = empty($extra_config) ? [] : json_decode($extra_config,true);
- $status = $extra_config['replace_book_status'] ?? 0;
- $bid = $extra_config['replace_book_bid'] ?? "";
- $cid = $extra_config['replace_chapter_cid'] ?? 0;
- if ($status == 1){
- if(!empty($bid) && !empty($cid)){
- $book = ['bid' => $bid,'cid' => $cid];
- }else{
- myLog("SendOrderReplaceBookError")->info(['send_order_id' => $send_order_id,'extra_config' => $extra_config]);
- }
- }
- }
- }catch (\Exception $exception){
- $book = [];
- }
- return response()->success($book);
- }
- }
|