diff --git a/application/admin/controller/Index - 副本 (2).php b/application/admin/controller/Index - 副本 (2).php deleted file mode 100644 index 26ea69a..0000000 --- a/application/admin/controller/Index - 副本 (2).php +++ /dev/null @@ -1,15 +0,0 @@ -assign('domain',$a); return $this->fetch(); } + + ################################################################other################################################################ + ################################################################other################################################################ + ################################################################other################################################################ + + public function msg($code,$msg='',$data=[]){ + return json(['code'=>$code,'msg'=>$msg,'data'=>$data]); + } } \ No newline at end of file diff --git a/application/app/controller/Index.php b/application/app/controller/Index.php new file mode 100644 index 0000000..103039b --- /dev/null +++ b/application/app/controller/Index.php @@ -0,0 +1,124 @@ +select(); + dump($result); + } + + // 创建用户卡片 + public function create_user_card(){ + $data = input(); + $result = Db::table('app_user_card')->insert([ + 'aan_id'=>$data['id'], + 'nickname'=>$data['nickname'], + 'birthday'=>$data['birthday'], + 'gender'=>$data['gender'], + 'create_time'=>date('Y-m-d H:i:s'), + 'last_update_time'=>date('Y-m-d H:i:s'), + ]); + if($result){ + return $this->msg(0,'success'); + }else{ + return $this->msg(10001,'创建失败'); + } + } + // 获取账号下用户卡片列表 + // $type 1获取列表,2获取详细信息 + public function user_card_list($aan_id = 1,$type=1){ + $result = Db::table('app_user_card')->where(['aan_id'=>$aan_id])->select(); + $data = []; + if($type == 1){ + for ($i=0; $i < count($result); $i++) { + array_push($data,['id'=>$result[$i]['id'],'nickname'=>$result[$i]['nickname']]); + } + }else{ + $data = $result; + } + return $data; + } + // 获取账号下用户卡片详细信息 + public function user_card_information($id){ + $result = Db::table('app_user_card')->where(['id'=>$id])->find(); + if($result){ + return $result; + }else{ + return false; + } + } + + // 创建身体数据 + public function create_body_data(){ + $data = input(); + $result = Db::table('app_body_data')->insert([ + 'auc_id'=>$data['id'], + 'height'=>$data['height'], + 'weight'=>$data['weight'], + 'bmi'=>$data['bmi'], + 'create_time'=>date('Y-m-d H:i:s'), + 'last_update_time'=>date('Y-m-d H:i:s'), + ]); + if($result){ + return $this->msg(0,'success'); + }else{ + return $this->msg(10001,'创建失败'); + } + } + // 获取账号下用户卡片身体数据 + // $type 1获取列表,2获取详细信息 + public function body_data_list($auc_id = 1,$type=1){ + $result = Db::table('app_body_data')->where(['auc_id'=>$auc_id])->select(); + $data = []; + if($type == 1){ + for ($i=0; $i < count($result); $i++) { + array_push($data,['id'=>$result[$i]['id'],'create_time'=>$result[$i]['create_time']]); + } + }else{ + $data = $result; + } + return $data; + } + // 获取账号下用户卡片身体数据详细信息 + public function body_data_information($id){ + $result = Db::table('app_body_data')->where(['id'=>$id])->find(); + if($result){ + return $result; + }else{ + return false; + } + } + + + public function data_card(){ + + } + + + + + ################################################################other################################################################ + ################################################################other################################################################ + ################################################################other################################################################ + + public function msg($code,$msg='',$data=[]){ + return json(['code'=>$code,'msg'=>$msg,'data'=>$data]); + } + +} \ No newline at end of file diff --git a/application/app/controller/Login.php b/application/app/controller/Login.php new file mode 100644 index 0000000..ffe97bb --- /dev/null +++ b/application/app/controller/Login.php @@ -0,0 +1,67 @@ +insert([ + 'account_number'=>$data['account_number'], + 'password'=>$data['password'], + ]); + if($result){ + return $this->msg(0,'success'); + }else{ + return $this->msg(10001,'注册失败'); + } + } + + // 登录 + public function login_action(){ + $data = input(); + $result = Db::table('app_register')->where([ + 'account_number'=>$data['account_number'], + 'password'=>$data['password'], + ])->count(); + if($result){ + return $this->msg(0,'success'); + }else{ + return $this->msg(10001,'未找到账户'); + } + } + + // 登录 + public function phone_code(){ + $data = '696969'; + return $this->msg(0,'success',['phone_code'=>$data]); + } + + // 登录 + public function email_code(){ + $data = '696969'; + return $this->msg(0,'success',['email_code'=>$data]); + } + + + ################################################################other################################################################ + ################################################################other################################################################ + ################################################################other################################################################ + + public function msg($code,$msg='',$data=[]){ + return json(['code'=>$code,'msg'=>$msg,'data'=>$data]); + } + +} \ No newline at end of file diff --git a/application/database.php b/application/database.php index 66ad466..1079b6c 100644 --- a/application/database.php +++ b/application/database.php @@ -11,17 +11,17 @@ return [ // 数据库类型 - 'type' => 'mysql', + 'type' => 'sqlsrv', // 服务器地址 - 'hostname' => '127.0.0.1', + 'hostname' => '121.36.67.254', // 数据库名 - 'database' => '', + 'database' => 'jt_tc', // 用户名 - 'username' => 'root', + 'username' => 'jt_user', // 密码 - 'password' => '', + 'password' => 'jtuser1qaz@WSX', // 端口 - 'hostport' => '', + 'hostport' => '4331', // 连接dsn 'dsn' => '', // 数据库连接参数