This commit is contained in:
parent
f5a88dcebc
commit
749beaec21
|
|
@ -1,15 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace app\test\controller;
|
|
||||||
|
|
||||||
use think\Controller;
|
|
||||||
use think\Db;
|
|
||||||
use app\bj\controller\Common;
|
|
||||||
use think\Log;
|
|
||||||
use \think\Validate;
|
|
||||||
|
|
||||||
class Text extends Controller{
|
|
||||||
public function demo(){
|
|
||||||
echo '你好';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -20,4 +20,12 @@ class Index extends Controller{
|
||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
################################################################other################################################################
|
||||||
|
################################################################other################################################################
|
||||||
|
################################################################other################################################################
|
||||||
|
|
||||||
|
public function msg($code,$msg='',$data=[]){
|
||||||
|
return json(['code'=>$code,'msg'=>$msg,'data'=>$data]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,124 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\app\controller;
|
||||||
|
|
||||||
|
use think\Controller;
|
||||||
|
use think\Db;
|
||||||
|
use app\bj\controller\Common;
|
||||||
|
use think\Log;
|
||||||
|
use \think\Validate;
|
||||||
|
|
||||||
|
class Index extends Controller{
|
||||||
|
|
||||||
|
|
||||||
|
################################################################个人资料卡################################################################
|
||||||
|
################################################################个人资料卡################################################################
|
||||||
|
################################################################个人资料卡################################################################
|
||||||
|
|
||||||
|
// 个人信息
|
||||||
|
public function personal_information(){
|
||||||
|
// phpinfo();
|
||||||
|
dump(123);
|
||||||
|
$result = Db::table('admin_user')->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]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\app\controller;
|
||||||
|
|
||||||
|
use think\Controller;
|
||||||
|
use think\Db;
|
||||||
|
use app\bj\controller\Common;
|
||||||
|
use think\Log;
|
||||||
|
use \think\Validate;
|
||||||
|
|
||||||
|
class Login extends Controller{
|
||||||
|
|
||||||
|
|
||||||
|
################################################################个人资料卡################################################################
|
||||||
|
################################################################个人资料卡################################################################
|
||||||
|
################################################################个人资料卡################################################################
|
||||||
|
|
||||||
|
// 注册
|
||||||
|
public function register_action(){
|
||||||
|
$data = input();
|
||||||
|
$result = Db::table('app_register')->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]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -11,17 +11,17 @@
|
||||||
|
|
||||||
return [
|
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
|
||||||
'dsn' => '',
|
'dsn' => '',
|
||||||
// 数据库连接参数
|
// 数据库连接参数
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue