activity
This commit is contained in:
parent
ef6c4c62ea
commit
69a60b156f
@ -101,11 +101,24 @@ class ActivityController extends Controller
|
||||
->where('merchant_services.type', 'community')
|
||||
->whereNull('merchant_services.deleted_at');
|
||||
}, null, null, 'left')
|
||||
->select('community_activities.pic', 'community_activities.title', 'community_activities.price',
|
||||
'community_activities.pv', 'merchant_services.status', 'community_activities.pay_type',
|
||||
'community_activities.reward_status', 'community_activities.created_at', 'merchant_services.is_top',
|
||||
'merchant_services.service_type', 'community_activities.id', 'community_activities.sku', 'community_activities.Subtitle','community_activities.start_time',
|
||||
'community_activities.end_time', 'community_activities.top_time')
|
||||
->select(
|
||||
'community_activities.pic',
|
||||
'community_activities.title',
|
||||
'community_activities.price',
|
||||
'community_activities.pv',
|
||||
'merchant_services.status',
|
||||
'community_activities.pay_type',
|
||||
'community_activities.reward_status',
|
||||
'community_activities.created_at',
|
||||
'merchant_services.is_top',
|
||||
'merchant_services.service_type',
|
||||
'community_activities.id',
|
||||
'community_activities.sku',
|
||||
'community_activities.Subtitle',
|
||||
'community_activities.start_time',
|
||||
'community_activities.end_time',
|
||||
'community_activities.top_time'
|
||||
)
|
||||
->with('banners:class_id,icon');
|
||||
if ($status != 2) {
|
||||
$activities = $activities->where('merchant_services.status', $status);
|
||||
@ -149,7 +162,8 @@ class ActivityController extends Controller
|
||||
$activity->banners->icon = json_decode($activity->banners->icon, true);
|
||||
}
|
||||
}
|
||||
if ($activity->sku && $activity->sku != 'null') $activity->sku = json_decode($activity->sku, true);
|
||||
if ($activity->sku && $activity->sku != 'null')
|
||||
$activity->sku = json_decode($activity->sku, true);
|
||||
$is_deadline = 0;
|
||||
if ($activity->class == 'one' && $activity->apply_deadline) {
|
||||
if ($activity->apply_deadline <= $time) {
|
||||
@ -200,7 +214,8 @@ class ActivityController extends Controller
|
||||
break;
|
||||
}
|
||||
|
||||
if (empty($service)) return $this->success('ok', []);
|
||||
if (empty($service))
|
||||
return $this->success('ok', []);
|
||||
$previews = $service->previews()->where(function ($sql) {
|
||||
$sql->whereHas('merchantUser')->orWhereHas('mpUser');
|
||||
})
|
||||
@ -208,7 +223,8 @@ class ActivityController extends Controller
|
||||
->orderBy('id', 'desc')
|
||||
->paginate();
|
||||
foreach ($previews as $preview) {
|
||||
$preview->user = $preview->merchantUser?:$preview->mpUser;;
|
||||
$preview->user = $preview->merchantUser ?: $preview->mpUser;
|
||||
;
|
||||
$preview->type = ($preview->previewed_type == 'App\\Models\\User') ? 1 : 2;
|
||||
unset($preview->merchantUser, $preview->mpUser);
|
||||
}
|
||||
@ -352,11 +368,13 @@ class ActivityController extends Controller
|
||||
$await_checkoutTextArray = [];
|
||||
$class = $request->class ?? 'one';
|
||||
$anchor = Anchor::where('m_id', $request->account_id)->first();
|
||||
if (!$anchor) return $this->fail('创建失败,请重新登录', 2);
|
||||
if (!$anchor)
|
||||
return $this->fail('创建失败,请重新登录', 2);
|
||||
$forzen_time = $request->forzen_time;
|
||||
$banners = $request->banners;
|
||||
$price = $request->price ? $request->price : 0;
|
||||
if (!is_numeric($price) || $price < 0) return $this->failure('请输入正确的价格');
|
||||
if (!is_numeric($price) || $price < 0)
|
||||
return $this->failure('请输入正确的价格');
|
||||
$await_checkoutTextArray[] = $price;
|
||||
$title = $request->title;
|
||||
$await_checkoutTextArray[] = $title;
|
||||
@ -368,13 +386,17 @@ class ActivityController extends Controller
|
||||
$agree_title = $request->agree_title;
|
||||
$agree_content = $request->agree_content;
|
||||
$share_thumb = $request->share_thumb;
|
||||
$sponsor = $request->sponsor;
|
||||
if ($class == 'one') {
|
||||
$start_time = $request->start_time;
|
||||
if (empty($start_time)) return $this->failure('请填写活动开始时间');
|
||||
if (empty($start_time))
|
||||
return $this->failure('请填写活动开始时间');
|
||||
$end_time = $request->end_time;
|
||||
if (empty($end_time)) return $this->failure('请填写活动结束时间');
|
||||
if (empty($end_time))
|
||||
return $this->failure('请填写活动结束时间');
|
||||
$apply_deadline = $request->apply_deadline;
|
||||
if (empty($apply_deadline)) return $this->failure('请填写活动截止报名时间');
|
||||
if (empty($apply_deadline))
|
||||
return $this->failure('请填写活动截止报名时间');
|
||||
}
|
||||
// $sku = null;
|
||||
// if ($request->has('sku') && $request->sku)
|
||||
@ -436,6 +458,7 @@ class ActivityController extends Controller
|
||||
$consulator->hidden_avatar = $hidden_avatar;
|
||||
$consulator->hidden_order_total = $hidden_order_total;
|
||||
$consulator->join_type = $join_type;
|
||||
$consulator->sponsor = $sponsor;
|
||||
DB::beginTransaction();
|
||||
// if($consulator->class=='one'){
|
||||
// // 创建聊天室
|
||||
@ -519,7 +542,8 @@ class ActivityController extends Controller
|
||||
$qr_code->save();
|
||||
$temp_url = urlencode(env('APP_URL') . '/pu/#/activitySignIn/' . $consulator->id);
|
||||
$jump_url = env('APP_URL') . '/api/official/live/wechat/FamilyAuth?merchant_id=' . $request->account_id .
|
||||
'&qr_code_id=' . $qr_code->id . '&url=' . $temp_url;;
|
||||
'&qr_code_id=' . $qr_code->id . '&url=' . $temp_url;
|
||||
;
|
||||
$image_url = $this->getPreviewQrcode($jump_url);
|
||||
$qr_code->jump_url = $jump_url;
|
||||
$qr_code->url = $image_url;
|
||||
@ -527,8 +551,10 @@ class ActivityController extends Controller
|
||||
}
|
||||
DB::commit();
|
||||
//保存后删除缓存草稿箱内容
|
||||
if (Cache::has('drafts_activity_merchant_id_' . $request->account_id) && $request->class == 'one') Cache::forget('drafts_activity_merchant_id_' . $request->account_id);
|
||||
if (Cache::has('drafts_service_merchant_id_' . $request->account_id) && $request->class == 'many') Cache::forget('drafts_service_merchant_id_' . $request->account_id);
|
||||
if (Cache::has('drafts_activity_merchant_id_' . $request->account_id) && $request->class == 'one')
|
||||
Cache::forget('drafts_activity_merchant_id_' . $request->account_id);
|
||||
if (Cache::has('drafts_service_merchant_id_' . $request->account_id) && $request->class == 'many')
|
||||
Cache::forget('drafts_service_merchant_id_' . $request->account_id);
|
||||
return $this->success('ok', ['id' => $consulator->id]);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
@ -627,7 +653,8 @@ class ActivityController extends Controller
|
||||
}
|
||||
$await_checkoutTextArray = [];
|
||||
$price = $request->input('price', 0);
|
||||
if (!is_numeric($price) || $price < 0) return $this->failure('请输入正确价格');
|
||||
if (!is_numeric($price) || $price < 0)
|
||||
return $this->failure('请输入正确价格');
|
||||
if (is_numeric($request->price) && $request->price != $consulator->price) {
|
||||
$consulator->price = $request->price;
|
||||
$await_checkoutTextArray[] = $request->price;
|
||||
@ -666,7 +693,8 @@ class ActivityController extends Controller
|
||||
}
|
||||
if ($request->has('report')) {
|
||||
$consulator->report = json_encode($request->report);
|
||||
if(empty($request->report)) $consulator->report = null;
|
||||
if (empty($request->report))
|
||||
$consulator->report = null;
|
||||
}
|
||||
//是否展示报名人头像
|
||||
if ($request->has('hidden_avatar')) {
|
||||
@ -703,6 +731,9 @@ class ActivityController extends Controller
|
||||
if ($request->has('reward_status')) {
|
||||
$consulator->reward_status = $request->reward_status;
|
||||
}
|
||||
if ($request->has("sponsor")) {
|
||||
$consulator->sponsor = $request->sponsor;
|
||||
}
|
||||
if ($request->has('ratio') && $request->ratio >= 0) {
|
||||
if ($request->ratio > 1.0) {
|
||||
return $this->failure('利润分成不可以大于100%');
|
||||
@ -821,7 +852,8 @@ class ActivityController extends Controller
|
||||
$new_sku[$key]['sku_id'] = $s['sku_id'];
|
||||
$new_sku[$key]['name'] = $s['name'];
|
||||
$new_sku[$key]['price'] = $s['price'];
|
||||
if ($consulator->class == 'one') $new_sku[$key]['num'] = $s['num'];
|
||||
if ($consulator->class == 'one')
|
||||
$new_sku[$key]['num'] = $s['num'];
|
||||
$new_sku[$key]['discount_price'] = !empty($group_sku[$key]['discount_price']) ? $group_sku[$key]['discount_price'] : $s['price'];
|
||||
//if($new_sku[$key]['discount_price'] > $new_sku[$key]['price']) return $this->failure('拼团优惠价不能大于原始价格');
|
||||
}
|
||||
@ -839,7 +871,8 @@ class ActivityController extends Controller
|
||||
}
|
||||
|
||||
//用户提交报告列表
|
||||
public function userReports(Request $request){
|
||||
public function userReports(Request $request)
|
||||
{
|
||||
try {
|
||||
$id = $request->id;
|
||||
$keyword = trim($request->keyword);
|
||||
@ -958,7 +991,8 @@ class ActivityController extends Controller
|
||||
$time = date('Y-m-d H:i:s');
|
||||
$is_deadline = 0;
|
||||
if ($activity->class == 'one' && $activity->apply_deadline) {
|
||||
if ($activity->apply_deadline <= $time) $is_deadline = 1;
|
||||
if ($activity->apply_deadline <= $time)
|
||||
$is_deadline = 1;
|
||||
}
|
||||
$activity->is_deadline = $is_deadline;
|
||||
$sign_qr_codes = QrCode::where('merchant_id', $request->account_id)
|
||||
@ -1033,9 +1067,11 @@ class ActivityController extends Controller
|
||||
if ($activity->merchant_id != $merchant_id) {
|
||||
$service_type = 1;
|
||||
}
|
||||
$members = TouristOrder::with('merUser', 'alliance', 'merchant:id,share_icon,share_title','orderStatusLink:id,order_id,status', 'mEarning:id,m_user_id,m_order_id,sharer,ratio,sub_ratio,value', 'mAdvanceEarning:id,m_user_id,m_order_id,sharer,ratio,sub_ratio,value', 'mEarning.user:id,pic,nickname,mobile', 'mAdvanceEarning.user:id,pic,nickname,mobile')->withCount(['blacklist'=>function($sql) {
|
||||
$members = TouristOrder::with('merUser', 'alliance', 'merchant:id,share_icon,share_title', 'orderStatusLink:id,order_id,status', 'mEarning:id,m_user_id,m_order_id,sharer,ratio,sub_ratio,value', 'mAdvanceEarning:id,m_user_id,m_order_id,sharer,ratio,sub_ratio,value', 'mEarning.user:id,pic,nickname,mobile', 'mAdvanceEarning.user:id,pic,nickname,mobile')->withCount([
|
||||
'blacklist' => function ($sql) {
|
||||
$sql->where('type', 'activity');
|
||||
}])
|
||||
}
|
||||
])
|
||||
->where('type', 'community')
|
||||
->where('type_id', $consulator_id)
|
||||
->orderBy('id', 'desc');
|
||||
@ -1137,13 +1173,14 @@ class ActivityController extends Controller
|
||||
{
|
||||
try {
|
||||
$code = $request->input('code');
|
||||
if (empty($code)) throw new \Exception('缺少参数code');
|
||||
if (empty($code))
|
||||
throw new \Exception('缺少参数code');
|
||||
$value = Redis::get('activity:' . $activity_id . ':members:export:code');
|
||||
if ($code != $value) throw new \Exception('code失效');
|
||||
if ($code != $value)
|
||||
throw new \Exception('code失效');
|
||||
$orders = TouristOrder::with('user:id,openid,user_id', 'user.user:id,name,sex,card_num,is_real_approved', 'tcfaceid:openid,name,card_num,is_real_approved')->where('type', 'community')->where('type_id', $activity_id)->where('pay_status', '!=', 0)->select('id', 'open_id', 'name', 'mobile', 'account_id', 'insurance_info', 'linkmen')->get();
|
||||
$data = [];
|
||||
foreach ($orders as $key => $order)
|
||||
{
|
||||
foreach ($orders as $key => $order) {
|
||||
$real_name = '';
|
||||
if ($order->user && $order->user->user) {
|
||||
$mp_user = $order->user->user;
|
||||
@ -1216,7 +1253,8 @@ class ActivityController extends Controller
|
||||
{
|
||||
try {
|
||||
$order = TouristOrder::find($id);
|
||||
if (!$order) return $this->failure('要删除的id不存在');
|
||||
if (!$order)
|
||||
return $this->failure('要删除的id不存在');
|
||||
$order->delete();
|
||||
return $this->success('ok');
|
||||
} catch (\Exception $e) {
|
||||
@ -1235,12 +1273,33 @@ class ActivityController extends Controller
|
||||
{
|
||||
try {
|
||||
$serve_tab = $request->serve_tab;
|
||||
$activity = CommunityActivity::withTrashed()->where('id', $id)->select('id', 'merchant_id', 'title', 'price'
|
||||
, 'pv', 'pic', 'start_time', 'end_time', 'apply_deadline', 'describe', 'sku', 'Subtitle', 'status',
|
||||
'class', 'deleted_at',"location_longitude","location_latitude","address","location")->first();
|
||||
$activity = CommunityActivity::withTrashed()->where('id', $id)->select(
|
||||
'id',
|
||||
'merchant_id',
|
||||
'title',
|
||||
'price'
|
||||
,
|
||||
'pv',
|
||||
'pic',
|
||||
'start_time',
|
||||
'end_time',
|
||||
'apply_deadline',
|
||||
'describe',
|
||||
'sku',
|
||||
'Subtitle',
|
||||
'status',
|
||||
'class',
|
||||
'deleted_at',
|
||||
"location_longitude",
|
||||
"location_latitude",
|
||||
"address",
|
||||
"location"
|
||||
)->first();
|
||||
$openid = MerchantAccount::where('id', $activity->merchant_id)->value('openid');
|
||||
if (!$openid) $openid = Anchor::where('m_id', $activity->merchant_id)->value('openid');
|
||||
if (empty($activity)) return $this->failure('该服务不存在');
|
||||
if (!$openid)
|
||||
$openid = Anchor::where('m_id', $activity->merchant_id)->value('openid');
|
||||
if (empty($activity))
|
||||
return $this->failure('该服务不存在');
|
||||
$banner = LiveBanner::where('class', 'community')->where('class_id', $id)->value('icon');
|
||||
//消费人数
|
||||
$consume_user_count = TouristOrder::where('type', 'community')->where('type_id', $id)->whereIn('pay_status', [1, 4])->groupBy('open_id')->get()->count();
|
||||
@ -1290,7 +1349,8 @@ class ActivityController extends Controller
|
||||
// MEarning::where('m_order_id',$value->id)->pluck
|
||||
foreach ($orders as $key => $order) {
|
||||
$avatar[$key] = MerchantUser::where('id', $order->account_id)->value('pic') ?? User::DefaultAvatar;
|
||||
if (empty($avatar[$key])) $avatar[$key] = User::DefaultAvatar;
|
||||
if (empty($avatar[$key]))
|
||||
$avatar[$key] = User::DefaultAvatar;
|
||||
}
|
||||
$activity->avatar = $avatar;
|
||||
//下架或删除状态 0下架 1正常上架 2已删除
|
||||
@ -1360,7 +1420,8 @@ class ActivityController extends Controller
|
||||
$order->text = $order->created_at . '购买了《' . $goods . '》';
|
||||
|
||||
$order->name = $order->merUser ? $order->merUser->nickname : '匿名用户';
|
||||
if (empty($order['pic'])) $order['pic'] = User::DefaultAvatar;
|
||||
if (empty($order['pic']))
|
||||
$order['pic'] = User::DefaultAvatar;
|
||||
}
|
||||
return $this->success('ok', $orders);
|
||||
} catch (\Exception $e) {
|
||||
@ -1407,19 +1468,22 @@ class ActivityController extends Controller
|
||||
$order->pay_price = $order->price;
|
||||
$order->pay_mobile = $order->mobile ?? '';
|
||||
$order->pay_pic = $payUser['pic'] ?? User::DefaultAvatar;
|
||||
if (empty($order->pay_pic)) $order->pay_pic = User::DefaultAvatar;
|
||||
if (empty($order->pay_pic))
|
||||
$order->pay_pic = User::DefaultAvatar;
|
||||
foreach ($order->mEarning as $k => $value) {
|
||||
$list[$k]['type'] = $value->sharer;
|
||||
$list[$k]['value'] = $value->value;
|
||||
if ($value->user) {
|
||||
$list[$k]['name'] = $value->user ? $value->user->nickname : '匿名用户';
|
||||
$list[$k]['pic'] = $value->user ? $value->user['pic'] : User::DefaultAvatar;
|
||||
if (empty($list[$k]['pic'])) $list[$k]['pic'] = User::DefaultAvatar;
|
||||
if (empty($list[$k]['pic']))
|
||||
$list[$k]['pic'] = User::DefaultAvatar;
|
||||
} else {
|
||||
$user = MerchantAccount::where('id', $merchant_id)->first();
|
||||
$list[$k]['name'] = $user->anchor->name ?? '匿名用户';
|
||||
$list[$k]['pic'] = $user->anchor['pic'] ?? User::DefaultAvatar;
|
||||
if (empty($list[$k]['pic'])) $list[$k]['pic'] = User::DefaultAvatar;
|
||||
if (empty($list[$k]['pic']))
|
||||
$list[$k]['pic'] = User::DefaultAvatar;
|
||||
}
|
||||
|
||||
unset($order->mEarning);
|
||||
@ -1525,7 +1589,8 @@ class ActivityController extends Controller
|
||||
$qr_code->save();
|
||||
$temp_url = urlencode(env('APP_URL') . '/pu/#/activitySignIn/' . $id);
|
||||
$jump_url = env('APP_URL') . '/api/official/live/wechat/FamilyAuth?merchant_id=' .
|
||||
$merchant_id . '&qr_code_id=' . $qr_code->id . '&url=' . $temp_url;;
|
||||
$merchant_id . '&qr_code_id=' . $qr_code->id . '&url=' . $temp_url;
|
||||
;
|
||||
$image_url = $this->getPreviewQrcode($jump_url);
|
||||
$qr_code->jump_url = $jump_url;
|
||||
$qr_code->url = $image_url;
|
||||
@ -1583,17 +1648,21 @@ class ActivityController extends Controller
|
||||
if (!empty($val['性别'])) {
|
||||
if ($val['性别'] == '男') {
|
||||
Log::info($val);
|
||||
if ($val['常居地'] == '未设置' || $val['常居地'] == '未提供' || $val['婚姻状态'] == '未设置' ||
|
||||
if (
|
||||
$val['常居地'] == '未设置' || $val['常居地'] == '未提供' || $val['婚姻状态'] == '未设置' ||
|
||||
$val['婚姻状态'] == '未提供' || $val['年龄'] == '未提供' || $val['年龄'] == '未设置' ||
|
||||
$val['常居地'] == '未设置-未设置' || $val['生日'] == '未设置' || $val['真实姓名'] == '未设置') {
|
||||
$val['常居地'] == '未设置-未设置' || $val['生日'] == '未设置' || $val['真实姓名'] == '未设置'
|
||||
) {
|
||||
$type['unknown'][] = $val;
|
||||
} else {
|
||||
$type['man'][] = $val;
|
||||
}
|
||||
} elseif ($val['性别'] == '女') {
|
||||
if ($val['常居地'] == '未设置' || $val['常居地'] == '未提供' || $val['婚姻状态'] == '未设置' ||
|
||||
if (
|
||||
$val['常居地'] == '未设置' || $val['常居地'] == '未提供' || $val['婚姻状态'] == '未设置' ||
|
||||
$val['婚姻状态'] == '未提供' || $val['年龄'] == '未提供' || $val['年龄'] == '未设置' ||
|
||||
$val['常居地'] == '未设置-未设置' || $val['生日'] == '未设置' || $val['真实姓名'] == '未设置') {
|
||||
$val['常居地'] == '未设置-未设置' || $val['生日'] == '未设置' || $val['真实姓名'] == '未设置'
|
||||
) {
|
||||
$type['unknown'][] = $val;
|
||||
} else {
|
||||
$type['women'][] = $val;
|
||||
@ -1618,12 +1687,15 @@ class ActivityController extends Controller
|
||||
{
|
||||
try {
|
||||
$activity_id = $request->activity_id;
|
||||
if(empty($activity_id)) return $this->failure('活动id不能为空');
|
||||
if (empty($activity_id))
|
||||
return $this->failure('活动id不能为空');
|
||||
$activity = CommunityActivity::find($activity_id);
|
||||
$merchant_id = $request->merchant_id;
|
||||
if(empty($merchant_id)) return $this->failure('商家id不能为空');
|
||||
if (empty($merchant_id))
|
||||
return $this->failure('商家id不能为空');
|
||||
$user_id = $request->user_id;
|
||||
if(empty($user_id)) return $this->failure('用户id不能为空');
|
||||
if (empty($user_id))
|
||||
return $this->failure('用户id不能为空');
|
||||
$user = User::select('nickname', 'mobile', 'photo')->where('id', $user_id)->first();
|
||||
$merchnat_user = MerchantUser::where('user_id', $user_id)->first();
|
||||
$order = new TouristOrder();
|
||||
@ -1769,8 +1841,13 @@ class ActivityController extends Controller
|
||||
*/
|
||||
private function getOrder($community_ids, $keyword, $nopage, $account, $request, $market_service_ids)
|
||||
{
|
||||
$orders = TouristOrder::with('viewer:avatar,mobile,openid,sex,nickname', 'merchant:id,share_icon,share_title',
|
||||
'fromUser:user_id as id,avatar,mobile,openid,sex,nickname', 'merUser', 'alliance')->withCount('follow');
|
||||
$orders = TouristOrder::with(
|
||||
'viewer:avatar,mobile,openid,sex,nickname',
|
||||
'merchant:id,share_icon,share_title',
|
||||
'fromUser:user_id as id,avatar,mobile,openid,sex,nickname',
|
||||
'merUser',
|
||||
'alliance'
|
||||
)->withCount('follow');
|
||||
$orders = $orders->where('type', 'community')
|
||||
->where(function ($query) use ($community_ids, $market_service_ids, $account) {
|
||||
$query->whereIn('type_id', $community_ids);
|
||||
@ -1815,8 +1892,10 @@ class ActivityController extends Controller
|
||||
}
|
||||
}
|
||||
if ($request->account_id == 491) {
|
||||
if (strstr($order->desc, '牵线') !== false || strstr($order->desc, '盲盒') !== false &&
|
||||
($order->pay_status == 1 || $order->pay_status == 4)) {
|
||||
if (
|
||||
strstr($order->desc, '牵线') !== false || strstr($order->desc, '盲盒') !== false &&
|
||||
($order->pay_status == 1 || $order->pay_status == 4)
|
||||
) {
|
||||
$order->show_match_user_button = 1;
|
||||
} else {
|
||||
$order->show_match_user_button = 0;
|
||||
@ -1906,7 +1985,8 @@ class ActivityController extends Controller
|
||||
} elseif ($order->viewer && $order->viewer['nickname']) {
|
||||
$user_info['nickname'] = $order->viewer['nickname'];
|
||||
} else {
|
||||
$user_info['nickname'] = '未获取';;
|
||||
$user_info['nickname'] = '未获取';
|
||||
;
|
||||
}
|
||||
$order->merchant_user = $user_info;
|
||||
}
|
||||
@ -1964,7 +2044,8 @@ class ActivityController extends Controller
|
||||
if ($account->pay_income >= 1)
|
||||
$order->pay_income = ($order->price * $account->pay_income) / 100;
|
||||
// $can_withdraw_total = $can_withdraw_total+$order->can_withdraw_count;
|
||||
if (!empty($order->remark) && $order->remark != 'null') $order->remark = json_decode($order->remark, true);
|
||||
if (!empty($order->remark) && $order->remark != 'null')
|
||||
$order->remark = json_decode($order->remark, true);
|
||||
$fol = MOrderFollow::where('order_id', $order->id)->where('result', '订单状态修改')->first();
|
||||
if ($fol) {
|
||||
$is_start = $fol->is_start;
|
||||
@ -1987,7 +2068,8 @@ class ActivityController extends Controller
|
||||
$max_price = 0;
|
||||
$has_refund = 0;
|
||||
$order = Order::where('trade_no', $trade_no)->first();
|
||||
if (!$order || $order->pay_status == 0 || $order->pay_status == 3) return 0;
|
||||
if (!$order || $order->pay_status == 0 || $order->pay_status == 3)
|
||||
return 0;
|
||||
if ($order->pay_status == 4) { //收益已到账 退商家收益
|
||||
//生成收益时间
|
||||
$created_at = MEarning::where('m_order_id', $order->id)->value('created_at');
|
||||
@ -2001,7 +2083,8 @@ class ActivityController extends Controller
|
||||
$has_refund = MRefundOrder::where('trade_no', $trade_no)->where('is_hook', 1)->sum('refund_fee');
|
||||
$max_price = $order->price - $has_refund;
|
||||
}
|
||||
if ($max_price < 0) return 0;
|
||||
if ($max_price < 0)
|
||||
return 0;
|
||||
return $max_price;
|
||||
} catch (\Exception $e) {
|
||||
$this->getError($e);
|
||||
@ -2315,8 +2398,19 @@ class ActivityController extends Controller
|
||||
{
|
||||
try {
|
||||
$degree = [
|
||||
'其他' => 0, '小学' => 1, '初中' => 2, '初中及初中以下' => 2, '中专' => 4, '高中' => 4,
|
||||
'高中/中专' => 4, '大专' => 5, '专科' => 5, '本科' => 6, '硕士' => 7,'硕士以上' => 7, '博士' => 8,
|
||||
'其他' => 0,
|
||||
'小学' => 1,
|
||||
'初中' => 2,
|
||||
'初中及初中以下' => 2,
|
||||
'中专' => 4,
|
||||
'高中' => 4,
|
||||
'高中/中专' => 4,
|
||||
'大专' => 5,
|
||||
'专科' => 5,
|
||||
'本科' => 6,
|
||||
'硕士' => 7,
|
||||
'硕士以上' => 7,
|
||||
'博士' => 8,
|
||||
];
|
||||
$trade_no = $request->trade_no;
|
||||
$merchant_id = $request->account_id;
|
||||
@ -2543,7 +2637,8 @@ class ActivityController extends Controller
|
||||
* 匹配后给被匹配用户发通知
|
||||
* @param Request $request
|
||||
*/
|
||||
public function sendTemplateMessageToMatchUser(Request $request){
|
||||
public function sendTemplateMessageToMatchUser(Request $request)
|
||||
{
|
||||
try {
|
||||
$merchant_id = $request->account_id;
|
||||
$receive_user_id = $request->receive_user_id;
|
||||
@ -2630,7 +2725,8 @@ class ActivityController extends Controller
|
||||
* @param Request $request
|
||||
* @return JsonResponse|string
|
||||
*/
|
||||
public function getNoMatchUser(Request $request){
|
||||
public function getNoMatchUser(Request $request)
|
||||
{
|
||||
try {
|
||||
$user_id = $request->user_id;
|
||||
$no_match_user = json_decode(Redis::get('no_match_user_' . $user_id), true);
|
||||
@ -2654,7 +2750,8 @@ class ActivityController extends Controller
|
||||
* @param Request $request
|
||||
* @return JsonResponse|string
|
||||
*/
|
||||
public function updateNoMatchUser(Request $request){
|
||||
public function updateNoMatchUser(Request $request)
|
||||
{
|
||||
try {
|
||||
$user_id = $request->user_id;
|
||||
$no_match_user_list = $request->no_match_user_list;
|
||||
@ -2677,7 +2774,8 @@ class ActivityController extends Controller
|
||||
/**
|
||||
* 生成签到码
|
||||
*/
|
||||
public function makeSignQrcode(Request $request){
|
||||
public function makeSignQrcode(Request $request)
|
||||
{
|
||||
|
||||
$lists = CommunityActivity::where('status', 1)->where('class', 'one')->get();
|
||||
foreach ($lists as $key => $val) {
|
||||
@ -2694,7 +2792,8 @@ class ActivityController extends Controller
|
||||
$qr_code->save();
|
||||
$temp_url = urlencode(env('APP_URL') . '/pu/#/activitySignIn/' . $val->id);
|
||||
$jump_url = env('APP_URL') . '/api/official/live/wechat/FamilyAuth?merchant_id=' .
|
||||
$val->merchant_id . '&qr_code_id=' . $qr_code->id . '&url=' . $temp_url;;
|
||||
$val->merchant_id . '&qr_code_id=' . $qr_code->id . '&url=' . $temp_url;
|
||||
;
|
||||
$image_url = $this->getPreviewQrcode($jump_url);
|
||||
$qr_code->jump_url = $jump_url;
|
||||
$qr_code->url = $image_url;
|
||||
@ -2704,13 +2803,15 @@ class ActivityController extends Controller
|
||||
return $this->success('ok');
|
||||
}
|
||||
|
||||
public function activityPhotos(Request $request, $id) {
|
||||
public function activityPhotos(Request $request, $id)
|
||||
{
|
||||
$type = 'activity';
|
||||
$photos = ActivityPhoto::where('type', $type)->where('type_id', $id)->orderByDesc('id')->paginate();
|
||||
return $this->success('ok', $photos);
|
||||
}
|
||||
|
||||
public function storeActvityPhotos(Request $request, $id) {
|
||||
public function storeActvityPhotos(Request $request, $id)
|
||||
{
|
||||
$pics = $request->input('pics');
|
||||
$data = [];
|
||||
foreach ($pics as $pic) {
|
||||
@ -2734,7 +2835,8 @@ class ActivityController extends Controller
|
||||
return $this->success('ok');
|
||||
}
|
||||
|
||||
public function addActivityMenu(Request $request){
|
||||
public function addActivityMenu(Request $request)
|
||||
{
|
||||
try {
|
||||
$activity_id = $request->id;
|
||||
$activity = CommunityActivity::where('id', $activity_id)->first();
|
||||
@ -2793,7 +2895,8 @@ class ActivityController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function getActivityMenu(Request $request){
|
||||
public function getActivityMenu(Request $request)
|
||||
{
|
||||
try {
|
||||
$activity_id = $request->id;
|
||||
$meeting = ActivityMeeting::where('activity_id', $activity_id)->first();
|
||||
@ -2814,7 +2917,8 @@ class ActivityController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function getMeetingApplyUser(Request $request){
|
||||
public function getMeetingApplyUser(Request $request)
|
||||
{
|
||||
try {
|
||||
$activity_id = $request->id;
|
||||
$keyword = $request->keyword;
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class TableCommunityActivitySponsor extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ufutx_community_activities', function (Blueprint $table) {
|
||||
$table->string("sponsor", 191)->nullable()->comment("举办方")->after("class");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ufutx_community_activities', function (Blueprint $table) {
|
||||
$table->dropColumn("sponsor");
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user