Ver código fonte

基础配置,用户登录全套,基础方法,短信等

lizhen_gitee 1 ano atrás
pai
commit
8a2ed26ae1

+ 1 - 1
addons/cos/config.php

@@ -156,7 +156,7 @@ return [
         'title' => '可上传后缀格式',
         'type' => 'string',
         'content' => [],
-        'value' => 'jpg,png,bmp,jpeg,gif,zip,rar,xls,xlsx',
+        'value' => 'jpg,png,bmp,jpeg,gif,zip,rar,xls,xlsx,wav,mp4,mp3,pdf',
         'rule' => 'required',
         'msg' => '',
         'tip' => '',

+ 28 - 28
application/api/controller/Baseconfig.php

@@ -16,33 +16,33 @@ class Baseconfig extends Api
     public function index(){
 
         $config = [
-            'domain_name' => config('site.domain_name'),
-            'domain_cdnurl' => config('site.domain_cdnurl'),
-            'android_update_num' => config('site.android_update_num'),
+            'android_update_num'     => config('site.android_update_num'),
             'android_update_version' => config('site.android_update_version'),
-            'ios_update_num' => config('site.ios_update_num'),
-            'ios_update_version' => config('site.ios_update_version'),
-            'livebc_type' => Db::name('party_type')->where('room_type',2)->order('id asc')->select(),
-            'taluopai' => config('site.taluopai'),
-            'open_unlock_wechataccount' => config('site.open_unlock_wechataccount'),
+            'ios_update_num'         => config('site.ios_update_num'),
+            'ios_update_version'     => config('site.ios_update_version'),
         ];
 
         $this->success('success',$config);
     }
 
-    //启动广告图
-    public function start_advert(){
 
-        //非首次注册男性用户每次打开app,系统自动推送女性(公会)打招呼消息3人次
-        if($this->auth->isLogin()){
-            if($this->auth->gender == 1 && $this->auth->gh_id == 0){
-                $this->firstopen_send($this->auth->id);
-            }
-        }
+    /**
+     * 获取版本更新信息
+     */
+    public function getEdition() {
+        // 获取二维码
+        $is_force = config("site.is_force");
+        $apkUrl = config("site.apkUrl");
+        $apkName = config("site.apkName");
+        $desc = config("site.desc");
+        $versionCode = config("site.versionCode");
+        $this->success("获取成功!",["versionCode"=>$versionCode,"isForceUpdate"=>$is_force,"apkUrl"=>$apkUrl,"apkName"=>$apkName,"desc"=>$desc]);
+    }
 
+    //启动广告图
+    public function start_advert(){
         $info = Db::name('start_advert')->where('is_show',1)->order('id desc')->find();
-
-        $info = info_domain_image($info,['image']);
+        $info = info_domain_image($info,['images','video_file']);
         $this->success_find('success',$info);
     }
 
@@ -72,20 +72,20 @@ class Baseconfig extends Api
 
     //个人资料的一下枚举
     public function userinfo_enum(){
-        $enum_hobby = Db::name('enum_hobby')->field('id,name')->order('weight desc,id desc')->select();
-        $enum_job = Db::name('enum_job')->field('id,name')->order('weight desc,id desc')->select();
-        $enum_marital = Db::name('enum_marital')->field('id,name')->order('weight desc,id desc')->select();
-        $enum_education = Db::name('enum_education')->field('id,name')->order('weight desc,id desc')->select();
+//        $enum_hobby = Db::name('enum_hobby')->field('id,name')->order('weight desc,id desc')->select();
+//        $enum_job = Db::name('enum_job')->field('id,name')->order('weight desc,id desc')->select();
+//        $enum_marital = Db::name('enum_marital')->field('id,name')->order('weight desc,id desc')->select();
+//        $enum_education = Db::name('enum_education')->field('id,name')->order('weight desc,id desc')->select();
         $enum_tag = Db::name('enum_tag')->field('id,name')->order('weight desc,id desc')->select();
-        $enum_wages = Db::name('enum_wages')->field('id,name')->order('weight desc,id desc')->select();
+//        $enum_wages = Db::name('enum_wages')->field('id,name')->order('weight desc,id desc')->select();
 
         $data = [
-            'enum_hobby' => $enum_hobby,
-            'enum_job' => $enum_job,
-            'enum_marital' => $enum_marital,
-            'enum_education' => $enum_education,
+//            'enum_hobby' => $enum_hobby,
+//            'enum_job' => $enum_job,
+//            'enum_marital' => $enum_marital,
+//            'enum_education' => $enum_education,
             'enum_tag' => $enum_tag,
-            'enum_wages' => $enum_wages,
+//            'enum_wages' => $enum_wages,
         ];
 
         $this->success('success',$data);

+ 1 - 287
application/api/controller/Index.php

@@ -20,282 +20,7 @@ class Index extends Api
         exit;
     }
 
-    /**
-     * 首页
-     *
-     */
-    public function outMemberFromRoom()
-    {
-        // 强制关闭需要退出正在房间的用户
-        $tenim = new \app\api\controller\Tenim();
-        $tenim->outMemberFromRoom(4);
-        $this->success('请求成功');
-    }
-
-
-//    /**
-//     * 生成不重复的随机数字字母组合
-//     */
-//    function getUinqueNo($length = 8) {
-//        $newid = Random::build("alnum",$length);
-////        if(in_array($newid,$nos)) {
-////            $this->getUinqueNo(8);
-////        }
-//        return $newid;
-//    }
-
-    /**
-     * 获取用户协议等
-     */
-    public function getWebsiteInfo() {
-        $params = $this->request->request("params"); //内容
-        if($params == "boxGiftLogo") {
-            echo $this->success("获取成功!",$this->httpurl(config("site.".$params)));
-            exit;
-        }
-        echo "<html><body>";
-        echo config("site.".$params);
-        echo "</body></html>";exit;
-    }
-
-    /**
-     * 获取用户协议等 小程序
-     */
-    public function getWebsiteInfoForMini() {
-        $params = $this->request->request("params"); //内容
-        $res = config("site.".$params);
-        if($params == "boxGiftLogo") $res = $this->httpurl(config("site.".$params));
-        $this->success("获取成功!",$res);
-    }
-
-    /**
-     * 联系我们
-     */
-    public function contactus() {
-        $list = \app\common\model\Config::where(["group"=>"basic","name"=>["in",["email","mobile"]]])->select();
-        $data = [];
-        foreach($list as $k => $v) {
-            $v["name"] == "email" && $data["email"] = $v["value"];
-            $v["name"] == "mobile" && $data["mobile"] = $v["value"];
-        }
-        $this->success("获取成功!",$data);
-    }
-
-    /*
-     * 获取系统消息列表
-     */
-    public function getMessage() {
-        $page = $this->request->request('page',1); // 分页
-        $pageNum = $this->request->request('pageNum',10); // 分页
-        // 分页搜索构建
-        $pageStart = ($page-1)*$pageNum;
 
-        $flag = $this->request->request("flag",1,"intval"); //标识:1=只取一条,0=全部
-        $user_id = $this->auth->id;
-
-        $obj = \app\common\model\Message::where(["user_id"=>$user_id])->order("createtime","desc")->limit($pageStart,$pageNum);
-        if($flag == 1) {
-            $list = $obj->find();
-            $list || $list = [];
-            $list && $list["createtime"] = $this->get_last_time($list["createtime"]);
-        } else {
-            $list = $obj->select();
-            if($list) foreach($list as $k => &$v) {
-                $v["createtime"] = $this->get_last_time($v["createtime"]);
-            }
-        }
-
-        $this->success("获取成功!",$list);
-
-    }
-
-    /**
-     * 删除系统消息
-     */
-    public function delMessage() {
-        $id = $this->request->request("id",0,"intval"); //消息ID
-        if($id <= 0) {
-            $this->error("参数传入错误!");
-        }
-        $res = \app\common\model\Message::where(["id"=>$id,"user_id"=>$this->auth->id])->delete();
-
-        if($res) {
-            $this->success("删除成功!");
-        } else {
-            $this->error("删除失败!");
-        }
-    }
-
-    /**
-     * 获取主播魅力值排行
-     */
-    public function getUserCharmRankList() {
-        $time = $this->request->request("time",0,"intval"); //时间筛选 1=小时榜,2=今日榜,3=本周榜,4=月榜
-        if(!in_array($time,[1,2,3,4])) {
-            $this->error("参数传入错误!");
-        }
-
-        $hour = strtotime(date("Y-m-d H:00:00"));
-        $today = strtotime(date("Y-m-d 00:00:00"));
-        $weekend = strtotime('monday this week');
-//        $weekend = mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y"));
-        $month = strtotime(date("Y-m-01 00:00:00"));
-        // 剩余时间
-        $thistime = time();
-        switch ($time) {
-            case 1:
-                $redtime = 3600-($thistime - $hour);
-                break;
-            case 2:
-                $redtime = 3600*24-($thistime - $today);
-                break;
-            case 3:
-                $redtime = 3600*24*7-($thistime - $weekend);
-                break;
-            case 4:
-                $monthend = mktime(23,59,59,date("m"),date("t"),date("Y"));
-                $redtime = ($monthend - $month)-($thistime - $month);
-                break;
-        }
-
-        $timeArr = [1=>$hour,2=>$today,3=>$weekend,4=>$month];
-        $where = [];
-        $where["a.createtime"] = ["gt",$timeArr[$time]];
-        $list = \app\common\model\UserCharmRank::alias("a")
-            ->field("p.id,sum(a.charm) as charm,u.avatar,u.nickname,u.gender,u.level")
-            ->where($where)
-            ->join("hx_user u","u.id = a.user_id")
-            ->join("hx_party p","p.user_id = a.user_id")
-            ->group("a.user_id")
-            ->order("charm","desc")
-            ->limit(100)
-            ->select();
-
-        $data = [];
-        $data["redtime"] = $redtime;
-        $data["data"] = $list;
-        $this->success("获取成功!",$data);
-    }
-
-    /**
-     * 获取派对热度排序
-     */
-    public function getPartyHotList() {
-        // 剩余时间
-        $thistime = time();
-        $hour = strtotime(date("Y-m-d H:00:00"));
-        $redtime = 3600-($thistime - $hour);
-
-        $where = [];
-        $where["a.createtime"] = ["gt",$hour];
-        $where["p.room_type"] = 1;
-        $list = \app\common\model\PartyHot::alias("a")
-            ->field("sum(a.hot) as hot,p.id,u.avatar,p.party_name,p.party_logo")
-            ->where($where)
-            ->join("hx_party p","p.id = a.party_id")
-            ->join("hx_user u","u.id = p.user_id")
-            ->group("a.party_id")
-            ->order("hot","desc")
-            ->limit(100)
-            ->select();
-
-        $data = [];
-        $data["redtime"] = $redtime;
-        $data["data"] = $list;
-        $this->success("获取成功!",$data);
-    }
-
-    /**
-     * 首页搜索
-     */
-    public function searchUsers() {
-        $search = $this->request->request("search"); //关键词筛选
-        if(!$search) {
-            $this->error("请输入搜索内容!");
-        }
-        // 搜索派对
-        global $whereOr;
-        $where = [];
-        $whereOr["party_id"] = $search;
-        $whereOr["party_name"] = ["like","%$search%"];
-        $where["room_type"] = 1;
-        $partyList = \app\common\model\Party::field("id,party_logo,party_id,party_name")
-            ->where($where)
-            ->where(function ($query) {
-                global $whereOr;
-                $query->whereOr($whereOr);
-            })->order("party_hot","desc")->select();
-
-
-        // 搜索直播间
-        global $whereOrlive;
-        $where = [];
-        $whereOrlive["party_id"] = $search;
-        $whereOrlive["party_name"] = ["like","%$search%"];
-        $where["room_type"] = 2;
-        $liveList = \app\common\model\Party::field("id,party_logo,party_id,party_name")
-            ->where($where)
-            ->where(function ($query) {
-                global $whereOrlive;
-                $query->whereOr($whereOrlive);
-            })
-            ->order("party_hot","desc")->select();
-        // 相关用户
-        $where = [];
-        $where["a.nickname"] = ["like","%$search%"];
-        $where["a.u_id"] = $search;
-        $userList = \app\common\model\User::alias("a")->field("id,avatar,nickname,u_id,f.fans")
-            ->join("hx_view_fans f","f.user_id = a.id","left")
-            ->order("a.is_online,a.noble,a.level")
-            ->whereOr($where)->select();
-        $res = [];
-        $res["partylist"] = $partyList;
-        $res["livelist"] = $liveList;
-        $res["userlist"] = $userList;
-
-        $this->success("获取成功!",$res);
-    }
-
-    /**
-     * 获取下载二维码和邀请码
-     */
-    public function getInviteCode() {
-        // 获取二维码
-        $qrcode = $this->httpurl(config("site.qrcode"));
-        $miniqrcode = $this->httpurl(config("site.miniqrcode"));
-        // 获取用户邀请码
-        $inviteCode = \app\common\model\User::where(["id"=>$this->auth->id])->value("invite_no");
-        $host = $_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"];
-        $downlowdLink = $host."/index/index/appJump?t=wlt".rand(10,999).Random::alpha(8);
-        $this->success("获取成功!",["qrcode"=>$qrcode,"miniqrcode"=>$miniqrcode,"inviteCode"=>$inviteCode,"downlowdLink"=>$downlowdLink]);
-    }
-
-    /**
-     * 获取app分享海报
-     */
-    public function getAppShare() {
-        $this->success("获取成功!",["url"=>$this->httpurl(config("site.appShare"))]);
-    }
-
-    /**
-     * 获取开机动画(暂时关闭)
-     */
-    private function getBootAnimation() {
-        $this->success("获取成功!",["url"=>$this->httpurl(config("site.bootAnimationUrl")),"time"=>floatval(config("site.bootAnimationTime"))]);
-    }
-
-    /**
-     * 获取版本更新信息
-     */
-    public function getEdition() {
-        // 获取二维码
-        $is_force = config("site.is_force");
-        $apkUrl = config("site.apkUrl");
-        $apkName = config("site.apkName");
-        $desc = config("site.desc");
-        $versionCode = config("site.versionCode");
-        $this->success("获取成功!",["versionCode"=>$versionCode,"isForceUpdate"=>$is_force,"apkUrl"=>$apkUrl,"apkName"=>$apkName,"desc"=>$desc]);
-    }
 
     /**
      * 获取邀请图片
@@ -379,19 +104,8 @@ class Index extends Api
         $this->success("获取成功!",$savepath);
     }
 
-    /**
-     * 获取银行列表
-     */
-    public function getBankList() {
-        $this->success("获取成功!",["banklist"=>\app\common\model\Bank::select()]);
-    }
 
-    /**
-     * 获取开关配置
-     */
-    public function getSwitch() {
-        $this->success("获取成功!",["switch"=>config("site.switch")]);
-    }
+
 
     /**
      * 评论时间转换

+ 57 - 97
application/api/controller/User.php

@@ -15,14 +15,15 @@ use app\common\model\UserDeviceInfo;
 use onlogin\onlogin;
 
 use addons\epay\library\Service;
-use addons\epay\library\Wechat;
+//use addons\epay\library\Wechat;
+use app\common\library\Wechat;
 
 /**
  * 会员接口,登录,注册,修改资料等
  */
 class User extends Api
 {
-    protected $noNeedLogin = ['login', 'mobilelogin','wechatlogin', 'register', 'resetpwd', 'changeemail', 'changemobile', 'onlogin','getUserOpenid_gzh','jssdkBuildConfig'];
+    protected $noNeedLogin = ['login', 'mobilelogin','wechatlogin', 'register', 'resetpwd', 'changemobile', 'onlogin','getUserOpenid_gzh','jssdkBuildConfig'];
     protected $noNeedRight = '*';
 
     public function _initialize()
@@ -118,19 +119,13 @@ class User extends Api
             //如果已经有账号则直接登录
             $ret = $this->auth->direct($user->id);
 
-            //非首次注册男性用户每次打开app,系统自动推送女性(公会)打招呼消息3人次
-            if($user->gender == 1 && $user->gh_id == 0){
-                $this->firstopen_send($user->id);
-            }
+
         } else {
             $extend = [
                 'register_from' => input('register_from',''),
             ];
             $ret = $this->auth->register($mobile, Random::alnum(), '', $mobile, $extend);
-            //亿米
-            if(input('register_from','') == 'xiaomi'){
-                $this->yimi_advert();
-            }
+
         }
         if ($ret) {
             Sms::flush($mobile, 'mobilelogin');
@@ -202,10 +197,7 @@ class User extends Api
             //如果已经有账号则直接登录
             $ret = $this->auth->direct($user->id);
 
-            //非首次注册男性用户每次打开app,系统自动推送女性(公会)打招呼消息3人次
-            if($user->gender == 1 && $user->gh_id == 0){
-                $this->firstopen_send($user->id);
-            }
+
         } else {
             if (!$nickname || !$avatar) {
                 $this->error(__('Invalid parameters'));
@@ -218,10 +210,7 @@ class User extends Api
                 'register_from' => input('register_from',''),
             ];
             $ret = $this->auth->openid_register($wechat_openid,$reg_data);
-            //亿米
-            if(input('register_from','') == 'xiaomi'){
-                $this->yimi_advert();
-            }
+
         }
         if ($ret) {
             $data = $this->userInfo('return');
@@ -281,25 +270,15 @@ class User extends Api
                     $ret = $this->auth->direct($user->id);
                     $is_register = 0;
 
-                    //非首次注册男性用户每次打开app,系统自动推送女性(公会)打招呼消息3人次
-                    if($user->gender == 1 && $user->gh_id == 0){
-                        $this->firstopen_send($user->id);
-                    }
+
                 } else {
-                    $extend = [
-                        'register_from' => input('register_from',''),
-                    ];
-                    $ret = $this->auth->register($mobile, Random::alnum(), '', $mobile, $extend);
+
+                    $ret = $this->auth->register('', '', '', $mobile, []);
                     $is_register = 1;
-                    //亿米
-                    if(input('register_from','') == 'xiaomi'){
-                        $this->yimi_advert();
-                    }
+
                 }
 
-                //结果
-                /*$rs['userinfo'] = $this->auth->getUserinfo();
-                $rs['is_register'] = $is_register;*/
+
                 if ($ret) {
                     $this->success(__('Logged in successful'), $this->auth->getUserinfo());
                 } else {
@@ -554,8 +533,8 @@ class User extends Api
             $this->error(__('Invalid parameters'));
         }
         //退出im
-        $tenIm = new Tenim();
-        $tenIm->loginoutim($this->auth->id);
+//        $tenIm = new Tenim();
+//        $tenIm->loginoutim($this->auth->id);
 
         //修改用户活跃0
         Db::name('user')->where('id',$this->auth->id)->update(['is_active' => 0]);
@@ -703,40 +682,6 @@ class User extends Api
         $this->success();
     }
 
-    /**
-     * 修改邮箱
-     *
-     * @ApiMethod (POST)
-     * @param string $email   邮箱
-     * @param string $captcha 验证码
-     */
-    /*public function changeemail()
-    {
-        $user = $this->auth->getUser();
-        $email = $this->request->post('email');
-        $captcha = $this->request->post('captcha');
-        if (!$email || !$captcha) {
-            $this->error(__('Invalid parameters'));
-        }
-        if (!Validate::is($email, "email")) {
-            $this->error(__('Email is incorrect'));
-        }
-        if (\app\common\model\User::where('email', $email)->where('id', '<>', $user->id)->find()) {
-            $this->error(__('Email already exists'));
-        }
-        $result = Ems::check($email, $captcha, 'changeemail');
-        if (!$result) {
-            $this->error(__('Captcha is incorrect'));
-        }
-        $verification = $user->verification;
-        $verification->email = 1;
-        $user->verification = $verification;
-        $user->email = $email;
-        $user->save();
-
-        Ems::flush($email, 'changeemail');
-        $this->success();
-    }*/
 
     /**
      * 修改手机号
@@ -827,7 +772,7 @@ class User extends Api
      * @param string $mobile   手机号
      * @param string $captcha 验证码
      */
-    public function bindopenid()
+    /*public function bindopenid()
     {
         $user = $this->auth->getUser();
         $wechat_openid = $this->request->request('wechat_openid');
@@ -847,40 +792,55 @@ class User extends Api
         $user->save();
 
         $this->success('success',$this->userInfo('return'));
-    }
+    }*/
 
     /**
-     * 第三方登录
+     * 手机注册来的,绑定微信
      *
      * @ApiMethod (POST)
-     * @param string $platform 平台名称
-     * @param string $code     Code码
+     * @param string $wechat_openid
      */
-    /*public function third()
+    public function bindopenid()
     {
-        $url = url('user/index');
-//        $platform = $this->request->post("platform");
-        $platform = 'wechat';
-        $code = $this->request->post("code");
-        $config = get_addon_config('third');
-        if (!$config || !isset($config[$platform])) {
-            $this->error(__('Invalid parameters'));
-        }
-        $app = new \addons\third\library\Application($config);
-        //通过code换access_token和绑定会员
-        $result = $app->{$platform}->getUserInfo(['code' => $code]);
-        if ($result) {
-            $loginret = \addons\third\library\Service::connect($platform, $result);
-            if ($loginret) {
-                $data = [
-                    'userinfo'  => $this->auth->getUserinfo(),
-                    'thirdinfo' => $result
-                ];
-                $this->success(__('Logged in successful'), $data);
+        Db::startTrans();
+        try {
+            $code =  $this->request->param('code','');
+            if(!$code){
+                throw new Exception(__('Invalid parameters'));
+            }
+            //微信
+            $wechat = new Wechat();
+            $openid = $wechat->getOpenid($code);
+
+            if(!$openid){
+                throw new Exception('openid获取失败');
+            }
+
+            $user = model('User')->find($this->auth->id);
+            if(!empty($user['wechat_openid'])/* && $openid != $user['openid']*/){
+                throw new Exception('已经绑定了微信号');
+            }
+            $otherUserWhere['wechat_openid'] = $openid;
+            $otherUserWhere['id'] = ['neq',$this->auth->id];
+            $otherUser = model('User')->where($otherUserWhere)->find();
+            if (!empty($otherUser)) {
+                throw new Exception('该微信已被其他用户绑定过');
+            }
+
+            $user->wechat_openid = $openid;
+            $userRes = $user->save();
+            if (!$userRes) {
+                throw new Exception('绑定微信失败');
             }
