scene('modifyPassword')->check($data); $userModel = new UserModel(); $user = $userModel->modifyPassword($data,$this->request->userInfo['id']); if ($user['status']) { return $this->renderSuccess('修改成功'); } else { return $this->renderError($user['msg']); } } catch (ValidateException $exception) { return $this->renderError($exception->getMessage()); } } /** * 提现记录 * @return array * @throws \think\db\exception\DbException */ public function withdrawalRecords() { $userData = $this->request->userInfo; $data = Request::param(); $limit = $data['limit'] ?: 10; $list = Db::name('withdrawal_records') ->where(['user_id' => $userData['id'], 'status' => 1]) ->field('withdrawal_amount,withdrawal_balance,apply_time,trade_type') ->order('id' ,'desc') ->paginate($limit); $listArr = $list->items(); $trade_type = [1 => '代理下分', 2 => '管理员下分', 3 => '支付宝']; foreach ($listArr as &$item) { $item['trade_type'] = $trade_type[$item['trade_type']]; give_symbol($item['withdrawal_amount'],'-'); $item['apply_time'] = date("m月d日 H:i",strtotime($item['apply_time'])); } return $this->renderSuccess('数据获取成功',[ 'list' => $listArr, 'total' => $list->total() ]); } /** * 充值记录 * @return array * @throws \think\db\exception\DbException */ public function rechargeRecords() { $userData = $this->request->userInfo; $data = Request::param(); $limit = $data['limit'] ?: 10; $list = Db::name('recharge_records') ->where('user_id',$userData['id']) ->field('recharge_amount,residue_amount,trade_type,recharge_time') ->order('id' ,'desc') ->paginate($limit); $listArr = $list->items(); $trade_type = [1 => '代理上分', 2 => '管理员上分', 3 => '支付宝']; foreach ($listArr as &$item) { give_symbol($item['recharge_amount']); $item['trade_type'] = $trade_type[$item['trade_type']]; $item['recharge_time'] = date("m月d日 H:i",strtotime($item['recharge_time'])); } return $this->renderSuccess('数据获取成功',[ 'list' => $listArr, 'total' => $list->total() ]); } /** * 消费记录 * @return array * @throws \think\db\exception\DbException */ public function consumptionRecords() { $userData = $this->request->userInfo; $data = Request::param(); $limit = $data['limit'] ?: 10; $list = Db::name('consumption_records') ->where(['user_id' => $userData['id'],'status' => 1]) ->field('zone_goods_id,actual_price,residue_amount,create_time') ->order('id' ,'desc') ->paginate($limit); $listArr = $list->items(); foreach ($listArr as &$item) { $ZoneGoods = ZoneGoods::find($item['zone_goods_id']); $item['zone_title'] = $ZoneGoods->title; give_symbol($item['actual_price'],'-'); $item['create_time'] = date("m月d日 H:i",strtotime($item['create_time'])); } return $this->renderSuccess('数据获取成功',[ 'list' => $listArr, 'total' => $list->total() ]); } /** * 中奖记录 * @return array * @throws \think\db\exception\DbException */ public function awardsRecords() { $userData = $this->request->userInfo; $data = Request::param(); $limit = $data['limit'] ?: 10; $list = Db::name('awards_records') ->where('user_id',$userData['id']) ->field('cr_id,awards_amount,withdrawal_balance,create_time') ->order('id' ,'desc') ->paginate($limit); $listArr = $list->items(); foreach ($listArr as &$item) { $ConsumptionRecords = ConsumptionRecords::find($item['cr_id']); $ZoneGoods = ZoneGoods::find($ConsumptionRecords->zone_goods_id); $item['zone_title'] = $ZoneGoods->title; give_symbol($item['awards_amount']); $item['create_time'] = date("m月d日 H:i",strtotime($item['create_time'])); } return $this->renderSuccess('数据获取成功',[ 'list' => $listArr, 'total' => $list->total() ]); } /** * 用户信息 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function userInfo() { $userData = $this->request->userInfo; $UserModel = new UserModel(); $info = $UserModel->field('id,avatar,balance,withdrawal_balance')->where('id',$userData['id'])->find(); $info['avatar'] = get_image_url($info['avatar']); return $this->renderSuccess('数据返回成功',['data' => $info]); } /** * 返回用户联系客服信息 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function getCustomerServiceList() { $where = []; $CustomerServiceModel = new CustomerServiceModel(); # 查询用户列表 $field = 'id,name,wx_number'; $list = $CustomerServiceModel->field($field)->where($where)->order('id desc')->select()->toArray(); return $this->renderSuccess('数据返回成功', ['list' => $list]); } /** * 退出登陆 */ public function LogOut() { $login_user_data = Cache::store('redis')->get('login_user_data'); if ($login_user_data) Cache::store('redis')->delete('login_user_data'); return $this->renderSuccess('退出登陆成功'); } }