model = new UserExtractModel(); $this->uid = get_login_admin('id'); } /** * 数据列表 */ public function datalist() { if (request()->isAjax()) { $param = get_params(); $where = []; $list = $this->model->getUserExtractList($where,$param); foreach ($list as $k =>$v){ $list[$k]['uid'] = Db::connect('shop')->table('eb_user')->where('uid',$v['uid'])->value('nickname'); if($v['extract_type'] == 0){ $list[$k]['extract_type'] = '银行卡'; } if($v['extract_type'] == 1){ $list[$k]['extract_type'] = '支付宝'; } if($v['extract_type'] == 2){ $list[$k]['extract_type'] = '微信'; } if($v['extract_type'] == 3){ $list[$k]['extract_type'] = '零钱'; } $list[$k]['admin_id'] = Db::connect('shop')->table('eb_system_admin')->where('admin_id',$v['admin_id'])->value('real_name'); } return table_assign(0, '', $list); } else{ return view(); } } /** * 添加 */ public function add() { if (request()->isAjax()) { $param = get_params(); // 检验完整性 try { validate(UserExtractValidate::class)->check($param); } catch (ValidateException $e) { // 验证失败 输出错误信息 return to_assign(1, $e->getError()); } $this->model->addUserExtract($param); }else{ return view(); } } /** * 编辑 */ public function edit() { $param = get_params(); if (request()->isAjax()) { // 检验完整性 try { validate(UserExtractValidate::class)->check($param); } catch (ValidateException $e) { // 验证失败 输出错误信息 return to_assign(1, $e->getError()); } $this->model->editUserExtract($param); }else{ $extract_id = isset($param['extract_id']) ? $param['extract_id'] : 0; $detail = $this->model->getUserExtractById($extract_id); if (!empty($detail)) { View::assign('detail', $detail); return view(); } else{ throw new \think\exception\HttpException(404, '找不到页面'); } } } /** * 查看信息 */ public function read() { $param = get_params(); $extract_id = isset($param['extract_id']) ? $param['extract_id'] : 0; $detail = $this->model->getUserExtractById($extract_id); if (!empty($detail)) { View::assign('detail', $detail); return view(); } else{ throw new \think\exception\HttpException(404, '找不到页面'); } } /** * 删除 * type=0,逻辑删除,默认 * type=1,物理删除 */ public function del() { $param = get_params(); $extract_id = isset($param['extract_id']) ? $param['extract_id'] : 0; $type = 1; $this->model->delUserExtractById($extract_id,$type); } }