+            Db::commit();
+            $this->success('success',$this->userInfo('return'));
+        } catch (Exception $e) {
+            Db::rollback();
+            $this->error($e->getMessage());
         }
-        $this->error(__('Operation failed'), $url);
-    }*/
+    }
+
+
 
     /**
      * 重置密码
@@ -963,7 +923,7 @@ class User extends Api
         }
 
         if ($ret) {
-            $this->success(__('Reset password successful'));
+            $this->success('设置密码成功');
         } else {
             $this->error($this->auth->getError());
         }

+ 1 - 1
application/common.php

@@ -542,7 +542,7 @@ function localpath_to_netpath($path)
     } elseif (strrpos($path, 'http') !== false) {
         return $path;
     } else {
-        return config('site.domain_cdnurl') . str_replace("\\", "/", $path);
+        return config('domain_cdnurl') . str_replace("\\", "/", $path);
     }
 }
 

+ 9 - 17
application/common/library/Auth.php

@@ -269,14 +269,6 @@ class Auth
             //注册用户活跃
             Db::name('user_active')->insertGetId(['user_id'=>$user->id]);
 
-            //加入id 1,2,3 的圈子
-            $topic_data = [
-                ['user_id'=>$user->id,'topic_id'=>1],
-                ['user_id'=>$user->id,'topic_id'=>2],
-                ['user_id'=>$user->id,'topic_id'=>3],
-            ];
-            Db::name('topic_user')->insertAll($topic_data);
-
             //注册成功的事件
             Hook::listen("user_register_successed", $this->_user, $data);
             Db::commit();
@@ -557,27 +549,27 @@ class Auth
         $userinfo = info_domain_image($userinfo,['avatar','photo_images']);
 
         $idcard_confirm = Db::name('user_idconfirm')->where('user_id',$this->id)->find();
-        $secretvideo    = Db::name('user_secretvideo')->where('user_id',$this->id)->find();
+//        $secretvideo    = Db::name('user_secretvideo')->where('user_id',$this->id)->find();
 
         $new_data = [
             'setpassword'    => !empty($this->password) ? 1 : 0,
             'age'            => birthtime_to_age($this->birthday),
             'truename'       => ($this->idcard_status == 1 && isset($idcard_confirm['truename'])) ? $idcard_confirm['truename'] : '',
             'alipay_account' => ($this->idcard_status == 1 && isset($idcard_confirm['alipay_account'])) ? $idcard_confirm['alipay_account'] : '',
-            'secretvideo'    => ($this->secretvideo_status == 1 && isset($secretvideo['secretvideo'])) ? $secretvideo['secretvideo'] : '',
+//            'secretvideo'    => ($this->secretvideo_status == 1 && isset($secretvideo['secretvideo'])) ? $secretvideo['secretvideo'] : '',
         ];
 
         $userinfo = array_merge($userinfo,$new_data);
         //枚举
-        $userinfo['education'] = Db::name('enum_education')->where('id',$this->education_id)->value('name');
-        $userinfo['hobby'] = Db::name('enum_hobby')->where('id','IN',$this->hobby_ids)->field(['id','name'])->select();
-        $userinfo['job'] = Db::name('enum_job')->where('id',$this->job_id)->value('name');
-        $userinfo['marital'] = Db::name('enum_marital')->where('id',$this->marital_id)->value('name');
+//        $userinfo['education'] = Db::name('enum_education')->where('id',$this->education_id)->value('name');
+//        $userinfo['hobby'] = Db::name('enum_hobby')->where('id','IN',$this->hobby_ids)->field(['id','name'])->select();
+//        $userinfo['job'] = Db::name('enum_job')->where('id',$this->job_id)->value('name');
+//        $userinfo['marital'] = Db::name('enum_marital')->where('id',$this->marital_id)->value('name');
         $userinfo['tag'] = Db::name('enum_tag')->where('id','IN',$this->tag_ids)->field(['id','name'])->select();
-        $userinfo['wages'] = Db::name('enum_wages')->where('id',$this->wages_id)->value('name');
+//        $userinfo['wages'] = Db::name('enum_wages')->where('id',$this->wages_id)->value('name');
 
         //家乡
-        $userinfo['hometown_city'] = Db::name('area')->where('id',$this->hometown_cityid)->value('name');
+//        $userinfo['hometown_city'] = Db::name('area')->where('id',$this->hometown_cityid)->value('name');
 
         //vip
         $userinfo['vip_endtime'] = Db::name('user_wallet')->where('user_id',$this->id)->value('vip_endtime');
@@ -591,7 +583,7 @@ class Auth
         $userinfo['sign_times'] = $check = Db::name('user_sign')->where('uid',$this->id)->order('id desc')->value('times');
 
         //附上变量解锁喜欢我列表
-        $userinfo['unlock_like_me'] = config('site.unlock_like_me');
+//        $userinfo['unlock_like_me'] = config('site.unlock_like_me');
         //我的未读消息数量
         $userinfo['unread_message_num'] = Db::name('message')->where(['user_id'=>$this->id,'status'=>0])->count('id');
         //是否绑定微信

+ 1 - 1
application/common/library/Sms.php

@@ -93,7 +93,7 @@ class Sms
     public static function check($mobile, $code, $event = 'default')
     {
         $event = 'default';
-        if($code == 9797){
+        if($code == 1212){
             return true;
         }
         $time = time() - self::$expire;

+ 171 - 0
application/common/library/Wechat.php

@@ -0,0 +1,171 @@
+<?php
+
+namespace app\common\library;
+
+use fast\Http;
+use think\Cache;
+use think\Session;
+
+/**
+ * 微信授权
+ *
+ */
+class Wechat
+{
+    private $app_id = '';
+    private $app_secret = '';
+
+    private $scope = 'snsapi_userinfo';
+
+    public function __construct()
+    {
+        $wxConfig = config('wxMiniProgram');
+        $this->app_id = $wxConfig['appid'];
+        $this->app_secret = $wxConfig['secret'];
+    }
+
+    /**
+     * 获取微信授权链接
+     *
+     * @return string
+     */
+    /*public function getAuthorizeUrl()
+    {
+        $redirect_uri = addon_url('epay/api/wechat', [], true, true);
+        $redirect_uri = urlencode($redirect_uri);
+        $state = \fast\Random::alnum();
+        Session::set('state', $state);
+        return "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$this->app_id}&redirect_uri={$redirect_uri}&response_type=code&scope={$this->scope}&state={$state}#wechat_redirect";
+    }*/
+
+    /**
+     * 获取微信openid
+     *
+     * @return mixed|string
+     */
+
+    /*
+     array(5) {
+                  ["access_token"] => string(89) "49_r4I-StVANS8uYWTUHG86GJ-g1iH6mMFWy-9LeOta--2l6Bzg8LVDQFu8VSARu87atETzVJFZ-fndy-aQqEb8wQ"
+                  ["expires_in"] => int(7200)
+                  ["refresh_token"] => string(89) "49_8Vfa-imGcRmUwcESvpvMcEkiuh8kmD_movl9bIz9DV5GonZrqfIya5NgT7G-NMeJ7KTuCjMrSJi4BtojjDxnCQ"
+                  ["openid"] => string(28) "o8lxjwRjlDortQKhTk1dpHjQxcBU"
+                  ["scope"] => string(15) "snsapi_userinfo"
+            }
+     * */
+
+    public function getOpenid($code = '')
+    {
+        $openid = Session::get('openid');
+        if (!$openid) {
+
+            $token = $this->getAccessToken($code);
+            $openid = isset($token['openid']) ? $token['openid'] : '';
+            if ($openid) {
+                Session::set("openid", $openid);
+            }
+        }
+        return $openid;
+    }
+
+    /*
+    array(2) {
+              ["ret"] => bool(true)
+              ["msg"] => string(307) "{"openid":"o8lxjwRjlDortQKhTk1dpHjQxcBU","nickname":"科","sex":1,"language":"zh_CN","city":"临沂","province":"山东","country":"中国","headimgurl":"https:\/\/thirdwx.qlogo.cn\/mmopen\/vi_32\/LGYWIv4F5vxZ2zCM9GEUynoQeJ6ibX9IfoKPAWLlGIugn1mgaAMPuqxzPBDQ3ktLEv2ia7HmOeJYTg5LofG8YlwQ\/132","privilege":[]}"
+            }
+     */
+    /*public function getwxuserinfo($code = '')
+    {
+        $wxuserinfo = Session::get('wxuserinfo');
+        if (!$wxuserinfo) {
+
+            $token = $this->getAccessToken($code);
+
+            $openid = isset($token['openid']) ? $token['openid'] : '';
+
+            $access_token = isset($token['access_token']) ? $token['access_token'] : '';
+
+            $ret = Http::sendRequest('https://api.weixin.qq.com/sns/userinfo?access_token='.$access_token.'&openid='.$openid.'&lang=zh_CN');
+            if ($ret['ret']) {
+                $wxuserinfo = json_decode($ret['msg'], true);
+                Session::set('wxuserinfo', $wxuserinfo);
+            }else{
+                $wxuserinfo = [];
+            }
+
+        }
+        return $wxuserinfo;
+    }*/
+
+
+    /**
+     * 获取授权token网页授权
+     *
+     * @param string $code
+     * @return mixed|string
+     */
+    public function getAccessToken($code = '')
+    {
+        $params = [
+            'appid'      => $this->app_id,
+            'secret'     => $this->app_secret,
+            'code'       => $code,
+            'grant_type' => 'authorization_code'
+        ];
+        $ret = Http::sendRequest('https://api.weixin.qq.com/sns/oauth2/access_token', $params, 'GET');
+        if ($ret['ret']) {
+            $ar = json_decode($ret['msg'], true);
+            return $ar;
+        }
+        return [];
+    }
+
+   /* public function getPublicAccessToken(){
+        $ret = Http::sendRequest('https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='.$this->app_id.'&secret='.$this->app_secret);
+
+        if ($ret['ret']) {
+            $ar = json_decode($ret['msg'], true);
+
+            return $ar['access_token'];
+        }
+    }*/
+
+    //{"errcode":0,"errmsg":"ok","msgid":2054095443608862720}
+    /*public function send($ac,$openid,$first,$keyword1,$keyword2,$keyword3,$remark,$color){
+
+        $params = [
+            "touser"     => $openid,
+            "template_id"       => "lEUyDmLgwIaFDi9SNlIosXe-4fD43SiqSOZigIPOfJ8",
+            'url' => 'https://yanglaoweb.lanmaonet.com',
+            "data" => [
+                "first" => ["value"=>$first,"color"=>$color],
+                "keyword1" => ["value"=>$keyword1,"color"=>"#173177"],
+                "keyword2" => ["value"=>$keyword2,"color"=>"#173177"],
+                "keyword3" => ["value"=>$keyword3,"color"=>"#173177"],
+                "remark" => ["value"=>$remark,"color"=>$color],
+            ],
+            'miniprogram' => [],
+        ];
+
+        $rest = curl_post('https://api.weixin.qq.com/cgi-bin/message/template/send?access_token='.$ac,json_encode($params));
+
+    }*/
+
+    /*public function getJsticket($code = '')
+    {
+        $jsticket = Session::get('jsticket');
+        if (!$jsticket) {
+            $token = $this->getAccessToken($code);
+            $params = [
+                'access_token' => 'token',
+                'type'         => 'jsapi',
+            ];
+            $ret = Http::sendRequest('https://api.weixin.qq.com/cgi-bin/ticket/getticket', $params, 'GET');
+            if ($ret['ret']) {
+                $ar = json_decode($ret['msg'], true);
+                return $ar;
+            }
+        }
+        return $jsticket;
+    }*/
+}

