浏览代码

1.缘分大厅改为只显示异性。
2.聊天详情页点击右上角和对方头像可跳转到对方个人信息页
3.缘分大厅和个人详情页增加编号,缘分大厅可用编号进行搜索
4.后台导入的注册字段不能修改
5.年龄算法更改

linwu 1 年之前
父节点
当前提交
d717cb9fe7

+ 30 - 3
app/common/Fun.php

@@ -69,12 +69,39 @@ class Fun
     /**
      * 是否手机号
      */
-    public static function isMobile($user_mobile){
+    public static function isMobile($user_mobile)
+    {
         $chars = "/^((\(\d{2,3}\))|(\d{3}\-))?1(3|5|8|9)\d{9}$/";
-        if (preg_match($chars, $user_mobile)){
+        if (preg_match($chars, $user_mobile)) {
             return true;
-        }else{
+        } else {
             return false;
         }
     }
+
+    /**
+     * 根据生日获取年龄
+     */
+    public static function getAgeByBirth($birthday)
+    {
+        if (empty($birthday)) {
+            return '未知';
+        }
+        //格式化出生时间年月日
+        $byear  = date('Y', $birthday);
+        $bmonth = date('m', $birthday);
+        $bday   = date('d', $birthday);
+
+        //格式化当前时间年月日
+        $tyear  = date('Y');
+        $tmonth = date('m');
+        $tday   = date('d');
+
+        //开始计算年龄
+        $age = $tyear - $byear;
+        if ($bmonth > $tmonth || $bmonth == $tmonth && $bday > $tday) {
+            $age--;
+        }
+        return $age;
+    }
 }

+ 5 - 4
app/love/controller/ActiveController.php

@@ -10,6 +10,7 @@
 // +----------------------------------------------------------------------
 namespace app\love\controller;
 
+use app\common\Fun;
 use app\love\model\ActiveApplyModel;
 use app\love\model\ActiveModel;
 use app\love\model\UserFriendModel;
@@ -147,7 +148,7 @@ class ActiveController extends LoveBaseController
             ->select();
 
         foreach ($list as $v) {
-            $v['age'] = empty($v['birthday']) ? 0 : date('Y') - date('Y', $v['birthday']);
+            $v['age'] = Fun::getAgeByBirth($v['birthday']);
         }
         $this->assign('list', $list);
 
@@ -204,7 +205,7 @@ class ActiveController extends LoveBaseController
             ->page($param['page'])
             ->select();
         foreach ($list as $v) {
-            $v['age'] = empty($v['birthday']) ? 0 : date('Y') - date('Y', $v['birthday']);
+            $v['age'] = Fun::getAgeByBirth($v['birthday']);
         }
         $this->result($list, 1);
     }
@@ -240,7 +241,7 @@ class ActiveController extends LoveBaseController
             ->limit(10)
             ->select();
         foreach ($list1 as $v) {
-            $v['age'] = empty($v['birthday']) ? 0 : date('Y') - date('Y', $v['birthday']);
+            $v['age'] = Fun::getAgeByBirth($v['birthday']);
         }
         $this->assign('list1', $list1);
 
@@ -253,7 +254,7 @@ class ActiveController extends LoveBaseController
             ->limit(10)
             ->select();
         foreach ($list2 as $v) {
-            $v['age'] = empty($v['birthday']) ? 0 : date('Y') - date('Y', $v['birthday']);
+            $v['age'] = Fun::getAgeByBirth($v['birthday']);
         }
         $this->assign('list2', $list2);
 

+ 2 - 1
app/love/controller/SceneController.php

@@ -10,6 +10,7 @@
 // +----------------------------------------------------------------------
 namespace app\love\controller;
 
+use app\common\Fun;
 use app\common\Wechat;
 use app\love\model\ActiveApplyModel;
 use app\love\model\ActiveModel;
@@ -194,7 +195,7 @@ class SceneController extends HomeBaseController
         $age_list = $list->column('id');
         $mating   = UserMatingModel::where('user_id', 'in', $age_list)->column('*', 'user_id');
         foreach ($list as $v) {
-            $v['age']    = empty($v['birthday']) ? 0 : date('Y') - date('Y', $v['birthday']);
+            $v['age'] = Fun::getAgeByBirth($v['birthday']);
             $v['mating'] = $mating[$v['id']];
             $v['url']    = urlencode(url('love/userwall/detail', ['id' => $v['id']], true, true));
         }

