hrjy 2 lat temu
rodzic
commit
6938de41a8

+ 8 - 13
app/admin/controller/user/User.php

@@ -133,8 +133,6 @@ class User extends AuthController
             ['money', 0],
             ['integration_status', 0],
             ['integration', 0],
-            ['anticipate_status', 0],
-            ['anticipate', 0],
         ], $this->request);
         if (!$uid) return $this->failed('数据不存在');
         $user = UserModel::get($uid);
@@ -142,7 +140,6 @@ class User extends AuthController
         BaseModel::beginTrans();
         $res1 = false;
         $res2 = false;
-        $res3 = false;
         $edit = array();
         if ($data['money_status'] && $data['money']) {//余额增加或者减少
             if ($data['money_status'] == 1) {//增加
@@ -190,7 +187,6 @@ class User extends AuthController
         } else {
             $res2 = true;
         }
-
         if ($data['anticipate_status'] && $data['anticipate']) {//趣豆增加或者减少
             if ($data['anticipate_status'] == 1) {//增加
                 $edit['anticipate'] = bcadd($user['anticipate'], $data['anticipate'], 2);
@@ -294,13 +290,13 @@ class User extends AuthController
         else
             return Json::fail('清除失败');
     }
-	
-	/**
-	 * 修改实名认证状态状态
-	 *
-	 * @return json
-	 */
-	
+
+    /**
+     * 修改实名认证状态状态
+     *
+     * @return json
+     */
+
 
     /**
      * 修改user表状态
@@ -396,7 +392,6 @@ class User extends AuthController
             ['status', 0],
             ['is_agent', 0],
             ['spread_time', ''],
-            ['anticipate']
         ]);
         if (!$uid) return $this->failed('数据不存在');
         $user = UserModel::get($uid);
@@ -861,4 +856,4 @@ class User extends AuthController
     {
         return Json::successful(UserBillAdmin::getOneBalanceChangList(compact('uid', 'page', 'limit')));
     }
-}
+}

+ 111 - 0
app/admin/controller/user/UserAuth.php

@@ -0,0 +1,111 @@
+<?php
+
+namespace app\admin\controller\user;
+
+use app\admin\controller\AuthController;
+use think\facade\Route as Url;
+use crmeb\traits\CurdControllerTrait;
+use app\admin\model\user\User as UserModel;
+use app\admin\model\user\UserBill as UserBillAdmin;
+use app\admin\model\system\{SystemUserLevel,SystemUserTask};
+use crmeb\services\{UtilService,JsonService,FormBuilder as Form};
+/**
+ * 会员设置
+ * Class UserLevel
+ * @package app\admin\controller\user
+ */
+class UserAuth extends AuthController
+{
+    use CurdControllerTrait;
+
+    /*
+     * 审核展示
+     * */
+    public function index()
+    {
+        return $this->fetch();
+    }
+
+    /*
+     * 创建form表单
+     * */
+    public function create($uid =0)
+    {
+		if ($uid) $vipinfo = UserModel::get($uid);
+        $field[] = Form::input('off', '拒绝理由', isset($vipinfo) ? $vipinfo->off: '')->col(Form::col(24));
+        $form = Form::make_post_form('添加拒绝理由', $field, Url::buildUrl('save', ['uid' => $uid]), 2);
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+    }
+
+    /*
+     * 审核/拒绝
+     * @param $uid 审核的用户uid
+     * @return json
+     * */
+    public function save($uid = 0)
+    {
+        $data = UtilService::postMore([
+            ['off', ''],
+        ]);
+        if (!$data['off']) return JsonService::fail('请输入拒绝理由');
+		if($data['off']){
+			// 查询是否已审核
+			$res1=UserModel::where(['uid' => $uid])->find();
+			if($res1['is_auth']==2||$res1['is_auth']==3){
+				 return JsonService::fail('该信息已审核!不可操作');
+			}
+			$res=UserModel::where(['uid' => $uid])->update(['off' =>$data['off'],'is_auth'=>"3"]);
+			if($res>0){
+				return JsonService::successful('审核成功');
+			}else{
+				 return JsonService::fail('该信息已审核!不可重复');
+			}
+		}
+    }
+	
+	/*
+	 * 审核通过
+	 * @param int $id
+	 * */
+	public function pass($uid = 0){
+		 if($uid){
+			// 查询是否已审核
+			$res1=UserModel::where(['uid' => $uid])->find();
+			if($res1['is_auth']==2||$res1['is_auth']==3){
+				 return JsonService::fail('该信息已审核!不可操作');
+			}
+			$res=UserModel::where(['uid' => $uid])->update(['is_auth' =>2,'f_integral'=>3000,'off'=>"", 'is_new' => 1]);
+			if($res>0){
+				// 添加积分充值记录
+				$res2=UserBillAdmin::income('实名认证赠送',$uid, 'integral', 'top_add', 3000, 0, 3000, '首次实名赠送(竞拍消费满30000释放)');
+				return JsonService::successful('审核成功');
+				
+			}else{
+				 return JsonService::fail('审核失败');
+			} 
+		 }else{
+			 return JsonService::fail('参数错误!'); 
+		 }
+		
+		
+		
+		
+		
+	}
+    /*
+     * 获取列表
+     * @param int page
+     * @param int limit
+     * */
+    public function get_system_user_list()
+    {
+       $where =UtilService::getMore([
+           ['page', 1],
+           ['limit', 20],
+		   ['is_auth','<>',0]
+       ]);
+        return JsonService::successlayui(UserModel::authlist($where));
+    }
+  
+}

+ 21 - 21
app/admin/model/user/User.php

@@ -134,26 +134,26 @@ class User extends BaseModel
         }
         return $model;
     }
