Browse Source

注销原因配置,注销规则,兑换金币规则

lizhen_gitee 3 months ago
parent
commit
f83190b260

+ 59 - 107
application/api/controller/User.php

@@ -509,6 +509,65 @@ class User extends Api
         }
     }
 
+    /**
+     * 微信注册来的,绑定手机号
+     *
+     * @ApiMethod (POST)
+     * @param string $mobile   手机号
+     * @param string $captcha 验证码
+     */
+    public function bindmobile()
+    {
+        $user = $this->auth->getUser();
+        $mobile = $this->request->request('mobile');
+        $captcha = $this->request->request('captcha');
+
+        if(!empty($this->auth->mobile)){
+            $this->error('已经绑定了手机号');
+        }
+        if (!$mobile || !$captcha) {
+            $this->error(__('Invalid parameters'));
+        }
+        if (!Validate::regex($mobile, "^1\d{10}$")) {
+            $this->error(__('Mobile is incorrect'));
+        }
+        if (\app\common\model\User::where('mobile', $mobile)->find()) {
+            $this->error('该手机号已被其他用户绑定');
+        }
+        $result = Sms::check($mobile, $captcha, 'changemobile');
+        if (!$result) {
+            $this->error(__('Captcha is incorrect'));
+        }
+
+        $user->mobile = $mobile;
+        $user->save();
+
+        Sms::flush($mobile, 'changemobile');
+
+        //手机号奖励
+        $task_rs = \app\common\model\TaskLog::tofinish($this->auth->id,18);
+        if($task_rs === false){
+            Db::rollback();
+            return false;
+        }
+        $this->success('success',$this->userInfo('return'));
+    }
+
+
+    //注销配置
+    public function cancleconfig(){
+        $rs = [
+            'rule' => config('site.user_cancle_rules'),
+            'reason' => [
+                            '想换个新账号',
+                            '没有聊得来的',
+                            '不想玩了',
+                            '其他原因',
+                        ],
+        ];
+        $this->success(1,$rs);
+    }
+
     //假注销
     public function cancleUser(){
         if (!$this->request->isPost()) {
@@ -1109,51 +1168,6 @@ class User extends Api
         Sms::flush($mobile, 'changemobile');
         $this->success();
     }
-    /**
-     * 微信注册来的,绑定手机号
-     *
-     * @ApiMethod (POST)
-     * @param string $mobile   手机号
-     * @param string $captcha 验证码
-     */
-    /*public function bindmobile()
-    {
-        $user = $this->auth->getUser();
-        $mobile = $this->request->request('mobile');
-        $captcha = $this->request->request('captcha');
-
-        if(!empty($this->auth->mobile)){
-            $this->error('已经绑定了手机号');
-        }
-        if (!$mobile || !$captcha) {
-            $this->error(__('Invalid parameters'));
-        }
-        if (!Validate::regex($mobile, "^1\d{10}$")) {
-            $this->error(__('Mobile is incorrect'));
-        }
-        if (\app\common\model\User::where('mobile', $mobile)->find()) {
-            $this->error('该手机号已被其他用户绑定');
-        }
-        $result = Sms::check($mobile, $captcha, 'changemobile');
-        if (!$result) {
-            $this->error(__('Captcha is incorrect'));
-        }
-        $verification = $user->verification;
-        $verification->mobile = 1;
-        $user->verification = $verification;
-        $user->mobile = $mobile;
-        $user->save();
-
-        Sms::flush($mobile, 'changemobile');
-
-        //手机号奖励
-        $task_rs = \app\common\model\TaskLog::tofinish($this->auth->id,18);
-        if($task_rs === false){
-            Db::rollback();
-            return false;
-        }
-        $this->success('success',$this->userInfo('return'));
-    }*/
 
     /**
      * 手机号注册来的,绑定微信
@@ -1924,68 +1938,6 @@ class User extends Api
         $this->success('用户', $id);
     }
 
-    //绑定支付宝账号信息
-    public function bindalipayaccount() {
-        $mt_user_bank = Db::name('user_bank');
-        $count = $mt_user_bank->where(['user_id' => $this->auth->id, 'type' => 1])->count();
-        if ($count) {
-            $this->error('您已绑定支付宝啦');
-        }
-
-        $auth_code = input('auth_code', '', 'trim');
-        if (!$auth_code) {
-            $this->error('授权码缺失');
-        }
-        //获取支付宝用户信息
-        $rs = getAlipayInfo($auth_code);
-        if ($rs['status'] == 0) {
-            $this->error($rs['info']);
-        }
-        $rs = $rs['data'];
-        /*
-         * Array(
-            [alipay_user_info_share_response] => Array
-                (
-                    [code] => 10000
-                    [msg] => Success
-                    [avatar] => https://tfs.alipayobjects.com/images/partner/T1BQJsXhhbXXXXXXXX  头像
-                    [city] => 临沂市       市名称。
-                    [gender] => m       【注意】只有is_certified为T的时候才有意义,否则不保证准确性. 性别(F:女性;M:男性)。
-                    [is_certified] => T   是否通过实名认证。T是通过 F是没有实名认证。
-                    [is_student_certified] => F  是否是学生 T是 F否
-                    [nick_name] => 风的追求         用户昵称
-                    [province] => 山东省        省份名称
-                    [user_id] => 2088902918001020  支付宝用户的userId
-                    [user_status] => T  用户状态(Q/T/B/W)。 Q代表快速注册用户 T代表已认证用户 B代表被冻结账户 W代表已注册,未激活的账户
-                    [user_type] => 2  用户类型(1/2) 1代表公司账户2代表个人账户
-                )
-            )
-        */
-
-        $data['banknumber'] = $rs['user_id']; //支付宝用户id
-        if (!$data['banknumber']) {
-            $this->error('获取用户信息失败');
-        }
-        $bank_number_count = $mt_user_bank->where(['banknumber' => $data['banknumber'], 'type' => 1])->count();
-        if ($bank_number_count) {
-            $this->error('该支付宝账号已经绑定用户, 请先解除绑定');
-        }
-
-        if (isset($rs['nick_name'])) {
-            $data['realname'] = $rs['nick_name'];  //支付宝用户昵称
-        }
-
-        $data['user_id'] = $this->auth->id;
-        $data['createtime'] = time();
-        $data['type'] = 1;
-
-        $rt = $mt_user_bank->insertGetId($data);
-        if (!$rt) {
-            $this->error('绑定失败');
-        }
-
-        $this->success('绑定成功');
-    }
 
  
 }

