123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <?php
- /**
- *
- * User: anyluck
- * Date: 2020/6/8
- * Time: 13:57
- */
- namespace app\admin\controller;
- use app\common\controller\Backend;
- use think\facade\Db;
- use think\facade\Request;
- use think\facade\Session;
- use think\facade\View;
- class Usersys extends Backend
- {
- // 代理商系统管理
- //我的邀请码
- public function my()
- {
- // if (Request::isPost()){
- // $data = Request::post();
- // foreach ($data as $k=>$v){
- // $res = Db::name('system')->where('name',$k)->update(['value'=>$v]);
- // }
- // json_result(200,"修改成功",$data);
- // }
- $is_admin=Session::get("is_admin");
- if ($is_admin){
- $adminid=Session::get("adminid");
- $where["id"]=$adminid;
- $code=\app\common\model\User::where($where)->value("code");
- // var_dump($code);die();
- // View::assign('config',json_encode($list));
- // $view = [
- // 'info' => $list,
- // 'title' => lang('add'),
- // ];
- View::assign("code",$code);
- return View::fetch();
- }else{
- $this->error("当前登录账号不是代理商 无法查看信息");
- exit();
- }
- }
- // 账号信息管理
- public function account()
- {
- if (Request::isPost()) {
- $data = Request::post();
- $adminid=Session::get("adminid");
- $where["id"]=$adminid;
- $pwd=input("pwd");
- if (!$pwd){
- unset($data["pwd"]);
- }else{
- $data["pwd"] = password_hash($pwd, PASSWORD_DEFAULT);;
- }
- // var_dump($data);die();
- \app\common\model\User::update($data,$where);
- json_result(200, "修改成功", $data);
- }
- $is_admin=Session::get("is_admin");
- if ($is_admin){
- $adminid=Session::get("adminid");
- $where["id"]=$adminid;
- $code=\app\common\model\User::where($where)->find();
- unset($code["pwd"]);
- View::assign("user",$code);
- return View::fetch();
- }else{
- $this->error("当前登录账号不是代理商 无法查看信息");
- exit();
- }
- }
- // 代理收款信息管理
- public function message()
- {
- if (Request::isPost()) {
- $data = Request::post();
- $adminid=Session::get("adminid");
- $where["user_id"]=$adminid;
- \app\common\model\UserMessage::update($data,$where);
- json_result(200, "修改成功", $data);
- }
- $is_admin=Session::get("is_admin");
- if ($is_admin){
- $adminid=Session::get("adminid");
- $where["user_id"]=$adminid;
- $code=\app\common\model\UserMessage::where($where)->find();
- if (!$code){
- \app\common\model\UserMessage::create($where);
- $code=\app\common\model\UserMessage::where($where)->find();
- }
- View::assign("user",$code);
- return View::fetch();
- }else{
- $this->error("当前登录账号不是代理商 无法查看信息");
- exit();
- }
- }
- }
|