-	
-	// 获取用户实名认证信息列表
-	public static function authlist($where) {
-		 $model = new self;
-		 $list = $model->where('is_auth','<>',0)->page((int)$where['page'], (int)$where['limit'])->select();
-		 $count = $model->where('is_auth','<>',0)->count();
-		for($i=0;$i<$count;$i++){
-			if($list[$i]['is_auth']==1){
-			 $list[$i]['is_auth']="待审核";
-			}
-			if($list[$i]['is_auth']==2){
-			 $list[$i]['is_auth']="已通过";
-			}
-			if($list[$i]['is_auth']==3){
-			 $list[$i]['is_auth']="已拒绝";
-			}
-		}
-		return ['count' => $count, 'data' =>$list];
-		
-	}
+
+    // 获取用户实名认证信息列表
+    public static function authlist($where) {
+        $model = new self;
+        $list = $model->where('is_auth','<>',0)->page((int)$where['page'], (int)$where['limit'])->select();
+        $count = $model->where('is_auth','<>',0)->count();
+        for($i=0;$i<$count;$i++){
+            if($list[$i]['is_auth']==1){
+                $list[$i]['is_auth']="待审核";
+            }
+            if($list[$i]['is_auth']==2){
+                $list[$i]['is_auth']="已通过";
+            }
+            if($list[$i]['is_auth']==3){
+                $list[$i]['is_auth']="已拒绝";
+            }
+        }
+        return ['count' => $count, 'data' =>$list];
+
+    }
     /**
      * 异步获取当前用户 信息
      * @param $where
@@ -745,7 +745,7 @@ class User extends BaseModel
             ['name' => '生日', 'value' => ''],
             ['name' => '代理', 'value' => $UserInfo['is_agent'] ?'是' :'否'],
             ['name' => '可用趣豆', 'value' => $UserInfo['integral']],
-			['name' => '冻结趣豆', 'value' => $UserInfo['f_integral']],
+            ['name' => '冻结趣豆', 'value' => $UserInfo['f_integral']],
             ['name' => '上级推广人', 'value' => $UserInfo['spread_uid'] ? self::where('uid', $UserInfo['spread_uid'])->value('nickname') : ''],
             ['name' => '账户余额', 'value' => $UserInfo['now_money']],
             ['name' => '佣金总收入', 'value' => UserBill::where('category', 'now_money')->where('type', 'brokerage')->where('uid', $uid)->sum('number')],

+ 180 - 0
app/admin/view/user/user_auth/index.php

@@ -0,0 +1,180 @@
+{extend name="public/container"}
+{block name="content"}
+<div class="layui-fluid">
+    <div class="layui-row layui-col-space15"  id="app">
+        <div class="layui-col-md12">
+            <div class="layui-card">
+                <div class="layui-card-header">搜索条件</div>
+                <div class="layui-card-body">
+                    <form class="layui-form layui-form-pane" action="">
+                        <div class="layui-form-item">
+                            <div class="layui-inline">
+                                <label class="layui-form-label">审核状态</label>
+                                <div class="layui-input-block">
+                                    <select name="is_show">
+                                        <option value="">审核状态</option>
+                                        <option value="1">已审核</option>
+                                        <option value="0">未审核</option>
+                                    </select>
+                                </div>
+                            </div>
+                            <div class="layui-inline">
+                                <label class="layui-form-label">认证姓名</label>
+                                <div class="layui-input-block">
+                                    <input type="text" name="title" class="layui-input" placeholder="请输入姓名">
+                                </div>
+                            </div>
+                            <div class="layui-inline">
+                                <div class="layui-input-inline">
+                                    <button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit="search" lay-filter="search">
+                                        <i class="layui-icon layui-icon-search"></i>搜索</button>
+                                </div>
+                            </div>
+                        </div>
+                    </form>
+                </div>
+            </div>
+        </div>
+        <!--产品列表-->
+        <div class="layui-col-md12">
+            <div class="layui-card">
+                <div class="layui-card-header">审核列表</div>
+                <div class="layui-card-body">
+                    <table class="layui-hide" id="List" lay-filter="List"></table>
+                    <script type="text/html" id="icon">
+                        <img style="cursor: pointer;max-width: 50px;" lay-event='open_image' src="{{d.cidimg}}">
+                    </script>
+                    <script type="text/html" id="act">
+                        <button type="button" class="layui-btn layui-btn-xs" onclick="dropdown(this)">操作 <span class="caret"></span></button>
+                        <ul class="layui-nav-child layui-anim layui-anim-upbit">
+                            <li>
+                                <a lay-event='pass' href="javascript:void(0)">
+                                    <i class="fa fa-check"></i>通过认证
+                                </a>
+                            </li>
+                            <li>
+                                <a href="javascript:void(0)"onclick="$eb.createModalFrame(this.innerText,'{:Url(\'create\')}?uid={{d.uid}}')">
+                                    <i class="fa fa-times"></i>拒绝认证
+                                </a>
+                            </li>
+                        </ul>
+                    </script>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<script src="{__ADMIN_PATH}js/layuiList.js"></script>
+{/block}
+{block name="script"}
+<script>
+    //实例化form
+    layList.form.render();
+    //加载列表
+    layList.tableList('List',"{:Url('get_system_user_list')}",function (){
+        return [
+            {field: 'uid', title: '编号', sort: true,event:'id',width:'6%',align:"center"},
+            {field: 'cidimg', title: '身份证图片',templet:'#icon',align:"center",width:'10%'},
+            {field: 'real_name', title: '姓名',edit:'real_name',width:'6%',align:"center"},
+			{field: 'card_id', title: '身份证号',align:"center"},
+            {field: 'is_auth', title: '认证状态',templet:'#is_auth',width:'8%',align:"center"},
+			 {field: 'off', title: '理由',templet:'#off',width:'8%',align:"center"},
+            {field: 'right', title: '操作',align:'center',toolbar:'#act',width:'8%'},
+        ];
+    });
+    //自定义方法
+    var action= {
+        set_value: function (field, id, value) {
+            layList.baseGet(layList.Url({
+                a: 'set_value',
+                q: {field: field, id: id, value: value}
+            }), function (res) {
+                layList.msg(res.msg);
+            });
+        },
+    }
+    //查询
+    layList.search('search',function(where){
+        layList.reload(where,true);
+    });
+    layList.switch('is_show',function (odj,value) {
+        if(odj.elem.checked==true){
+            layList.baseGet(layList.Url({a:'set_show',p:{is_show:1,id:value}}),function (res) {
+                layList.msg(res.msg);
+            });
+        }else{
+            layList.baseGet(layList.Url({a:'set_show',p:{is_show:0,id:value}}),function (res) {
+                layList.msg(res.msg);
+            });
+        }
+    });
+    //快速编辑
+    layList.edit(function (obj) {
+        var id=obj.data.id,value=obj.value;
+        switch (obj.field) {
+            case 'name':
+                action.set_value('name',id,value);
+                break;
+            case 'grade':
+                action.set_value('grade',id,value);
+                break;
+            case 'discount':
+                action.set_value('discount',id,value);
+                break;
+        }
+    });
+    //监听并执行排序
+    layList.sort(['id','sort'],true);
+    //点击事件绑定
+    layList.tool(function (event,data,obj) {
+        switch (event) {
+            case 'pass':
+                var url=layList.U({a:'pass',q:{uid:data.uid}});
+                    $eb.axios.get(url).then(function(res){
+                        if(res.status == 200 && res.data.code == 200) {
+                            $eb.$swal('success',res.data.msg);
+							layList.reload();
+                        }else
+                            return Promise.reject(res.data.msg || '审核失败')
+                    }).catch(function(err){
+                        $eb.$swal('error',err);
+                    });
+                break;
+            case 'open_image':
+                $eb.openImage(data.cidimg);
+                break;
+        }
+    })
+    //下拉框
+    $(document).click(function (e) {
+        $('.layui-nav-child').hide();
+    })
+    function dropdown(that){
+        var oEvent = arguments.callee.caller.arguments[0] || event;
+        oEvent.stopPropagation();
+        var offset = $(that).offset();
+        var top=offset.top-$(window).scrollTop();
+        var index = $(that).parents('tr').data('index');
+        $('.layui-nav-child').each(function (key) {
+            if (key != index) {
+                $(this).hide();
+            }
+        })
+        if($(document).height() < top+$(that).next('ul').height()){
+            $(that).next('ul').css({
+                'padding': 10,
+                'top': - ($(that).parent('td').height() / 2 + $(that).height() + $(that).next('ul').height()/2),
+                'min-width': 'inherit',
+                'position': 'absolute'
+            }).toggle();
+        }else{
+            $(that).next('ul').css({
+                'padding': 10,
+                'top':$(that).parent('td').height() / 2 + $(that).height(),
+                'min-width': 'inherit',
+                'position': 'absolute'
+            }).toggle();
+        }
+    }
+</script>
+{/block}

+ 16 - 0
app/api/controller/user/UserBillController.php

@@ -345,4 +345,20 @@ class UserBillController
         return app('json')->successful(UserBill::userBillList($request->uid(), $page, $limit));
 
     }
+    /**
+     * 预约券记录
+     * @param Request $request
+     * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function anticipate_list(Request $request)
+    {
+        list($page, $limit) = UtilService::getMore([
+            [['page', 'd'], 0], [['limit', 'd'], 0]
+        ], $request, true);
+        return app('json')->successful(UserBill::userAnticipate($request->uid(), $page, $limit));
+
+    }
 }

+ 5 - 5
app/api/controller/user/UserController.php

@@ -22,7 +22,7 @@ use app\models\user\UserExtract;
 use app\models\user\UserNotice;
 use crmeb\services\GroupDataService;
 use crmeb\services\UtilService;
-use app\validate\User as Userva;
+use app\http\validates\user\UserValidates as Userva;
 /**
  * 用户类
  * Class UserController
@@ -82,11 +82,11 @@ class UserController
         ]);
         //规则验证
         if(!$validate->Check($info)){
-            return json($validate->getError());
+            return app('json')->fail($validate->getError());
         }
-		
+
 		$res=User::cidUser($info['rname'],$info['cidimg'], $info['cid'],$request->uid());
-		return $res;
+		return app('json')->success('上传成功');
     }
 	/**
 	 * 实名信息查询
@@ -99,7 +99,7 @@ class UserController
 		  $data=[
 			'is_auth'=>$res['is_auth'],
 			 'off'=>$res['off']
-			  
+
 		  ];
 		 return app('json')->success($data);
 	 }

+ 40 - 0
app/http/validates/user/UserValidates.php

@@ -0,0 +1,40 @@
+<?php
+namespace app\http\validates\user;
+
+
+use think\Validate;
+
+/**
+ * 注册验证
+ * Class RegisterValidates
+ * @package app\http\validates\user
+ */
+class UserValidates extends Validate
+{
+
+    protected $rule = [
+        'rname'  =>  'require',
+        'cid'  =>  'require|idCard',
+        'cidimg'  =>  'require',
+    ];
+
+    protected $message  =   [
+        'rname.require'     =>  '姓名必须填写',
+        'cid.require'     =>  '身份证必须填写',
+        'cidimg.require'     =>  '身份证图片必须上传',
+        'cid.idCard' => '身份证格式不对'
+
+    ];
+
+
+    public function sceneCode()
+    {
+        return $this->only(['phone']);
+    }
+
+
+    public function sceneRegister()
+    {
+        return $this->only(['account','captcha','password']);
+    }
+}