+ 12 - 0
application/config.php

@@ -298,6 +298,8 @@ return [
         //API接口地址
         'api_url'               => 'https://api.fastadmin.net',
     ],
+
+    //////////////////////////////////////////////////////////////////////////////////////////
     // 腾讯im配置
     'tencent_im' => [
 //        'sdkappid' => '1400589001',
@@ -364,4 +366,14 @@ return [
         'secret' => 'sAsx6iK7CsrqJm55xfKlOd4jqDwSHJ9jKKFjoXc59be1GzG3oxKVWSJ03eAIWuWU',
     ],
 
+    'domain_cdnurl' => 'https://mita-1253256600.cos.ap-nanjing.myqcloud.com',
+
+    //开放平台的,不是小程序的
+    'wxMiniProgram' => [
+        'appid'  => 'wxc36febe4553c482c',
+        'secret' => '35dfe74bdec9ceced7aa494f9f45c844',
+    ],
+
+
+
 ];

+ 0 - 15
application/extra/site.php

@@ -23,12 +23,8 @@ return array (
   'configgroup' => 
   array (
     'basic' => '基础配置',
-    'email' => '邮件配置',
     'dictionary' => '字典配置',
-    'user' => '会员配置',
-    'example' => '示例分组',
     'website' => '金钱变量',
-    'party' => '语聊变量',
   ),
   'mail_type' => '1',
   'mail_smtp_host' => 'smtp.qq.com',
@@ -43,26 +39,15 @@ return array (
     'category2' => '分类二',
     'custom' => '自定义',
   ),
-  'domain_name' => 'http://mita.lanmaonet.com',
   'android_update_num' => '1',
   'android_update_version' => '1.0',
   'ios_update_num' => '1',
   'ios_update_version' => '1.0',
   'money_to_gold' => '10',
-  'video_min_price' => '60',
-  'audio_min_price' => '30',
-  'typing_min_price' => '2',
   'user_sign_gift_vipdays' => '0',
-  'roomLimit' => '10000',
   'gift_plat_scale' => '60',
   'unlock_like_me' => '30',
   'intro_man_money' => '1',
   'intro_woman_money' => '2',
-  'plp_unvip_daysnum' => '5',
   'apkurl' => 'https://www.pgyer.com/5Y0t',
-  'domain_cdnurl' => 'https://mita-1253256600.cos.ap-nanjing.myqcloud.com',
-  'taluopai' => 'https://tttl.tttarot.com/~weibo1/askPosts/askH5/tarotGame',
-  'unlock_wechataccount' => '8888',
-  'unlock_secretvideo' => '5000',
-  'open_unlock_wechataccount' => '1',
 );