124 lines
4.0 KiB
PHP
124 lines
4.0 KiB
PHP
|
|
<?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]);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|