activity
This commit is contained in:
parent
f550a4a539
commit
d04ce73cbf
@ -65,23 +65,25 @@ class ActivityController extends Controller
|
||||
$merchant_user = MerchantUser::where('openid', $openid)->first();
|
||||
} else {
|
||||
$merchant_user = MerchantUser::where('id', $request->merchant_user_id)->first();
|
||||
if (empty($merchant_user)) throw new \Exception("未获取到用户信息");
|
||||
if (empty($merchant_user))
|
||||
throw new \Exception("未获取到用户信息");
|
||||
$openid = $merchant_user->openid;
|
||||
}
|
||||
$user_coupon_id = $request->user_coupon_id;
|
||||
$result = CommunityActivity::withTrashed()->where('id', $id)->first();
|
||||
if (!$result) return $this->failure('该活动已下线或不存在');
|
||||
if (!$result)
|
||||
return $this->failure('该活动已下线或不存在');
|
||||
$result->increment('pv', 1);
|
||||
$merchant_user->preview($result);
|
||||
$result->price = floatval($result->price);
|
||||
$banner = LiveBanner::where('class', 'community')->where('class_id', $id)->value('icon');
|
||||
if(!$banner){
|
||||
if (!$banner) {
|
||||
$result->banner = [];
|
||||
}else{
|
||||
} else {
|
||||
$result->banner = json_decode($banner, true);
|
||||
}
|
||||
$result->sku = json_decode($result->sku, true);
|
||||
if ($result->pay_type == 'free'){
|
||||
if ($result->pay_type == 'free') {
|
||||
$result->sku = null;
|
||||
}
|
||||
$token = WangYiYunUser::where('accid', $openid)->value('token');
|
||||
@ -114,8 +116,8 @@ class ActivityController extends Controller
|
||||
$type = '服务';
|
||||
}
|
||||
$url = urlencode($url);
|
||||
$url = env('APP_URL').'/api/official/live/wechat/FamilyAuth?from_openid='.$openid.'&merchant_id='.
|
||||
$request->merchant_id.'&url='.$url;
|
||||
$url = env('APP_URL') . '/api/official/live/wechat/FamilyAuth?from_openid=' . $openid . '&merchant_id=' .
|
||||
$request->merchant_id . '&url=' . $url;
|
||||
// 是否购买过
|
||||
$pay_status = TouristOrder::where('account_id', $request->merchant_user_id)
|
||||
->where('type', 'community')->whereIn('pay_status', [1, 4])
|
||||
@ -139,14 +141,14 @@ class ActivityController extends Controller
|
||||
if ($pay_status) {
|
||||
$is_deadline = 1;
|
||||
$result->order_id = $pay_status->id;
|
||||
$has_write = ReportAnswer::where('m_user_id',$request->merchant_user_id)
|
||||
->where('m_order_id',$pay_status->id)->first();
|
||||
$result->has_write = !empty($has_write) ? 1 : 0 ;
|
||||
$has_write = ReportAnswer::where('m_user_id', $request->merchant_user_id)
|
||||
->where('m_order_id', $pay_status->id)->first();
|
||||
$result->has_write = !empty($has_write) ? 1 : 0;
|
||||
} elseif ($result->apply_deadline && $result->apply_deadline <= $time) {
|
||||
$is_deadline = 2;
|
||||
} elseif ($result->end_time && $result->end_time <= $time) {
|
||||
$is_deadline = 3;
|
||||
}else{
|
||||
} else {
|
||||
$result->has_write = 0;
|
||||
}
|
||||
$result->is_deadline = $is_deadline;
|
||||
@ -162,7 +164,7 @@ class ActivityController extends Controller
|
||||
$user->nickname = ($result->hidden_avatar) ? mb_substr($user->nickname, 0, 1) . '**' : $user->nickname;
|
||||
}
|
||||
$result->pay_user = $users;
|
||||
// $result->member_count = ($result->hidden_order_total) ? '':TouristOrder::where('type', 'community')
|
||||
// $result->member_count = ($result->hidden_order_total) ? '':TouristOrder::where('type', 'community')
|
||||
// ->where('type_id', $id)->whereIn('pay_status', [1,4])
|
||||
// ->get()->count();
|
||||
|
||||
@ -171,7 +173,7 @@ class ActivityController extends Controller
|
||||
foreach ($orders as $order) {
|
||||
if ($order->linkmen) {
|
||||
Log::info($order->linkmen);
|
||||
$link_count = count(json_decode($order->linkmen, true))?:1;
|
||||
$link_count = count(json_decode($order->linkmen, true)) ?: 1;
|
||||
$count += $link_count;
|
||||
}
|
||||
|
||||
@ -179,7 +181,7 @@ class ActivityController extends Controller
|
||||
if ($count == 0) {
|
||||
$count = $orders->count();
|
||||
}
|
||||
$result->member_count = ($result->hidden_order_total == 1)?'': $count;
|
||||
$result->member_count = ($result->hidden_order_total == 1) ? '' : $count;
|
||||
|
||||
$merchant_user = MerchantUser::where('id', $request->merchant_user_id)->first();
|
||||
if (config('app.env') == 'production') {
|
||||
@ -233,7 +235,7 @@ class ActivityController extends Controller
|
||||
$result->is_real_approved = $is_real_approved;
|
||||
$question = ReportQuestion::where('type', 'community')->where('type_id', $request->id)->first();
|
||||
$result->report = !empty($question) ? 1 : 0;
|
||||
$report = MerchantReport::where('type','community')->where('type_id',$request->id)
|
||||
$report = MerchantReport::where('type', 'community')->where('type_id', $request->id)
|
||||
->whereNotNull('commitd_at')->first();
|
||||
//该报告是否设置了填写日期
|
||||
if ($report && !empty($report->commitd_at)) {
|
||||
@ -244,12 +246,12 @@ class ActivityController extends Controller
|
||||
sort($commitd_at);
|
||||
$result->commitd_at = $commitd_at;
|
||||
$merchant = MerchantAccount::find($result->merchant_id);
|
||||
if(!$merchant){
|
||||
if (!$merchant) {
|
||||
return $this->failure('商家不存在');
|
||||
}
|
||||
$result->has_group = $merchant->hasGroup($result) ? 1 : 0;
|
||||
$result->group = $merchant->groupInformation($result);
|
||||
// if ($result->id == 2201) {
|
||||
// if ($result->id == 2201) {
|
||||
// $skus = [];
|
||||
// foreach ($result->sku as $sku) {
|
||||
// if ($sku['sku_id'] != 7) {
|
||||
@ -258,36 +260,36 @@ class ActivityController extends Controller
|
||||
// }
|
||||
// $result->sku = $skus;
|
||||
// }
|
||||
if($user_coupon_id){
|
||||
if ($user_coupon_id) {
|
||||
$result = $result->toArray();
|
||||
$user_coupon = UserCoupon::where('id',$user_coupon_id)->where('status',0)
|
||||
->where('m_id',$request->merchant_id)->where('m_user_id',$merchant_user_id)
|
||||
$user_coupon = UserCoupon::where('id', $user_coupon_id)->where('status', 0)
|
||||
->where('m_id', $request->merchant_id)->where('m_user_id', $merchant_user_id)
|
||||
->first();
|
||||
if(!$user_coupon){
|
||||
if (!$user_coupon) {
|
||||
return $this->failure('用户优惠券不存在');
|
||||
}
|
||||
$coupon = Coupon::where('id',$user_coupon->coupons_id)->where('type_id',$id)->where('type','community')
|
||||
->where('m_id',$request->merchant_id)
|
||||
$coupon = Coupon::where('id', $user_coupon->coupons_id)->where('type_id', $id)->where('type', 'community')
|
||||
->where('m_id', $request->merchant_id)
|
||||
->first();
|
||||
if(!$coupon){
|
||||
if (!$coupon) {
|
||||
return $this->failure('优惠券不存在');
|
||||
}
|
||||
foreach ($result['sku'] as $key => $val){
|
||||
switch($coupon->coupon_type){
|
||||
foreach ($result['sku'] as $key => $val) {
|
||||
switch ($coupon->coupon_type) {
|
||||
case 1:
|
||||
$result['sku'][$key]['discount_amount'] = strval($val['price']);
|
||||
$result['sku'][$key]['charge'] = strval(0.00);
|
||||
break;
|
||||
case 2:
|
||||
$result['sku'][$key]['discount_amount'] = number_format( $val['price'] * (1 - $coupon->discount_rate),2);
|
||||
$result['sku'][$key]['charge']= number_format( $val['price'] - $result['sku'][$key]['discount_amount'],2);
|
||||
$result['sku'][$key]['discount_amount'] = number_format($val['price'] * (1 - $coupon->discount_rate), 2);
|
||||
$result['sku'][$key]['charge'] = number_format($val['price'] - $result['sku'][$key]['discount_amount'], 2);
|
||||
break;
|
||||
case 3:
|
||||
$temp = number_format($val['price'] - $coupon->discount_rate,2);
|
||||
if($temp < 0){
|
||||
$temp = number_format($val['price'] - $coupon->discount_rate, 2);
|
||||
if ($temp < 0) {
|
||||
$result['sku'][$key]['discount_amount'] = strval($val['price']);
|
||||
$result['sku'][$key]['charge'] = strval(0.00);
|
||||
}else{
|
||||
} else {
|
||||
$result['sku'][$key]['discount_amount'] = strval($coupon->discount_rate);
|
||||
$result['sku'][$key]['charge'] = strval($temp);
|
||||
}
|
||||
@ -298,13 +300,13 @@ class ActivityController extends Controller
|
||||
}
|
||||
}
|
||||
//是否含活动照片
|
||||
$result['has_pics'] = ActivityPhoto::where('type', 'activity')->where('type_id', $result['id'])->count()?true:false;
|
||||
$result['has_pics'] = ActivityPhoto::where('type', 'activity')->where('type_id', $result['id'])->count() ? true : false;
|
||||
//是否加入黑名单
|
||||
$result['blacklist'] = MerchantBlacklist::where(['m_id'=>$request->merchant_id, 'user_id'=>$merchant_user->id, 'type'=>'activity'])->first();
|
||||
$result['blacklist'] = MerchantBlacklist::where(['m_id' => $request->merchant_id, 'user_id' => $merchant_user->id, 'type' => 'activity'])->first();
|
||||
//sku报名人数限制
|
||||
$tourist_order = new TouristOrder();
|
||||
$sku = $result['sku'];
|
||||
if($sku){
|
||||
if ($sku) {
|
||||
foreach ($sku as &$item) {
|
||||
$item['sku_buy_num'] = 0;//该规格购买人数
|
||||
$item['can_buy'] = 1;//是否可已购买
|
||||
@ -312,14 +314,14 @@ class ActivityController extends Controller
|
||||
if (!$total_limit_num) {
|
||||
continue;
|
||||
}
|
||||
$item['sku_buy_num'] = $tourist_order->getSkuBuyNum($id,$request->merchant_id,$item['sku_id']);
|
||||
$item['sku_buy_num'] = $tourist_order->getSkuBuyNum($id, $request->merchant_id, $item['sku_id']);
|
||||
$item['can_buy'] = $item['sku_buy_num'] == $total_limit_num ? 0 : 1;
|
||||
}
|
||||
}
|
||||
$result['sku'] = $sku;
|
||||
//记录分享记录
|
||||
if ($request->from_openid && $request->from_openid != $merchant_user->openid) {
|
||||
MEarningShare::create(["user_id"=>$merchant_user->id, "type"=>CommunityActivity::class, 'type_id'=>$request->id, 'from_openid'=>$request->from_openid]);
|
||||
MEarningShare::create(["user_id" => $merchant_user->id, "type" => CommunityActivity::class, 'type_id' => $request->id, 'from_openid' => $request->from_openid]);
|
||||
}
|
||||
return $this->success('ok', $result);
|
||||
} catch (\Exception $e) {
|
||||
@ -442,8 +444,10 @@ class ActivityController extends Controller
|
||||
//是否填写过报告
|
||||
$has_write = ReportAnswer::where('m_user_id', $merchant_user_id)->where('m_order_id', $value->id)->first();
|
||||
$value->has_write = !empty($has_write) ? 1 : 0;
|
||||
if ($com->class == 'one') $value->type = 'activity';
|
||||
if ($com->class == 'many') $value->type = 'service';
|
||||
if ($com->class == 'one')
|
||||
$value->type = 'activity';
|
||||
if ($com->class == 'many')
|
||||
$value->type = 'service';
|
||||
$report = MerchantReport::where('type', 'community')->where('type_id', $com->id)->first();
|
||||
$value->class = !empty($report) ? $report->class : 'one';
|
||||
}
|
||||
@ -470,12 +474,15 @@ class ActivityController extends Controller
|
||||
public function updateOrderLinkmen(Request $request, TouristOrder $order)
|
||||
{
|
||||
$activity = $order->activity;
|
||||
if (empty($activity) || time() > strtotime($activity->end_time)) return $this->failure("活动已结束");
|
||||
if (empty($activity) || time() > strtotime($activity->end_time))
|
||||
return $this->failure("活动已结束");
|
||||
$linkmen = $request->linkmen;
|
||||
if (empty($linkmen)) throw new \Exception("缺少参数linkmen");
|
||||
if (!is_array($linkmen)) throw new \Exception("linkmen数据类型不是数组");
|
||||
if (empty($linkmen))
|
||||
throw new \Exception("缺少参数linkmen");
|
||||
if (!is_array($linkmen))
|
||||
throw new \Exception("linkmen数据类型不是数组");
|
||||
$linkmen = json_encode($linkmen, JSON_UNESCAPED_UNICODE);
|
||||
$order->update(['linkmen'=>$linkmen]);
|
||||
$order->update(['linkmen' => $linkmen]);
|
||||
UpdateOrderLinkmen::dispatch($order->id)->onQueue('love');
|
||||
return $this->success('ok');
|
||||
}
|
||||
@ -494,7 +501,8 @@ class ActivityController extends Controller
|
||||
$class = $request->class ?? 'one';
|
||||
if ($request->merchant_id && $request->merchant_id >= 1) {
|
||||
$Account = MerchantAccount::where('id', $request->merchant_id)->first();
|
||||
if (!$Account) return $this->failure('商户信息有误。');
|
||||
if (!$Account)
|
||||
return $this->failure('商户信息有误。');
|
||||
$id = Anchor::where('m_id', $Account->id)->value('id');
|
||||
} else {
|
||||
$anchor_openid = $request->anchor_openid;
|
||||
@ -520,8 +528,14 @@ class ActivityController extends Controller
|
||||
->where('merchant_services.status', 1)
|
||||
->whereNull('merchant_services.deleted_at');
|
||||
}, null, null, 'left')
|
||||
->select('community_activities.title', 'community_activities.pic', 'community_activities.price',
|
||||
'community_activities.Subtitle', 'community_activities.end_time', 'community_activities.id')
|
||||
->select(
|
||||
'community_activities.title',
|
||||
'community_activities.pic',
|
||||
'community_activities.price',
|
||||
'community_activities.Subtitle',
|
||||
'community_activities.end_time',
|
||||
'community_activities.id'
|
||||
)
|
||||
->with('banners:class_id,icon')
|
||||
->where('community_activities.status', 1)
|
||||
->where('merchant_services.type', 'community')
|
||||
@ -532,12 +546,12 @@ class ActivityController extends Controller
|
||||
->paginate();
|
||||
}
|
||||
$time = date('Y-m-d H:i:s');
|
||||
foreach ($result as $key => $value){
|
||||
foreach ($result as $key => $value) {
|
||||
$group = CollageGroup::where('type', 'community')->where('type_id', $value->id)->where('start_time', '<', $time)
|
||||
->where('end_time', '>', $time)->first();
|
||||
if($group){
|
||||
if ($group) {
|
||||
$value->is_group = 1;
|
||||
}else{
|
||||
} else {
|
||||
$value->is_group = 0;
|
||||
}
|
||||
}
|
||||
@ -554,83 +568,85 @@ class ActivityController extends Controller
|
||||
return $this->success('ok', $photos);
|
||||
}
|
||||
|
||||
public function activityMenu(Request $request){
|
||||
public function activityMenu(Request $request)
|
||||
{
|
||||
try {
|
||||
$activity_id = $request->id;
|
||||
$meeting = ActivityMeeting::where('activity_id',$activity_id)->first();
|
||||
if(!empty($meeting)){
|
||||
$meeting = ActivityMeeting::where('activity_id', $activity_id)->first();
|
||||
if (!empty($meeting)) {
|
||||
$meeting->menu = json_decode($meeting->menu);
|
||||
}
|
||||
return $this->success('ok',$meeting);
|
||||
}catch (\Exception $e){
|
||||
return $this->success('ok', $meeting);
|
||||
} catch (\Exception $e) {
|
||||
return $this->failure($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function activityMeetingApply(Request $request){
|
||||
public function activityMeetingApply(Request $request)
|
||||
{
|
||||
try {
|
||||
$user_id = $request->merchant_user_id;
|
||||
$activity_id = $request->id;
|
||||
$name = $request->name;
|
||||
$mobile = $request->mobile;
|
||||
if(empty($name) || empty($mobile)){
|
||||
if (empty($name) || empty($mobile)) {
|
||||
return $this->failure('姓名和电话不为空');
|
||||
}
|
||||
$is_sing = ActivityMeetingApply::where('activity_id',$activity_id)->where('mobile',$mobile)->exists();
|
||||
if($is_sing){
|
||||
$is_sing = ActivityMeetingApply::where('activity_id', $activity_id)->where('mobile', $mobile)->exists();
|
||||
if ($is_sing) {
|
||||
return $this->failure('您已签到');
|
||||
}
|
||||
$is_apply = CommunityActivityMember::where('activity_id',$activity_id)->where('mobile',$mobile)->first();
|
||||
if(!$is_apply){
|
||||
$is_apply = CommunityActivityMember::where('activity_id', $activity_id)->where('mobile', $mobile)->first();
|
||||
if (!$is_apply) {
|
||||
return $this->failure('暂未报名');
|
||||
}
|
||||
$activity_meeting = ActivityMeeting::where('activity_id',$activity_id)->first();
|
||||
if(empty($activity_meeting)){
|
||||
$activity_meeting = ActivityMeeting::where('activity_id', $activity_id)->first();
|
||||
if (empty($activity_meeting)) {
|
||||
return $this->failure('活动会议不存在');
|
||||
}
|
||||
//初始化桌子
|
||||
$number = $activity_meeting->start_desk;
|
||||
//查看是否已经排桌
|
||||
$apply_desk = ActivityMeetingApply::orderBydesc('desk_number')->limit(1)->first();
|
||||
if(!empty($apply_desk)){
|
||||
if (!empty($apply_desk)) {
|
||||
//查看排桌人数,
|
||||
$apply_desk_user = ActivityMeetingApply::where('desk_number',$apply_desk->desk_number)->count();
|
||||
if($apply_desk_user < $activity_meeting->user_number){
|
||||
$apply_desk_user = ActivityMeetingApply::where('desk_number', $apply_desk->desk_number)->count();
|
||||
if ($apply_desk_user < $activity_meeting->user_number) {
|
||||
$number = $apply_desk->desk_number;
|
||||
}else{
|
||||
$number = $apply_desk->desk_number +1;
|
||||
} else {
|
||||
$number = $apply_desk->desk_number + 1;
|
||||
}
|
||||
}
|
||||
//获取同一个订单用户,同一个订单用户有安排桌子,优先安排到同一桌
|
||||
$order_mobile = CommunityActivityMember::where('order_id',$is_apply->order_id)->pluck('mobile');
|
||||
$order_mobile = CommunityActivityMember::where('order_id', $is_apply->order_id)->pluck('mobile');
|
||||
//查看桌子
|
||||
$user_desks = ActivityMeetingApply::whereIn('mobile',$order_mobile)->pluck('desk_number');
|
||||
if($user_desks){
|
||||
foreach ($user_desks as $user_desk){
|
||||
$desk_count = ActivityMeetingApply::where('desk_number',$user_desk)->count();
|
||||
if($desk_count < $activity_meeting->user_number){
|
||||
$user_desks = ActivityMeetingApply::whereIn('mobile', $order_mobile)->pluck('desk_number');
|
||||
if ($user_desks) {
|
||||
foreach ($user_desks as $user_desk) {
|
||||
$desk_count = ActivityMeetingApply::where('desk_number', $user_desk)->count();
|
||||
if ($desk_count < $activity_meeting->user_number) {
|
||||
$number = $user_desk;
|
||||
break;
|
||||
}
|
||||
if(count($order_mobile) >= 3){
|
||||
if($apply_desk->desk_number){
|
||||
$number = $apply_desk->desk_number+1;
|
||||
}else{
|
||||
$number = $number+1;
|
||||
if (count($order_mobile) >= 3) {
|
||||
if ($apply_desk->desk_number) {
|
||||
$number = $apply_desk->desk_number + 1;
|
||||
} else {
|
||||
$number = $number + 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//如果桌子号大于了最大排桌,往没坐满桌子排
|
||||
if($number >= $activity_meeting->total_desk){
|
||||
if ($number >= $activity_meeting->total_desk) {
|
||||
$number = ActivityMeetingApply::select('desk_number', DB::raw('count(*) as count'))
|
||||
->groupBy('desk_number')
|
||||
->having('count', '<', $activity_meeting->user_number)
|
||||
->orderBy('desk_number', 'asc')
|
||||
->pluck('desk_number');
|
||||
}
|
||||
if($number >= $activity_meeting->total_desk){
|
||||
if ($number >= $activity_meeting->total_desk) {
|
||||
return $this->failure('座位已满,请联系工作人员');
|
||||
}
|
||||
$map = [];
|
||||
@ -642,52 +658,115 @@ class ActivityController extends Controller
|
||||
ActivityMeetingApply::create($map);
|
||||
|
||||
return $this->success('ok');
|
||||
}catch (\Exception $e){
|
||||
} catch (\Exception $e) {
|
||||
return $this->failure($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function meetingMenuDetail(Request $request){
|
||||
public function meetingMenuDetail(Request $request)
|
||||
{
|
||||
try {
|
||||
$name = $request->name;
|
||||
$activity_id = $request->id;
|
||||
$meeting = ActivityMeeting::where('activity_id',$activity_id)->first();
|
||||
if(empty($meeting)){
|
||||
return $this->success('ok',$meeting);
|
||||
$meeting = ActivityMeeting::where('activity_id', $activity_id)->first();
|
||||
if (empty($meeting)) {
|
||||
return $this->success('ok', $meeting);
|
||||
}
|
||||
$menus = json_decode($meeting->menu,true);
|
||||
$menus = json_decode($meeting->menu, true);
|
||||
$images = null;
|
||||
foreach ($menus as $menu){
|
||||
if(!isset($menu['name']) || !isset($menu['images'])){
|
||||
foreach ($menus as $menu) {
|
||||
if (!isset($menu['name']) || !isset($menu['images'])) {
|
||||
continue;
|
||||
}
|
||||
if($menu['name'] != $name){
|
||||
if ($menu['name'] != $name) {
|
||||
continue;
|
||||
}
|
||||
$images = $menu['images'];
|
||||
break;
|
||||
}
|
||||
if($name == "入场签到"){
|
||||
if ($name == "入场签到") {
|
||||
$images = $meeting->sign_images;
|
||||
}
|
||||
return $this->success('ok',$images);
|
||||
}catch (\Exception $e){
|
||||
return $this->success('ok', $images);
|
||||
} catch (\Exception $e) {
|
||||
return $this->failure($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function getMeetingDeskNumber(Request $request){
|
||||
public function getMeetingDeskNumber(Request $request)
|
||||
{
|
||||
try {
|
||||
$mobile = $request->mobile;
|
||||
$activity_id = $request->id;
|
||||
$desk_number = ActivityMeetingApply::where('activity_id',$activity_id)->where('mobile',$mobile)->first();
|
||||
if(empty($desk_number)){
|
||||
$desk_number = ActivityMeetingApply::where('activity_id', $activity_id)->where('mobile', $mobile)->first();
|
||||
if (empty($desk_number)) {
|
||||
return $this->failure('暂未查询到座位');
|
||||
}
|
||||
$desk_number->desk_images = ActivityMeeting::where('activity_id',$activity_id)->value('desk_images');
|
||||
return $this->success('ok',$desk_number);
|
||||
}catch (\Exception $e){
|
||||
$desk_number->desk_images = ActivityMeeting::where('activity_id', $activity_id)->value('desk_images');
|
||||
return $this->success('ok', $desk_number);
|
||||
} catch (\Exception $e) {
|
||||
return $this->failure($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
function getUftxActivities(Request $request)
|
||||
{
|
||||
if (config('app.env') == 'production') {
|
||||
$merchant_id = 44;
|
||||
} else {
|
||||
$merchant_id = 17;
|
||||
}
|
||||
|
||||
$class = "one";
|
||||
$time = date('Y-m-d H:i:s');
|
||||
$account = MerchantAccount::where('id', $merchant_id)->first();
|
||||
if (!$account)
|
||||
return $this->failure('商户信息有误。');
|
||||
$id = Anchor::where('m_id', $account->id)->value('id');
|
||||
|
||||
if (!$id) {
|
||||
// 返回空数组
|
||||
$result = CommunityActivity::where('pay_type', 'array')->paginate();
|
||||
return $this->success('ok', $result);
|
||||
}
|
||||
$merchant_service_ids = MerchantService::where('merchant_id', $merchant_id)->where('type', 'community')->where('status', 1)
|
||||
->pluck('type_id')->toArray();
|
||||
$result = CommunityActivity::whereIn('community_activities.id', $merchant_service_ids)
|
||||
->join('merchant_services', function ($join) use ($class) {
|
||||
$join->on('community_activities.id', '=', 'merchant_services.type_id')
|
||||
->where('community_activities.class', $class)
|
||||
->where('community_activities.type', 'business')
|
||||
->where('merchant_services.status', 1)
|
||||
->whereNull('merchant_services.deleted_at');
|
||||
}, null, null, 'left')
|
||||
->select(
|
||||
'community_activities.title',
|
||||
'community_activities.pic',
|
||||
'community_activities.price',
|
||||
'community_activities.Subtitle',
|
||||
'community_activities.end_time',
|
||||
'community_activities.id'
|
||||
)
|
||||
->with('banners:class_id,icon')
|
||||
->where('community_activities.status', 1)
|
||||
->where('merchant_services.type', 'community')
|
||||
->where("start_time", ">", $time)
|
||||
->where('merchant_services.merchant_id', $request->merchant_id)
|
||||
->orderBy('merchant_services.status', 'desc')
|
||||
->orderBy('merchant_services.is_top', 'desc')
|
||||
->orderBy('merchant_services.top_time', 'desc')
|
||||
->paginate();
|
||||
|
||||
foreach ($result as $key => $value) {
|
||||
$group = CollageGroup::where('type', 'community')->where('type_id', $value->id)->where('start_time', '<', $time)
|
||||
->where('end_time', '>', $time)->first();
|
||||
if ($group) {
|
||||
$value->is_group = 1;
|
||||
} else {
|
||||
$value->is_group = 0;
|
||||
}
|
||||
}
|
||||
return $this->success('ok', $result);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\Server\H5\ActivityController;
|
||||
|
||||
|
||||
|
||||
Route::get('token', 'ShareChannelController@token');
|
||||
@ -11,7 +13,7 @@ Route::get('information_detail', 'InformationController@information_detail');
|
||||
// 评论列表
|
||||
Route::get('information/{comment_id}/comment/list', 'InformationController@commentList');
|
||||
// 点赞列表
|
||||
Route::get('information/likes/{id}','InformationController@likes')->where('id', '[0-9]+');
|
||||
Route::get('information/likes/{id}', 'InformationController@likes')->where('id', '[0-9]+');
|
||||
//服务商平台授权中间件
|
||||
Route::middleware('merchant_user')->group(function () {
|
||||
//---------------------------------动态资讯------------------------
|
||||
@ -24,7 +26,7 @@ Route::middleware('merchant_user')->group(function () {
|
||||
// 删除评论
|
||||
Route::delete('information/delComment', 'InformationController@delComment');
|
||||
// 动态点赞
|
||||
Route::get('information/like/{id}','InformationController@like')->where('id', '[0-9]+');
|
||||
Route::get('information/like/{id}', 'InformationController@like')->where('id', '[0-9]+');
|
||||
|
||||
//资讯打赏
|
||||
Route::any('pay/reward/info/{info_id}', 'OrderController@payReward')->where('info_id', '[0-9]+');
|
||||
@ -33,7 +35,7 @@ Route::middleware('merchant_user')->group(function () {
|
||||
// 获取标签动态
|
||||
Route::get('tag/informations', 'InformationController@tagInformations');
|
||||
|
||||
//--------------------------咨询模块-------------------
|
||||
//--------------------------咨询模块-------------------
|
||||
//商户-咨询列表
|
||||
Route::get('BusinessconsultingService', 'ConsultController@BusinessconsultingService');
|
||||
//商户-咨询详情
|
||||
@ -52,15 +54,15 @@ Route::middleware('merchant_user')->group(function () {
|
||||
//咨询-提交评价
|
||||
Route::post('ConsultationComment', 'ConsultController@SubmitComment');
|
||||
//咨询预约排班
|
||||
Route::get('consult/reservation/scheduling','ConsultController@reservationScheduling');
|
||||
Route::get('consult/reservation/scheduling', 'ConsultController@reservationScheduling');
|
||||
//获取指定日期的预约排班数据
|
||||
Route::get('consult/reservation/scheduling/detail','ConsultController@getSchedulingDetail');
|
||||
Route::get('consult/reservation/scheduling/detail', 'ConsultController@getSchedulingDetail');
|
||||
//设置订单预约时间
|
||||
Route::post('consult/order/change','ConsultController@consultOrderChange');
|
||||
Route::post('consult/order/change', 'ConsultController@consultOrderChange');
|
||||
|
||||
|
||||
|
||||
// --------------------------收益分成-----------------
|
||||
// --------------------------收益分成-----------------
|
||||
//商户-我的收益记录
|
||||
Route::get('communities/MyEarnings', 'EarningController@MyEarnings');
|
||||
//商户:我的收益记录v2
|
||||
@ -80,7 +82,7 @@ Route::middleware('merchant_user')->group(function () {
|
||||
|
||||
|
||||
|
||||
// ------------------------------- 问答测试 --------------------------
|
||||
// ------------------------------- 问答测试 --------------------------
|
||||
//商户-问答测试列表
|
||||
Route::get('communities/QA_test', 'EmoTestController@QA_testList');
|
||||
//商户-问答测试详情
|
||||
@ -92,9 +94,9 @@ Route::middleware('merchant_user')->group(function () {
|
||||
// 商户-我的问答测试详情
|
||||
Route::get('communities/my_QA_test_Detail/{id}', 'EmoTestController@my_QA_test_Detail')->where('id', '[0-9]+');
|
||||
// 商户-我的问答成员
|
||||
Route::get('plat/QA_test/user/{id}','EmoTestController@QA_testUser')->where('id', '[0-9]+');
|
||||
Route::get('plat/QA_test/user/{id}', 'EmoTestController@QA_testUser')->where('id', '[0-9]+');
|
||||
|
||||
// ------------------------------- 直播模块 --------------------------
|
||||
// ------------------------------- 直播模块 --------------------------
|
||||
//直播详情
|
||||
Route::get('live/{id}', 'LiveController@liveDetail')->where('id', '[0-9]+');
|
||||
// 直播列表
|
||||
@ -109,7 +111,7 @@ Route::middleware('merchant_user')->group(function () {
|
||||
Route::post('live/{live_id}/feedback', 'LiveController@submitFeedbacks')->where('live_id', '[0-9]+');
|
||||
|
||||
|
||||
//----------------------------课程模块---------------------
|
||||
//----------------------------课程模块---------------------
|
||||
// 课程列表-商户 1
|
||||
Route::get('course/list/Business', 'CourseController@BusinessCourseList');
|
||||
// 心得评论-商户 1
|
||||
@ -150,7 +152,7 @@ Route::middleware('merchant_user')->group(function () {
|
||||
Route::get('getCouponList', 'CouponController@getCouponList');
|
||||
|
||||
|
||||
// ----------------------------------商城模块------------------------------
|
||||
// ----------------------------------商城模块------------------------------
|
||||
// //商户 购买商城商品
|
||||
Route::post('shops/BusinessPayOrder', 'OrderController@BusinessMerchantShop');
|
||||
Route::get('merchant/shops', 'ShopController@MerchantShops');
|
||||
@ -183,7 +185,7 @@ Route::middleware('merchant_user')->group(function () {
|
||||
//短视频详情
|
||||
Route::get('short/video/{video_id}', 'VideoController@shortVideoDetail');
|
||||
|
||||
//-----------------------------社群活动 服务-----------------------
|
||||
//-----------------------------社群活动 服务-----------------------
|
||||
// 商户社群活动详情 1
|
||||
Route::get('communities/BusinessactivityDetail', 'ActivityController@BusinessactivityDetail');
|
||||
//签到页面活动详情
|
||||
@ -217,7 +219,7 @@ Route::middleware('merchant_user')->group(function () {
|
||||
//邀请的用户列表
|
||||
Route::get('user/invitationUsers', 'UserController@invitationUsers');
|
||||
//联系我们
|
||||
Route::get('connect/us','UserController@connectUs');
|
||||
Route::get('connect/us', 'UserController@connectUs');
|
||||
//老师入驻v1
|
||||
Route::post('RecruitingTeachers', 'UserController@RecruitingTeachers');
|
||||
//服务 订单栏 是否展示
|
||||
@ -271,7 +273,7 @@ Route::middleware('merchant_user')->group(function () {
|
||||
// 用户头像
|
||||
Route::get('friend/photos', 'MakeFriendsController@userPhotos');
|
||||
|
||||
Route::post('merchant/merchantUserBindMobile','UserController@merchantUserBindMobile');
|
||||
Route::post('merchant/merchantUserBindMobile', 'UserController@merchantUserBindMobile');
|
||||
//同步福恋资料
|
||||
Route::post('sync/love/profile', 'MakeFriendsController@syncLoveProfile');
|
||||
//用户资料信息
|
||||
@ -281,9 +283,9 @@ Route::middleware('merchant_user')->group(function () {
|
||||
//福恋用户详情数据
|
||||
Route::get('other/user/{user_id}', 'UserController@otherUser');
|
||||
//联系短信 废弃
|
||||
Route::post('vip/spread_carrier/contactFulinkUserSms','VipController@contactFulinkUserSms');
|
||||
Route::post('vip/spread_carrier/contactFulinkUserSms', 'VipController@contactFulinkUserSms');
|
||||
//联系ta
|
||||
Route::post('vip/spread_carrier/contactFulinkUser','VipController@contactFulinkUser');
|
||||
Route::post('vip/spread_carrier/contactFulinkUser', 'VipController@contactFulinkUser');
|
||||
|
||||
// ----一点零----
|
||||
// 测试列表
|
||||
@ -425,7 +427,7 @@ Route::middleware('merchant_user')->group(function () {
|
||||
//可预约老师时间列表
|
||||
Route::get('appointment/members/{m_id}/times', 'AppointmentController@memberTimeList');
|
||||
|
||||
Route::group(['prefix' => 'health'], function(){
|
||||
Route::group(['prefix' => 'health'], function () {
|
||||
Route::put('base', 'HealthController@saveInfoBase');
|
||||
Route::put('symptom', 'HealthController@saveInfoSymptom');
|
||||
Route::put('check', 'HealthController@saveInfoCheck');
|
||||
@ -457,9 +459,9 @@ Route::middleware('merchant_user')->group(function () {
|
||||
//vip权益领取
|
||||
Route::post('vip/receive/gain', 'VipGainController@receiveGain');
|
||||
//我的vip订单
|
||||
Route::get('vip/myOrderList','VipController@orderList');
|
||||
Route::get('vip/myOrderList', 'VipController@orderList');
|
||||
//获取领福恋小程序VIP短链
|
||||
Route::post('vip/receive/appletShortLink','VipGainController@appletShortLink');
|
||||
Route::post('vip/receive/appletShortLink', 'VipGainController@appletShortLink');
|
||||
|
||||
});
|
||||
|
||||
@ -493,3 +495,5 @@ Route::any('callback/survey/{trade_no}', 'QuestionnaireController@surveyCallback
|
||||
|
||||
Route::post('virtual/activities/{activity}/members', 'SignInController@storeVirtualMembers')->where('activity', '[0-9]+');
|
||||
|
||||
// 友福活动
|
||||
Route::get("uftx/community/activity/list", [ActivityController::class, "getUftxActivities"]);
|
||||
Loading…
Reference in New Issue
Block a user