+ 10 - 4
app/love/controller/UserwallController.php

@@ -11,6 +11,7 @@
 namespace app\love\controller;
 
 use app\common\Constant;
+use app\common\Fun;
 use app\love\model\GiftModel;
 use app\love\model\UserFavoriteModel;
 use app\love\model\UserFriendModel;
@@ -37,10 +38,11 @@ class UserwallController extends LoveBaseController
             ->where('is_complete', 1)
             ->where('is_public', 1)
             ->where('id', '<>', cmf_get_current_user_id())
+            ->where('sex', '<>', cmf_get_current_user()['sex'])
             ->limit(4)
             ->select();
         foreach ($list as $v) {
-            $v['age'] = empty($v['birthday']) ? 0 : date('Y') - date('Y', $v['birthday']);
+            $v['age'] = Fun::getAgeByBirth($v['birthday']);
         }
         $this->assign('list', $list);
 
@@ -67,6 +69,7 @@ class UserwallController extends LoveBaseController
             ['check_status', '=', 2],
             ['is_complete', '=', 1],
             ['is_public', '=', 1],
+            ['sex', '<>', cmf_get_current_user()['sex']],
         ];
         if (!empty($param['age'])) {
             $age        = $this->_age[$param['age']];
@@ -74,8 +77,11 @@ class UserwallController extends LoveBaseController
             $end_time   = strtotime("-{$age[0]} year");
             $where[]    = ['birthday', 'between', [$start_time, $end_time]];
         }
-        if (!empty($param['sex'])) {
-            $where[] = ['sex', '=', $param['sex']];
+//        if (!empty($param['sex'])) {
+//            $where[] = ['sex', '=', $param['sex']];
+//        }
+        if (!empty($param['id'])) {
+            $where[] = ['id', '=', $param['id']];
         }
         if (!empty($param['high'])) {
             $high    = $this->_high[$param['high']];
@@ -95,7 +101,7 @@ class UserwallController extends LoveBaseController
             ->order($param['sort'])
             ->select();
         foreach ($list as $v) {
-            $v['age'] = empty($v['birthday']) ? 0 : date('Y') - date('Y', $v['birthday']);
+            $v['age'] = Fun::getAgeByBirth($v['birthday']);
         }
         $this->result($list, 1);
     }

+ 1 - 1
app/portal/controller/IndexController.php

@@ -63,7 +63,7 @@ class IndexController extends LoveBaseController
             ->limit(6)
             ->select();
         foreach ($list as $v) {
-            $v['age'] = empty($v['birthday']) ? '未知' : date('Y') - date('Y', $v['birthday']);
+            $v['age'] = Fun::getAgeByBirth($v['birthday']);
         }
         $this->assign('list', json_encode($list));
 

+ 8 - 2
public/themes/simpleboot3/love/message/detail.html

@@ -29,13 +29,16 @@
         }
         .gif_item {display:flex;justify-content:space-around;align-items:center;height:40px;}
         .van-swipe__indicator {background:#aaa;}
+        .van-nav-bar__right .van-nav-bar__text {font-size:22px;}
     </style>
 </block>
 <block name="body">
     <van-nav-bar
         fixed
         left-text="返回"
+        right-text="···"
         @click-left="onBack"
+        @click-right="onUserDetail"
         left-arrow
     >
         <template #title>
@@ -52,7 +55,7 @@
                 <div class="t_center color_9 scroll_this_el" v-if="key > 0 && item.create_time - message[key-1].create_time > 600">{{item.create_time_text}}</div>
                 <!--对方-->
                 <dl class="pl60 pr mb15 pt5 oe_chat tl pr60" v-if="item.from_id == to_id">
-                    <dt class="pa lt">
+                    <dt class="pa lt" @click="onUserDetail">
                         <span class="br50 oh img_40 inline_block"><img class="w100 h100" :src="item.from_user.avatar ? item.from_user.avatar : '__TMPL__/public/assets/images/userwall/no_image_thumb.png'"></span>
                     </dt>
                     <p class="color_9 fz12">{{item.from_user.username}}</p>
@@ -256,7 +259,10 @@
                         }
 
                     },'json');
