|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
+use AlibabaCloud\SDK\Dyvmsapi\V20170525\Models\ListCallTaskResponseBody\data;
|
|
|
use app\common\controller\Api;
|
|
|
use app\common\library\Ems;
|
|
|
use app\common\library\Sms;
|
|
@@ -2003,5 +2004,108 @@ class User extends Api
|
|
|
$this->success('申请退款成功,请等待审核');
|
|
|
}
|
|
|
|
|
|
+ //查询用户信息
|
|
|
+ public function getmyinfo() {
|
|
|
+ $user_id = input('user_id', 0, 'intval'); //用户id
|
|
|
+ if (!$user_id) {
|
|
|
+ $user_id = $this->auth->id;
|
|
|
+ }
|
|
|
+
|
|
|
+ $hu_user = Db::name('user');
|
|
|
+ $user_info = $hu_user->field(['id', 'nickname', 'mobile', 'avatar', 'height', 'weight', 'birthday', 'excel_position', 'rank_id', 'total_num', 'win_num', 'lose_num', 'power_value', 'mvp_num', 'foul_num', 'block_num', 'help_num', 'backboard_num', 'score', 'assess'])->where(['id' => $user_id])->find();
|
|
|
+ if (!$user_info) {
|
|
|
+ $this->error('您的网络开小差了');
|
|
|
+ }
|
|
|
+ $user_info['avatar'] = one_domain_image($user_info['avatar']);
|
|
|
+ $user_info['age'] = birthtime_to_age($user_info['birthday']);
|
|
|
+ $user_info['birthday'] = date('Y-m-d', $user_info['birthday']);
|
|
|
+ $rank_info = Db::name('rank')->where(['id' => $user_info['rank_id']])->find();
|
|
|
+ $user_info['rank_name'] = $rank_info ? $rank_info['name'] : '';
|
|
|
+ $user_info['rank_image'] = $rank_info ? one_domain_image($rank_info['image']) : '';
|
|
|
+
|
|
|
+ $user_info['max_total_num'] = $hu_user->order('total_num desc')->value('total_num');
|
|
|
+ $user_info['max_power_value'] = $hu_user->order('power_value desc')->value('power_value');
|
|
|
+ $user_info['max_win_num'] = $hu_user->order('win_num desc')->value('win_num');
|
|
|
+ $user_info['max_mvp_num'] = $hu_user->order('mvp_num desc')->value('mvp_num');
|
|
|
+ $user_info['max_foul_num'] = $hu_user->order('foul_num desc')->value('foul_num');
|
|
|
+ $user_info['winning_rate'] = $user_info['total_num'] == 0 ? 0 : ceil($user_info['win_num'] / $user_info['total_num']);
|
|
|
+ $user_info['max_block_num'] = $hu_user->order('block_num desc')->value('block_num');
|
|
|
+ $user_info['max_help_num'] = $hu_user->order('help_num desc')->value('help_num');
|
|
|
+ $user_info['max_backboard_num'] = $hu_user->order('backboard_num desc')->value('backboard_num');
|
|
|
+ $user_info['max_score'] = $hu_user->order('score desc')->value('score');
|
|
|
+
|
|
|
+ $this->success('信息', $user_info);
|
|
|
+ }
|
|
|
+
|
|
|
+ //修改信息
|
|
|
+ public function editinfo() {
|
|
|
+ $avatar = $this->request->post('avatar', '', 'trim,strip_tags,htmlspecialchars'); //头像
|
|
|
+ $nickname = $this->request->post('nickname', '', 'trim'); //昵称
|
|
|
+ $birthday = $this->request->post('birthday', '', 'strtotime'); //生日
|
|
|
+ $height = input('height', 0, 'intval'); //身高
|
|
|
+ $weight = input('weight', 0, 'intval'); //体重
|
|
|
+ $excel_position = input('excel_position', '', 'trim'); //擅长位置
|
|
|
+
|
|
|
+ $data = [];
|
|
|
+ if ($avatar) {
|
|
|
+ if (iconv_strlen($avatar, 'utf-8') > 255) {
|
|
|
+ $this->error('图片超出范围');
|
|
|
+ }
|
|
|
+ $data['avatar'] = $avatar;
|
|
|
+ }
|
|
|
+ if ($nickname) {
|
|
|
+ if (iconv_strlen($nickname, 'utf-8') > 30) {
|
|
|
+ $this->error('昵称最多30字');
|
|
|
+ }
|
|
|
+ $data['nickname'] = $nickname;
|
|
|
+ }
|
|
|
+ if ($height > 0) {
|
|
|
+ $data['height'] = $height;
|
|
|
+ }
|
|
|
+ if ($weight > 0) {
|
|
|
+ $data['weight'] = $weight;
|
|
|
+ }
|
|
|
+ if ($birthday) {
|
|
|
+ $data['birthday'] = $birthday;
|
|
|
+ }
|
|
|
+ if ($excel_position) {
|
|
|
+ if(iconv_strlen($excel_position, 'utf-8') > 30) {
|
|
|
+ $this->error('请选择正确位置');
|
|
|
+ }
|
|
|
+ $data['excel_position'] = $excel_position;
|
|
|
+ }
|
|
|
|
|
|
+ if (!$data) {
|
|
|
+ $this->error('暂无修改内容');
|
|
|
+ }
|
|
|
+ //修改用户表
|
|
|
+ $rt = Db::name('user')->where(['id' => $this->auth->id])->setField($data);
|
|
|
+ if ($rt === false) {
|
|
|
+ $this->error('修改失败');
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->success('修改成功');
|
|
|
+ }
|
|
|
+
|
|
|
+ //我的比赛
|
|
|
+ public function mygame() {
|
|
|
+ $list = Db::name('game_people')->field('id, game_id, createtime')->where(['user_id' => $this->auth->id, 'status' => ['gt', 0]])->page($this->page, $this->pagenum)->order('id desc')->select();
|
|
|
+
|
|
|
+ if ($list) {
|
|
|
+ $hu_game = Db::name('game');
|
|
|
+ foreach ($list as &$v) {
|
|
|
+ $v['createtime'] = date('Y.m.d', $v['createtime']);
|
|
|
+ $game_info = $hu_game->field('name, image')->where(['id' => $v['game_id']])->find();
|
|
|
+ $v['game_name'] = $game_info['name'];
|
|
|
+ $v['game_image'] = one_domain_image($game_info['image']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->success('我的比赛', $list);
|
|
|
+ }
|
|
|
+
|
|
|
+ //取消报名
|
|
|
+ public function cancelsignup() {
|
|
|
+
|
|
|
+ }
|
|
|
}
|