+ 64 - 0
application/api/controller/Userbank.php

@@ -117,5 +117,69 @@ class Userbank extends Api
         $this->success('success', $info);
     }
 
+    //绑定支付宝账号信息
+    public function bindalipayaccount() {
+        $mt_user_bank = Db::name('user_bank');
+        $count = $mt_user_bank->where(['user_id' => $this->auth->id, 'type' => 1])->count();
+        if ($count) {
+            $this->error('您已绑定支付宝啦');
+        }
+
+        $auth_code = input('auth_code', '', 'trim');
+        if (!$auth_code) {
+            $this->error('授权码缺失');
+        }
+        //获取支付宝用户信息
+        $rs = getAlipayInfo($auth_code);
+        if ($rs['status'] == 0) {
+            $this->error($rs['info']);
+        }
+        $rs = $rs['data'];
+        /*
+         * Array(
+            [alipay_user_info_share_response] => Array
+                (
+                    [code] => 10000
+                    [msg] => Success
+                    [avatar] => https://tfs.alipayobjects.com/images/partner/T1BQJsXhhbXXXXXXXX  头像
+                    [city] => 临沂市       市名称。
+                    [gender] => m       【注意】只有is_certified为T的时候才有意义,否则不保证准确性. 性别(F:女性;M:男性)。
+                    [is_certified] => T   是否通过实名认证。T是通过 F是没有实名认证。
+                    [is_student_certified] => F  是否是学生 T是 F否
+                    [nick_name] => 风的追求         用户昵称
+                    [province] => 山东省        省份名称
+                    [user_id] => 2088902918001020  支付宝用户的userId
+                    [user_status] => T  用户状态(Q/T/B/W)。 Q代表快速注册用户 T代表已认证用户 B代表被冻结账户 W代表已注册,未激活的账户
+                    [user_type] => 2  用户类型(1/2) 1代表公司账户2代表个人账户
+                )
+            )
+        */
+
+        $data['banknumber'] = $rs['user_id']; //支付宝用户id
+        if (!$data['banknumber']) {
+            $this->error('获取用户信息失败');
+        }
+        $bank_number_count = $mt_user_bank->where(['banknumber' => $data['banknumber'], 'type' => 1])->count();
+        if ($bank_number_count) {
+            $this->error('该支付宝账号已经绑定用户, 请先解除绑定');
+        }
+
+        if (isset($rs['nick_name'])) {
+            $data['realname'] = $rs['nick_name'];  //支付宝用户昵称
+        }
+
+        $data['user_id'] = $this->auth->id;
+        $data['createtime'] = time();
+        $data['type'] = 1;
+
+        $rt = $mt_user_bank->insertGetId($data);
+        if (!$rt) {
+            $this->error('绑定失败');
+        }
+
+        $this->success('绑定成功');
+    }
+
+
 
 }