-                }
+                },
+                onUserDetail() {
+                    location.href = '{:url("love/userwall/detail")}?id=' + this.to_id;
+                },
             },
             watch:{
                 message:function(){

+ 5 - 5
public/themes/simpleboot3/love/my/index.html

@@ -87,11 +87,11 @@
                 <img src="__TMPL__/public/assets/images/my/icon_images.svg" class="van-cell__left-icon" style="height:24px;"/>
             </template>
         </van-cell>
-        <!--<van-cell title="帮助中心" is-link url="{:url('love/scene/helpCenter')}" size="large">-->
-            <!--<template #icon>-->
-                <!--<img src="__TMPL__/public/assets/images/my/icon_profile.svg" class="van-cell__left-icon" style="height:24px;"/>-->
-            <!--</template>-->
-        <!--</van-cell>-->
+        <van-cell title="帮助中心" is-link url="https://mp.weixin.qq.com/s/j4TVfQdX7-64spljgN64NA" size="large">
+            <template #icon>
+                <img src="__TMPL__/public/assets/images/my/icon_profile.svg" class="van-cell__left-icon" style="height:24px;"/>
+            </template>
+        </van-cell>
     </van-cell-group>
 
     <!--底部-->

+ 2 - 2
public/themes/simpleboot3/love/my/profile.html

@@ -25,16 +25,16 @@
 
     <!--增空-->
     <van-field
-            required
             v-model="form.realname"
             label="真实姓名"
             placeholder="请输入真实姓名"
+            disabled
     ></van-field>
     <van-field
-            required
             v-model="form.mobile"
             label="电话"
             placeholder="请输入电话号码"
+            disabled
     ></van-field>
     <van-field
             v-model="form.sex == 1 ? '男' : '女'"

+ 5 - 17
public/themes/simpleboot3/love/register/profile.html

@@ -37,16 +37,16 @@
 
     <!--增空-->
     <van-field
-            required
             v-model="form.realname"
             label="真实姓名"
             placeholder="请输入真实姓名"
+            disabled
     ></van-field>
     <van-field
-            required
             v-model="form.mobile"
             label="电话"
             placeholder="请输入电话号码"
+            disabled
     ></van-field>
     <van-field
             v-model="form.sex == 1 ? '男' : '女'"
@@ -176,10 +176,10 @@
 
     <!--工作单位和职务-->
     <van-field
-            required
             v-model="form.company"
             label="工作单位"
             placeholder="请输入工作单位"
+            disabled
     ></van-field>
     <van-field
             required
@@ -190,22 +190,10 @@
 
     <!--身份类型-->
     <van-field
-            required
-            clickable
-            :value="form.id_type"
+            v-model="form.id_type"
             label="身份类型"
-            placeholder="点击选择身份类型"
-            @click="showIdType = true"
+            disabled
     ></van-field>
-    <van-popup position="bottom" v-model="showIdType">
-        <van-picker
-                title="身份类型"
-                show-toolbar
-                :columns="idType"
-                @confirm="onIdTypeConfirm"
-                @cancel="showIdType = false"
-        ></van-picker>
-    </van-popup>
 
     <!--家庭成员-->
     <van-field required name="form.family" label="家庭成员">

+ 1 - 1
public/themes/simpleboot3/love/userwall/detail.html

@@ -24,7 +24,7 @@
         <div class="fl">
             <h3 class="ws">
                 <span class="fz22">{{user.realname ? user.realname : user.username}}</span>
-                <span class="fz16 text-gray">(ID:{{user.id}})</span>
+                <span class="fz16 text-gray">(编号:{{user.id}})</span>
             </h3>
             <p class="fz16 mt10">
                 <van-icon

+ 41 - 17
public/themes/simpleboot3/love/userwall/index.html

@@ -5,6 +5,9 @@
         #app{
             padding-bottom:50px;
         }
+        .masonry {
+            padding-top: 140px;
+        }
     </style>
 </block>
 <block name="body">
@@ -16,25 +19,28 @@
             <span style="color:white;">筛选</span>
         </template>
     </van-nav-bar>
+    <div style="position: fixed;top: 46px;width: 100%;z-index: 100;background:white;box-sizing:border-box;padding:5px 10px;">
+        <van-search v-model="form.id" placeholder="请输入嘉宾编号" @search="onIdSearch"></van-search>
+    </div>
 
     <!--筛选-->
-    <van-dropdown-menu style="position: fixed;top: 46px;width: 100%;z-index: 100;">
+    <van-dropdown-menu style="position: fixed;top: 92px;width: 100%;z-index: 100;">
         <van-dropdown-item v-model="form.age" :options="age_option" @change="onAgeChange"></van-dropdown-item>
         <van-dropdown-item v-model="form.sort" :options="sort_option" @change="onSortChange"></van-dropdown-item>
     </van-dropdown-menu>
     <van-popup v-model="show" position="right" :style="{width: '80%',height: '100%'}">
         <div class="search_wrapper">
-            <p class="search_title">性别</p>
-            <van-row :gutter="10">
-                <van-col span="8" v-for="(item) in sex_option">
-                    <div :class="{btn_search_item:true,active:item.value == form.sex}"
-                         @click="selectOption('sex',item.value)">
-                        {{item.text}}
-                        <van-icon v-if="item.value == form.sex"
-                                  class="iconfont icon-gouxuan-youxiajiaogouxuan btn_search_icon text-pink"></van-icon>
-                    </div>
-                </van-col>
-            </van-row>
+            <!--<p class="search_title">性别</p>-->
+            <!--<van-row :gutter="10">-->
+                <!--<van-col span="8" v-for="(item) in sex_option">-->
+                    <!--<div :class="{btn_search_item:true,active:item.value == form.sex}"-->
+                         <!--@click="selectOption('sex',item.value)">-->
+                        <!--{{item.text}}-->
+                        <!--<van-icon v-if="item.value == form.sex"-->
+                                  <!--class="iconfont icon-gouxuan-youxiajiaogouxuan btn_search_icon text-pink"></van-icon>-->
+                    <!--</div>-->
+                <!--</van-col>-->
+            <!--</van-row>-->
 
             <p class="search_title">身高</p>
             <van-row :gutter="10">
@@ -103,6 +109,8 @@
                                             <van-icon
                                                     :class="[item.sex == 1 ? 'icon-xingbie-nan text-blue' : 'icon-xingbie-nv text-pink','iconfont']"></van-icon>
                                             {{item.realname ? item.realname : item.username}}
+
+                                            <span class="fz12 text-gray">(编号:{{item.id}})</span>
                                         </span>
                                     </h3>
                                     <div class="describe">
@@ -176,11 +184,11 @@
                         {text: '最新注册', value: 'create_time desc'},
                         {text: '最近登录', value: 'last_login_time desc'},
                     ],
-                    sex_option: [
-                        {text: '不限', value: 0},
-                        {text: '男嘉宾', value: 1},
-                        {text: '女嘉宾', value: 2},
-                    ],
+                    // sex_option: [
+                    //     {text: '不限', value: 0},
+                    //     {text: '男嘉宾', value: 1},
+                    //     {text: '女嘉宾', value: 2},
+                    // ],
                     high_option: [
                         {text: '不限', value: 0},
                         {text: '150-160CM', value: 1},
@@ -228,14 +236,30 @@
                 },
                 onAgeChange(value) {
                     this.form.age = value;
+                    this.form.id = '';
                     this.onRefresh();
                 },
                 onSortChange(value) {
                     this.form.sort = value;
+                    this.form.id = '';
                     this.onRefresh();
                 },
                 selectOption(key, value) {
                     this.form[key] = value;
+                    this.form.id = '';
+                },
+                onIdSearch() {
+                    this.form = {
+                        age: 0,
+                        sort: 'star desc',
+                        id: this.form.id,
+                        sex: 0,
+                        high: 0,
+                        weight: 0,
+                        marry: 0,
+                        education: 0,
+                    };
+                    this.onRefresh();
                 },
                 searchReset() {
                     this.form = {