|
@@ -3,7 +3,9 @@
|
|
|
namespace App\Http\Controllers\Wap\Web;
|
|
|
|
|
|
use App\Modules\Subscribe\Services\OrderService;
|
|
|
+use App\Modules\User\Services\ReadRecordService;
|
|
|
use Illuminate\Routing\Controller;
|
|
|
+use App\Http\Controllers\Wap\BaseController;
|
|
|
use Illuminate\Http\Request;
|
|
|
use Cookie;
|
|
|
use DB;
|
|
@@ -11,8 +13,9 @@ use Redis;
|
|
|
use App\Modules\SendOrder\Services\SendOrderService;
|
|
|
use App\Modules\OfficialAccount\Services\ForceSubscribeService;
|
|
|
use App\Modules\Statistic\Services\WapVisitStatService;
|
|
|
+use Hashids;
|
|
|
|
|
|
-class RedirectController extends Controller
|
|
|
+class RedirectController extends BaseController
|
|
|
{
|
|
|
private $alluv;
|
|
|
/**
|
|
@@ -23,6 +26,7 @@ class RedirectController extends Controller
|
|
|
*/
|
|
|
public function index(Request $request, $t, $domain, $param)
|
|
|
{
|
|
|
+ $this->send_order_id = $param;
|
|
|
$h5_scheme = 'https';
|
|
|
//判断派单链接有没有进黑名单
|
|
|
$black_send_order_ids = explode(',', env('BLACK_SEND_ORDER_IDS'));
|
|
@@ -46,7 +50,7 @@ class RedirectController extends Controller
|
|
|
return response()->error('UNKNOWN_ERROR');
|
|
|
}
|
|
|
$uid = Cookie::get(env('COOKIE_AUTH_WEB_WECHAT'));
|
|
|
- if($uid){
|
|
|
+ if($this->uid){
|
|
|
try{
|
|
|
Redis::hset('book_read:' . $uid, 'send_order_id', $param);
|
|
|
}catch (\Exception $e){}
|
|
@@ -130,13 +134,58 @@ class RedirectController extends Controller
|
|
|
$url = secure_url('/') .$redirect_path;
|
|
|
return redirect()->to($url);
|
|
|
}else{
|
|
|
- return redirect()->to($url);
|
|
|
+ if (($recent_url = $this->JumpTorecentRead($link->redirect_url, $this->uid, $param))) {
|
|
|
+ return redirect()->to($recent_url);
|
|
|
+ } else {
|
|
|
+ return redirect()->to($url);
|
|
|
+ }
|
|
|
+ //return redirect()->to($url);
|
|
|
}
|
|
|
}
|
|
|
return redirect()->to(parse_url(url()->current())['scheme'] . '://' . _domain() . '/?' . $query);
|
|
|
}
|
|
|
|
|
|
|
|
|
+ private function JumpTorecentRead($url, $uid, $send_order_id)
|
|
|
+ {
|
|
|
+ if (!$uid) return '';
|
|
|
+ $url_info = parse_url($url);
|
|
|
+ if (!isset($url_info['path']) || !isset($url_info['query']) || $url_info['path'] != '/reader') return '';
|
|
|
+
|
|
|
+ parse_str($url_info['query'], $query_param);
|
|
|
+ if (!$query_param || !isset($query_param['bid']) || !isset($query_param['cid'])) return '';
|
|
|
+ $bid = 0;
|
|
|
+ $bid_str = $query_param['bid'];
|
|
|
+ $cid = $query_param['cid'];
|
|
|
+ try {
|
|
|
+ $bid_arr = Hashids::decode($bid_str);
|
|
|
+ if (isset($bid_arr[0])) $bid = $bid_arr[0];
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$bid) return '';
|
|
|
+ $record_info = '';
|
|
|
+ try {
|
|
|
+ $record_info = ReadRecordService::getRecordByUidBid($uid, $bid);
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ \Log::info($e);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$record_info) return '';
|
|
|
+ $record_info_arr = explode('_', $record_info);
|
|
|
+ if (!isset($record_info_arr[0])) return '';
|
|
|
+
|
|
|
+ $param['cid'] = $record_info_arr[0];
|
|
|
+ $param['bid'] = $bid_str;
|
|
|
+ $param['soid'] = $send_order_id;
|
|
|
+ if ($cid && $cid != $record_info_arr[0]) {
|
|
|
+ $url = env('H5_SCHEME', 'https') . '://' . _domain() . '/reader?' . http_build_query($param);
|
|
|
+ return $url;
|
|
|
+ }
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public function testLogin(Request $request)
|
|
|
{
|
|
|
$siteid = $request->input('siteid');
|