userModel = new \app\common\model\User(); } /** * 获取个人信息 */ public function getUserInfo() { $user_id = input("user_id"); if (!$user_id) { $this->error(__('Invalid parameters')); } // 获取基本信息 $where = []; $where["id"] = $user_id; $userInfo = $this->userModel->field("id,nickname,mobile,avatar,gender,u_id,level,age_id,province_id,city_id,desc,charm_level,wealth_level,job_id")->where($where)->find(); if(!$userInfo){ $this->error('不存在的用户'); } $userInfo = info_domain_image($userInfo,['avatar']); //用户钱包 $userwallet = Db::name('user_wallet')->where('user_id',$user_id)->find(); $userInfo['wallet'] = $userwallet; $userInfoA = $this->userModel->getAppendData($userInfo); $userInfo['age_text'] = $userInfoA['age_text']; $userInfo['province_text'] = $userInfoA['province_text']; $userInfo['city_text'] = $userInfoA['city_text']; // $userInfo['friends_num'] = $userInfoA['friends_num']; $userInfo['look_num'] = $userInfoA['look_num']; //关注人数,粉丝人数 $follow_num = Db::name('user_follow')->where(['uid'=>$user_id])->count('id'); $fans_num = Db::name('user_follow')->where(['follow_uid'=>$user_id])->count('id'); $userinfo['follow_num'] = $follow_num; $userinfo['fans_num'] = $fans_num; // 查看者是否已关注 $userInfo["is_follow"] = $this->is_follow($this->auth->id,$user_id); $userInfo['is_friend'] = $this->is_friend($this->auth->id,$user_id); $userInfo['is_black'] = $this->is_black($this->auth->id,$user_id); // 获取用户在派对直播间情况信息 $redis = new Redis(); $redisconfig = config("redis"); $redis->connect($redisconfig["host"], $redisconfig["port"]); if ($redisconfig['redis_pwd']) { $redis->auth($redisconfig['redis_pwd']); } if($redisconfig['redis_selectdb'] > 0){ $redis->select($redisconfig['redis_selectdb']); } $livingUserPartyId = $redis->hGet("livingUser", $user_id); $userInfo['party_info'] = json([]); if ($livingUserPartyId) { $party = \app\common\model\Party::where('id',$livingUserPartyId)->field('id,room_type')->find(); $userInfo['party_info'] = ['party_id' => $party['id'], 'room_type' => $party['room_type']]; } $memberinfo = Db::name('guild_member')->alias('m')->field('m.id as `member_id`,m.user_id,guild.name,guild.image,guild.member,guild.desc')->join('guild','m.guild_id = guild.id','LEFT')->where(['m.user_id'=>$user_id,'m.status'=>1])->find(); if ($memberinfo) { $userInfo['memberinfo'] = $memberinfo; } //家族信息 $guildField = 'g.id,g.g_id,g.user_id,g.party_id,g.name,g.image,g.desc,g.member,g.status'; $guildWhere['gm.user_id'] = $user_id; $guildWhere['g.status'] = 1; $guildInfo = model('Guild')->alias('g')->field($guildField) ->join('guild_member gm','gm.guild_id = g.id','LEFT') ->where($guildWhere)->order('id desc')->find(); $userInfo['guild_info'] = !empty($guildInfo) ? $guildInfo : []; $guildStatus = -2; if (!empty($guildInfo)) { $guildStatus = (int)$guildInfo['status']; } $userInfo['guild_status'] = $guildStatus;//家族状态:公会状态:0=待审核,1=正常,-1=已解散,-2无公会 //访客记录 if ($this->auth->id != $user_id) { $visit_data = [ 'user_id' => $this->auth->id, 'visit_user_id' => $user_id, ]; $visit_check = Db::name('user_visitlist')->where($visit_data)->find(); if(empty($visit_check)){ $visit_data['updatetime'] = time(); Db::name('user_visitlist')->insertGetId($visit_data); }else{ Db::name('user_visitlist')->where('id',$visit_check['id'])->update(['updatetime'=>time()]); } } $this->success("获取成功!",$userInfo); } /** * 获取最近访客 * (消息) */ public function getMyVisitList(){ $list = Db::name('user_visitlist')->alias('uv') ->field('uv.user_id,uv.updatetime,user.nickname,user.avatar,user.gender,user.desc') ->join('user','uv.user_id = user.id','LEFT') ->where('uv.visit_user_id',$this->auth->id) //被访问者 ->order('uv.id desc')->autopage()->select(); $list = list_domain_image($list,['avatar']); if(!empty($list)){ foreach($list as $key => &$val){ //关注 $val['is_follow'] = $this->is_follow($this->auth->id,$val['user_id']); } } $this->success(1,$list); } /////////////////////////////////////////////////// /** * 获取关注人列表.派对信息 */ public function getFollowsLive() { $is_online = $this->request->request("is_online");// 是否在线:1=直播中,0=未开播 $page = $this->request->request('page',1); // 分页 $pageNum = $this->request->request('pageNum',10); // 分页 // 分页搜索构建 $pageStart = ($page-1)*$pageNum; $is_online == 1 || $is_online = 0; $fanfollowModel = new \app\common\model\UserFansFollow(); $where = []; $where["a.fans_id"] = $this->auth->id; $where["p.room_type"] = 2; $where["p.is_online"] = $is_online; if($is_online == 1) { $field = "p.id as party_id,u.u_id,u.nickname,p.party_name,p.party_hot,p.party_logo,u.avatar,t.id as party_type"; } else { $field = "p.id as party_id,a.user_id,u.avatar,u.gender,u.level,u.nickname,p.party_name,p.party_logo,t.id as party_type"; } $list = $fanfollowModel->alias("a") ->field($field) ->join("hx_user u","u.id = a.user_id") ->join("hx_party p","p.user_id = a.user_id") ->join("hx_party_type t","t.id = p.party_type","left") ->limit($pageStart,$pageNum) ->where($where)->select(); if($list) { foreach($list as $k => $v) { $mod = isset($v["party_type"])?intval($v["party_type"])%5:1; if(isset($v["type_name"]) && $v["type_name"]) { $type_name = $v["type_name"]; } else { $type_name = "普通房"; } $list[$k]["party_type"] = $type_name; $list[$k]["party_type_color"] = $mod == 0?5:$mod; } $this->success("获取成功!",$list); } else { $this->success("数据为空!",[]); } } /** * 获取个人技能列表 */ public function getMySkillList() { $user_id = $this->request->request('user_id',0); // 用户ID $page = $this->request->request('page',1); // 分页 $pageNum = $this->request->request('pageNum',10); // 分页 if ($user_id == -1) { $user_id = $this->auth->id; } elseif($user_id>0) { $user_id = intval($user_id); } else { $this->error(__('Invalid parameters')); } // 分页搜索构建 $pageStart = ($page-1)*$pageNum; $authModel = new \app\common\model\DispatchAuth(); $where = []; $where["a.user_id"] = $user_id; $where["a.status"] = 1; $authskillList = $authModel->alias("a") ->field("a.id,ds.image,ds.name,a.voice,a.voice_time,a.price,a.is_main,ds.unit") ->join("hx_dispatch_skill ds","ds.id = a.skill_id") ->where($where) ->limit($pageStart,$pageNum) ->select(); $this->success("获取成功!",$authskillList); } /** * 删除个人技能信息 */ public function delMySkillInfo() { $id = $this->request->request('id'); // 认证ID if (!$id) { $this->error(__('Invalid parameters')); } $authModel = new \app\common\model\DispatchAuth(); $where = []; $where["id"] = $id; $where["user_id"] = $this->auth->id; $authInfo = $authModel->where($where)->find(); if(!$authInfo) $this->error("技能认证未找到"); // if($authInfo->is_main == 1) $this->error("请先取消主技能,再删除!"); Db::startTrans(); try{ $res1 = $authInfo->delete(); $res2 = \app\common\model\UserSkill::where(["user_id"=>$this->auth->id,"skill_id"=>$authInfo->skill_id])->delete(); if($res1 && $res2) { Db::commit(); $this->success("删除成功!"); } else { $this->error("网络错误,请稍后重试!"); } }catch (ValidateException $e) { Db::rollback(); $this->error($e->getMessage()); } catch (PDOException $e) { Db::rollback(); $this->error($e->getMessage()); } catch (Exception $e) { Db::rollback(); $this->error($e->getMessage()); } } /** * 修改个人技能信息 */ public function editMySkillInfo() { $price = $this->request->request('price'); // 价格 $id = $this->request->request('id'); // 认证ID $is_main = $this->request->request('is_main'); // 是否设置为主技能 if (!$id && !$price) { $this->error(__('Invalid parameters')); } $authModel = new \app\common\model\DispatchAuth(); $where = []; $where["id"] = $id; if(!$authModel->where($where)->find()) $this->error("技能认证未找到"); Db::startTrans(); try{ if($is_main == 1) { $where = []; $where["user_id"] = $this->auth->id; $authModel->update(["is_main"=>0],$where); } $where = []; $where["id"] = $id; $data = []; $data["price"] = $price; $data["is_main"] = $is_main; $res = $authModel->update($data,$where); $myAuthList = $authModel->where(["user_id"=>$this->auth->id,"is_main"=>1])->find(); if(!$myAuthList) { $this->error("必须至少设置一个主技能"); Db::rollback(); } if($res) { Db::commit(); $this->success("修改成功!",$data); } else { $this->error("网络错误,请稍后重试!"); } }catch (ValidateException $e) { Db::rollback(); $this->error($e->getMessage()); } catch (PDOException $e) { Db::rollback(); $this->error($e->getMessage()); } catch (Exception $e) { Db::rollback(); $this->error($e->getMessage()); } } /** * 编辑个人信息(完善资料) */ /*public function editUserInfo() { $avatar = $this->request->request('avatar'); // 头像 $nickname = $this->request->request('nickname'); // 昵称 $age = $this->request->request('age'); // 年龄 $ageId = $this->request->request('age_id'); // 年龄段 $gender = $this->request->request('gender'); // 性别 0=女,1=男 $image = $this->request->request('image'); // 个人形象照 $constellationId = $this->request->request('star_id'); //星座ID $provinceId = $this->request->request('province_id'); //省ID $cityId = $this->request->request('city_id'); //城市ID $desc = $this->request->request('desc'); //个性签名 $where = []; $where["id"] = $this->auth->id; $data = []; $avatar && $data["avatar"] = $avatar; if($nickname){ if (mb_strlen($nickname) > 30) { $this->error('用户昵称最多支持30个汉字或组合'); } $data["nickname"] = $nickname; } $gender && $data["gender"] = $gender; $age && $data["age"] = $age; $image && $data["image"] = $image; $ageId && $data['age_id'] = $ageId; $constellationId && $data['constellation_id'] = $constellationId; $provinceId && $data['province_id'] = $provinceId; $cityId && $data['city_id'] = $cityId; $desc && $data['desc'] = $desc; $res = $this->userModel->update($data,$where); if($res) { $user = $this->userModel->where($where)->find(); if (!empty($user['nickname']) && !empty($user['avatar']) && !empty($user['age_id']) && $user['has_info']==0) { $data['has_info'] = 1; $this->userModel->update($data,$where); } $this->success("修改成功!"); } else { $this->error("网络错误,请稍后重试!"); } }*/ /** * 编辑个人信息(修改昵称和头像需要后台审核) */ /*public function editUser() { $avatar = $this->request->request('avatar'); // 头像 $nickname = $this->request->request('nickname'); // 昵称 if (!$avatar && !$nickname) { $this->error(__('请输入要修改的信息')); } $data = []; if ($avatar && $avatar != $this->auth->avatar) { $data["pre_avatar"] = $avatar; } if($nickname && $nickname != $this->auth->nickname){ if (mb_strlen($nickname) > 8) { $this->error('用户昵称最多支持8个汉字或组合'); } $data["pre_nickname"] = $nickname; } if (!empty($data)) { $data['need_check'] = 1; $where["id"] = $this->auth->id; $res = $this->userModel->update($data,$where); if(!$res) { $this->error("网络错误,请稍后重试!"); } } $this->success("修改成功!"); }*/ /** * 主播申请 */ public function anchorApply() { $type_id = $this->request->request('type_id',0); // 技能分类ID $party_type_id = $this->request->request('party_type_id'); //分类ID $desc = $this->request->request('desc'); // 申请备注 if (!$party_type_id && !$desc) { $this->error(__('Invalid parameters')); } $useranchorModel = new \app\common\model\UserAnchor(); $data = []; $data["user_id"] = $this->auth->id; $data["type_id"] = $type_id; $data["party_type_id"] = $party_type_id; if($useranchorModel->where($data)->find()) $this->error(__('您已申请过该类型的主播,请勿重复申请!')); $data["desc"] = $desc; $data["createtime"] = time(); $res = $useranchorModel->insertGetId($data); if($res) { \app\common\model\User::update(["is_anchor"=>1],["id"=>$this->auth->id]); $vbot = new \addons\vbot\Vbot(); $vbot->vbotSendMsg('Anchor_Application_Notice', [], []); $this->success("申请发送成功!"); } else { $this->error("网络错误,请稍后重试"); } } /** * 实名认证 */ public function authApply() { $realname = $this->request->request('realname'); // 真实姓名 $idcard = $this->request->request('idcard'); // 身份证号 $zimage = $this->request->request('zimage'); // 身份证正面照 $fimage = $this->request->request('fimage'); // 身份证反面照 if (!$realname && !$idcard && !$zimage && !$fimage) { $this->error(__('Invalid parameters')); } $userauthModel = new \app\common\model\UserAuth(); $data = []; $data["user_id"] = $this->auth->id; //$data["idcard"] = $idcard; $userAuth = $userauthModel->where($data)->find(); if (!empty($userAuth)) { if(in_array($userAuth['status'],[0,1])) $this->error('您已经申请过了,请勿重复操作!'); } // 测试需要 开始 $data["realname"] = $realname; $zimage && $data["zimage"] = $zimage; $fimage && $data["fimage"] = $fimage; $data["status"] = 1; if (!empty($userAuth)) { $data["updatetime"] = time(); $authWhere['user_id'] = $this->auth->id; $res = $userauthModel->where($authWhere)->update($data); } else { $data["createtime"] = time(); $res = $userauthModel->insertGetId($data); } if($res) { \app\common\model\User::update(["is_auth"=>2],["id"=>$this->auth->id]); $this->success("恭喜,实名认证成功!"); } else { $this->error("网络错误,请稍后重试"); } // 测试需要 结束 // 实名认证验证 $configInfo = config("auth"); $outh = new outh($configInfo["api_url"],$configInfo["customer_code"],$configInfo["private_key"],$configInfo["key"]); $out_trade_no = date("YmdHis").rand(1000,9999); $ret = $outh->toVerify($out_trade_no,$realname,$idcard); if(isset($ret["code"])) { if($ret["code"] == "1008") { $this->error(__('身份证格式错误')); } if($ret["code"] == "1009") { $this->error(__('身份证格式错误')); } if($ret["code"] == "0001") { $this->error(__('姓名和身份证号不匹配!')); } if($ret["code"] == "0000") { $data["realname"] = $realname; $zimage && $data["zimage"] = $zimage; $fimage && $data["fimage"] = $fimage; $data["status"] = 1; $data["createtime"] = time(); $res = $userauthModel->insertGetId($data); if($res) { \app\common\model\User::update(["is_auth"=>2],["id"=>$this->auth->id]); $this->success("恭喜,实名认证成功!"); } else { $this->error("网络错误,请稍后重试"); } } } else { $this->error("网络错误,请稍后重试"); } } /** * 获取主播分类 */ public function getAnchorType() { $this->success("获取成功!",\app\common\model\UserAnchorType::select()); } /** * redis 数据恢复---非redis数据丢失请勿使用!!!! */ public function shujuhuifu() { $key = $this->request->request("key");// 操作验证 123456 if($key != 123456) { $this->error(__('Invalid parameters')); } $giftuserpartyModel = new \app\common\model\GiftUserParty(); $redis = new Redis(); $redisconfig = config("redis"); $redis->connect($redisconfig["host"], $redisconfig["port"]); if ($redisconfig['redis_pwd']) { $redis->auth($redisconfig['redis_pwd']); } if($redisconfig['redis_selectdb'] > 0){ $redis->select($redisconfig['redis_selectdb']); } // 获取本周第一天 $weekday = $this->firstOfWeek(date("Y-m-d H:i:s")); // 获取本月第一天 $monthday = date("Ym01"); $where = []; $where["createtime"] = ["gt",strtotime($weekday)]; $list1 = $giftuserpartyModel->where($where)->select(); foreach($list1 as $k => $v) { // 添加redis记录做财富排行榜周榜用 $redis->zIncrBy("jewel_get_".$v["party_id"].":".$weekday,$v["value"],$v["user_to_id"]); // 添加redis记录做贡献排行榜周榜用 $redis->zIncrBy("jewel_to_".$v["party_id"].":".$weekday,$v["value"],$v["user_id"]); } $where = []; $where["createtime"] = ["gt",strtotime(date("Y-m-01"))]; $list2 = $giftuserpartyModel->where($where)->select(); foreach($list2 as $k => $v) { // 添加redis记录做财富排行榜月榜用 $redis->zIncrBy("jewel_get_".$v["party_id"].":".$monthday,$v["value"],$v["user_to_id"]); // 添加redis记录做贡献排行榜月榜用 $redis->zIncrBy("jewel_to_".$v["party_id"].":".$monthday,$v["value"],$v["user_id"]); } $this->success("执行成功!"); } /** * 获取用户钻石余额 */ public function getUserJewel() { //用户钱包 $data = Db::name('user_wallet')->field("jewel,money")->where('user_id',$this->auth->id)->find(); return $this->success("获取成功!",$data); } /** * 获取用户等级说明 */ public function getLevelExplain() { $data = \app\common\model\UserLevelExplain::field("title,content")->select(); return $this->success("获取成功!",$data); } /** * 获取用户等级信息 */ public function getUserLevelInfo() { $res = [];$exstart = 0;$exend = 0; $userModel = new \app\common\model\User(); $userInfo = $userModel->field("id,nickname,avatar,level,empirical")->where(["id"=>$this->auth->id])->find(); if(!$userInfo) { $this->error("用户信息获取失败!"); } $res["avatar"] = $userInfo['avatar']; $res["nickname"] = $userInfo['nickname']; // 获取用户当前经验值对应等级 $userconfigModel = new \app\common\model\UserLevelConfig(); $where = []; $where["empirical"] = ["elt",$userInfo["empirical"]]; $userexplainstart = $userconfigModel->where($where)->order("empirical","desc")->limit(1)->select(); $where = []; $where["empirical"] = ["gt",$userInfo["empirical"]]; $userexplainend = $userconfigModel->where($where)->order("empirical","asc")->limit(1)->select(); if(!$userexplainstart && !$userexplainend) { $this->error("经验等级信息获取失败!"); } elseif(!$userexplainstart && $userexplainend) { $res["level_start"] = 0; $res["level_end"] = $userexplainend[0]["level"]; } elseif($userexplainstart && !$userexplainend) { $res["level_start"] = $userexplainstart[0]["level"]; $res["level_end"] = $userexplainstart[0]["level"]; } elseif($userexplainstart && $userexplainend) { $res["level_start"] = $userexplainstart[0]["level"]; $res["level_end"] = $userexplainend[0]["level"]; } $userexplainstart && $exstart = $userexplainstart[0]["empirical"]; $userexplainend && $exend = $userexplainend[0]["empirical"]; $r1 = $exend-$exstart; // 等级经验值差 $r2 = $userInfo["empirical"]-$exstart; // 当前等级与最低等级经验值差 $r3 = $exend-$userInfo["empirical"]; // 还需多少经验值升级 if($r1 == 0) { $res["level_rate"] = 1; } elseif($r2 == 0) { $res["level_rate"] = 0; if($res["level_start"] == $res["level_end"]) { $res["level_rate"] = 1; } } else { $res["level_rate"] = intval(($r2/$r1)*100)/100; } $res["to_up_need"] = $r3>0?$r3:0; // // 满级 // if($r3 == 0 && !$userexplainend) { // $res["level_rate"] = 1; // } $this->success("获取成功!",$res); } /** * 钻石兑换记录 * @return void */ public function exchangeList() { try { $field = 'id,sound_coin,createtime'; $where['user_id'] = $this->auth->id; $result = model('UserExchangeLog')->field($field)->where($where)->autopage()->order('createtime desc')->select(); if (!empty($result)) { foreach ($result as $key => &$value) { $value['jewel'] = '+'.$value['sound_coin']; $value['createtime'] = !empty($value['createtime']) ? date('Y-m-d H:i',$value['createtime']) : ''; unset($value['sound_coin']); } } $this->success('获取成功',$result); } catch (Exception $e) { $this->error($e->getMessage()); } } /** * 钻石充值记录 * @return void */ public function rechargeList() { try { $field = 'id,detail,mode,value,createtime'; $where['user_id'] = $this->auth->id; $result = model('UserJewelLog')->field($field)->where($where)->autopage()->order('createtime desc')->select(); if (!empty($result)) { foreach ($result as $key => &$value) { $value['value'] = $value['mode'].$value['value']; $value['createtime'] = !empty($value['createtime']) ? date('Y-m-d H:i',$value['createtime']) : ''; } } $this->success('获取成功',$result); } catch (Exception $e) { $this->error($e->getMessage()); } } /** * 提现配置列表 * @return void */ public function withdrawalConfigList() { try { $field = 'id,money,real_money'; $result = model('WithdrawalConfig')->field($field)->autopage()->order('weigh asc')->select(); if (!empty($result)) { //设置是否使用自定义 $withdrawDefine = config('site.withdraw_define'); if ($withdrawDefine == 1) { $fieldArr = [[ 'id' => -1, 'money' => 0, 'real_money' => 0.00, ],]; $result = array_merge($result,$fieldArr); } } $this->success('获取成功',$result); } catch (Exception $e) { $this->error($e->getMessage()); } } /** * 提现 * @return void */ public function withdrawal() { Db::startTrans(); try { $withdrawConfigId = $this->request->param('id',0); $money = $this->request->param('money',0.00); $type = $this->request->param('type',0); $userId = $this->auth->id; $isAnchor = $this->auth->is_anchor; $userMoney = $this->auth->money; if (empty($withdrawConfigId) && empty($money)) { throw new Exception('参数错误'); } //只有主播可以提现 if ($isAnchor != 2) { throw new Exception('您不是主播不允许提现'); } if ($this->auth->power->withdraw == 1) { throw new Exception('您已被禁止提现'); } //验证提现类型 $withdrawTypeConfig = config('wallet.withdraw_type'); $typeIds = array_keys($withdrawTypeConfig); if (!in_array($type,$typeIds)) { throw new Exception('未知的提现类型'); } $typeStr = isset($withdrawTypeConfig[$type]) ? $withdrawTypeConfig[$type] : ''; $withdrawRateConfig = config('site.withdrawRate');//用户获取的金额比例(需要/100) $withdrawRate = bcdiv($withdrawRateConfig,100,2); if (!empty($money)) {//自定义金额 if ($money <= 0) { throw new Exception('金额有误'); } $inputMoney = $money; $moneys = bcmul($money,$withdrawRate,2); $platformMoney = bcsub($money,$moneys,2); } else {//提现配置 $where['id'] = $withdrawConfigId; $withdrawalConfig = model('WithdrawalConfig')->where($where)->find(); if (empty($withdrawalConfig)) { throw new Exception('未知的配置信息'); } $inputMoney = $withdrawalConfig['money']; $moneys = $withdrawalConfig['money']; $platformMoney = bcsub($moneys,$withdrawalConfig['real_money'],2);; } if ($moneys <= 0) { throw new Exception('申请金额异常'); } //扣减余额 记录余额日志 $walletRes = model('wallet')->lockChangeAccountRemain($userId, $inputMoney, '-', $userMoney, '申请提现', 104,'money'); if (!$walletRes['status']) { throw new Exception($walletRes['msg']); } $account = $name = ''; if ($type == 1) {//微信 $account = ''; $name = ''; } elseif ($type == 2) {//支付宝 $userAlipayWhere['user_id'] = $userId; $userAlipay = model('UserAlipay')->where($userAlipayWhere)->find(); if (empty($userAlipay)) { throw new Exception('请绑定支付宝'); } $account = $userAlipay['pay_no']; $name = $userAlipay['realname']; } elseif ($type == 3) {//银行 $userBankWhere['user_id'] = $userId; $userBank = model('UserBank')->where($userBankWhere)->find(); if (empty($userBank)) { throw new Exception('请绑定银行卡'); } $account = $userBank['bank_no']; $name = $userBank['realname']; } $realMoney = bcsub($inputMoney,$platformMoney,2); if ($realMoney < 0.1) { throw new Exception('输入金额请大于0.1'); } $data = [ 'user_id' => $userId,//用户ID 'money' => $inputMoney,//金额 'handingfee' => $platformMoney,//手续费 'real_money' => $realMoney,//金额 'taxes' => 0.00,//税费 'type' => $typeStr,//类型 'account' => $account,//提现账户 'name' => $name,//真实姓名 //'memo' => '',//备注 'orderid' => getMillisecond() . mt_rand(1, 1000),//订单号 //'transactionid' => '',//流水号 'status' => 'created',//状态:created=申请中,successed=成功,rejected=已拒绝 //'transfertime' => '',//转账时间 'createtime' => time(),//添加时间 ]; $withdrawRes = model('Withdraw')->insertGetId($data); if (!$withdrawRes) { throw new Exception('提现失败'); } Db::commit(); $vbot = new \addons\vbot\Vbot(); $vbot->vbotSendMsg('Withdrawal_Application_Notice', [], [ 'name' => $name, 'account' => $account, 'real_money' => $realMoney, 'type' => $typeStr, 'handingfee' => $platformMoney ]); $this->success('操作成功待审核'); } catch (Exception $e) { Db::rollback(); $this->error($e->getMessage()); } } /** * 提现列表 * @return void */ public function withdrawalList() { try { $field = 'id,money,type,status,createtime,transfertime'; $where=[]; $where['user_id'] = $this->auth->id; //$where['status'] = 'successed';//状态:created=申请中,successed=成功,rejected=已拒绝 $result = model('Withdraw')->field($field)->where($where)->autopage()->order('createtime desc')->select(); if (!empty($result)) { foreach ($result as $key => &$value) { $value['money'] = '-'.$value['money']; $value['createtime'] = !empty($value['createtime']) ? date('Y-m-d H:i', $value['createtime']) : ''; $value['transfertime'] = !empty($value['transfertime']) ? date('Y-m-d H:i', $value['transfertime']) : ''; } } $this->success('获取成功',$result); } catch (Exception $e) { $this->error($e->getMessage()); } } }