|
@@ -141,10 +141,11 @@ class ActivityController extends BaseController
|
|
|
return view('crm.crmActivity', ['url' => $url, 'img' => $img['button'], 'fee' => $fee]);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
public function huaweiActivity(Request $request)
|
|
|
{
|
|
|
$encode_distribution_channel_id = encodeDistributionChannelId($this->distribution_channel_id);
|
|
|
- $activity_id = redisEnv('HUAWEI_ACTIVITY_ID',0);
|
|
|
+ $activity_id = redisEnv('HUAWEI_ACTIVITY_ID', 0);
|
|
|
$activity_info = ActivityService::getById($activity_id);
|
|
|
if ($activity_info && isset($activity_info->setting) && empty(!$activity_info->setting)) {
|
|
|
$from = $request->input('fromtype', 'main');
|
|
@@ -162,7 +163,7 @@ class ActivityController extends BaseController
|
|
|
$request_param['display_dialog'] = 'block';
|
|
|
$count_info = DB::table('huaweilottery_user_counts')->where('uid', $this->uid)->select('count')->first();
|
|
|
$count = 0;
|
|
|
- if($count_info && $count_info->count){
|
|
|
+ if ($count_info && $count_info->count) {
|
|
|
$count = $count_info->count;
|
|
|
}
|
|
|
$default_url = env('H5_SCHEME', 'https') . '://site' . $this->en_distribution_channel_id . '.' . env('CUSTOM_HOST') . '.com';
|
|
@@ -173,47 +174,123 @@ class ActivityController extends BaseController
|
|
|
'product_id' => $v,
|
|
|
'activity_id' => $activity_info->id,
|
|
|
'fromtype' => $from,
|
|
|
- 'pay_redirect_url' => $default_url.'/activity/huaweiActivity?'.http_build_query($request_param),
|
|
|
+ 'pay_redirect_url' => $default_url . '/activity/huaweiActivity?' . http_build_query($request_param),
|
|
|
'limit' => 100,
|
|
|
];
|
|
|
$url[] = env('CREATE_PAY_URL') . '?' . http_build_query($param);
|
|
|
}
|
|
|
- return view('pay.activity.huaweiActivity', ['url' => $url, 'code' => 0,'display_dialog'=>$display_dialog,'count'=>$count ,'end_time'=>$activity_info->end_time]);
|
|
|
+ return view('pay.activity.huaweiActivity', ['url' => $url, 'code' => 0, 'display_dialog' => $display_dialog, 'count' => $count, 'end_time' => $activity_info->end_time]);
|
|
|
} else if (time() <= strtotime($activity_info->start_time)) {
|
|
|
- return view('pay.activity.huaweiActivity', ['url' => [], 'code' => 1 ,'display_dialog'=>'none','count'=>0,'end_time'=>$activity_info->end_time]);
|
|
|
+ return view('pay.activity.huaweiActivity', ['url' => [], 'code' => 1, 'display_dialog' => 'none', 'count' => 0, 'end_time' => $activity_info->end_time]);
|
|
|
} else {
|
|
|
- return view('pay.activity.huaweiActivity', ['url' => [], 'code' => 2,'display_dialog'=>'none','count'=>0,'end_time'=>$activity_info->end_time]);
|
|
|
+ return view('pay.activity.huaweiActivity', ['url' => [], 'code' => 2, 'display_dialog' => 'none', 'count' => 0, 'end_time' => $activity_info->end_time]);
|
|
|
}
|
|
|
}
|
|
|
$default_url = env('H5_SCHEME', 'https') . '://site' . $encode_distribution_channel_id . '.' . env('CUSTOM_HOST') . '.com/';
|
|
|
return redirect()->to($default_url);
|
|
|
}
|
|
|
|
|
|
+ //端午活动
|
|
|
+ public function ragonBoatActivity(Request $request)
|
|
|
+ {
|
|
|
+ $encode_distribution_channel_id = encodeDistributionChannelId($this->distribution_channel_id);
|
|
|
+ $default_url = env('H5_SCHEME', 'https') . '://site' . $encode_distribution_channel_id . '.' . env('CUSTOM_HOST') . '.com/';
|
|
|
+ $token = $request->input('token');
|
|
|
+ if (!$token) {
|
|
|
+ return redirect()->to($default_url);
|
|
|
+ }
|
|
|
+ $activity_info = ActivityService::getByToken($token);
|
|
|
+ if (!$activity_info) {
|
|
|
+ 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;
|
|
|
+ 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);
|
|
|
+ $url = [];
|
|
|
+ $product_ids = [6172, 6173, 6174];
|
|
|
+ foreach ($product_ids as $item) {
|
|
|
+ $param = [
|
|
|
+ 'uid' => $this->uid,
|
|
|
+ 'distribution_channel_id' => $this->distribution_channel_id,
|
|
|
+ 'product_id' => $item,
|
|
|
+ 'activity_id' => $activity_info->id,
|
|
|
+ 'fromtype' => $from,
|
|
|
+ 'pay_redirect_url' => $redirect_url,
|
|
|
+ 'limit' => 100,
|
|
|
+ ];
|
|
|
+ $url[] = env('CREATE_PAY_URL') . '?' . http_build_query($param);
|
|
|
+ }
|
|
|
+ return view('pay.activity.ragonBoatInnerActivity', ['url' => $url, 'code' => 0]);
|
|
|
+ } elseif (time() <= strtotime($activity_info->start_time)) {
|
|
|
+ return view('pay.activity.ragonBoatInnerActivity', ['url' => ['javascript:void(0)', 'javascript:void(0)', 'javascript:void(0)'], 'code' => 1]);
|
|
|
+ } else {
|
|
|
+ return view('pay.activity.ragonBoatInnerActivity', ['url' => ['javascript:void(0)', 'javascript:void(0)', 'javascript:void(0)'], '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);
|
|
|
+ $url = [];
|
|
|
+ $product_ids = [6191, 6192];
|
|
|
+ foreach ($product_ids as $item) {
|
|
|
+ $param = [
|
|
|
+ 'uid' => $this->uid,
|
|
|
+ 'distribution_channel_id' => $this->distribution_channel_id,
|
|
|
+ 'product_id' => $item,
|
|
|
+ 'activity_id' => $activity_info->id,
|
|
|
+ 'fromtype' => $from,
|
|
|
+ 'pay_redirect_url' => $redirect_url,
|
|
|
+ 'limit' => 100
|
|
|
+ ];
|
|
|
+ $url[] = env('CREATE_PAY_URL') . '?' . http_build_query($param);
|
|
|
+ }
|
|
|
+ return view('pay.activity.ragonBoatActivity', ['url' => $url, 'code' => 0]);
|
|
|
+ } elseif (time() <= strtotime($activity_info->start_time)) {
|
|
|
+ return view('pay.activity.ragonBoatActivity', ['url' => ['javascript:void(0)', 'javascript:void(0)'], 'code' => 1]);
|
|
|
+ } else {
|
|
|
+ return view('pay.activity.ragonBoatActivity', ['url' => ['javascript:void(0)', 'javascript:void(0)'], 'code' => 2]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function huaweiLotteryView()
|
|
|
{
|
|
|
$count_info = DB::table('huaweilottery_user_counts')->where('uid', $this->uid)->select('count')->first();
|
|
|
$total = DB::table('huaweilottery_record')->sum('price');
|
|
|
- $left_total = 5000000-($total?$total:0);
|
|
|
+ $left_total = 5000000 - ($total ? $total : 0);
|
|
|
$count = 0;
|
|
|
- if($count_info && $count_info->count){
|
|
|
+ if ($count_info && $count_info->count) {
|
|
|
$count = $count_info->count;
|
|
|
}
|
|
|
- $activity_id = redisEnv('HUAWEI_ACTIVITY_ID',0);
|
|
|
+ $activity_id = redisEnv('HUAWEI_ACTIVITY_ID', 0);
|
|
|
|
|
|
$activity_info = ActivityService::getById($activity_id);
|
|
|
\Log::info($activity_info);
|
|
|
- if(!$activity_info){
|
|
|
+ if (!$activity_info) {
|
|
|
$diff = 0;
|
|
|
- }else{
|
|
|
- $diff = strtotime($activity_info->end_time)-time();
|
|
|
- $diff = $diff>0?$diff:0;
|
|
|
+ } else {
|
|
|
+ $diff = strtotime($activity_info->end_time) - time();
|
|
|
+ $diff = $diff > 0 ? $diff : 0;
|
|
|
}
|
|
|
$list = DB::table('huaweilottery_record')
|
|
|
- ->where('uid',$this->uid)
|
|
|
- ->where('price','>',0)
|
|
|
- ->select('created_at','price')
|
|
|
+ ->where('uid', $this->uid)
|
|
|
+ ->where('price', '>', 0)
|
|
|
+ ->select('created_at', 'price')
|
|
|
->get();
|
|
|
- return view('pay.activity.huaweiLottery', ['count' => $count, 'time_diff' => $diff,'list'=>$list,'total'=>$left_total]);
|
|
|
+ return view('pay.activity.huaweiLottery', ['count' => $count, 'time_diff' => $diff, 'list' => $list, 'total' => $left_total]);
|
|
|
}
|
|
|
|
|
|
public function huaweiLottery()
|
|
@@ -226,7 +303,7 @@ class ActivityController extends BaseController
|
|
|
$count = random_int(6, 10);
|
|
|
if ($rest_count <= 0) {
|
|
|
//Log::info('--------------------------');
|
|
|
- return response()->success(['rotate' => 20 + 45 * 2+360*$count]);
|
|
|
+ return response()->success(['rotate' => 20 + 45 * 2 + 360 * $count]);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -266,6 +343,6 @@ class ActivityController extends BaseController
|
|
|
'created_at' => date('Y-m-d H:i:s'),
|
|
|
'updated_at' => date('Y-m-d H:i:s'),
|
|
|
]);
|
|
|
- return response()->success(compact('rotate','price'));
|
|
|
+ return response()->success(compact('rotate', 'price'));
|
|
|
}
|
|
|
}
|