|
@@ -13,15 +13,16 @@ class ActivityController extends BaseController
|
|
|
{
|
|
|
|
|
|
//渠道自定义活动 可以多少充值
|
|
|
- public function channelCustomActivity(Request $request){
|
|
|
+ public function channelCustomActivity(Request $request)
|
|
|
+ {
|
|
|
$encode_distribution_channel_id = encodeDistributionChannelId($this->distribution_channel_id);
|
|
|
$token = $request->input('token');
|
|
|
$activity_info = ActivityService::getByToken($token);
|
|
|
$img = 'https://cdn-novel.iycdm.com/h5/activity-chanel-custom/btn48.jpg';
|
|
|
if ($activity_info && $activity_info->product_id) {
|
|
|
- $customer_activity_info = DB::table('channel_custom_activity')->where('product_id',$activity_info->product_id)->select('setting')->first();
|
|
|
- if($customer_activity_info && $customer_activity_info->setting){
|
|
|
- $img = json_decode($customer_activity_info->setting,1)['img'];
|
|
|
+ $customer_activity_info = DB::table('channel_custom_activity')->where('product_id', $activity_info->product_id)->select('setting')->first();
|
|
|
+ if ($customer_activity_info && $customer_activity_info->setting) {
|
|
|
+ $img = json_decode($customer_activity_info->setting, 1)['img'];
|
|
|
}
|
|
|
$from = $request->input('fromtype', 'main');
|
|
|
$uv_key_format = 'activity:%s:distribution_channel_id:%s:date:%s:uv';
|
|
@@ -33,15 +34,15 @@ class ActivityController extends BaseController
|
|
|
//$order = Order::where('uid',$this->uid)->where('status','PAID')->where('activity_id',$activity_info->id)->count();
|
|
|
//渠道不符合
|
|
|
if ($activity_info->distribution_channel_id != $this->distribution_channel_id) {
|
|
|
- return view('pay.activity.ChannelCustomerV1', ['url' => '###', 'img'=>$img,'code' => -1, 'start_time' => date('Y-m-d', time() - 86400 * 2), 'end_time' => date('Y-m-d', time() - 86400)]);
|
|
|
+ return view('pay.activity.ChannelCustomerV1', ['url' => '###', 'img' => $img, 'code' => -1, 'start_time' => date('Y-m-d', time() - 86400 * 2), 'end_time' => date('Y-m-d', time() - 86400)]);
|
|
|
}
|
|
|
//活动未开始
|
|
|
if (time() < strtotime($activity_info->start_time)) {
|
|
|
- return view('pay.activity.ChannelCustomerV1', ['url' => '###', 'img'=>$img, 'code' => -3, 'start_time' => date('Y-m-d', strtotime($activity_info->start_time)), 'end_time' => date('Y-m-d', strtotime($activity_info->end_time) - 100)]);
|
|
|
+ return view('pay.activity.ChannelCustomerV1', ['url' => '###', 'img' => $img, 'code' => -3, 'start_time' => date('Y-m-d', strtotime($activity_info->start_time)), 'end_time' => date('Y-m-d', strtotime($activity_info->end_time) - 100)]);
|
|
|
}
|
|
|
//活动结束
|
|
|
if (time() > strtotime($activity_info->end_time)) {
|
|
|
- return view('pay.activity.ChannelCustomerV1', ['url' => '###', 'img'=>$img, 'code' => -1, 'start_time' => date('Y-m-d', strtotime($activity_info->start_time)), 'end_time' => date('Y-m-d', strtotime($activity_info->end_time) - 100)]);
|
|
|
+ return view('pay.activity.ChannelCustomerV1', ['url' => '###', 'img' => $img, 'code' => -1, 'start_time' => date('Y-m-d', strtotime($activity_info->start_time)), 'end_time' => date('Y-m-d', strtotime($activity_info->end_time) - 100)]);
|
|
|
}
|
|
|
|
|
|
if (time() > strtotime($activity_info->start_time) && time() < strtotime($activity_info->end_time)) {
|
|
@@ -55,10 +56,10 @@ class ActivityController extends BaseController
|
|
|
'pay_redirect_url' => env('H5_SCHEME', 'https') . '://site' . $encode_distribution_channel_id . '.' . env('CUSTOM_HOST') . '.com/person'
|
|
|
];
|
|
|
$url = env('CREATE_PAY_URL') . '?' . http_build_query($param);
|
|
|
- return view('pay.activity.ChannelCustomerV1', ['url' => $url, 'img'=>$img, 'code' => 0, 'start_time' => date('Y-m-d', strtotime($activity_info->start_time)), 'end_time' => date('Y-m-d', strtotime($activity_info->end_time) - 100)]);
|
|
|
+ return view('pay.activity.ChannelCustomerV1', ['url' => $url, 'img' => $img, 'code' => 0, 'start_time' => date('Y-m-d', strtotime($activity_info->start_time)), 'end_time' => date('Y-m-d', strtotime($activity_info->end_time) - 100)]);
|
|
|
}
|
|
|
}
|
|
|
- return view('pay.activity.ChannelCustomerV1', ['url' => '###', 'img'=>$img, 'code' => -1, 'start_time' => date('Y-m-d', time() - 86400 * 2), 'end_time' => date('Y-m-d', time() - 86400)]);
|
|
|
+ return view('pay.activity.ChannelCustomerV1', ['url' => '###', 'img' => $img, 'code' => -1, 'start_time' => date('Y-m-d', time() - 86400 * 2), 'end_time' => date('Y-m-d', time() - 86400)]);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -81,7 +82,7 @@ class ActivityController extends BaseController
|
|
|
$redirect_url = urldecode($redirect_url);
|
|
|
}
|
|
|
$product_id = $activity_info->product_id;
|
|
|
- if($activity_info->id == 6000){
|
|
|
+ if ($activity_info->id == 6000) {
|
|
|
$imgs['page_bd_img'] = 'https://cdn-novel.iycdm.com/h5/activity-2019-04-29/bg2.jpg';
|
|
|
$product_id = 5788;
|
|
|
}
|
|
@@ -110,60 +111,63 @@ class ActivityController extends BaseController
|
|
|
return redirect()->to($default_url);
|
|
|
}
|
|
|
|
|
|
- public function crmActivity(Request $request){
|
|
|
+ public function crmActivity(Request $request)
|
|
|
+ {
|
|
|
$default_url = env('H5_SCHEME', 'https') . '://site' . $this->en_distribution_channel_id . '.' . env('CUSTOM_HOST') . '.com/';
|
|
|
|
|
|
$token = $request->input('token');
|
|
|
- if(!$token){
|
|
|
+ if (!$token) {
|
|
|
return redirect()->to($default_url);
|
|
|
}
|
|
|
$activity_info = ActivityService::getByToken($token);
|
|
|
- if(!$activity_info){
|
|
|
+ if (!$activity_info) {
|
|
|
return redirect()->to($default_url);
|
|
|
}
|
|
|
- $img = \GuzzleHttp\json_decode($activity_info->setting,1);
|
|
|
+ $img = \GuzzleHttp\json_decode($activity_info->setting, 1);
|
|
|
$param = [
|
|
|
'uid' => $this->uid,
|
|
|
'distribution_channel_id' => $this->distribution_channel_id,
|
|
|
'product_id' => $activity_info->product_id,
|
|
|
'activity_id' => $activity_info->id,
|
|
|
'fromtype' => 'crm',
|
|
|
- 'pay_redirect_url' => $default_url.'person',
|
|
|
+ 'pay_redirect_url' => $default_url . 'person',
|
|
|
'limit' => 100,
|
|
|
];
|
|
|
$product_info = ProductService::getProductSingle($activity_info->product_id);
|
|
|
$url = env('CREATE_PAY_URL') . '?' . http_build_query($param);
|
|
|
- $fee = $product_info->price*100+$product_info->given;
|
|
|
- return view('crm.crmActivity', ['url' => $url,'img'=>$img['button'],'fee'=>$fee]);
|
|
|
+ $fee = $product_info->price * 100 + $product_info->given;
|
|
|
+ return view('crm.crmActivity', ['url' => $url, 'img' => $img['button'], 'fee' => $fee]);
|
|
|
}
|
|
|
|
|
|
//端午活动
|
|
|
public function ragonBoatActivity(Request $request)
|
|
|
{
|
|
|
$encode_distribution_channel_id = encodeDistributionChannelId($this->distribution_channel_id);
|
|
|
- $a_id = 1 ;
|
|
|
+ $a_id = 1;
|
|
|
$activity_info = ActivityService::getById($a_id);
|
|
|
- if ($activity_info) {
|
|
|
- $imgs = json_decode($activity_info->setting, 1);
|
|
|
- $from = $request->input('fromtype', 'main');
|
|
|
- $uv_key_format = 'activity:%s:distribution_channel_id:%s:date:%s:uv';
|
|
|
- $pv_key_format = 'activity:%s:distribution_channel_id:%s:pv';
|
|
|
- $uv_key = sprintf($uv_key_format, $activity_info->id, $this->distribution_channel_id, date('Y-m-d'));
|
|
|
- $pv_key = sprintf($pv_key_format, $activity_info->id, $this->distribution_channel_id);
|
|
|
+ if (!$activity_info) {
|
|
|
+ $default_url = env('H5_SCHEME', 'https') . '://site' . $encode_distribution_channel_id . '.' . env('CUSTOM_HOST') . '.com/';
|
|
|
+ return redirect()->to($default_url);
|
|
|
+ }
|
|
|
+ $from = $request->input('fromtype', 'main');
|
|
|
+ $uv_key_format = 'activity:%s:distribution_channel_id:%s:date:%s:uv';
|
|
|
+ $pv_key_format = 'activity:%s:distribution_channel_id:%s:pv';
|
|
|
+ $uv_key = sprintf($uv_key_format, $activity_info->id, $this->distribution_channel_id, date('Y-m-d'));
|
|
|
+ $pv_key = sprintf($pv_key_format, $activity_info->id, $this->distribution_channel_id);
|
|
|
|
|
|
- $redirect_url = env('H5_SCHEME', 'https') . '://site' . $encode_distribution_channel_id . '.' . env('CUSTOM_HOST') . '.com/person';
|
|
|
- if ($request->input('redirect_url')) {
|
|
|
- $redirect_url = $request->input('redirect_url');
|
|
|
- $redirect_url = urldecode($redirect_url);
|
|
|
- }
|
|
|
- //$product_id = $activity_info->product_id;
|
|
|
+ $redirect_url = env('H5_SCHEME', 'https') . '://site' . $encode_distribution_channel_id . '.' . env('CUSTOM_HOST') . '.com/person';
|
|
|
+ if ($request->input('redirect_url')) {
|
|
|
+ $redirect_url = $request->input('redirect_url');
|
|
|
+ $redirect_url = urldecode($redirect_url);
|
|
|
+ }
|
|
|
+ //$product_id = $activity_info->product_id;
|
|
|
+ if (in_array($this->distribution_channel_id, [123, 211, 146, 155, 255, 256, 691, 722, 4364, 4427, 695, 4174, 4025, 4593, 4426, 4889, 4891, 4742, 4053, 4334, 4487, 5611, 6122, 6123, 6124, 8, 5, 160, 4236, 4237, 4241, 273, 148, 266, 202, 271])) {
|
|
|
if (time() > strtotime($activity_info->start_time) && time() < strtotime($activity_info->end_time)) {
|
|
|
Redis::sadd($uv_key, $this->uid);
|
|
|
Redis::hincrby($pv_key, date('Y-m-d'), 1);
|
|
|
- $setting = $activity_info->setting;
|
|
|
- $product_ids = explode(',',$setting);
|
|
|
$url = [];
|
|
|
- foreach ($product_ids as $item){
|
|
|
+ $product_ids = [6172, 6173, 6174];
|
|
|
+ foreach ($product_ids as $item) {
|
|
|
$param = [
|
|
|
'uid' => $this->uid,
|
|
|
'distribution_channel_id' => $this->distribution_channel_id,
|
|
@@ -175,14 +179,23 @@ class ActivityController extends BaseController
|
|
|
];
|
|
|
$url[] = env('CREATE_PAY_URL') . '?' . http_build_query($param);
|
|
|
}
|
|
|
- return view('pay.activity.ragonBoatActivity', ['url' => $url, 'code' => 0]);
|
|
|
- } else if (time() <= strtotime($activity_info->start_time)) {
|
|
|
+ return view('pay.activity.ragonBoatInnerActivity', ['url' => $url, 'code' => 0]);
|
|
|
+ } elseif (time() <= strtotime($activity_info->start_time)) {
|
|
|
+ return view('pay.activity.ragonBoatInnerActivity', ['url' => [], 'code' => 1]);
|
|
|
+ } else {
|
|
|
+ return view('pay.activity.ragonBoatInnerActivity', ['url' => [], 'code' => 2]);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (time() > strtotime($activity_info->start_time) && time() < strtotime($activity_info->end_time)) {
|
|
|
+ Redis::sadd($uv_key, $this->uid);
|
|
|
+ Redis::hincrby($pv_key, date('Y-m-d'), 1);
|
|
|
+ return view('pay.activity.ragonBoatActivity', ['url' => [], 'code' => 0]);
|
|
|
+ } elseif (time() <= strtotime($activity_info->start_time)) {
|
|
|
return view('pay.activity.ragonBoatActivity', ['url' => [], 'code' => 1]);
|
|
|
} else {
|
|
|
return view('pay.activity.ragonBoatActivity', ['url' => [], 'code' => 2]);
|
|
|
}
|
|
|
}
|
|
|
- $default_url = env('H5_SCHEME', 'https') . '://site' . $encode_distribution_channel_id . '.' . env('CUSTOM_HOST') . '.com/';
|
|
|
- return redirect()->to($default_url);
|
|
|
+
|
|
|
}
|
|
|
}
|