+ 3 - 2
app/models/auction/AuctionOrder.php

@@ -150,6 +150,7 @@ class AuctionOrder extends BaseModel
         $userModel = new \app\models\user\User();
         $productModel = new AuctionProduct();
         $user = $userModel->find($id);
+
         if ($user['spread_uid'] > 0){
             $s_price = number_format(($price - $product['price']) * 0.1, 2); // 卖出价格减去购买价格的百分之十 为上级直推奖励
             $spread = $userModel->find($user['spread_uid']);
@@ -207,10 +208,10 @@ class AuctionOrder extends BaseModel
         if ($user['is_new'] == 1){
 
             if ($user['spread_uid']) {
-                $spread = $userModel->where('id', $user['spread_uid'])->find();
+                $spread = $userModel->where('uid', $user['spread_uid'])->find();
                 $spread['green_time'] = strtotime(date('Y-m-d', strtotime('+1 day'))); // 开启明天的绿色通道
             }
-            $orderCount = AuctionOrder::where([['uid', '=',  $user['uid']], ['status', 3]])->count();
+            $orderCount = AuctionOrder::where([['uid', '=',  $user['uid']], ['status','=', 3]])->count();
             if ($orderCount >= 5){
                 $user['is_new'] = 0;
             }

+ 28 - 28
app/models/user/User.php

@@ -384,34 +384,34 @@ class User extends BaseModel
     {
         return self::edit(['avatar' => $avatar,'nickname' => $nickname], $uid, 'uid');
     }
-	/**
-	 * 修改个人身份信息
-	 * @param $CID 身份证号
-	 * @param $name 姓名
-	  * @param $cidimg 身份证图
-	 * @return bool
-	 */
-	public static function cidUser($rname,$cidimg,$cid,$uid)
-	{
-		// 查询该身份证在数据库中是否存在
-		$res=self::where('card_id',$cid)->find();
-		if($res['is_auth']==2){
-		return app('json')->fail('该身份信息已被注册');
-		}
-		$ress=self::where('uid',$uid)->find();
-		if($ress['is_auth']==1||$ress['is_auth']==2){
-			return app('json')->fail('您已提交认证,不可重复提交');
-		}
-		//找出出生年月日
-		$time= substr($cid,6,4).substr($cid,10,2).substr($cid,12,2);
-		$brithday=strtotime($time);
-		$rust=self::edit(['real_name'=>$rname,'cidimg'=>$cidimg, 'card_id'=>$cid,'is_auth'=>1,'off'=>'','birthday'=>$brithday], $uid, 'uid');
-		
-		if($rust){
-			return app('json')->successful("提交成功");
-		}
-		return app('json')->fail('提交失败');
-	}
+    /**
+     * 修改个人身份信息
+     * @param $CID 身份证号
+     * @param $name 姓名
+     * @param $cidimg 身份证图
+     * @return bool
+     */
+    public static function cidUser($rname,$cidimg,$cid,$uid)
+    {
+        // 查询该身份证在数据库中是否存在
+        $res=self::where('card_id',$cid)->find();
+        if($res['is_auth']==2){
+            return app('json')->fail('该身份信息已被注册');
+        }
+        $ress=self::where('uid',$uid)->find();
+        if($ress['is_auth']==1||$ress['is_auth']==2){
+            return app('json')->fail('您已提交认证,不可重复提交');
+        }
+        //找出出生年月日
+        $time= substr($cid,6,4).substr($cid,10,2).substr($cid,12,2);
+        $brithday=strtotime($time);
+        $rust=self::edit(['real_name'=>$rname,'cidimg'=>$cidimg, 'card_id'=>$cid,'is_auth'=>1,'off'=>'','birthday'=>$brithday], $uid, 'uid');
+
+        if($rust){
+            return app('json')->successful("提交成功");
+        }
+        return app('json')->fail('提交失败');
+    }
     /**
      * TODO 获取推广人数 一级
      * @param int $uid

+ 37 - 0
app/models/user/UserBill.php

@@ -85,6 +85,43 @@ class UserBill extends BaseModel
         return $list;
     }
 
+    /**
+     * 预约券
+     * @param $uid
+     * @param $page
+     * @param $limit
+     * @param string $category
+     * @return array|\think\Collection
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public static function userAnticipate($uid, $page, $limit, $category = 'anticipate')
+    {
+        if ($page) {
+            $list = self::where('uid', $uid)
+                ->where('category', $category)
+                ->field('mark,pm,number,add_time')
+                ->where('status', 1)
+                ->order('add_time DESC')
+                ->page((int)$page, (int)$limit)
+                ->select();
+        } else {
+            $list = self::where('uid', $uid)
+                ->where('category', $category)
+                ->field('mark,pm,number,add_time')
+                ->where('status', 1)
+                ->order('add_time DESC')
+                ->select();
+        }
+        $list = count($list) ? $list->toArray() : [];
+        foreach ($list as &$v) {
+            $v['add_time'] = date('Y/m/d H:i', $v['add_time']);
+            $v['number'] = floatval($v['number']);
+        }
+        return $list;
+    }
+
     /**
      * 获取昨日佣金
      * @param $uid

+ 2 - 0
route/api/route.php

@@ -53,6 +53,7 @@ Route::group(function () {
     Route::get('logout', 'AuthController/logout')->name('logout');// 退出登录
     Route::post('switch_h5', 'AuthController/switch_h5')->name('switch_h5');// 切换账号
     Route::post('binding', 'AuthController/binding_phone')->name('bindingPhone');// 绑定手机号
+    Route::post('rname', 'user.userController/rname')->name('rname');// 实名认证
     //产品类
     Route::get('product/code/:id', 'store.StoreProductController/code')->name('productCode');//产品分享二维码 推广员
 
@@ -145,6 +146,7 @@ Route::group(function () {
     Route::get('spread/count/:type', 'user.UserBillController/spread_count')->name('spreadCount');//推广 佣金 3/提现 4 总和
     Route::get('spread/banner', 'user.UserBillController/spread_banner')->name('spreadBanner');//推广分销二维码海报生成
     Route::get('integral/list', 'user.UserBillController/integral_list')->name('integralList');//积分记录
+    Route::get('anticipate/list', 'user.UserBillController/anticipate_list')->name('anticipate');//预约券记录
     //提现类
     Route::get('extract/bank', 'user.UserExtractController/bank')->name('extractBank');//提现银行/提现最低金额
     Route::post('extract/cash', 'user.UserExtractController/cash')->name('extractCash');//提现申请