+ 4 - 3
application/common/model/User.php

@@ -40,11 +40,11 @@ class User extends Model
      */
     public function getAvatarAttr($value, $data)
     {
-        if (!$value) {
+        /*if (!$value) {
             //如果不需要启用首字母头像,请使用
             //$value = '/assets/img/avatar.png';
             $value = letter_avatar($data['nickname']);
-        }
+        }*/
         return $value;
     }
 
@@ -53,7 +53,8 @@ class User extends Model
      */
     public function getGroupAttr($value, $data)
     {
-        return UserGroup::get($data['group_id']);
+        return '';
+//        return UserGroup::get($data['group_id']);
     }
 
     /**

+ 13 - 1
application/extra/site.php

@@ -28,6 +28,7 @@ return array (
     'website' => '金钱变量',
     'version' => '版本配置',
     'withdraw' => '提现配置',
+    'showrules' => '显示规则配置',
   ),
   'mail_type' => '1',
   'mail_smtp_host' => 'smtp.163.com',
@@ -69,7 +70,7 @@ return array (
   'withdrawal_show' => '1、提现需要完成实名认证、否则无法提现
 2、上一次申请提现通过后,才可继续申请
 3、提现扣除手续费7%
-3、相关额度会在2个工作日内审核发放,请注意查收',
+3、相关额度会在1个工作日内审核发放,请注意查收',
   'typename' => '推荐,附近,新人',
   'randomuser_num' => '10000',
   'pay_customer_service_id' => '32',
@@ -97,4 +98,15 @@ return array (
   'boy_vip_free_greet_num' => '5',
   'rmb_to_gold' => '10',
   'withdraw_min_money' => '100',
+  'user_cancle_rules' => '注销后,你的账号将:
+1、无法登录;
+2、所有信息将被永久删除,你的好友无法再与你取得联系;
+3、所有零钱、道具、等级等个人数据将全部清空;
+4、账户内获得的收益、金币、礼物等奖动将视作自动放弃;
+5、绑定手机/微信等将会解绑,解绑后可再次注册新的账号;
+6、请确保所有交易已完结且无纠纷,账户注销后,历史交易可能产生的资金退回权益将视作自动放弃;
+7、其他不限于以上所列举的,账号的资产和权益将视为自动放弃;
+8、15天后自动注销,15天内再次登录账号即视为放弃注销;请谨慎使用账号注销功能,账号一旦注销将无法找回,因该账号注销带来的问题,平台不承担任何责任。',
+  'exchange_rule' => '1、每个档位不限制兑换次数
+2、兑换金币即可到账,若出现兑换失败或延迟的情况,请联系在线客服处理',
 );