|
@@ -6,16 +6,22 @@ use Illuminate\Http\Request;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Modules\SendOrder\Services\SendOrderService;
|
|
use App\Modules\SendOrder\Services\SendOrderService;
|
|
use Hashids;
|
|
use Hashids;
|
|
|
|
+use Cookie;
|
|
|
|
+use Redis;
|
|
|
|
|
|
class WelcomeController extends Controller
|
|
class WelcomeController extends Controller
|
|
{
|
|
{
|
|
|
|
+
|
|
|
|
+ private $send_order_id;
|
|
|
|
+
|
|
public function index(Request $request, string $send_order_id_encode)
|
|
public function index(Request $request, string $send_order_id_encode)
|
|
{
|
|
{
|
|
$decode_id = Hashids::decode($send_order_id_encode);
|
|
$decode_id = Hashids::decode($send_order_id_encode);
|
|
if ($decode_id) {
|
|
if ($decode_id) {
|
|
- $send_order_id = $decode_id[0];
|
|
|
|
- $send_order = SendOrderService::getSendOrderStatic($send_order_id);
|
|
|
|
- $quick_send_order = SendOrderService::getQuickAppSendOrderStatic($send_order_id);
|
|
|
|
|
|
+ $this->send_order_id = $decode_id[0];
|
|
|
|
+ $send_order = SendOrderService::getSendOrderStatic($this->send_order_id);
|
|
|
|
+ $quick_send_order = SendOrderService::getQuickAppSendOrderStatic($this->send_order_id);
|
|
|
|
+ $this->sendOrderStatistic($send_order);
|
|
if ($send_order && $quick_send_order) {
|
|
if ($send_order && $quick_send_order) {
|
|
return view('qapp.welcome')->with([
|
|
return view('qapp.welcome')->with([
|
|
'gzh_code' => $quick_send_order->child_gzh_name,
|
|
'gzh_code' => $quick_send_order->child_gzh_name,
|
|
@@ -26,4 +32,36 @@ class WelcomeController extends Controller
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private function sendOrderStatistic($send_order)
|
|
|
|
+ {
|
|
|
|
+ $key = date('Y-m-d');
|
|
|
|
+ $send_order_flag = Cookie::get('send_order_flag');
|
|
|
|
+ $send_orders = explode(',', $send_order_flag);
|
|
|
|
+ //uv
|
|
|
|
+ if (!Cookie::get('send_order_flag_' . $this->send_order_id) && !in_array($this->send_order_id, $send_orders)) {
|
|
|
|
+ Redis::hincrby('send_order_uv_' . $this->send_order_id, $key, 1);
|
|
|
|
+ Redis::hincrby('send_order_uv_' . $this->send_order_id, 'total', 1);
|
|
|
|
+ array_push($send_orders, $this->send_order_id);
|
|
|
|
+ $str = implode(',', $send_orders);
|
|
|
|
+ Cookie::queue('send_order_flag', $str, env('U_COOKIE_EXPIRE'), null, null, false, false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (Cookie::get('send_order_flag_' . $this->send_order_id)) {
|
|
|
|
+ array_push($send_orders, $this->send_order_id);
|
|
|
|
+ $str = implode(',', $send_orders);
|
|
|
|
+ Cookie::queue('send_order_flag', $str, env('U_COOKIE_EXPIRE'), null, null, false, false);
|
|
|
|
+ Cookie::queue('send_order_flag_' . $this->send_order_id, null, -1);
|
|
|
|
+ }
|
|
|
|
+ //pv
|
|
|
|
+ Redis::hincrby('send_order_pv_' . $this->send_order_id, $key, 1); //每天
|
|
|
|
+ Redis::hincrby('send_order_pv_' . $this->send_order_id, 'total', 1); //汇总
|
|
|
|
+ Redis::sadd('send_order' . $key, $this->send_order_id);
|
|
|
|
+ if (isset($send_order->send_time) && $send_order->send_time) { } else {
|
|
|
|
+ $uv = Redis::hget('send_order_uv_' . $this->send_order_id, $key);
|
|
|
|
+ if ($uv && $uv > 20) {
|
|
|
|
+ SendOrderService::updateSendOrderTime($this->send_order_id);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|