PHP婚恋小程序开发源码支持微信+公众号+APP

随着社会的发展和人们生活节奏的加快,传统的相亲方式已经不能满足现代人的需求。在此背景下,有人想到通过线上小程序的方式来满足更多的人进行相亲,所以在此情况下,婚恋相亲小程序由此出现。婚恋相亲小程序的功能有会员功能,红娘管理,后台系统,支付系统,动态管理,通知管理,私人定制管理等等。

在这么多的功能中,今天选择红娘管理给大家做下详细介绍:

联系TA记录:查看A联系B的记录,需要显示联系人方的ID与手机号,联系人发送的被联系人方的ID与手机号,点击按钮的时间,负责的星座红娘。可以按照红娘或时间段筛选

我的联系方式记录:查看联系的红娘,联系人ID,手机号,发送的手机号与微信号

牵线记录:查看A牵线B的记录,需要显示牵线人的ID与手机号,被牵线人的ID与手机号,点击牵线的时间,负责的星座红娘,可以按照红娘或时间段筛选

会员管理:会员管理所有功能

婚恋相亲小程序开发部分源码分享:

<?phpnamespace app\api\controller;use addons\epay\library\Service;
use app\common\controller\Api;
use app\common\model\Activity;
use app\common\model\AppConfig;
use app\common\model\AppUser;
use app\common\model\ChatRoom;
use app\common\model\FlyerOrder;
use app\common\model\Icon;
use app\common\model\Notice;
use app\common\model\OrderActivity;
use app\common\model\SayCommonRule;
use app\common\model\SayLog;
use app\common\model\SayOrder;
use app\common\model\SayPackage;
use app\common\model\User;
use app\common\model\UserWall as UserWallModel;
use app\common\model\VipExperience;
use app\common\model\VipOrder;
use app\common\model\VipPackage;
use im\Ffs;
use im\Im;
use subscribeMsg\SubscribeMsg;
use think\cache\driver\Redis;
use think\Db;
use think\Env;
use think\Exception;
use think\Log;/*** 首页接口*/
class Index extends Api
{protected $noNeedLogin = ['getUserToken','index','activity','vipNotify','activityNotify','sayNotify','updateLngLat','user_wallNotify','getSayConfig','delmsg','getAgr'];protected $noNeedRight = ['*'];/*** 首页**/public function index(){$scene = $this->request->param('scene');$scene = $scene?$scene : 2; // 1 首页   2 推荐$user = $this->auth->getUserinfo();$gender = $this->request->param('gender',1);$is_eject = 0;if ($user){$is_eject = VipExperience::retNotEject($user['id']);}$list = AppUser::getPushUser($user,$gender,$scene);$icon = Icon::where('type',1)->field('icon_img,title,href')->select();// 个人中心背景$center_bg = AppConfig::getValue('center_bg') ;$center_bg = fileUrl($center_bg);// 如果是首页 需要追加推荐墙数据if ($scene == 1){$uw_where['order_status'] = 1;$city = $this->request->param('city');if ($user){$uw_where['gender'] = ['<>',$user['gender']];}$uw_where['live_city'] = $city;$date = date('Y-m-d 00:00:00');$uw_user_id = UserWallModel::where($uw_where)->where('start_time','=',$date)->limit(9)->column('user_id');$uw_list = AppUser::whereIn('id',$uw_user_id)->field('id,nickname,live_address,avatar,birthday,height,photos,job,education,is_completion_data,gender,constellation')->select();foreach ($uw_list as $v){$list[] = $v;}}$this->success('请求成功',compact('list','icon','is_eject','center_bg'));}/*** 每周活动* @throws \think\exception\DbException*/public function activity(){$data = Activity::get(['status'=>1]);$this->success('请求成功',$data);}/*** 参加活动* @throws \think\exception\DbException*/public function joinActivity(){$user_info = $this->auth->getUserinfo();$activity_id = input('activity_id');$activity = Activity::find($activity_id);// 判断是否参加了活动$is_join = OrderActivity::where(['user_id'=>$user_info['id'],'activity_id'=>$activity_id,'status'=>1])->count();if ($is_join) $this->error('已报名该场活动');$gender_key = $user_info['gender'] ? 'male_num' : 'female_num';$join_key = $user_info['gender'] ? 'male_join_num' : 'female_join_num';if($activity[$join_key] >= $activity[$gender_key]) $this->error('活动人数已达上限');$order_num = date("YmdHis") . mt_rand(100000, 999999);$param['price'] = $activity['price'];$param['user_id'] = $user_info['id'];$param['order_num'] = $order_num;$param['activity_id'] = $activity_id;$model = new OrderActivity();$model->data($param);$re = $model->save();if(!$re) $this->error('操作失败');$pay_params = ['amount' => $activity['price'],
//            'amount' => 0.01,'orderid' => $param['order_num'],'type' => "wechat",'title' => "已遇蓝桉",'notifyurl' => Env::get('app.url').'/api/index/activityNotify','method' => "miniapp",'openid' => $user_info['openid'],];$response = Service::submitOrder($pay_params);$this->success('获取成功',['pay_param' => $response,'order_number' => $order_num]);}/*** 参加活动结果* @throws \think\db\exception\DataNotFoundException* @throws \think\db\exception\ModelNotFoundException* @throws \think\exception\DbException*/public function activityResult(){$order_number = input('order_number');$order = OrderActivity::field('id,check_num,check_qr_code,status')->where('order_num',$order_number)->find();if (!$order) $this->error('订单不存在');if ($order['status'] != 1) $this->error('订单未支付');$order['check_qr_code'] = fileUrl($order['check_qr_code']);$this->success('获取成功',$order);}/*** 购买会员回调**/public function vipNotify(){$pay = Service::checkNotify('wechat');if (!$pay) {Log::error('签名错误');
//            $filename = 'miniprogram_pay_notify_info_'.date('Y-m-d');
//            file_put_contents($filename, $pay.PHP_EOL, FILE_APPEND);}$data = $pay->verify();try {$pay_amount = $data['total_fee'] / 100;$out_trade_no = $data['out_trade_no'];$order = VipOrder::where('order_number',$out_trade_no)->find();if (!$order) {throw new \Exception('订单不存在');}
//            if ($order['price'] != $pay_amount) {
//                throw new \Exception('订单异常');
//            }$package = VipPackage::get($order['package_id']);if (!$package) {throw new \Exception('套餐不存在');}//如果用户已有会员,有效期就在原有时间上增加$user = AppUser::get($order['user_id']);$now_expire = $user['vip_expire_time'] && $user['is_vip'] == 1 ? strtotime($user['vip_expire_time']) : time();$time_limit = $package['time_limit'];$expire = date("Y-m-d H:i:s");switch ($package['unit']) {case 0:$expire = date("Y-m-d H:i:s",strtotime("+".$time_limit." day",$now_expire));break;case 1:$expire = date("Y-m-d H:i:s",strtotime("+".$time_limit." month",$now_expire));break;case 2:$expire = date("Y-m-d H:i:s",strtotime("+".$time_limit." year",$now_expire));break;}$user->is_vip = 1;$user->vip_expire_time = $expire;$user->save();$order->status = 1;$order->buy_time = date('Y-m-d H:i:s');$order->expire_time = $expire;$order->save();// 返佣FlyerOrder::returnCommission($order,1);return $pay->success()->send();} catch (\Exception $e) {Log::error($e);}}/*** 购买say豆回调*/public function sayNotify(){$pay = Service::checkNotify('wechat');if (!$pay) {Log::error('签名错误');}$data = $pay->verify();try {$pay_amount = $data['total_fee'] / 100;$out_trade_no = $data['out_trade_no'];$order = SayOrder::where('order_number',$out_trade_no)->find();if (!$order) {throw new \Exception('订单不存在');}
//            if ($order['price'] != $pay_amount) {
//                throw new \Exception('订单异常');
//            }SayLog::saveLog($order['user_id'],$order['say_num'],9,'购买say豆');$order->status = 1;$order->buy_time = date('Y-m-d H:i:s');$order->save();// 返佣FlyerOrder::returnCommission($order,2);return $pay->success()->send();} catch (\Exception $e) {Log::error($e);}}/*** 参加活动回调*/public function activityNotify(){$pay = Service::checkNotify('wechat');if (!$pay) {Log::error('签名错误');}$data = $pay->verify();try {$order = OrderActivity::get(['order_num'=>$data['out_trade_no']]);
//            $order = OrderActivity::get(1);//生成核销码,核销二维码$check_num = time() . mt_rand(100000, 999999);$qr = Common::build($check_num);
//            $qrcode = Common::serverUrl().'/uploads/qrcode/'.$qr;$qrcode = '/uploads/qrcode/'.$qr;$order->check_num = $check_num;$order->check_qr_code = $qrcode;$order->status = 1;$order->save();$user = AppUser::get($order['user_id']);//参加活动对应性别人数加1$key = $user['gender'] ? 'male_join_num' : 'female_join_num' ;Activity::where('id',$order['activity_id'])->setInc($key);// 发送订阅消息$usr_arr = AppUser::getFieldInfo($order['user_id']);$act_info = Activity::where('id',$order['activity_id'])->find();$sub_msg_data['name1'] =  $usr_arr['nickname'];$sub_msg_data['time4'] =  $act_info['start_time'];$sub_msg_data['thing7'] =  $act_info['title'];$sub_msg_data['thing3'] =  '恭喜您已成功预约,客服之后会与您联系';SubscribeMsg::activityMsg($usr_arr['openid'],$sub_msg_data);return $pay->success()->send();} catch (\Exception $e) {Log::error($e);}}/*** 推荐上墙回调*/public function user_wallNotify(){$pay = Service::checkNotify('wechat');if (!$pay) {Log::error('签名错误');}$data = $pay->verify();try {$out_trade_no = $data['out_trade_no'];$order = \app\common\model\UserWall::where('order_number',$out_trade_no)->find();if (!$order) {throw new \Exception('订单不存在');}// 获取顺延时间$date_arr = \app\common\model\UserWall::getPostponedDate($order);$order->order_status = 1;$order->buy_time = date('Y-m-d H:i:s');$order->postponed_count = $date_arr['postponed_count'];$order->start_time = $date_arr['start_time'];$order->end_time = $date_arr['end_time'];$order->save();$msg_time = date('Y年m月d日',strtotime($date_arr['start_time']));// 发送消息// 创建聊天室$room_info = ChatRoom::where(['user_id'=>0,'to_user_id'=>$order['user_id']])->find();if (!$room_info){$room = new ChatRoom();$room->type = 1;$room->user_id = 0;$room->to_user_id = $order['user_id'];$room->status = 2;$room->createtime = time();$room->last_time = time();$room->to_user_id_del = $order['user_id'];$room->to_user_del_time = null;$room->save();}else{$room_info->last_time = time();$room_info->to_user_id_del = $order['user_id'];$room_info->to_user_del_time = null;$room_info->save();}// 上线$redis = new Redis();$redis->sadd(online_key(),$order['user_id']);$msg = "恭喜您已完成预约!您的预约时间是{$msg_time}。在此时间将您的个人形象及信息将展示于我平台【推荐墙】。展示时间为24小时,再次感谢您的预约。";
//            $im = new Im();
//            $im->adminPushMsg($order['user_id'],$msg);return $pay->success()->send();} catch (\Exception $e) {Log::error($e);}}/***  更新经纬度*/public function updateLngLat(){$lng = $this->request->post('lng');$lat = $this->request->post('lat');$user = $this->auth->getUserinfo();if ($user && $lng && $lat){AppUser::where(['id'=>$user['id']])->update(['lng'=>$lng,'lat'=>$lat]);}$this->success('ok');}/*** 返回配置的say豆*/public function getSayConfig(){$list = SayCommonRule::field('scene,beans')->select();$list = toArray($list);$app_config = AppConfig::where('key','in',['release_forum'])->field('value,name')->select();$app_config = toArray($app_config);foreach ($app_config as $k=>$v){$arr['scene'] = $v['name'];$arr['beans'] = $v['value'];$list[] = $arr;}$this->success('ok',$list);}/*** 协议*/public function getAgr(){$data['yh_content'] = config('site.yh_content');$data['ys_content'] = config('site.ys_content');$this->success('ok',$data);}/*** 公告列表*/public function getNotice(){$user = $this->auth->getUserinfo();$page = $this->request->param('page');$size = $this->request->param('size');$notice = Notice::order('id desc')->page($page,$size)->select();foreach ($notice as $k=>$v){// 是否阅读$notice[$k]['is_read'] = Notice::isRead($v['id'],$user['id']);}$data = compact('notice');$this->success('ok',$data);}/*** 清空所有用户的会话记录*/public function delmsg(){//        die;
//        $list = AppUser::order('id asc')->select();
//        foreach ($list as $k=>$v){
//            $v->birthday_int = $v['birthday'] ? strtotime($v['birthday']) : 0;
//            $v->save();
//        }
//
//        die;$where['is_completion_data']=1;$list = AppUser::order('id asc')->where($where)->column('id');$tokens = Db::name('user_token_test')->whereIn('user_id',$list)->select();$tokens = toArray($tokens);foreach ($tokens as $k=>$v){$tokens[$k]['nickname'] = AppUser::order('id asc')->where(['id'=>$v['user_id']])->value('nickname');}dd($tokens);/*for ($i=50;$i<57;$i++){for($j=50;$j<57;$j++){if ($i != $j){$im = new Im();$re = $im->setMsgRead($i.'x',$j.'x');if ($re['ActionStatus'] != 'OK'){d($i.'x-'.$j.'x');d($re);}$im2 = new Im();$re2 = $im2->setMsgRead($i,$j);if ($re2['ActionStatus'] != 'OK'){d($i.'-'.$j);d($re);}}}}*/dd();/*$where['id'] = ['in','50,1,6'];$where['is_completion_data']=1;$page = $this->request->param('page');$list = AppUser::order('id asc')->where($where)->limit(5)->page($page)->column('id');$list2 = AppUser::order('id asc')->where($where)->column('id');$count1 = count($list);$count2 = count($list2);for ($i=0;$i<$count1;$i++){for($j=0;$j<$count2;$j++){if ($list[$i] != $list2[$j]){
//                    d($list[$i].'x'.$list2[$j].'x');$im = new Im();$re = $im->setMsgRead($list[$i].'x',$list2[$j].'x');$im = new Im();$re = $im->setMsgRead($list[$i],$list2[$j]);}}}*/dd($list);$list = ChatRoom::where('id','>',0)->select();foreach ($list as $info){
//            $im = new Im();if ($info['type'] == 1){
//                $im->setMsgRead($info['user_id'],$info['to_user_id']);
//                $im->setMsgRead($info['to_user_id'],$info['user_id']);$im->deleteMsg($info['user_id'],$info['to_user_id']);$im->deleteMsg($info['to_user_id'],$info['user_id']);}else{
//                $im->setMsgRead($info['user_id'].'x',$info['to_user_id'].'x');
//                $im->setMsgRead($info['to_user_id'].'x',$info['user_id'].'x');
//                $im->deleteMsg($info['user_id'].'x',$info['to_user_id'].'x');
//                $im->deleteMsg($info['to_user_id'].'x',$info['user_id'].'x');}
//            $info->delete();}dd($list);$list = AppUser::where('id','>',0)->page(1)->limit(5)->select();foreach ($list as $user){$to_list = AppUser::all();foreach ($to_list as $to_user){
//                $im = new Im();
//                $im->deleteMsg($user['id'],$to_user['id']);
//                $im = new Im();
//                $im->deleteMsg($user['id'].'x',$to_user['id'].'x');}}dd($list);}/*** 测试*/public function test(){$access_token_val = getAccessToken();$url = 'https://api.weixin.qq.com/wxa/generate_urllink?access_token='.$access_token_val;$param['path'] = 'pages/index/index';$param['query'] = 'id='.$this->auth->getUserinfo()['id'];$result = httpRequest( $url, json_encode($param),"POST");$arr = json_decode($result,true);dd($arr);}/*** 获取用户token*/public function getUserToken(){$id = $this->request->param('id');$this->auth->direct($id);$token = $this->auth->getToken();dd($token);}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/623376.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

科技云报道:AI大模型疯长,存储扛住了吗?

科技云报道原创。 AI大模型正在倒逼数字基础设施产业加速升级。 过去一年半&#xff0c;AI大模型标志性的应用相继出现&#xff0c;从ChatGPT到Sora一次次刷新人们的认知。震撼的背后&#xff0c;是大模型参数指数级的增长。 这种数据暴涨的压力&#xff0c;快速传导到了大模…

Web前端-JavaScript

黑马程序员JavaWeb开发教程 文章目录 一、js引入方式1、内部脚本2、外部脚本 二、js基础语法1、书写语法&#xff08;1&#xff09;基本语法&#xff08;2&#xff09;输出语句 2、变量&#xff08;1&#xff09;变量&#xff08;2&#xff09;注意事项 3、数据类型、运算符、流…

利驰软件亮相第二届全国先进技术成果转化大会

4月8日&#xff0c;第二届全国先进技术成果转化大会在苏开幕。省长许昆林出席大会开幕式并致辞。国家国防科工局局长张克俭&#xff0c;省委常委、苏州市委书记刘小涛分别致辞。 本次转化大会由江苏省国防科学技术工业办公室、苏州市人民政府、先进技术成果长三角转化中心主办…

暴力破解密码自动阻断

1 re模块 re 模块是 Python 中用于正则表达式操作的模块。正则表达式&#xff08;Regular Expression&#xff09;是一种强大的文本处理工具&#xff0c;它使用一种特殊的字符序列来表示字符串中的模式&#xff0c;并可以通过模式匹配、查找、替换等操作对文本进行高效处理。 …

AUTOCAD输出或打印PDF文件时,如何将图形居中且布满图纸?

AUTOCAD输出或打印PDF文件时,如何将图形居中且布满图纸? 如下图所示,我们打开一份DWG格式的图纸文件,然后点击上方的“打印“图标, 如下图所示, 打印机/绘图仪这里选择“DWG To PDF“; 图纸尺寸:这里以普通的A4纸为例进行说明; 打印比例选择“布满图纸“; 打印偏移…

Jmeter 简单的压力测试

今天我们一起利用Apache Jmeter&#xff08;一种接口测试工具&#xff09;来进行压力测试学习。压力测试主要目的是测试负载均衡的实现效果。 安装Jmeter这里就不做阐述了&#xff0c;上网下载个最新版就可以了&#xff0c;因为Jmeter是由JAVA语言开发的&#xff0c;所以安装之…

程序猿之路

我接触计算机算对自己来说是比较晚的了&#xff0c;上初中的时候就有微机课&#xff0c;但是在那个小县城&#xff0c;上课也只是3个人共用一个电脑&#xff0c;我初中整个过程只会开关机&#xff0c;哈哈&#xff0c;虽然学过word&#xff0c;但是无奈&#xff0c;我插不上手呀…

跟风Spring的context继承风格写的一个业务处理器,无聊

忽然记起spring的context的N重继承风格&#xff0c;一个抽象类实现一部份功能&#xff0c;想从那重改复写就从哪重开始。脑子一抽&#xff0c;也在业务代码里面玩了下。效果嘛。学得是有模有样&#xff0c;感觉就是越搞越复杂。有点过度设计了&#xff0c;折腾个啥呢。哈哈哈……

tcp的全连接队列和半连接队列满时,客户端再connect发生的情况

首先简单介绍下tcp的全连接队列(accept queue)和半连接队列(syn queue)&#xff0c; 1.客户端发起syn请求时&#xff0c;服务端收到该请求&#xff0c;将其放入到syn queue&#xff0c;然后回复acksyn给客户端。 2.客户端收到acksyn&#xff0c;再发送ack给服务端。 3. 服务端从…

通过adb 命令打印安装在第三方模拟器上的log

1&#xff0c;环境&#xff1a;Windows 11 &#xff0c;第三方模拟器 网易的MuMu 步骤&#xff1a; 1&#xff0c;打开cmd&#xff0c;输入 adb connect 172.0.0.1:7555 2&#xff0c;在cmd&#xff0c;再次输入adb logcat 回车

超详细的社交红人营销玩法来啦!点击查看↓天府锋巢直播产业基地重点服务优势

在刚刚过去的2023年 直播行业听到最多的词“红人营销” 可以算上其中之一 到底什么是红人营销&#xff1f; 红人营销如何做到声量和销量双增长&#xff1f; 企业如何产出 最真实有趣高效的营销内容&#xff1f; 天府锋巢为您解析基地 链主企业「无锋科技」提供的 重点优…

数据结构-上三角矩阵存储方式[0知识掌握]

目标&#xff1a;看完本文章你将会了解上三角矩阵的存储方式以及矩阵中数据的位置索引号如何求 难点&#xff1a;上三角矩阵的公式推导&#xff0c;上三角任意位置对应的存储位置。 一、准备知识 1.求和公式 前n项和&#xff1a;Sn n(a1an)/2 公差&#xff1a;d后项-前项…