user_id; $update["update_time"]=time(); User::update($update,$where); json_result(200, "", $this->user); } // 更新头像 public function update_image() { $image = input("image"); if (!$image) json_result(400, "请上传图片路径"); $where["id"] = $this->user_id; $update["image"] = $image; User::update($update, $where); json_result(200, "设置成功"); } // 更新用户名 public function update_name() { $name = input("name"); $where["id"] = $this->user_id; $update["name"] = $name; User::update($update, $where); json_result(200, "设置成功"); } // 更新手机号码 public function update_phone() { $phone = input("phone"); if (!$phone) json_result(400, "请输入手机号"); $code = input("code"); if (!$code) json_result(400, "请输入验证码"); $rest = Tripartite::push_code($phone, 0); if ($rest != $code) { json_result(400, "验证码错误"); } $where["id"] = $this->user_id; $update["phone"] = $phone; User::update($update, $where); json_result(200, "设置成功"); } // 更新邮箱 public function update_mail() { $phone = input("mail"); if (!$phone) json_result(400, "请输入邮箱"); $code = input("code"); if (!$code) json_result(400, "请输入验证码"); $rest = Tripartite::push_code($phone, 1); if ($rest != $code) { json_result(400, "验证码错误"); } $where["id"] = $this->user_id; $update["mail"] = $phone; User::update($update, $where); json_result(200, "设置成功"); } // 显示收账信息 public function receivable_show() { $where["user_id"] = $this->user_id; $user_message = UserMessage::where($where)->find(); if (!$user_message) {// 没有数据就添加数据 $add["user_id"] = $this->user_id; UserMessage::create($add); $user_message = UserMessage::where($where)->find(); } json_result(200, $user_message); } // 修改收账信息 public function update_receivable() { $id = input("id"); if (!$id) json_result(400, "请上传更新id"); $data["phone"] = input("phone"); $data["name"] = input("name"); $data["bank_name"] = input("bank_name"); $data["bank_number"] = input("bank_number"); $data["bank_branch"] = input("bank_branch"); $data["ali_pay"] = input("ali_pay"); $data["wx_pay"] = input("wx_pay"); $data["ali_pay_image"] = input("ali_pay_image"); $data["wx_pay_image"] = input("wx_pay_image"); $where["id"] = $id; UserMessage::update($data, $where); json_result(200, "操作成功"); } // 消息 获取最新的三条数据 public function notice() { $notice = Message::where(["type" => 0])->order("id desc")->find(); // 公告 $message_jiaoyi = Message::where(["type" => 2])->order("id desc")->find();// 交易 $message_zijin = Message::where(["type" => 1])->order("id desc")->find();// 资金 $data["notice"] = $notice; $data["message_jiaoyi"] = $message_jiaoyi; $data["message_zijin"] = $message_zijin; json_result(200, "", $data); } // 消息列表 public function notice_list() { $type = input("type") ?: 0; $page = input("page") ?: 1; $limit = input("limit") ?: 10; $where["type"] = $type; $where["user_id"] = $this->user_id; $list = Message::where($where)->order("id desc,status asc")->paginate(['list_rows' => $limit, 'page' => $page])->each(function ($item) { $item["add_time"] = date("Y-m-d H:i", $item["add_time"]); return $item; }); json_result(200, "", $list); } // 更新消息是否已读 public function notice_status() { $id = input("id"); $where["id"] = $id; $update["status"] = 1; Message::update($update, $where); json_result(200); } // 反馈意见 public function feedback() { $content = input("content"); $image = input("image"); $add["user_id"] = $this->user_id; $add["content"] = $content; $add["image"] = $image; $add["add_time"] = time(); Feedback::create($add); json_result(200, "反馈成功"); } // 常见问题 public function problem() { $page = input("page") ?: 1; $limit = input("limit") ?: 10; $list = Problem::order("id desc")->paginate(['list_rows' => $limit, 'page' => $page]); json_result(200, "", $list); } // 常见问题详情 public function problem_show() { $id = input("id"); $where["id"] = $id; $data = Problem::where($where)->find(); json_result(200, "", $data); } // 修改密码 public function update_pwd() { // $phone=input("phone");// 系统内置手机号或邮件 $yuan = input("ypwd"); if (!$yuan) json_result(400, "请输入原密码"); $pwd = input("pwd"); if (!$pwd) json_result(400, "请输入新密码"); $where["id"] = $this->user_id; $update["pwd"] = password_hash($pwd, PASSWORD_DEFAULT);; $user = User::where($where)->find(); if ($user->pwd == $update["pwd"]) { json_result(400, "原密码不能和新密码一样"); } User::update($update, $where); json_result(200, "设置成功"); } // 关于我们 public function about() { $where["id"] = 1; $about = About::where($where)->find(); json_result(200, "", $about); } // 我的推广显示页面 public function extension() { $where["pid"] = $this->user_id; $count = User::where($where)->count(); $data["push"] = $count; $data["team"] = $this->user["team"]; json_result(200, "", $data); } // 直推列表 public function extension_list() { $pid = input("pid"); $page = input("page") ?: 1; $limit = input("limit") ?: 10; $where = []; if ($pid) { $where["pid"] = $pid; } else { $where["pid"] = $this->user_id; } $list = Problem::where($where)->order("id desc")->field("id,image,phone,name,mail,add_time")->paginate(['list_rows' => $limit, 'page' => $page])->each(function ($item) { // 统计人数 $where["pid"] = $item["id"]; $count = User::where($where)->count(); $item["team"] = $count; if ($item["add_time"]) { $item["add_time"] = date("Y-m-d H:i", $item["add_time"]); } return $item; }); json_result(200,"",$list); } // 可售额度 public function vendibility_list() { $page = input("page") ?: 1; $limit = input("limit") ?: 10; $where["user_id"]=$this->user_id; $list = Problem::where($where)->order("id desc")->paginate(['list_rows' => $limit, 'page' => $page])->each(function ($item) { if ($item["add_time"]) { $item["add_time"] = date("Y-m-d H:i", $item["add_time"]); } return $item; }); json_result(200,"",$list); } // 保证金交易明细 public function bond_list() { $page = input("page") ?: 1; $limit = input("limit") ?: 10; $where["user_id"]=$this->user_id; $list = BondFinance::where($where)->order("id desc")->paginate(['list_rows' => $limit, 'page' => $page])->each(function ($item) { if ($item["add_time"]) { $item["add_time"] = date("Y-m-d H:i", $item["add_time"]); } return $item; }); json_result(200,"",$list); } //佣金记录 public function commission_list() { $page = input("page") ?: 1; $limit = input("limit") ?: 10; $where["user_id"]=$this->user_id; $list = CommissionFinance::where($where)->order("id desc")->paginate(['list_rows' => $limit, 'page' => $page])->each(function ($item) { if ($item["add_time"]) { $item["add_time"] = date("Y-m-d H:i", $item["add_time"]); } return $item; }); json_result(200,"",$list); } // 充值和提现保证金 public function bond() { $money=input("money");if (!$money)json_result(400,"请输入提现金额"); $type=input("type")?:0;//0 充值 1 提现 // 查看账号余额 if ($this->user->ensure_money<$money){ json_result(400,"账号保证金不足"); } $add["money"]=$money; $add["type"]=$type; $add["status"]=0; $add["add_time"]=time(); $add["user_id"]=$this->user_id; Bond::create($add); json_result(200,"申请成功"); } // 通证充值 public function general() { $money=input("money"); $actual_money=input("actual_money"); $charge_money=input("charge_money"); $add["money"]=$money; $add["user_id"]=$this->user_id; $add["actual_money"]=$actual_money; $add["charge_money"]=$charge_money; $add["status"]=0; $add["add_time"]=time(); GeneralFinance::create($add); json_result(200,"申请成功"); } //通证转账 public function general_transfer() { $account=input("account"); $money=input("money"); if ($money>$this->user->money){ json_result(400,"账号通证余额不足"); } $where["phone|mail"]=$account; $user=User::where($where)->find(); if (!$user){ json_result(200,"账号不存在"); } $add["user_id"]=$this->user_id; $add["puser_id"]=$user->id; $add["account"]=$account; $add["money"]=$money; $add["status"]=0; $add["add_time"]=time(); GeneralTransfer::create($add); json_result(200,"申请成功"); } }