0306部分测试
This commit is contained in:
parent
41efd39a32
commit
6f8fe55e03
|
|
@ -1246,10 +1246,8 @@ class Countfood extends Base{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// dump($food_content);
|
|
||||||
// die;
|
|
||||||
$food_content = $this->calculate_nutrients($food_content);
|
$food_content = $this->calculate_nutrients($food_content);
|
||||||
return $this->msg($food_content);
|
// return $this->msg($food_content);
|
||||||
foreach ($food_content as $key => $value) {
|
foreach ($food_content as $key => $value) {
|
||||||
// dump($value['nutrients_four']);
|
// dump($value['nutrients_four']);
|
||||||
$return_data['today_intake']['kcal'] = bcadd($return_data['today_intake']['kcal'],$value['kcal_val'],2);
|
$return_data['today_intake']['kcal'] = bcadd($return_data['today_intake']['kcal'],$value['kcal_val'],2);
|
||||||
|
|
|
||||||
|
|
@ -689,7 +689,7 @@ class Index extends Base{
|
||||||
['name'=>'高度活动(每周6-7天高强度运动)','val'=>'1.725'],
|
['name'=>'高度活动(每周6-7天高强度运动)','val'=>'1.725'],
|
||||||
['name'=>'极高活动(体力劳动或每天高强度训练)','val'=>'1.9'],
|
['name'=>'极高活动(体力劳动或每天高强度训练)','val'=>'1.9'],
|
||||||
],
|
],
|
||||||
'language_arr'=>$this->process_Language()
|
// 'language_arr'=>$this->process_Language()
|
||||||
];
|
];
|
||||||
$cfc = Db::connect('cfc_db');
|
$cfc = Db::connect('cfc_db');
|
||||||
|
|
||||||
|
|
@ -839,9 +839,6 @@ class Index extends Base{
|
||||||
// 添加每餐背景图start
|
// 添加每餐背景图start
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $this->msg($return_data);
|
return $this->msg($return_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use PHPMailer\PHPMailer\PHPMailer;
|
||||||
|
|
||||||
|
|
||||||
class Login extends Base{
|
class Login extends Base{
|
||||||
protected $code_time = 300;
|
protected $code_time = 55;
|
||||||
// protected $token_time = 2592000;//30天的秒数
|
// protected $token_time = 2592000;//30天的秒数
|
||||||
protected $default_head_pic = 'http://tc.pcxbc.com/tsf/head_pic.png';
|
protected $default_head_pic = 'http://tc.pcxbc.com/tsf/head_pic.png';
|
||||||
protected $login_use_db_name = [
|
protected $login_use_db_name = [
|
||||||
|
|
@ -57,18 +57,19 @@ class Login extends Base{
|
||||||
if (!preg_match('/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/', $data['data'])) {
|
if (!preg_match('/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/', $data['data'])) {
|
||||||
return $this->msg(10005,'data type is error');
|
return $this->msg(10005,'data type is error');
|
||||||
}else{
|
}else{
|
||||||
if(!strlen($data['data']) > 20){
|
if(strlen($data['data']) > 50){
|
||||||
return $this->msg(10005,'data too long');
|
return $this->msg(10005,'email too long');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->verify_data_is_ok($data['password'],'str')){
|
if(!$this->verify_data_is_ok($data['password'],'str')){
|
||||||
return $this->msg(10005,'password type is error');
|
return $this->msg(10005,'password type is error');
|
||||||
}else{
|
}else{
|
||||||
if(!strlen($data['password']) > 20){
|
if(!strlen($data['password']) > 50){
|
||||||
return $this->msg(10005,'password too long');
|
return $this->msg(10005,'password too long');
|
||||||
}else{
|
}else{
|
||||||
if($data['password'] != $data['confirm_password']){
|
if($data['password'] != $data['confirm_password']){
|
||||||
return $this->msg(10005,'请确认密码');
|
return $this->msg(10005,'The two passwords entered do not match.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -82,7 +83,7 @@ class Login extends Base{
|
||||||
$inspect_repeat = $cfc->table($this->login_use_db_name['account'])->where(['account'=>$data['data'],'is_del'=>0])->field('id,token')->find();
|
$inspect_repeat = $cfc->table($this->login_use_db_name['account'])->where(['account'=>$data['data'],'is_del'=>0])->field('id,token')->find();
|
||||||
|
|
||||||
if($inspect_repeat){
|
if($inspect_repeat){
|
||||||
return $this->msg(10002,'注册失败,账号已存在');
|
return $this->msg(10002,'Registration failed. Account already exists.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -90,7 +91,7 @@ class Login extends Base{
|
||||||
// 检查验证码
|
// 检查验证码
|
||||||
$code_result = $this->check_code($data['data'],$data['code']);
|
$code_result = $this->check_code($data['data'],$data['code']);
|
||||||
if($code_result !== true){
|
if($code_result !== true){
|
||||||
return $this->msg(10002,'验证码错误或失效');
|
return $this->msg(10002,'Verification code is incorrect or invalid.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证完之后
|
// 验证完之后
|
||||||
|
|
@ -148,8 +149,8 @@ class Login extends Base{
|
||||||
if (!preg_match('/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/', $data['data'])) {
|
if (!preg_match('/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/', $data['data'])) {
|
||||||
return $this->msg(10005,'data type is error');
|
return $this->msg(10005,'data type is error');
|
||||||
}else{
|
}else{
|
||||||
if(!strlen($data['data']) > 30){
|
if(strlen($data['data']) > 50){
|
||||||
return $this->msg(10005,'data too long');
|
return $this->msg(10005,'email too long');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!array_key_exists($data['language'],$this->language_country)){
|
if(!array_key_exists($data['language'],$this->language_country)){
|
||||||
|
|
@ -167,14 +168,14 @@ class Login extends Base{
|
||||||
// 检查验证码
|
// 检查验证码
|
||||||
$code_result = $this->check_code($data['data'],$data['validate_data']);
|
$code_result = $this->check_code($data['data'],$data['validate_data']);
|
||||||
if($code_result !== true){
|
if($code_result !== true){
|
||||||
return $this->msg(20001,'验证码错误或失效');
|
return $this->msg(20001,'Verification code is incorrect or invalid.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$code_name = $data['data'];
|
$code_name = $data['data'];
|
||||||
if($this->check_code($code_name,$data['validate_data']) === true){
|
if($this->check_code($code_name,$data['validate_data']) === true){
|
||||||
// 查询账号是否已经注册
|
// 查询账号是否已经注册
|
||||||
$inspect_repeat = $cfc->table($this->login_use_db_name['account'])->where(['account'=>$data['data']])->field('id,token,language')->find();
|
$inspect_repeat = $cfc->table($this->login_use_db_name['account'])->where(['account'=>$data['data'],'is_del'=>0])->field('id,token,language')->find();
|
||||||
if($inspect_repeat){
|
if($inspect_repeat){
|
||||||
$cfc->table($this->login_use_db_name['account'])->where(['token'=>$inspect_repeat['token']])->update(['login_time'=>date('Y-m-d H:i:s'),'language'=>$data['language']]);
|
$cfc->table($this->login_use_db_name['account'])->where(['token'=>$inspect_repeat['token']])->update(['login_time'=>date('Y-m-d H:i:s'),'language'=>$data['language']]);
|
||||||
return $this->msg(['token'=>$inspect_repeat['token'],'aan_id'=>$inspect_repeat['id'],'language'=>$this->language_country[$data['language']][1]]);
|
return $this->msg(['token'=>$inspect_repeat['token'],'aan_id'=>$inspect_repeat['id'],'language'=>$this->language_country[$data['language']][1]]);
|
||||||
|
|
@ -192,22 +193,22 @@ class Login extends Base{
|
||||||
if($result_add){
|
if($result_add){
|
||||||
return $this->msg(['token'=>$set_data['token'],'aan_id'=>$result_add,'language'=>$this->language_country[$data['language']][1]]);
|
return $this->msg(['token'=>$set_data['token'],'aan_id'=>$result_add,'language'=>$this->language_country[$data['language']][1]]);
|
||||||
}else{
|
}else{
|
||||||
return $this->msg(10002,'登录失败,请稍后重试');
|
return $this->msg(10002,'Login failed. Please try again later.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
return $this->msg(10002,'登录失败,验证码错误或失效');
|
return $this->msg(10002,'Login failed. Verification code is incorrect or expired.');
|
||||||
}
|
}
|
||||||
}else if($data['validate_type'] == 'password'){
|
}else if($data['validate_type'] == 'password'){
|
||||||
if(!$this->verify_data_is_ok($data['validate_data'],'str')){
|
if(!$this->verify_data_is_ok($data['validate_data'],'str')){
|
||||||
return $this->msg(10005,'validate_data type is error');
|
return $this->msg(10005,'validate_data type is error');
|
||||||
}else{
|
}else{
|
||||||
if(!strlen($data['validate_data']) > 20){
|
if(strlen($data['validate_data']) > 50){
|
||||||
return $this->msg(10005,'validate_data too long');
|
return $this->msg(10005,'password too long');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 查询账号是否已经注册
|
// 查询账号是否已经注册
|
||||||
$inspect_repeat = $cfc->table($this->login_use_db_name['account'])->where(['account'=>$data['data'],'password'=>$data['validate_data']])->field('id,token,language')->find();
|
$inspect_repeat = $cfc->table($this->login_use_db_name['account'])->where(['account'=>$data['data'],'password'=>$data['validate_data'],'is_del'=>0])->field('id,token,language')->find();
|
||||||
|
|
||||||
if($inspect_repeat){
|
if($inspect_repeat){
|
||||||
|
|
||||||
|
|
@ -215,7 +216,7 @@ class Login extends Base{
|
||||||
|
|
||||||
return $this->msg(['token'=>$inspect_repeat['token'],'aan_id'=>$inspect_repeat['id'],'language'=>$this->language_country[$inspect_repeat['language']][1]]);
|
return $this->msg(['token'=>$inspect_repeat['token'],'aan_id'=>$inspect_repeat['id'],'language'=>$this->language_country[$inspect_repeat['language']][1]]);
|
||||||
}else{
|
}else{
|
||||||
return $this->msg(10003,'账号未注册,请先注册');
|
return $this->msg(10003,'Account not registered. Please sign up first.');
|
||||||
$set_data['password'] = $data['validate_data'];
|
$set_data['password'] = $data['validate_data'];
|
||||||
$set_data['account'] = $data['data'];
|
$set_data['account'] = $data['data'];
|
||||||
$set_data['head_pic'] = $this->default_head_pic;
|
$set_data['head_pic'] = $this->default_head_pic;
|
||||||
|
|
@ -228,7 +229,7 @@ class Login extends Base{
|
||||||
if($result_add){
|
if($result_add){
|
||||||
return $this->msg(['token'=>$set_data['token'],'aan_id'=>$result_add,'language'=>$this->language_country[$data['language']][1]]);
|
return $this->msg(['token'=>$set_data['token'],'aan_id'=>$result_add,'language'=>$this->language_country[$data['language']][1]]);
|
||||||
}else{
|
}else{
|
||||||
return $this->msg(10002,'登录失败,请稍后重试');
|
return $this->msg(10002,'Login failed. Please try again later.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -253,7 +254,7 @@ class Login extends Base{
|
||||||
}
|
}
|
||||||
// 退出登录操作
|
// 退出登录操作
|
||||||
public function user_quit_account($data=['token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
public function user_quit_account($data=['token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
||||||
// try {
|
try {
|
||||||
// 你的业务逻辑
|
// 你的业务逻辑
|
||||||
if(count(input('post.')) > 0){
|
if(count(input('post.')) > 0){
|
||||||
$data = input('post.');
|
$data = input('post.');
|
||||||
|
|
@ -274,41 +275,40 @@ class Login extends Base{
|
||||||
// 成功
|
// 成功
|
||||||
$this->record_api_log($data, null, $return_data);
|
$this->record_api_log($data, null, $return_data);
|
||||||
return $return_data;
|
return $return_data;
|
||||||
// } catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// // 捕获异常
|
// 捕获异常
|
||||||
// $logContent["flie"] = $e->getFile();
|
$logContent["flie"] = $e->getFile();
|
||||||
// $logContent["line"] = $e->getLine();
|
$logContent["line"] = $e->getLine();
|
||||||
// $logContent['all_content'] = "异常信息:\n";
|
$logContent['all_content'] = "异常信息:\n";
|
||||||
// $logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||||
// $logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||||
// $logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||||
// $logContent['all_content'] .= "方法: " . __METHOD__ . "\n";
|
$logContent['all_content'] .= "方法: " . __METHOD__ . "\n";
|
||||||
// $logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||||
// $logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||||
// $this->record_api_log($data, $logContent, null);
|
$this->record_api_log($data, $logContent, null);
|
||||||
// return $this->msg(99999);
|
return $this->msg(99999);
|
||||||
// }
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重置密码
|
// 重置密码
|
||||||
public function reset_password($data = ['data'=>'18530934717','password'=>'ceshi1','c_password'=>'ceshi1','code'=>'491661']){
|
public function reset_password(){
|
||||||
|
$data = input('post.');
|
||||||
try {
|
try {
|
||||||
// 你的业务逻辑
|
// 你的业务逻辑
|
||||||
// 验证是否前段发送过来的数据
|
// 验证是否前段发送过来的数据
|
||||||
if(count(input('post.')) > 0){
|
|
||||||
$data = input('post.');
|
|
||||||
}
|
|
||||||
// 验证数据项是否完整
|
// 验证数据项是否完整
|
||||||
if(!array_key_exists('data', $data) || !array_key_exists('password', $data) || !array_key_exists('c_password', $data) || !array_key_exists('code', $data)){
|
if(!array_key_exists('token', $data) || !array_key_exists('data', $data) || !array_key_exists('password', $data) || !array_key_exists('c_password', $data) || !array_key_exists('code', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
// 验证数据值是否合规
|
// 验证数据值是否合规
|
||||||
if($data['password'] != $data['c_password']){
|
if($data['password'] != $data['c_password']){
|
||||||
return $this->msg(10003,'两次密码不一致');
|
return $this->msg(10003,'The two passwords entered do not match.');
|
||||||
}
|
}
|
||||||
if($data['password'] == ''){
|
if($data['password'] == ''){
|
||||||
return $this->msg(10003,'密码不能为空');
|
return $this->msg(10003,'Password cannot be empty.');
|
||||||
}
|
}
|
||||||
if(!$this->verify_data_is_ok($data['password'],'str')){
|
if(!$this->verify_data_is_ok($data['password'],'str')){
|
||||||
return $this->msg(10005);
|
return $this->msg(10005);
|
||||||
|
|
@ -321,25 +321,40 @@ class Login extends Base{
|
||||||
if($code_result !== true){
|
if($code_result !== true){
|
||||||
return $this->msg(10003,$code_result);
|
return $this->msg(10003,$code_result);
|
||||||
}
|
}
|
||||||
$t_y = $this->is_tel_email($data['data']);
|
|
||||||
if($t_y === false){
|
if (!preg_match('/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/', $data['data'])) {
|
||||||
return $this->msg(10003,'账号格式错误');
|
return $this->msg(10005,'data type is error');
|
||||||
|
}else{
|
||||||
|
if(strlen($data['data']) > 50){
|
||||||
|
return $this->msg(10005,'email too long');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// $t_y = $this->is_tel_email($data['data']);
|
||||||
|
// if($t_y === false){
|
||||||
|
// return $this->msg(10003,'账号格式错误');
|
||||||
|
// }
|
||||||
|
|
||||||
|
$cfc = Db::connect('cfc_db');
|
||||||
|
|
||||||
// 检查账号是否存在
|
// 检查账号是否存在
|
||||||
$find_data = Db::table($this->login_use_db_name['1'])->where([$t_y=>$data['data'],'is_del'=>0])->field('id,token')->find();
|
$find_data = $cfc->table($this->login_use_db_name['account'])->where(['account'=>$data['data'],'is_del'=>0])->field('id,token')->find();
|
||||||
if(!$find_data){
|
if(!$find_data){
|
||||||
return $this->msg(10003);
|
return $this->msg(10003);
|
||||||
}
|
}
|
||||||
$result = Db::table($this->login_use_db_name['1'])->where([$t_y=>$data['data']])->update(['password'=>$data['password']]);
|
|
||||||
|
$result = $cfc->table($this->login_use_db_name['account'])->where(['account'=>$data['data']])->update(['password'=>$data['password']]);
|
||||||
|
|
||||||
if($result){
|
if($result){
|
||||||
$return_data = $this->msg(['token'=>$find_data['token'],'aan_id'=>$find_data['id']]);
|
return $this->msg(['token'=>$find_data['token'],'aan_id'=>$find_data['id']]);
|
||||||
}else{
|
}else{
|
||||||
$return_data = $this->msg(10002);
|
return $this->msg(10002);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 成功
|
// 成功
|
||||||
$this->record_api_log($data, null, $return_data);
|
// $this->record_api_log($data, null, $return_data);
|
||||||
return $return_data;
|
// return $return_data;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// 捕获异常
|
// 捕获异常
|
||||||
$logContent["flie"] = $e->getFile();
|
$logContent["flie"] = $e->getFile();
|
||||||
|
|
@ -360,25 +375,43 @@ class Login extends Base{
|
||||||
|
|
||||||
|
|
||||||
// 删除账号
|
// 删除账号
|
||||||
public function delete_account($data=['token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
public function delete_account(){
|
||||||
|
$data = input('post.');
|
||||||
try {
|
try {
|
||||||
// 你的业务逻辑
|
// 你的业务逻辑
|
||||||
if(count(input('post.')) > 0){
|
|
||||||
$data = input('post.');
|
if(!array_key_exists('token', $data) || !array_key_exists('code', $data)){
|
||||||
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
if(!array_key_exists('token', $data)){
|
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||||
$return_data = $this->msg(10001);
|
return $this->msg(10005);
|
||||||
}
|
}
|
||||||
$result = Db::table($this->login_use_db_name['1'])->where(['token'=>$data['token']])->update(['is_del'=>1,'login_time'=>'2024-09-01 00:00:00']);
|
if(!$this->verify_data_is_ok($data['code'],'num')){
|
||||||
if($result){
|
return $this->msg(10005);
|
||||||
$return_data = $this->msg([]);
|
|
||||||
}else{
|
|
||||||
$return_data = $this->msg(10002);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 成功
|
|
||||||
$this->record_api_log($data, null, $return_data);
|
$cfc = Db::connect('cfc_db');
|
||||||
return $return_data;
|
|
||||||
|
$account_data = $cfc->table($this->login_use_db_name['account'])->where(['token'=>$data['token']])->field('id,token,account')->find();
|
||||||
|
|
||||||
|
// dump($account_data);
|
||||||
|
// die;
|
||||||
|
// 检查验证码
|
||||||
|
$code_result = $this->check_code($account_data['account'],$data['code']);
|
||||||
|
|
||||||
|
|
||||||
|
if($code_result !== true){
|
||||||
|
return $this->msg(10003,$code_result);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $cfc->table($this->login_use_db_name['account'])->where(['token'=>$data['token']])->update(['is_del'=>1]);
|
||||||
|
|
||||||
|
if($result){
|
||||||
|
return $this->msg([]);
|
||||||
|
}else{
|
||||||
|
return $this->msg(10002);
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// 捕获异常
|
// 捕获异常
|
||||||
$logContent["flie"] = $e->getFile();
|
$logContent["flie"] = $e->getFile();
|
||||||
|
|
@ -419,7 +452,7 @@ class Login extends Base{
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cache($data['data'].'_cfc_multilingual')){
|
if(cache($data['data'].'_cfc_multilingual')){
|
||||||
return $this->msg(10002,'60秒仅可发送一次验证码');
|
return $this->msg(10002,'You can only send a verification code once every 60 seconds.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$num = mt_rand(100000,999999);
|
$num = mt_rand(100000,999999);
|
||||||
|
|
@ -429,7 +462,7 @@ class Login extends Base{
|
||||||
cache($data['data'].'_cfc_multilingual', $num, $this->code_time);
|
cache($data['data'].'_cfc_multilingual', $num, $this->code_time);
|
||||||
return $this->msg([]);
|
return $this->msg([]);
|
||||||
}else{
|
}else{
|
||||||
return $this->msg(10010,'验证码发送失败');
|
return $this->msg(10010,'Failed to send verification code.');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,10 @@ class Base extends Controller{
|
||||||
'3'=>'app_user_data',
|
'3'=>'app_user_data',
|
||||||
'4'=>'pc_vitalcapacity_standard',
|
'4'=>'pc_vitalcapacity_standard',
|
||||||
'5'=>'admin_estimate',
|
'5'=>'admin_estimate',
|
||||||
'6'=>'app_account_number'
|
'6'=>'app_account_number',
|
||||||
|
'search_history'=>'app_user_search_history',
|
||||||
|
'foodlist4'=>'app_z_national_standard_food_type_4',
|
||||||
|
'user'=>'app_user_data'
|
||||||
];
|
];
|
||||||
|
|
||||||
public $test_token = ['57bd45e3a963b372ea2d873e4bd8d1f8','e0966788d02cc93290d9d674921d9715'];
|
public $test_token = ['57bd45e3a963b372ea2d873e4bd8d1f8','e0966788d02cc93290d9d674921d9715'];
|
||||||
|
|
@ -88,7 +91,7 @@ class Base extends Controller{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 判断字符串是手机还是邮箱
|
// 判断字符串是手机还是邮箱(有用)
|
||||||
public function is_tel_email($str) {
|
public function is_tel_email($str) {
|
||||||
// 手机号码的正则表达式(中国大陆格式)(下面正则实际判断的是是否为11位数字)
|
// 手机号码的正则表达式(中国大陆格式)(下面正则实际判断的是是否为11位数字)
|
||||||
$mobilePattern = '/^\d{11}$/';
|
$mobilePattern = '/^\d{11}$/';
|
||||||
|
|
@ -106,7 +109,7 @@ class Base extends Controller{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算年龄
|
// 计算年龄(有用)
|
||||||
public function calculate_age($data = '1991-04-20'){
|
public function calculate_age($data = '1991-04-20'){
|
||||||
$today = time(); // 获取当前时间的 Unix 时间戳
|
$today = time(); // 获取当前时间的 Unix 时间戳
|
||||||
$birthDate = strtotime($data); // 将出生日期字符串转换为 Unix 时间戳
|
$birthDate = strtotime($data); // 将出生日期字符串转换为 Unix 时间戳
|
||||||
|
|
@ -206,7 +209,7 @@ class Base extends Controller{
|
||||||
return $interval->format('%a');
|
return $interval->format('%a');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算月龄
|
// 计算月龄(有用)
|
||||||
public function calculateAgeInMonthsWithPrecision($birthDateStr) {
|
public function calculateAgeInMonthsWithPrecision($birthDateStr) {
|
||||||
// 获取当前日期
|
// 获取当前日期
|
||||||
$now = new \DateTime();
|
$now = new \DateTime();
|
||||||
|
|
@ -224,28 +227,32 @@ class Base extends Controller{
|
||||||
$ageInMonthsPrecise = intval($ageInMonths + $partialMonth);
|
$ageInMonthsPrecise = intval($ageInMonths + $partialMonth);
|
||||||
return $ageInMonthsPrecise;
|
return $ageInMonthsPrecise;
|
||||||
}
|
}
|
||||||
// 曲线页面-底部统计动作
|
|
||||||
public function base_target_initial_cumulative_weight($data = []){
|
|
||||||
// 第一种:用户详情(所有数据都有)
|
// // 曲线页面-底部统计动作
|
||||||
// 第二种:手动记录(只有最新体重)
|
// public function base_target_initial_cumulative_weight($data = []){
|
||||||
// 第三种:修改原始体重(只有原始体重)
|
// // 第一种:用户详情(所有数据都有)
|
||||||
// $result_data['target_weight'] 目标体重
|
// // 第二种:手动记录(只有最新体重)
|
||||||
// $result_data['initial_weight'] 最初体重
|
// // 第三种:修改原始体重(只有原始体重)
|
||||||
// $result_data['weight'] 最近一次测量重量
|
// // $result_data['target_weight'] 目标体重
|
||||||
// $result_data['initial_date'] 初始体重日期
|
// // $result_data['initial_weight'] 最初体重
|
||||||
if(count($data) > 0){
|
// // $result_data['weight'] 最近一次测量重量
|
||||||
$result_data['target_weight'] = $data['target_weight'];
|
// // $result_data['initial_date'] 初始体重日期
|
||||||
$result_data['initial_weight'] = $data['initial_weight'];
|
// if(count($data) > 0){
|
||||||
$result_data['cumulative_weight'] = bcsub($data['weight'],$data['initial_weight'],2);
|
// $result_data['target_weight'] = $data['target_weight'];
|
||||||
$result_data['cumulative_day'] = $data['initial_date'] == 0?0:$this->daysSince($data['initial_date']);
|
// $result_data['initial_weight'] = $data['initial_weight'];
|
||||||
}else{
|
// $result_data['cumulative_weight'] = bcsub($data['weight'],$data['initial_weight'],2);
|
||||||
$result_data['target_weight'] = 0;
|
// $result_data['cumulative_day'] = $data['initial_date'] == 0?0:$this->daysSince($data['initial_date']);
|
||||||
$result_data['initial_weight'] = 0;
|
// }else{
|
||||||
$result_data['cumulative_weight'] = 0;
|
// $result_data['target_weight'] = 0;
|
||||||
$result_data['cumulative_day'] = 0;
|
// $result_data['initial_weight'] = 0;
|
||||||
}
|
// $result_data['cumulative_weight'] = 0;
|
||||||
return $result_data;
|
// $result_data['cumulative_day'] = 0;
|
||||||
}
|
// }
|
||||||
|
// return $result_data;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 判断一个参数是否为数字且大于等于0
|
// 判断一个参数是否为数字且大于等于0
|
||||||
public function isPositiveNumber($value) {
|
public function isPositiveNumber($value) {
|
||||||
|
|
@ -597,6 +604,34 @@ class Base extends Controller{
|
||||||
$filtered = filter_var($data, FILTER_VALIDATE_INT);
|
$filtered = filter_var($data, FILTER_VALIDATE_INT);
|
||||||
return $filtered !== false && $filtered > 0;
|
return $filtered !== false && $filtered > 0;
|
||||||
|
|
||||||
|
case 'arr_intnum':
|
||||||
|
// 一维整数数组验证 - 必须是非空数组,且所有元素都是整数
|
||||||
|
// 1. 先检查是否是数组
|
||||||
|
if (!is_array($data)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 检查数组是否为空
|
||||||
|
if (empty($data)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 检查是否是一维数组
|
||||||
|
foreach ($data as $item) {
|
||||||
|
if (is_array($item)) {
|
||||||
|
return false; // 包含多维数组,不是一维数组
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 验证所有元素都是整数
|
||||||
|
foreach ($data as $item) {
|
||||||
|
$filtered = filter_var($item, FILTER_VALIDATE_INT);
|
||||||
|
if ($filtered === false) {
|
||||||
|
return false; // 不是整数
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
case 'datetime':
|
case 'datetime':
|
||||||
// 日期时间验证 - 保持原有逻辑不变
|
// 日期时间验证 - 保持原有逻辑不变
|
||||||
$formats = ['Y-m-d', 'Y-m-d H:i:s'];
|
$formats = ['Y-m-d', 'Y-m-d H:i:s'];
|
||||||
|
|
@ -614,7 +649,7 @@ class Base extends Controller{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 处理身高体重的单位,转换它们为cm和kg。
|
// 处理身高体重的单位,转换它们为cm和kg。(有用)
|
||||||
public function convertHeightAndWeight($height, $weight) {
|
public function convertHeightAndWeight($height, $weight) {
|
||||||
// 加 bcadd(,,20)
|
// 加 bcadd(,,20)
|
||||||
// 减 bcsub(,,20)
|
// 减 bcsub(,,20)
|
||||||
|
|
@ -709,36 +744,290 @@ class Base extends Controller{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
##########################################################以下是厨房秤的内容##########################################################
|
||||||
|
##########################################################以下是厨房秤的内容##########################################################
|
||||||
|
##########################################################以下是厨房秤的内容##########################################################
|
||||||
|
|
||||||
|
// 计算常规卡路里
|
||||||
|
public function count_user_nutrition_all($data){
|
||||||
public function ceshiyong($aa = 4,$gd = 0.2){
|
// 计算基础代谢率(BMR)
|
||||||
|
if($data['gender'] == 1){
|
||||||
phpinfo();
|
// 男性:BMR = 10 × 体重(kg) + 6.25 × 身高(cm) - 5 × 年龄(岁) + 5
|
||||||
die;
|
$bmr = bcmul(10,$data['weight'],20);
|
||||||
$token = 'cd3f27cf4c4002170ea7bceeb723ac91';
|
$bmr = bcadd($bmr,bcmul(6.25,$data['height'],20),20);
|
||||||
|
$bmr = bcsub($bmr,bcmul(5,$data['age_num'],20),20);
|
||||||
$data = Db::table('pc_bmistand2')->select();
|
$bmr = bcadd($bmr,5,2);
|
||||||
for ($i=0; $i < count($data); $i++) {
|
}else if($data['gender'] == 2){
|
||||||
foreach ($data[$i] as $key => $value) {
|
// 女性:BMR = 10 × 体重(kg) + 6.25 × 身高(cm) - 5 × 年龄(岁) - 161
|
||||||
$data[$i][$key] = str_replace(' ', '',$data[$i][$key]);
|
$bmr = bcmul(10,$data['weight'],20);
|
||||||
|
$bmr = bcadd($bmr,bcmul(6.25,$data['height'],20),20);
|
||||||
}
|
$bmr = bcsub($bmr,bcmul(5,$data['age_num'],20),20);
|
||||||
Db::table('pc_bmistand2')->where(['id'=>$data[$i]['id']])->update([
|
$bmr = bcsub($bmr,161,2);
|
||||||
'month'=>$data[$i]['month'],
|
}else{
|
||||||
'sex'=>$data[$i]['sex'],
|
return $this->msg(10003,'性别未知');
|
||||||
// 'f3sd'=>$data[$i]['f3sd'],
|
|
||||||
// 'f2sd'=>$data[$i]['f2sd'],
|
|
||||||
'f1sd'=>$data[$i]['f1sd'],
|
|
||||||
'median'=>$data[$i]['median'],
|
|
||||||
'z1sd'=>$data[$i]['z1sd'],
|
|
||||||
'z2sd'=>$data[$i]['z2sd'],
|
|
||||||
// 'z3sd'=>$data[$i]['z3sd'],
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
die;
|
|
||||||
// $this->send_email_api_error(["tsf3920322@126.com"],['title'=>'接口报错','from_user_name'=>'青测API','content'=>'123']);
|
// 每日总能量消耗(TDEE)
|
||||||
|
// 久坐(很少或没有运动):BMR × 1.2
|
||||||
|
// 轻度活动(每周1-3天轻度运动):BMR × 1.375
|
||||||
|
// 中度活动(每周3-5天中度运动):BMR × 1.55
|
||||||
|
// 高度活动(每周6-7天高强度运动):BMR × 1.725
|
||||||
|
// 极高活动(体力劳动或每天高强度训练):BMR × 1.9
|
||||||
|
if(array_key_exists('activity_level',$data)){
|
||||||
|
if($data['activity_level'] != null){
|
||||||
|
$tdee = bcmul($bmr,$data['activity_level'],2);
|
||||||
|
}else{
|
||||||
|
$tdee = bcmul($bmr,1.55,2);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$tdee = bcmul($bmr,1.55,2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 碳水化合物:通常占总热量的45-65%
|
||||||
|
// 蛋白质:通常占总热量的10-35%
|
||||||
|
// 脂肪:通常占总热量的20-35%
|
||||||
|
// 孩子&成年人:碳水化合物50%,蛋白质20%,脂肪30%。
|
||||||
|
// 老人:碳水化合物50%,蛋白质25%,脂肪25%。
|
||||||
|
// 建议每日摄入量计算:
|
||||||
|
// 1.碳水化合物(克): (TDEE × 碳水化合物比例) / 4
|
||||||
|
// 2.蛋白质(克):(TDEE × 蛋白质比例) / 4
|
||||||
|
// 3.脂肪(克): (TDEE × 脂肪比例) / 9
|
||||||
|
|
||||||
|
$carbohydrate_p = 0.5;
|
||||||
|
$carbohydrate = bcdiv(bcmul($tdee,0.5,20),4,2);
|
||||||
|
if($data['age_num'] < 65){
|
||||||
|
$protein_p = 0.2;
|
||||||
|
$fat_p = 0.3;
|
||||||
|
$protein = bcdiv(bcmul($tdee,0.2,20),4,2);
|
||||||
|
$fat = bcdiv(bcmul($tdee,0.3,20),9,2);
|
||||||
|
}else{
|
||||||
|
$protein_p = 0.25;
|
||||||
|
$fat_p = 0.25;
|
||||||
|
$protein = bcdiv(bcmul($tdee,0.25,20),4,2);
|
||||||
|
$fat =bcdiv(bcmul($tdee,0.25,20),9,2);
|
||||||
|
}
|
||||||
|
return ['kcal'=>$tdee,'carbohydrate'=>$carbohydrate,'protein'=>$protein,'fat'=>$fat,'bmr'=>$bmr,'carbohydrate_p'=>$carbohydrate_p,'protein_p'=>$protein_p,'fat_p'=>$fat_p];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算营养物质
|
||||||
|
public function calculate_nutrients($data){
|
||||||
|
// dump($data);
|
||||||
|
$food_id_arr = [];
|
||||||
|
for ($i=0; $i < count($data); $i++) {
|
||||||
|
$food_id_arr[] = $data[$i]['food_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$cfc = Db::connect('cfc_db');
|
||||||
|
|
||||||
|
// dump($data);
|
||||||
|
// dump(implode(",",$food_id_arr));
|
||||||
|
$nutrients_list = $cfc->table($this->base_use_db_name['foodlist4'])
|
||||||
|
->where("father_id in (".implode(",",$food_id_arr).")")
|
||||||
|
// ->field()
|
||||||
|
->select();
|
||||||
|
|
||||||
|
$nutrients_arr = ['VitaminA','VitaminB1','VitaminB2','VitaminB6','VitaminB12','VitaminD','VitaminK','Niacin','VitaminC','VitaminE','FolicAcid','Biotin','PantothenicAcid','TotalCholine','Ca','Phosphorus','Kalium','Mg','Na','Fe','Zn','Se','Cu','Mn','Iodine'];
|
||||||
|
// dump($nutrients_list);
|
||||||
|
// die;
|
||||||
|
// 加 bcadd(,,20)
|
||||||
|
// 减 bcsub(,,20)
|
||||||
|
// 乘 bcmul(,,20)
|
||||||
|
// 除 bcdiv(,,20)
|
||||||
|
for ($i=0; $i < count($data); $i++) {
|
||||||
|
$zong_all = bcadd($data[$i]['protein_val'],bcadd($data[$i]['fat_val'],$data[$i]['carbohydrate_val'],20),20);
|
||||||
|
$data[$i]['nutrients_four'][] = [
|
||||||
|
'name' => '卡路里',
|
||||||
|
'unit' => 'kcal',
|
||||||
|
'color' => '',
|
||||||
|
'value' => $data[$i]['kcal_val'],
|
||||||
|
'proportion' => 0,
|
||||||
|
];
|
||||||
|
$data[$i]['nutrients_four'][] = [
|
||||||
|
'name' => '蛋白质',
|
||||||
|
'unit' => 'g',
|
||||||
|
'color' => '#5180D8',
|
||||||
|
'value' => $data[$i]['protein_val'],
|
||||||
|
'proportion' => $zong_all == 0?0:bcmul(bcdiv($data[$i]['protein_val'],$zong_all,2),100,0),
|
||||||
|
];
|
||||||
|
$data[$i]['nutrients_four'][] = [
|
||||||
|
'name' => '脂肪',
|
||||||
|
'unit' => 'g',
|
||||||
|
'color' => '#ED7886',
|
||||||
|
'value' => $data[$i]['fat_val'],
|
||||||
|
'proportion' => $zong_all == 0?0:bcmul(bcdiv($data[$i]['fat_val'],$zong_all,2),100,0),
|
||||||
|
];
|
||||||
|
$data[$i]['nutrients_four'][] = [
|
||||||
|
'name' => '碳水化合物',
|
||||||
|
'unit' => 'g',
|
||||||
|
'color' => '#FFB169',
|
||||||
|
'value' => $data[$i]['carbohydrate_val'],
|
||||||
|
'proportion' => $zong_all == 0?0:bcmul(bcdiv($data[$i]['carbohydrate_val'],$zong_all,2),100,0),
|
||||||
|
];
|
||||||
|
$data[$i]['nutrients_list'][] = [
|
||||||
|
'name' => 'Calorie',
|
||||||
|
'name_ch' => '卡路里',
|
||||||
|
'unit' => 'kcal',
|
||||||
|
'value' => $data[$i]['kcal_val'],
|
||||||
|
'type' => 1,
|
||||||
|
'type_name' => '能量及宏量营养素',
|
||||||
|
'color' => '#C4FFE0',
|
||||||
|
];
|
||||||
|
$data[$i]['nutrients_list'][] = [
|
||||||
|
'name' => 'Protein',
|
||||||
|
'name_ch' => '蛋白质',
|
||||||
|
'unit' => 'g',
|
||||||
|
'value' => $data[$i]['protein_val'],
|
||||||
|
'type' => 1,
|
||||||
|
'type_name' => '能量及宏量营养素',
|
||||||
|
'color' => '#C4FFE0',
|
||||||
|
];
|
||||||
|
$data[$i]['nutrients_list'][] = [
|
||||||
|
'name' => 'Fat',
|
||||||
|
'name_ch' => '脂肪',
|
||||||
|
'unit' => 'g',
|
||||||
|
'value' => $data[$i]['fat_val'],
|
||||||
|
'type' => 1,
|
||||||
|
'type_name' => '能量及宏量营养素',
|
||||||
|
'color' => '#C4FFE0',
|
||||||
|
];
|
||||||
|
$data[$i]['nutrients_list'][] = [
|
||||||
|
'name' => 'Carbohydrate',
|
||||||
|
'name_ch' => '碳水化合物',
|
||||||
|
'unit' => 'g',
|
||||||
|
'value' => $data[$i]['carbohydrate_val'],
|
||||||
|
'type' => 1,
|
||||||
|
'type_name' => '能量及宏量营养素',
|
||||||
|
'color' => '#C4FFE0',
|
||||||
|
];
|
||||||
|
foreach ($nutrients_list as $key => $value) {
|
||||||
|
if($value['father_id'] == $data[$i]['food_id']){
|
||||||
|
if(in_array($value['name'],$nutrients_arr)){
|
||||||
|
$data[$i]['nutrients_list'][] = [
|
||||||
|
'name' => $value['name'],
|
||||||
|
'name_ch' => $value['name_ch'],
|
||||||
|
'unit' => $value['unit'],
|
||||||
|
'value' => bcmul($value['value'],bcdiv($data[$i]['weight'],100,20),2),
|
||||||
|
'type' => $value['type'],
|
||||||
|
'type_name' => $value['type'] == 1?'能量及宏量营养素':($value['type'] == 2?'维生素':($value['type'] == 3?'矿物质':'')),
|
||||||
|
'color' => $value['type'] == 1?'#C4FFE0':($value['type'] == 2?'#FFEFB7':($value['type'] == 3?'#7DA8E0':'')),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function add_search_history_action($data){
|
||||||
|
// 添加一条搜索记录start
|
||||||
|
// $data['id']是账号id
|
||||||
|
// $cfc = Db::connect('cfc_db');
|
||||||
|
$insert_search_log = Db::table($this->base_use_db_name['search_history'])->where(['user_id'=>$data['id'],'keyword'=>$data['search_data'],'type'=>$data['type']])->field('id,search_count')->find();
|
||||||
|
if($insert_search_log){
|
||||||
|
Db::table($this->base_use_db_name['search_history'])->where(['id'=>$insert_search_log['id']])->update([
|
||||||
|
'search_count'=>$insert_search_log['search_count']+1,
|
||||||
|
'last_searched_at'=>date('Y-m-d H:i:s'),
|
||||||
|
]);
|
||||||
|
}else{
|
||||||
|
Db::table($this->base_use_db_name['search_history'])->insert([
|
||||||
|
'user_id'=>$data['id'],
|
||||||
|
'keyword'=>$data['search_data'],
|
||||||
|
'type'=>$data['type'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
// 添加一条搜索记录end
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将重量转换为克(g)
|
||||||
|
* @param string $weight 重量值
|
||||||
|
* @param string $unit 单位 (g, oz, lb, lb:oz)
|
||||||
|
* @return float 转换后的克重
|
||||||
|
*/
|
||||||
|
public function convertWeightToGrams($weight = 100, $unit = 'oz') {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 定义精确的转换常量
|
||||||
|
$G_PER_OZ = '28.349523125';
|
||||||
|
$G_PER_LB = '453.59237';
|
||||||
|
|
||||||
|
$unit = strtolower($unit);
|
||||||
|
$result = 0;
|
||||||
|
|
||||||
|
switch ($unit) {
|
||||||
|
case 'g':
|
||||||
|
case '克':
|
||||||
|
// 已经是克,直接返回
|
||||||
|
$result = $weight;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'oz':
|
||||||
|
case '盎司':
|
||||||
|
// 盎司转克
|
||||||
|
$result = bcmul($weight,$G_PER_OZ,2);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'lb':
|
||||||
|
case '磅':
|
||||||
|
// 磅转克
|
||||||
|
$result = bcmul($weight,$G_PER_LB,2);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'lb:oz':
|
||||||
|
case '磅:盎司':
|
||||||
|
// 磅:盎司复合单位处理
|
||||||
|
if (strpos($weight, ':') !== false) {
|
||||||
|
$temporary_data = explode(':', $weight);
|
||||||
|
$result = bcadd(bcmul($temporary_data[0],$G_PER_LB,20),bcmul($temporary_data[1],$G_PER_OZ,20),20);
|
||||||
|
} else {
|
||||||
|
// 如果格式不正确,可以抛出异常或返回0
|
||||||
|
$result = '0';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$result = '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保留两位小数并返回(目前不做截取,全额返回)
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// public function ceshiyong($aa = 4,$gd = 0.2){
|
||||||
|
|
||||||
|
// phpinfo();
|
||||||
|
// die;
|
||||||
|
// $token = 'cd3f27cf4c4002170ea7bceeb723ac91';
|
||||||
|
|
||||||
|
// $data = Db::table('pc_bmistand2')->select();
|
||||||
|
// for ($i=0; $i < count($data); $i++) {
|
||||||
|
// foreach ($data[$i] as $key => $value) {
|
||||||
|
// $data[$i][$key] = str_replace(' ', '',$data[$i][$key]);
|
||||||
|
|
||||||
|
// }
|
||||||
|
// Db::table('pc_bmistand2')->where(['id'=>$data[$i]['id']])->update([
|
||||||
|
// 'month'=>$data[$i]['month'],
|
||||||
|
// 'sex'=>$data[$i]['sex'],
|
||||||
|
// // 'f3sd'=>$data[$i]['f3sd'],
|
||||||
|
// // 'f2sd'=>$data[$i]['f2sd'],
|
||||||
|
// 'f1sd'=>$data[$i]['f1sd'],
|
||||||
|
// 'median'=>$data[$i]['median'],
|
||||||
|
// 'z1sd'=>$data[$i]['z1sd'],
|
||||||
|
// 'z2sd'=>$data[$i]['z2sd'],
|
||||||
|
// // 'z3sd'=>$data[$i]['z3sd'],
|
||||||
|
// ]);
|
||||||
|
// }
|
||||||
|
// die;
|
||||||
|
// // $this->send_email_api_error(["tsf3920322@126.com"],['title'=>'接口报错','from_user_name'=>'青测API','content'=>'123']);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -3,14 +3,31 @@
|
||||||
namespace app\NewReedaw\controller\app;
|
namespace app\NewReedaw\controller\app;
|
||||||
|
|
||||||
use think\Db;
|
use think\Db;
|
||||||
use think\Cache;
|
|
||||||
|
|
||||||
class Card extends Base{
|
class Card extends Base{
|
||||||
|
|
||||||
protected $card_db_name = [
|
protected $card_db_name = [
|
||||||
'zhanghao'=>'app_account_number',
|
'zhanghao'=>'app_account_number',
|
||||||
'juese'=>'app_user_data',
|
'juese'=>'app_user_data',
|
||||||
'card'=>'app_card_data'
|
'card'=>'app_card_data',
|
||||||
|
'skip'=>'app_card_skip_data',
|
||||||
|
'vitalcapacity'=>'app_card_vitalcapacity_data',
|
||||||
|
'zhongzhao'=>'app_sportstesting_data',
|
||||||
|
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $card_standard_arr_data = [
|
||||||
|
'id'=>'',
|
||||||
|
'name'=>'',
|
||||||
|
'content'=>'',
|
||||||
|
'page_url_report'=>'',
|
||||||
|
'is_sub_item'=>'',
|
||||||
|
'background_color'=>'',
|
||||||
|
'background_pic'=>'',
|
||||||
|
'key_word'=>'',
|
||||||
|
'data'=>[],
|
||||||
];
|
];
|
||||||
// 加 bcadd(,,20)
|
// 加 bcadd(,,20)
|
||||||
// 减 bcsub(,,20)
|
// 减 bcsub(,,20)
|
||||||
|
|
@ -23,10 +40,10 @@ class Card extends Base{
|
||||||
################################################################接口################################################################
|
################################################################接口################################################################
|
||||||
|
|
||||||
// 卡片列表信息
|
// 卡片列表信息
|
||||||
public function card_list_msg(){
|
public function card_list_all(){
|
||||||
|
$data = input('post.');
|
||||||
try {
|
try {
|
||||||
// 你的业务逻辑
|
// 你的业务逻辑
|
||||||
$data = input('post.');
|
|
||||||
if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data)){
|
if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
|
|
@ -36,7 +53,7 @@ class Card extends Base{
|
||||||
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||||||
return $this->msg(10005,'aud_id type error');
|
return $this->msg(10005,'aud_id type error');
|
||||||
}
|
}
|
||||||
return $this->card_list_msg_action($data);
|
return $this->card_list_all_action($data);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// 捕获异常
|
// 捕获异常
|
||||||
$logContent["flie"] = $e->getFile();
|
$logContent["flie"] = $e->getFile();
|
||||||
|
|
@ -51,12 +68,12 @@ class Card extends Base{
|
||||||
return $this->msg(99999);
|
return $this->msg(99999);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 卡片列表信息
|
// 保存用户所选的卡片列表
|
||||||
public function card_user_order(){
|
public function save_card_list(){
|
||||||
|
$data = input('post.');
|
||||||
try {
|
try {
|
||||||
// 你的业务逻辑
|
// 你的业务逻辑
|
||||||
$data = input('post.');
|
if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data) || !array_key_exists('card_list', $data)){
|
||||||
if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data) || !array_key_exists('card_data', $data)){
|
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
if(!$this->verify_data_is_ok($data['token'],'str')){
|
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||||
|
|
@ -65,7 +82,137 @@ class Card extends Base{
|
||||||
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||||||
return $this->msg(10005,'aud_id type error');
|
return $this->msg(10005,'aud_id type error');
|
||||||
}
|
}
|
||||||
return $this->card_user_order_action($data);
|
if(!$this->verify_data_is_ok(explode(',',$data['card_list']),'arr_intnum')){
|
||||||
|
return $this->msg(10005,'aud_id type error');
|
||||||
|
}
|
||||||
|
return $this->save_card_list_action($data);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// 捕获异常
|
||||||
|
$logContent["flie"] = $e->getFile();
|
||||||
|
$logContent["line"] = $e->getLine();
|
||||||
|
$logContent['all_content'] = "异常信息:\n";
|
||||||
|
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||||
|
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||||
|
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||||
|
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||||
|
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||||
|
$this->record_api_log($data, $logContent, null);
|
||||||
|
return $this->msg(99999);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 角色卡片列表信息
|
||||||
|
public function user_card_list(){
|
||||||
|
$data = input('post.');
|
||||||
|
try {
|
||||||
|
// 你的业务逻辑
|
||||||
|
if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data)){
|
||||||
|
return $this->msg(10001);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||||
|
return $this->msg(10005,'token type error');
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||||||
|
return $this->msg(10005,'aud_id type error');
|
||||||
|
}
|
||||||
|
return $this->user_card_list_action($data);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// 捕获异常
|
||||||
|
$logContent["flie"] = $e->getFile();
|
||||||
|
$logContent["line"] = $e->getLine();
|
||||||
|
$logContent['all_content'] = "异常信息:\n";
|
||||||
|
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||||
|
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||||
|
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||||
|
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||||
|
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||||
|
$this->record_api_log($data, $logContent, null);
|
||||||
|
return $this->msg(99999);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// BMI测评
|
||||||
|
public function bmi_evaluation(){
|
||||||
|
$cbe_data = input('post.');
|
||||||
|
try {
|
||||||
|
|
||||||
|
if(!is_array($cbe_data)){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
if(!array_key_exists('height', $cbe_data) || !array_key_exists('weight', $cbe_data) || !array_key_exists('birthday', $cbe_data) || !array_key_exists('sex', $cbe_data)){
|
||||||
|
return $this->msg(10001);
|
||||||
|
}
|
||||||
|
unset($cbe_data['token']);
|
||||||
|
if(!$this->verify_data_is_ok($cbe_data['birthday'],'datetime')){
|
||||||
|
return $this->msg(10005,'birthday type error');
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($cbe_data['height'],'num')){
|
||||||
|
return $this->msg(10005,'height type error');
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($cbe_data['weight'],'num')){
|
||||||
|
return $this->msg(10005,'weight type error');
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($cbe_data['sex'],'intnum')){
|
||||||
|
return $this->msg(10005,'sex type error');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 直接开始业务,请求外部接口start
|
||||||
|
$url = 'http://ybdevice.pcxbc.com/api/result/calcbmi';
|
||||||
|
$temporary_parameter = [
|
||||||
|
'height'=>$cbe_data['height'],
|
||||||
|
'weight'=>$cbe_data['weight'],
|
||||||
|
'birthday'=>$cbe_data['birthday'],
|
||||||
|
'sex'=>$cbe_data['sex'],
|
||||||
|
];
|
||||||
|
$request_result = $this->postRequest($url,$temporary_parameter,array('Content-Type:application/json','Origin:http://ybdevice.pcxbc.com'));
|
||||||
|
// 直接开始业务,请求外部接口end
|
||||||
|
|
||||||
|
// 处理进度点
|
||||||
|
$request_result =$this->bmi_evaluation_action($request_result);
|
||||||
|
return $request_result;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// 捕获异常
|
||||||
|
$logContent["flie"] = $e->getFile();
|
||||||
|
$logContent["line"] = $e->getLine();
|
||||||
|
$logContent['all_content'] = "异常信息:\n";
|
||||||
|
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||||
|
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||||
|
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||||
|
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||||
|
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||||
|
$this->record_api_log($cbe_data, $logContent, null);
|
||||||
|
return $this->msg(99999);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 身高预测
|
||||||
|
public function genetic_height(){
|
||||||
|
$data = input('post.');
|
||||||
|
try {
|
||||||
|
|
||||||
|
if(!array_key_exists('dadHeight', $data) || !array_key_exists('momHeight', $data) || !array_key_exists('birthday', $data) || !array_key_exists('sex', $data)){
|
||||||
|
return $this->msg(10001);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['birthday'],'datetime')){
|
||||||
|
return $this->msg(10005,'birthday type error');
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['dadHeight'],'num')){
|
||||||
|
return $this->msg(10005,'dadHeight type error');
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['momHeight'],'num')){
|
||||||
|
return $this->msg(10005,'momHeight type error');
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['sex'],'intnum')){
|
||||||
|
return $this->msg(10005,'sex type error');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 直接开始业务,请求外部接口start
|
||||||
|
$url = 'https://ybapi.pcxbc.com/api/child/predictheight';
|
||||||
|
$temporary_parameter = [
|
||||||
|
'dadHeight'=>$data['dadHeight'],
|
||||||
|
'momHeight'=>$data['momHeight'],
|
||||||
|
'birthday'=>$data['birthday'],
|
||||||
|
'sex'=>$data['sex'],
|
||||||
|
];
|
||||||
|
$request_result = $this->postRequest($url,$temporary_parameter,array('Content-Type:application/json','Origin:http://ybdevice.pcxbc.com'));
|
||||||
|
return json($request_result);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// 捕获异常
|
// 捕获异常
|
||||||
$logContent["flie"] = $e->getFile();
|
$logContent["flie"] = $e->getFile();
|
||||||
|
|
@ -82,9 +229,13 @@ class Card extends Base{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
################################################################action################################################################
|
################################################################action################################################################
|
||||||
################################################################action################################################################
|
################################################################action################################################################
|
||||||
public function card_list_msg_action($data){
|
|
||||||
|
public function card_list_all_action($data){
|
||||||
|
|
||||||
// 检查角色
|
// 检查角色
|
||||||
$user_data = Db::table($this->card_db_name['juese'])->where(['id'=>$data['aud_id'],'is_del'=>0])->field('id,card_order')->find();
|
$user_data = Db::table($this->card_db_name['juese'])->where(['id'=>$data['aud_id'],'is_del'=>0])->field('id,card_order')->find();
|
||||||
if(!$user_data){
|
if(!$user_data){
|
||||||
|
|
@ -98,46 +249,223 @@ class Card extends Base{
|
||||||
'chosen_no'=>[],
|
'chosen_no'=>[],
|
||||||
];
|
];
|
||||||
if($user_data['card_order'] != ''){
|
if($user_data['card_order'] != ''){
|
||||||
|
// 如果有设置过
|
||||||
$user_data['card_order'] = explode(',',$user_data['card_order']);
|
$user_data['card_order'] = explode(',',$user_data['card_order']);
|
||||||
}else{
|
}else{
|
||||||
$user_data['card_order'] = [];
|
$user_data['card_order'] = [];
|
||||||
}
|
}
|
||||||
for ($i=0; $i < count($card_data); $i++) {
|
// 对照处理用户的卡片信息
|
||||||
if(!in_array($card_data[$i]['id'],$user_data['card_order'])){
|
foreach ($user_data['card_order'] as $key => $value) {
|
||||||
$return_data['chosen_no'][] = $card_data[$i];
|
foreach ($card_data as $k => $v) {
|
||||||
}else{
|
if(in_array($v['id'],$user_data['card_order']) && $v['id'] == $value){
|
||||||
$key = array_search($card_data[$i]['id'], $user_data['card_order']);
|
$return_data['chosen_yes'][] = $v;
|
||||||
$return_data['chosen_yes'][$key] = $card_data[$i];
|
unset($card_data[$k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($card_data as $key => $value) {
|
||||||
|
$return_data['chosen_no'][] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 剔除不必要的数据
|
||||||
|
foreach ($return_data as $key => $value) {
|
||||||
|
foreach ($value as $k => $v) {
|
||||||
|
unset($return_data[$key][$k]['content']);
|
||||||
|
unset($return_data[$key][$k]['page_url_report']);
|
||||||
|
unset($return_data[$key][$k]['is_sub_item']);
|
||||||
|
unset($return_data[$key][$k]['background_color']);
|
||||||
|
unset($return_data[$key][$k]['background_pic']);
|
||||||
|
unset($return_data[$key][$k]['ROW_NUMBER']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ksort($return_data['chosen_yes']);
|
|
||||||
return $this->msg($return_data);
|
return $this->msg($return_data);
|
||||||
}
|
}
|
||||||
public function card_user_order_action($data){
|
public function save_card_list_action($data){
|
||||||
|
// 检查角色
|
||||||
if($data['card_data'] != ''){
|
$user_data = Db::table($this->card_db_name['juese'])->where(['id'=>$data['aud_id'],'is_del'=>0])->field('id,card_order')->find();
|
||||||
$data['card_data2'] = explode(',',$data['card_data']);
|
if(!$user_data){
|
||||||
}else{
|
|
||||||
$data['card_data2'] = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($data['card_data2'] as $key => $value) {
|
|
||||||
if(!$this->verify_data_is_ok($value,'intnum')){
|
|
||||||
return $this->msg(10005,'卡片id错误');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$user_data = Db::table($this->card_db_name['juese'])->where(['id'=>$data['aud_id'],'is_del'=>0])->count();
|
|
||||||
if($user_data <= 0){
|
|
||||||
return $this->msg(10003,'未核实到角色信息');
|
return $this->msg(10003,'未核实到角色信息');
|
||||||
}
|
}
|
||||||
$result = Db::table($this->card_db_name['juese'])->where(['id'=>$data['aud_id']])->update(['card_order' => $data['card_data']]);
|
$card_data = Db::table($this->card_db_name['card'])->where("id in (".$data['card_list'].")")->field('id')->cache(86400)->select();
|
||||||
if($result){
|
|
||||||
return $this->msg([]);
|
if(count(explode(',',$data['card_list'])) == count($card_data)){
|
||||||
|
$result = Db::table($this->card_db_name['juese'])->where(['id'=>$data['aud_id'],'is_del'=>0])->update([
|
||||||
|
'card_order' => $data['card_list']
|
||||||
|
]);
|
||||||
|
if($result){
|
||||||
|
return $this->msg([]);
|
||||||
|
}else{
|
||||||
|
return $this->msg(10002);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
return $this->msg(10002);
|
return $this->msg(10003,'卡片数据错误');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function user_card_list_action($data){
|
||||||
|
// 检查角色
|
||||||
|
$user_data = Db::table($this->card_db_name['juese'])->where(['id'=>$data['aud_id'],'is_del'=>0])->field('id,card_order')->find();
|
||||||
|
if(!$user_data){
|
||||||
|
return $this->msg(10003,'未核实到角色信息');
|
||||||
|
}
|
||||||
|
if($user_data['card_order'] == '' || $user_data['card_order'] == '2'){
|
||||||
|
// == 2是为了兼容老数据
|
||||||
|
return $this->msg([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$card_data = Db::table($this->card_db_name['card'])->where(['is_del'=>0])->field('id,name,content,page_url_report,is_sub_item,background_color,background_pic,key_word')->cache(86400)->select();
|
||||||
|
|
||||||
|
// 处理卡片映射
|
||||||
|
$card_data_map = [];
|
||||||
|
foreach ($card_data as $key => $value) {
|
||||||
|
$card_data_map[$value['key_word']] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开始处理列表数据
|
||||||
|
$user_card_list = explode(',',$user_data['card_order']);
|
||||||
|
$return_data = [];
|
||||||
|
|
||||||
|
// dump($card_data_map);
|
||||||
|
// die;
|
||||||
|
|
||||||
|
foreach ($user_card_list as $key => $value) {
|
||||||
|
// dump('本次card_id:'.$value);
|
||||||
|
$temporary_data = $this->little_tool_one($card_data_map,$data['aud_id'],$value);
|
||||||
|
|
||||||
|
// dump('最终结果如下');
|
||||||
|
// dump($temporary_data);
|
||||||
|
if(count($temporary_data) > 0){
|
||||||
|
$return_data[] = $temporary_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->msg($return_data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public function bmi_evaluation_action($data){
|
||||||
|
// 加 bcadd(,,20)
|
||||||
|
// 减 bcsub(,,20)
|
||||||
|
// 乘 bcmul(,,20)
|
||||||
|
// 除 bcdiv(,,20)
|
||||||
|
if(!array_key_exists('code',$data) || !array_key_exists('data',$data)){
|
||||||
|
return $this->msg(99999,'网络异常,请稍后重试1');
|
||||||
|
}
|
||||||
|
if($data['code'] != 0){
|
||||||
|
return $this->msg(99999,'网络异常,请稍后重试2');
|
||||||
|
}
|
||||||
|
if(!is_array($data['data'])){
|
||||||
|
return $this->msg(99999,'网络异常,请稍后重试3');
|
||||||
|
}
|
||||||
|
if(!array_key_exists('bmi',$data['data']) || !array_key_exists('bmilevel',$data['data']) || !array_key_exists('bmilevelcolor',$data['data']) || !array_key_exists('bmilevellist',$data['data'])){
|
||||||
|
return $this->msg(99999,'网络异常,请稍后重试4');
|
||||||
|
}
|
||||||
|
if(!is_array($data['data']['bmilevellist'])){
|
||||||
|
return $this->msg(99999,'网络异常,请稍后重试5');
|
||||||
|
}
|
||||||
|
$num = 0;
|
||||||
|
$subsection_val = 0;
|
||||||
|
$temporary_subsection_val = null;
|
||||||
|
foreach ($data['data']['bmilevellist'] as $key => $value) {
|
||||||
|
if(!array_key_exists('maxvalue',$value) || !array_key_exists('minvalue',$value)){
|
||||||
|
return $this->msg(99999,'网络异常,请稍后重试6');
|
||||||
|
}
|
||||||
|
// 判断是否可以进行比较,规则是否正确
|
||||||
|
if(is_numeric($value['maxvalue']) && is_numeric($value['minvalue'])){
|
||||||
|
if($data['data']['bmi'] >= $value['minvalue'] && $data['data']['bmi'] < $value['maxvalue']){
|
||||||
|
// 在落点内
|
||||||
|
$subsection_val = bcsub($value['maxvalue'],$value['minvalue'],1);//获取最大最小值差
|
||||||
|
$temporary_subsection_val = bcsub($data['data']['bmi'],$value['minvalue'],1);//获取当前值与最小值差
|
||||||
|
$temporary_subsection_val = bcdiv($temporary_subsection_val,$subsection_val,1);//获取当前值与最小值差与最大最小值差之比
|
||||||
|
$subsection_val = bcdiv(100,count($data['data']['bmilevellist']),1);//每段应该的百分比
|
||||||
|
$temporary_subsection_val = bcmul($subsection_val,$temporary_subsection_val,1);//获取当前值与最小值差与最大最小值差之比与总段数之比
|
||||||
|
$temporary_subsection_val = bcadd($temporary_subsection_val,bcmul($subsection_val,$num,1),1);
|
||||||
|
}else{
|
||||||
|
$num = $num + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($temporary_subsection_val === null){
|
||||||
|
if($data['data']['bmi'] >= $data['data']['bmilevellist'][count($data['data']['bmilevellist'])-1]['maxvalue']){
|
||||||
|
$temporary_subsection_val = 100;
|
||||||
|
}else{
|
||||||
|
return $this->msg(99999,'网络异常,请稍后重试7');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$data['data']['offset'] = $temporary_subsection_val;
|
||||||
|
$data = $data['data'];
|
||||||
|
// 处理key名称一致start
|
||||||
|
foreach ($data['bmilevellist'] as $key => $value) {
|
||||||
|
$data['bmilevellist'][$key]['max_val'] = $value['maxvalue'];
|
||||||
|
$data['bmilevellist'][$key]['min_val'] = $value['minvalue'];
|
||||||
|
unset($data['bmilevellist'][$key]['minvalue']);
|
||||||
|
unset($data['bmilevellist'][$key]['maxvalue']);
|
||||||
|
}
|
||||||
|
// 处理key名称一致end
|
||||||
|
return $this->msg($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
################################################################小工具################################################################
|
||||||
|
################################################################小工具################################################################
|
||||||
|
|
||||||
|
public function little_tool_one($data,$aud_id,$type){
|
||||||
|
$result = $this->card_standard_arr_data;
|
||||||
|
if($type == 6){
|
||||||
|
if(!array_key_exists('skip',$data)){
|
||||||
|
// 如果系统已经停用了跳绳
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
$temporary_data = $data['skip'];
|
||||||
|
$all_data = Db::table($this->card_db_name['skip'])->where(['aud_id'=>$aud_id,'is_del'=>0])->order('id desc')->field('id,jump_kcal as val_data')->find();
|
||||||
|
$result['data']['unit'] = 'kcal';
|
||||||
|
}else if($type == 8){
|
||||||
|
if(!array_key_exists('vitalcapacity',$data)){
|
||||||
|
// 如果系统已经停用了肺活
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
$temporary_data = $data['skip'];
|
||||||
|
$all_data = Db::table($this->card_db_name['vitalcapacity'])->where(['aud_id'=>$aud_id,'is_del'=>0])->order('id desc')->field('id,score_val as val_data')->find();
|
||||||
|
$result['data']['unit'] = '分';
|
||||||
|
}else if($type == 20){
|
||||||
|
if(!array_key_exists('zz_score',$data)){
|
||||||
|
// 如果系统已经停用了中招估分
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
$temporary_data = $data['skip'];
|
||||||
|
$all_data = Db::table($this->card_db_name['zhongzhao'])->where(['aud_id'=>$aud_id,'is_del'=>0])->order('id desc')->field('id,score as val_data')->find();
|
||||||
|
$result['data']['unit'] = '分';
|
||||||
|
}else if($type == 21 || $type == 22 || $type == 25 || $type == 26){
|
||||||
|
if(!array_key_exists('bmi',$data) || !array_key_exists('heredity',$data) || !array_key_exists('fat_loss',$data) || !array_key_exists('target',$data)){
|
||||||
|
// 如果系统已经停用了BMI测评、遗传身高、减脂对比、曲线/目标、
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$map = ['21'=>'bmi','22'=>'heredity','25'=>'fat_loss','26'=>'target'];
|
||||||
|
$temporary_data = $data[$map[$type]];
|
||||||
|
$all_data = ['val_data'=>''];
|
||||||
|
$result['data']['unit'] = '';
|
||||||
|
|
||||||
|
}else{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if($all_data){
|
||||||
|
$result['id'] = $temporary_data['id'];
|
||||||
|
$result['name'] = $temporary_data['name'];
|
||||||
|
$result['content'] = $temporary_data['content'];
|
||||||
|
$result['page_url_report'] = $temporary_data['page_url_report'];
|
||||||
|
$result['is_sub_item'] = $temporary_data['is_sub_item'];
|
||||||
|
$result['background_color'] = $temporary_data['background_color'];
|
||||||
|
$result['background_pic'] = $temporary_data['background_pic'];
|
||||||
|
$result['key_word'] = $temporary_data['key_word'];
|
||||||
|
|
||||||
|
$result['data']['value'] = $all_data['val_data'];
|
||||||
|
return $result;
|
||||||
|
}else{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,436 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\NewReedaw\controller\app;
|
||||||
|
|
||||||
|
use think\Db;
|
||||||
|
use think\Controller;
|
||||||
|
|
||||||
|
class Guessyoulike extends Controller {
|
||||||
|
|
||||||
|
protected $kitchenscale_db_msg = [
|
||||||
|
'cookbook' => 'app_user_cookbook', //食谱表
|
||||||
|
'cookbook_label' => 'app_user_cookbook_label', //食谱标签表
|
||||||
|
'cookbook_food_relation' => 'app_user_cookbook_food_relation', //食谱跟食材关系表
|
||||||
|
'foodlist2' => 'app_z_national_standard_food_type_2', //食材标签表2
|
||||||
|
'foodlist3' => 'app_z_national_standard_food_type_3', //食材表
|
||||||
|
'kcal_log' => 'app_user_kcal_log', //用户饮食记录表记录用户吃了什么食材
|
||||||
|
'search_history' => 'app_user_search_history', //用户搜索记录表,记录用户搜索过什么内容
|
||||||
|
'tag_preference' => 'app_user_tag_preference', //用户标签偏好表
|
||||||
|
'recommend_cache' => 'app_recommend_cache' //智能推荐缓存表
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $config = [
|
||||||
|
'tag_limit' => 2,
|
||||||
|
'item_limit' => 12,
|
||||||
|
'cache_time' => 3600
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 猜你喜欢主接口
|
||||||
|
*/
|
||||||
|
public function getGuessYouLike($user_id = 1, $type = 'food', $limit = null) {
|
||||||
|
try {
|
||||||
|
$cfc = Db::connect('cfc_db');
|
||||||
|
// dump(1);
|
||||||
|
// 设置限制数量
|
||||||
|
$tag_limit = $limit ? intval($limit) : $this->config['tag_limit'];
|
||||||
|
$item_limit = $this->config['item_limit'];
|
||||||
|
|
||||||
|
// 检查缓存
|
||||||
|
// $cache_key = $user_id . ':' . $type;
|
||||||
|
// $cache_result = $this->getCache($cfc, $cache_key);
|
||||||
|
// // die;
|
||||||
|
// if ($cache_result !== null) {
|
||||||
|
// return $cache_result;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 判断用户是否有历史数据
|
||||||
|
$has_history = $this->checkUserHistory($cfc, $user_id);
|
||||||
|
|
||||||
|
if (!$has_history) {
|
||||||
|
// 新用户,返回最火信息(仅一个标签)
|
||||||
|
$result = $this->getPopularRecommendations($cfc, $type, 1, $item_limit);
|
||||||
|
} else {
|
||||||
|
// 老用户,根据类型返回个性化推荐
|
||||||
|
|
||||||
|
if ($type === 'cookbook') {
|
||||||
|
$result = $this->getCookbookRecommendations($cfc, $user_id, $tag_limit, $item_limit);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$result = $this->getFoodRecommendations($cfc, $user_id, $tag_limit, $item_limit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确保返回格式正确
|
||||||
|
if (!is_array($result)) {
|
||||||
|
$result = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新缓存
|
||||||
|
// $this->updateCache($cfc, $cache_key, $user_id, $type, $result);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// 记录错误日志
|
||||||
|
\think\Log::error('猜你喜欢功能错误: ' . $e->getMessage());
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查用户是否有历史数据
|
||||||
|
*/
|
||||||
|
private function checkUserHistory($db, $user_id) {
|
||||||
|
try {
|
||||||
|
// 检查饮食记录
|
||||||
|
// $kcal_result = $db->query("
|
||||||
|
$kcal_result = Db::query("
|
||||||
|
SELECT COUNT(*) as count
|
||||||
|
FROM {$this->kitchenscale_db_msg['kcal_log']}
|
||||||
|
WHERE aud_id = ? AND is_del = 0
|
||||||
|
", [$user_id]);
|
||||||
|
$kcal_count = $kcal_result[0]['count'] ?? 0;
|
||||||
|
|
||||||
|
// 检查搜索记录
|
||||||
|
// $search_result = $db->query("
|
||||||
|
$search_result = Db::query("
|
||||||
|
SELECT COUNT(*) as count
|
||||||
|
FROM {$this->kitchenscale_db_msg['search_history']}
|
||||||
|
WHERE user_id = ? AND is_del = 0
|
||||||
|
", [$user_id]);
|
||||||
|
$search_count = $search_result[0]['count'] ?? 0;
|
||||||
|
|
||||||
|
return ($kcal_count > 0 || $search_count > 0);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取缓存数据
|
||||||
|
*/
|
||||||
|
private function getCache($db, $cache_key) {
|
||||||
|
try {
|
||||||
|
// $cache_result = $db->query("
|
||||||
|
$cache_result = Db::query("
|
||||||
|
SELECT id, cache_key, user_id, keyword, recommend_data, hit_count, last_hit, is_del, create_time
|
||||||
|
FROM {$this->kitchenscale_db_msg['recommend_cache']}
|
||||||
|
WHERE cache_key = ? AND is_del = 0
|
||||||
|
", [$cache_key]);
|
||||||
|
|
||||||
|
if (!empty($cache_result)) {
|
||||||
|
$cache = $cache_result[0];
|
||||||
|
$last_hit_timestamp = strtotime($cache['last_hit']);
|
||||||
|
|
||||||
|
if (time() - $last_hit_timestamp < $this->config['cache_time']) {
|
||||||
|
// 更新命中次数和时间
|
||||||
|
// $db->execute("
|
||||||
|
Db::execute("
|
||||||
|
UPDATE {$this->kitchenscale_db_msg['recommend_cache']}
|
||||||
|
SET hit_count = hit_count + 1, last_hit = GETDATE()
|
||||||
|
WHERE id = ?
|
||||||
|
", [$cache['id']]);
|
||||||
|
|
||||||
|
$data = json_decode($cache['recommend_data'], true);
|
||||||
|
return is_array($data) ? $data : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// 忽略缓存错误,继续执行
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新缓存
|
||||||
|
*/
|
||||||
|
private function updateCache($db, $cache_key, $user_id, $keyword, $data) {
|
||||||
|
try {
|
||||||
|
$current_time = date('Y-m-d H:i:s');
|
||||||
|
$recommend_data = json_encode($data, JSON_UNESCAPED_UNICODE);
|
||||||
|
|
||||||
|
// 检查是否存在缓存
|
||||||
|
// $existing_result = $db->query("
|
||||||
|
$existing_result = Db::query("
|
||||||
|
SELECT id FROM {$this->kitchenscale_db_msg['recommend_cache']}
|
||||||
|
WHERE cache_key = ? AND is_del = 0
|
||||||
|
", [$cache_key]);
|
||||||
|
|
||||||
|
if (!empty($existing_result)) {
|
||||||
|
// 更新现有缓存
|
||||||
|
// $db->execute("
|
||||||
|
Db::execute("
|
||||||
|
UPDATE {$this->kitchenscale_db_msg['recommend_cache']}
|
||||||
|
SET user_id = ?, keyword = ?, recommend_data = ?, hit_count = 1,
|
||||||
|
last_hit = ?, create_time = ?
|
||||||
|
WHERE cache_key = ? AND is_del = 0
|
||||||
|
", [$user_id, $keyword, $recommend_data, $current_time, $current_time, $cache_key]);
|
||||||
|
} else {
|
||||||
|
// 插入新缓存
|
||||||
|
// $db->execute("
|
||||||
|
Db::execute("
|
||||||
|
INSERT INTO {$this->kitchenscale_db_msg['recommend_cache']}
|
||||||
|
(cache_key, user_id, keyword, recommend_data, hit_count, last_hit, create_time, is_del)
|
||||||
|
VALUES (?, ?, ?, ?, 1, ?, ?, 0)
|
||||||
|
", [$cache_key, $user_id, $keyword, $recommend_data, $current_time, $current_time]);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// 忽略缓存更新错误
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取热门推荐(新用户)
|
||||||
|
*/
|
||||||
|
private function getPopularRecommendations($db, $type, $tag_limit, $item_limit) {
|
||||||
|
// dump($type);
|
||||||
|
if ($type === 'cookbook') {
|
||||||
|
return $this->getPopularCookbooks($db, $tag_limit, $item_limit);
|
||||||
|
} else {
|
||||||
|
// dump(111);
|
||||||
|
return $this->getPopularFoods($db, $tag_limit, $item_limit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取热门食谱(新用户)
|
||||||
|
*/
|
||||||
|
private function getPopularCookbooks($db, $tag_limit, $item_limit) {
|
||||||
|
try {
|
||||||
|
// 简化查询,避免复杂关联导致的错误
|
||||||
|
$popular_cookbooks = $db->query("
|
||||||
|
SELECT TOP {$item_limit}
|
||||||
|
id,
|
||||||
|
title as name
|
||||||
|
FROM {$this->kitchenscale_db_msg['cookbook']}
|
||||||
|
WHERE is_del = 0
|
||||||
|
ORDER BY likes_num DESC, read_it DESC, create_time DESC
|
||||||
|
");
|
||||||
|
// dump('sp');
|
||||||
|
// dump($popular_cookbooks);
|
||||||
|
$result = [];
|
||||||
|
$label_data = [];
|
||||||
|
|
||||||
|
foreach ($popular_cookbooks as $cookbook) {
|
||||||
|
$label_data[] = [
|
||||||
|
'name' => $cookbook['name'] ?? '未知食谱',
|
||||||
|
'id' => $cookbook['id'] ?? 0,
|
||||||
|
'type' => 'cookbook'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($label_data)) {
|
||||||
|
$result['最火食谱搜索'] = $label_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取热门食材(新用户)
|
||||||
|
*/
|
||||||
|
private function getPopularFoods($db, $tag_limit, $item_limit) {
|
||||||
|
try {
|
||||||
|
// dump(2222);
|
||||||
|
// // 简化查询,避免复杂关联导致的错误
|
||||||
|
// $popular_foods = $db->query("
|
||||||
|
$popular_foods = Db::query("
|
||||||
|
SELECT TOP {$item_limit}
|
||||||
|
id,
|
||||||
|
keyword as name,
|
||||||
|
COUNT(*) as num
|
||||||
|
FROM {$this->kitchenscale_db_msg['search_history']}
|
||||||
|
WHERE is_del = 0 AND type = 'food'
|
||||||
|
GROUP BY id, keyword
|
||||||
|
ORDER BY num DESC
|
||||||
|
");
|
||||||
|
// dump('sc');
|
||||||
|
// dump($popular_foods);
|
||||||
|
|
||||||
|
$popular_foods_2 = [];
|
||||||
|
if(count($popular_foods) < $item_limit){
|
||||||
|
$num = $item_limit - count($popular_foods);
|
||||||
|
$popular_foods_2 = $db->query("
|
||||||
|
SELECT TOP {$num}
|
||||||
|
id,
|
||||||
|
food_name as name
|
||||||
|
FROM {$this->kitchenscale_db_msg['foodlist3']}
|
||||||
|
WHERE is_del = 0
|
||||||
|
ORDER BY is_popular DESC, food_name ASC
|
||||||
|
");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($popular_foods_2 as $key => $value) {
|
||||||
|
$popular_foods[] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
$label_data = [];
|
||||||
|
|
||||||
|
foreach ($popular_foods as $food) {
|
||||||
|
$label_data[] = [
|
||||||
|
'name' => $food['name'] ?? '未知食材',
|
||||||
|
'id' => $food['id'] ?? 0,
|
||||||
|
'type' => 'food'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($label_data)) {
|
||||||
|
$result['最火食材搜索'] = $label_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取个性化食谱推荐(老用户)
|
||||||
|
*/
|
||||||
|
private function getCookbookRecommendations($db, $user_id, $tag_limit, $item_limit) {
|
||||||
|
// dump($user_id);
|
||||||
|
try {
|
||||||
|
// 获取用户最常吃的食材
|
||||||
|
// $user_top_foods = $db->query("
|
||||||
|
$user_top_foods = Db::query("
|
||||||
|
SELECT TOP 10 food_id, COUNT(*) as eat_count
|
||||||
|
FROM {$this->kitchenscale_db_msg['kcal_log']}
|
||||||
|
WHERE aud_id = ? AND is_del = 0
|
||||||
|
GROUP BY food_id
|
||||||
|
ORDER BY eat_count DESC
|
||||||
|
", [$user_id]);
|
||||||
|
|
||||||
|
// dump($user_top_foods);
|
||||||
|
|
||||||
|
if (empty($user_top_foods)) {
|
||||||
|
return $this->getPopularCookbooks($db, $tag_limit, $item_limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
$food_ids = array_column($user_top_foods, 'food_id');
|
||||||
|
if (empty($food_ids)) {
|
||||||
|
return $this->getPopularCookbooks($db, $tag_limit, $item_limit);
|
||||||
|
}
|
||||||
|
$food_ids_str = implode(',', $food_ids);
|
||||||
|
// dump($food_ids_str);
|
||||||
|
// 获取包含这些食材的食谱标签
|
||||||
|
$preferred_labels = $db->query("
|
||||||
|
SELECT TOP {$tag_limit} lbl.id, lbl.name, COUNT(DISTINCT cb.id) as match_count
|
||||||
|
FROM {$this->kitchenscale_db_msg['cookbook_label']} lbl
|
||||||
|
INNER JOIN {$this->kitchenscale_db_msg['cookbook']} cb ON lbl.id = cb.cook_label AND cb.is_del = 0
|
||||||
|
INNER JOIN {$this->kitchenscale_db_msg['cookbook_food_relation']} cfr ON cb.id = cfr.cookbook_id
|
||||||
|
WHERE lbl.is_del = 0 AND cfr.food_id IN ({$food_ids_str})
|
||||||
|
GROUP BY lbl.id, lbl.name
|
||||||
|
ORDER BY match_count DESC
|
||||||
|
");
|
||||||
|
// dump($preferred_labels);
|
||||||
|
$result = [];
|
||||||
|
foreach ($preferred_labels as $label) {
|
||||||
|
// 使用子查询避免GROUP BY复杂性问题
|
||||||
|
$cookbooks = $db->query("
|
||||||
|
SELECT TOP {$item_limit} cb.id, cb.title as name
|
||||||
|
FROM {$this->kitchenscale_db_msg['cookbook']} cb
|
||||||
|
WHERE cb.id IN (
|
||||||
|
SELECT DISTINCT cfr.cookbook_id
|
||||||
|
FROM {$this->kitchenscale_db_msg['cookbook_food_relation']} cfr
|
||||||
|
WHERE cfr.food_id IN ({$food_ids_str})
|
||||||
|
)
|
||||||
|
AND cb.cook_label = ?
|
||||||
|
AND cb.is_del = 0
|
||||||
|
ORDER BY cb.likes_num DESC, cb.read_it DESC
|
||||||
|
", [$label['id']]);
|
||||||
|
|
||||||
|
$label_data = [];
|
||||||
|
foreach ($cookbooks as $cookbook) {
|
||||||
|
$label_data[] = [
|
||||||
|
'name' => $cookbook['name'] ?? '未知食谱',
|
||||||
|
'id' => $cookbook['id'] ?? 0,
|
||||||
|
'type' => 'cookbook'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($label_data)) {
|
||||||
|
$result[$label['name'] ?? '未知标签'] = $label_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// dump($result);
|
||||||
|
if(count($result)<=0){
|
||||||
|
return $this->getPopularCookbooks($db, $tag_limit, $item_limit);
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->getPopularCookbooks($db, $tag_limit, $item_limit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取个性化食材推荐(老用户)
|
||||||
|
*/
|
||||||
|
private function getFoodRecommendations($db, $user_id, $tag_limit, $item_limit) {
|
||||||
|
try {
|
||||||
|
// 获取用户最常吃的食材
|
||||||
|
// $user_top_foods = $db->query("
|
||||||
|
$user_top_foods = Db::query("
|
||||||
|
SELECT TOP 10 food_id, COUNT(*) as eat_count
|
||||||
|
FROM {$this->kitchenscale_db_msg['kcal_log']}
|
||||||
|
WHERE aud_id = ? AND is_del = 0
|
||||||
|
GROUP BY food_id
|
||||||
|
ORDER BY eat_count DESC
|
||||||
|
", [$user_id]);
|
||||||
|
|
||||||
|
if (empty($user_top_foods)) {
|
||||||
|
return $this->getPopularFoods($db, $tag_limit, $item_limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
$food_ids = array_column($user_top_foods, 'food_id');
|
||||||
|
if (empty($food_ids)) {
|
||||||
|
return $this->getPopularFoods($db, $tag_limit, $item_limit);
|
||||||
|
}
|
||||||
|
$food_ids_str = implode(',', $food_ids);
|
||||||
|
|
||||||
|
// 获取用户偏好食材的分类
|
||||||
|
$preferred_categories = $db->query("
|
||||||
|
SELECT TOP {$tag_limit} f2.id, f2.name, COUNT(DISTINCT f3.id) as food_count
|
||||||
|
FROM {$this->kitchenscale_db_msg['foodlist2']} f2
|
||||||
|
INNER JOIN {$this->kitchenscale_db_msg['foodlist3']} f3 ON f2.id = f3.two_id
|
||||||
|
WHERE f3.id IN ({$food_ids_str}) AND f2.is_del = 0 AND f3.is_del = 0
|
||||||
|
GROUP BY f2.id, f2.name
|
||||||
|
ORDER BY food_count DESC
|
||||||
|
");
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
foreach ($preferred_categories as $category) {
|
||||||
|
// 获取该分类下的其他食材
|
||||||
|
$foods = $db->query("
|
||||||
|
SELECT TOP {$item_limit} id, food_name as name
|
||||||
|
FROM {$this->kitchenscale_db_msg['foodlist3']}
|
||||||
|
WHERE two_id = ? AND is_del = 0 AND id NOT IN ({$food_ids_str})
|
||||||
|
ORDER BY is_popular DESC, food_name ASC
|
||||||
|
", [$category['id']]);
|
||||||
|
|
||||||
|
$category_data = [];
|
||||||
|
foreach ($foods as $food) {
|
||||||
|
$category_data[] = [
|
||||||
|
'name' => $food['name'] ?? '未知食材',
|
||||||
|
'id' => $food['id'] ?? 0,
|
||||||
|
'type' => 'food'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($category_data)) {
|
||||||
|
$result[$category['name'] ?? '未知分类'] = $category_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->getPopularFoods($db, $tag_limit, $item_limit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,7 +8,8 @@ use think\Db;
|
||||||
// use think\Log;
|
// use think\Log;
|
||||||
// use PHPMailer\PHPMailer\PHPMailer;
|
// use PHPMailer\PHPMailer\PHPMailer;
|
||||||
// use app\NewReedaw\controller\app\Role;
|
// use app\NewReedaw\controller\app\Role;
|
||||||
use app\app\controller\Language;
|
// use app\app\controller\Language;
|
||||||
|
use app\KitchenScale2\controller\app\Index as Cfindex;//厨房秤的config
|
||||||
|
|
||||||
class Index extends Base{
|
class Index extends Base{
|
||||||
|
|
||||||
|
|
@ -22,6 +23,7 @@ class Index extends Base{
|
||||||
'banner'=>'admin_notice_banner',
|
'banner'=>'admin_notice_banner',
|
||||||
'skip'=>'app_card_skip_data',
|
'skip'=>'app_card_skip_data',
|
||||||
'vitalcapacity'=>'app_card_vitalcapacity_data',
|
'vitalcapacity'=>'app_card_vitalcapacity_data',
|
||||||
|
'cookbook_label'=>'app_user_cookbook_label',//菜谱标签表
|
||||||
];
|
];
|
||||||
protected $request_result = [
|
protected $request_result = [
|
||||||
'2'=>['height'=>['身高','cm'],'weight'=>['体重','kg'],'age'=>['年龄','岁'],'bmi'=>['BMI',''],'head'=>['头围',''],'fat_w'=>['脂肪量','kg'],'fat_r'=>['脂肪率','%'],'muscleval'=>['肌肉量','kg'],'muscle'=>['肌肉率','%'],'proteinval'=>['蛋白量','kg'],'protein'=>['蛋白率','%'],'water'=>['水分',''],'bone'=>['骨重','kg'],'visceral'=>['内脏指数',''],'sfr'=>['皮下脂肪','%'],'kcal'=>['基础代谢','kcal'],'un_fat_w_weight'=>['去脂体重','kg'],'body_age'=>['体龄',''],'body_level'=>['肥胖等级',''],'body_type'=>['体型','']],
|
'2'=>['height'=>['身高','cm'],'weight'=>['体重','kg'],'age'=>['年龄','岁'],'bmi'=>['BMI',''],'head'=>['头围',''],'fat_w'=>['脂肪量','kg'],'fat_r'=>['脂肪率','%'],'muscleval'=>['肌肉量','kg'],'muscle'=>['肌肉率','%'],'proteinval'=>['蛋白量','kg'],'protein'=>['蛋白率','%'],'water'=>['水分',''],'bone'=>['骨重','kg'],'visceral'=>['内脏指数',''],'sfr'=>['皮下脂肪','%'],'kcal'=>['基础代谢','kcal'],'un_fat_w_weight'=>['去脂体重','kg'],'body_age'=>['体龄',''],'body_level'=>['肥胖等级',''],'body_type'=>['体型','']],
|
||||||
|
|
@ -56,10 +58,33 @@ class Index extends Base{
|
||||||
################################################################接口################################################################
|
################################################################接口################################################################
|
||||||
################################################################接口################################################################
|
################################################################接口################################################################
|
||||||
|
|
||||||
|
// 检测版本及判断是否登录失效
|
||||||
|
public function login_invalid_version(){
|
||||||
|
|
||||||
|
$data = input('post.');
|
||||||
|
if(!array_key_exists('token', $data)){
|
||||||
|
return $this->msg(-1,'已过期');
|
||||||
|
|
||||||
|
}else{
|
||||||
|
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
$user_token_state = $this->token_time_validate($data['token']);
|
||||||
|
// $language_data = $this->pd_language($user_token_state['language'],$isSupportedLanguage,$language);
|
||||||
|
if($user_token_state['state'] === false){
|
||||||
|
return $this->msg(-1,'已过期');
|
||||||
|
// return [['code'=>-1,'description'=>'已过期'],['version'=>$version,'url'=>$url]];
|
||||||
|
}else{
|
||||||
|
$zh = Db::table($this->index_db_name['zhanghao'])->where(['token' => $data['token']])->cache(86400)->field('id,token,nickname')->find();
|
||||||
|
return $this->msg($zh);
|
||||||
|
// return [['code'=>0,'description'=>'未过期'],['version'=>$version,'url'=>$url]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// 配置信息
|
// 配置信息
|
||||||
public function config(){
|
public function config(){
|
||||||
$data = input('post.');
|
$data = input('post.');
|
||||||
try {
|
// try {
|
||||||
if(!array_key_exists('token', $data)){
|
if(!array_key_exists('token', $data)){
|
||||||
return $this->msg(10001,'token is miss');
|
return $this->msg(10001,'token is miss');
|
||||||
}
|
}
|
||||||
|
|
@ -67,20 +92,20 @@ class Index extends Base{
|
||||||
return $this->msg(10005,'token type error');
|
return $this->msg(10005,'token type error');
|
||||||
}
|
}
|
||||||
return $this->config_action($data);
|
return $this->config_action($data);
|
||||||
} catch (\Exception $e) {
|
// } catch (\Exception $e) {
|
||||||
// 捕获异常
|
// // 捕获异常
|
||||||
$logContent["flie"] = $e->getFile();
|
// $logContent["flie"] = $e->getFile();
|
||||||
$logContent["line"] = $e->getLine();
|
// $logContent["line"] = $e->getLine();
|
||||||
$logContent['all_content'] = "异常信息:\n";
|
// $logContent['all_content'] = "异常信息:\n";
|
||||||
$logContent['all_content'] .= "函数: config" . "\n";
|
// $logContent['all_content'] .= "函数: config" . "\n";
|
||||||
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
// $logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||||
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
// $logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||||
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
// $logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||||
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
// $logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||||
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
// $logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||||
$this->record_api_log($data, $logContent, null);
|
// $this->record_api_log($data, $logContent, null);
|
||||||
return $this->msg(99999);
|
// return $this->msg(99999);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取角色信息
|
// 获取角色信息
|
||||||
|
|
@ -115,107 +140,9 @@ class Index extends Base{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// // 身高预测
|
|
||||||
// public function genetic_height(){
|
|
||||||
// try {
|
|
||||||
// $data = input('post.');
|
|
||||||
// if(!is_array($data)){
|
|
||||||
// return $this->msg(10005);
|
|
||||||
// }
|
|
||||||
// if(!array_key_exists('dadHeight', $data) || !array_key_exists('momHeight', $data) || !array_key_exists('birthday', $data) || !array_key_exists('sex', $data)){
|
|
||||||
// return $this->msg(10001);
|
|
||||||
// }
|
|
||||||
// unset($data['token']);
|
|
||||||
// if(!$this->verify_data_is_ok($data['birthday'],'datetime')){
|
|
||||||
// return $this->msg(10005,'birthday type error');
|
|
||||||
// }
|
|
||||||
// if(!$this->verify_data_is_ok($data['dadHeight'],'num')){
|
|
||||||
// return $this->msg(10005,'dadHeight type error');
|
|
||||||
// }
|
|
||||||
// if(!$this->verify_data_is_ok($data['momHeight'],'num')){
|
|
||||||
// return $this->msg(10005,'momHeight type error');
|
|
||||||
// }
|
|
||||||
// if(!$this->verify_data_is_ok($data['sex'],'intnum')){
|
|
||||||
// return $this->msg(10005,'sex type error');
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // 直接开始业务,请求外部接口start
|
|
||||||
// $url = 'https://ybapi.pcxbc.com/api/child/predictheight';
|
|
||||||
// $temporary_parameter = [
|
|
||||||
// 'dadHeight'=>$data['dadHeight'],
|
|
||||||
// 'momHeight'=>$data['momHeight'],
|
|
||||||
// 'birthday'=>$data['birthday'],
|
|
||||||
// 'sex'=>$data['sex'],
|
|
||||||
// ];
|
|
||||||
// $request_result = $this->postRequest($url,$temporary_parameter,array('Content-Type:application/json','Origin:http://ybdevice.pcxbc.com'));
|
|
||||||
// return json($request_result);
|
|
||||||
// } catch (\Exception $e) {
|
|
||||||
// // 捕获异常
|
|
||||||
// $logContent["flie"] = $e->getFile();
|
|
||||||
// $logContent["line"] = $e->getLine();
|
|
||||||
// $logContent['all_content'] = "异常信息:\n";
|
|
||||||
// $logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
|
||||||
// $logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
|
||||||
// $logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
|
||||||
// $logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
|
||||||
// $logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
|
||||||
// $this->record_api_log($data, $logContent, null);
|
|
||||||
// return $this->msg(99999);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // BMI测评
|
|
||||||
// public function bmi_evaluation(){
|
|
||||||
// try {
|
|
||||||
// $cbe_data = input('post.');
|
|
||||||
// if(!is_array($cbe_data)){
|
|
||||||
// return $this->msg(10005);
|
|
||||||
// }
|
|
||||||
// if(!array_key_exists('height', $cbe_data) || !array_key_exists('weight', $cbe_data) || !array_key_exists('birthday', $cbe_data) || !array_key_exists('sex', $cbe_data)){
|
|
||||||
// return $this->msg(10001);
|
|
||||||
// }
|
|
||||||
// unset($cbe_data['token']);
|
|
||||||
// if(!$this->verify_data_is_ok($cbe_data['birthday'],'datetime')){
|
|
||||||
// return $this->msg(10005,'birthday type error');
|
|
||||||
// }
|
|
||||||
// if(!$this->verify_data_is_ok($cbe_data['height'],'num')){
|
|
||||||
// return $this->msg(10005,'height type error');
|
|
||||||
// }
|
|
||||||
// if(!$this->verify_data_is_ok($cbe_data['weight'],'num')){
|
|
||||||
// return $this->msg(10005,'weight type error');
|
|
||||||
// }
|
|
||||||
// if(!$this->verify_data_is_ok($cbe_data['sex'],'intnum')){
|
|
||||||
// return $this->msg(10005,'sex type error');
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // 直接开始业务,请求外部接口start
|
|
||||||
// $url = 'http://ybdevice.pcxbc.com/api/result/calcbmi';
|
|
||||||
// $temporary_parameter = [
|
|
||||||
// 'height'=>$cbe_data['height'],
|
|
||||||
// 'weight'=>$cbe_data['weight'],
|
|
||||||
// 'birthday'=>$cbe_data['birthday'],
|
|
||||||
// 'sex'=>$cbe_data['sex'],
|
|
||||||
// ];
|
|
||||||
// $request_result = $this->postRequest($url,$temporary_parameter,array('Content-Type:application/json','Origin:http://ybdevice.pcxbc.com'));
|
|
||||||
// // 直接开始业务,请求外部接口end
|
|
||||||
|
|
||||||
// // 处理进度点
|
|
||||||
// $request_result =$this->bmi_evaluation_action($request_result);
|
|
||||||
// return $request_result;
|
|
||||||
// } catch (\Exception $e) {
|
|
||||||
// // 捕获异常
|
|
||||||
// $logContent["flie"] = $e->getFile();
|
|
||||||
// $logContent["line"] = $e->getLine();
|
|
||||||
// $logContent['all_content'] = "异常信息:\n";
|
|
||||||
// $logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
|
||||||
// $logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
|
||||||
// $logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
|
||||||
// $logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
|
||||||
// $logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
|
||||||
// $this->record_api_log($cbe_data, $logContent, null);
|
|
||||||
// return $this->msg(99999);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // 数据对比(包含身体、跳绳、肺活量)
|
// // 数据对比(包含身体、跳绳、肺活量)
|
||||||
// public function all_data_contrast($data = ['before_id'=>'171','after_id'=>'174','type'=>'2','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
// public function all_data_contrast($data = ['before_id'=>'171','after_id'=>'174','type'=>'2','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
||||||
|
|
@ -285,25 +212,188 @@ class Index extends Base{
|
||||||
'此测量数据仅供参考,不可替代医学专业测试!'
|
'此测量数据仅供参考,不可替代医学专业测试!'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'king_kong_region'=>[
|
// 'king_kong_region'=>[
|
||||||
['title'=>'减值对比','icon'=>'https://tc.pcxbc.com/new_reedaw/icon/contrast.png','jump'=>'/pageTwo/compk/contrast'],
|
// ['title'=>'减值对比','icon'=>'https://tc.pcxbc.com/new_reedaw/icon/contrast.png','jump'=>'/pageTwo/compk/contrast'],
|
||||||
['title'=>'中招估分','icon'=>'https://tc.pcxbc.com/new_reedaw/icon/report.png','jump'=>'/pageTwo/score/report'],
|
// ['title'=>'中招估分','icon'=>'https://tc.pcxbc.com/new_reedaw/icon/report.png','jump'=>'/pageTwo/score/report'],
|
||||||
['title'=>'遗传身高','icon'=>'https://tc.pcxbc.com/new_reedaw/icon/inheritHeighet.png','jump'=>'/pageTwo/home/inheritHeighet'],
|
// ['title'=>'遗传身高','icon'=>'https://tc.pcxbc.com/new_reedaw/icon/inheritHeighet.png','jump'=>'/pageTwo/home/inheritHeighet'],
|
||||||
['title'=>'BMI测评','icon'=>'https://tc.pcxbc.com/new_reedaw/icon/bmi.png','jump'=>'/pageTwo/home/bmi'],
|
// ['title'=>'BMI测评','icon'=>'https://tc.pcxbc.com/new_reedaw/icon/bmi.png','jump'=>'/pageTwo/home/bmi'],
|
||||||
],
|
// ],
|
||||||
'version_msg'=>[],
|
|
||||||
'login_status'=>[],
|
|
||||||
'business_cooperation_url'=>[],
|
'business_cooperation_url'=>[],
|
||||||
'area_list'=>[],
|
'area_list'=>[],
|
||||||
'identity_list'=>[],
|
'identity_list'=>[],
|
||||||
'grade_list'=>[],
|
'grade_list'=>[],
|
||||||
'banner'=>[],
|
'banner'=>[],
|
||||||
|
'activity_level'=>[
|
||||||
|
['name'=>'久坐(很少或没有运动)','val'=>'1.2'],
|
||||||
|
['name'=>'轻度活动(每周1-3天轻度运动)','val'=>'1.375'],
|
||||||
|
['name'=>'中度活动(每周3-5天中度运动)','val'=>'1.55'],
|
||||||
|
['name'=>'高度活动(每周6-7天高强度运动)','val'=>'1.725'],
|
||||||
|
['name'=>'极高活动(体力劳动或每天高强度训练)','val'=>'1.9'],
|
||||||
|
],
|
||||||
|
'meal_list'=>[
|
||||||
|
['icon'=>'https://tc.pcxbc.com/kitchenscale_all/meal_1.png','name'=>'早餐','icon_bg'=>'https://tc.pcxbc.com/kitchenscale_all/meal_1_bg.jpg'],
|
||||||
|
['icon'=>'https://tc.pcxbc.com/kitchenscale_all/meal_2.png','name'=>'午餐','icon_bg'=>'https://tc.pcxbc.com/kitchenscale_all/meal_2_bg.jpg'],
|
||||||
|
['icon'=>'https://tc.pcxbc.com/kitchenscale_all/meal_3.png','name'=>'晚餐','icon_bg'=>'https://tc.pcxbc.com/kitchenscale_all/meal_3_bg.jpg'],
|
||||||
|
['icon'=>'https://tc.pcxbc.com/kitchenscale_all/meal_4.png','name'=>'加餐','icon_bg'=>'https://tc.pcxbc.com/kitchenscale_all/meal_4_bg.jpg'],
|
||||||
|
],
|
||||||
|
'default_count_foot'=>[
|
||||||
|
'date' => '',
|
||||||
|
'remaining_kcal' => 0,
|
||||||
|
'details' => [
|
||||||
|
'carbohydrate' => [
|
||||||
|
'name' => '碳水',
|
||||||
|
'icon' => 'https://tc.pcxbc.com/kitchenscale_all/icon_carbohydrate.png',
|
||||||
|
'color' => '#ED7886',
|
||||||
|
'val' => 0,
|
||||||
|
'unit' => 'g',
|
||||||
|
'proportion' => '0.00',
|
||||||
|
'rank_list' => [
|
||||||
|
['icon' => 'https://tc.pcxbc.com/kitchenscale_all/rank1.png', 'name' => '', 'pic_url' => '', 'weight' => ''],
|
||||||
|
['icon' => 'https://tc.pcxbc.com/kitchenscale_all/rank2.png', 'name' => '', 'pic_url' => '', 'weight' => ''],
|
||||||
|
['icon' => 'https://tc.pcxbc.com/kitchenscale_all/rank3.png', 'name' => '', 'pic_url' => '', 'weight' => '']
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'protein' => [
|
||||||
|
'name' => '蛋白质',
|
||||||
|
'icon' => 'https://tc.pcxbc.com/kitchenscale_all/icon_protein.png',
|
||||||
|
'color' => '#FFB169',
|
||||||
|
'val' => 0,
|
||||||
|
'unit' => 'g',
|
||||||
|
'proportion' => '0.00',
|
||||||
|
'rank_list' => [
|
||||||
|
['icon' => 'https://tc.pcxbc.com/kitchenscale_all/rank1.png', 'name' => '', 'pic_url' => '', 'weight' => ''],
|
||||||
|
['icon' => 'https://tc.pcxbc.com/kitchenscale_all/rank2.png', 'name' => '', 'pic_url' => '', 'weight' => ''],
|
||||||
|
['icon' => 'https://tc.pcxbc.com/kitchenscale_all/rank3.png', 'name' => '', 'pic_url' => '', 'weight' => '']
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'fat' => [
|
||||||
|
'name' => '脂肪',
|
||||||
|
'icon' => 'https://tc.pcxbc.com/kitchenscale_all/icon_fat.png',
|
||||||
|
'color' => '#3CB383',
|
||||||
|
'val' => 0,
|
||||||
|
'unit' => 'g',
|
||||||
|
'proportion' => '0.00',
|
||||||
|
'rank_list' => [
|
||||||
|
['icon' => 'https://tc.pcxbc.com/kitchenscale_all/rank1.png', 'name' => '', 'pic_url' => '', 'weight' => ''],
|
||||||
|
['icon' => 'https://tc.pcxbc.com/kitchenscale_all/rank2.png', 'name' => '', 'pic_url' => '', 'weight' => ''],
|
||||||
|
['icon' => 'https://tc.pcxbc.com/kitchenscale_all/rank3.png', 'name' => '', 'pic_url' => '', 'weight' => '']
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'trace_elements_all_day' => [
|
||||||
|
['name' => 'VitaminA', 'name_ch' => '维生素A', 'unit' => 'μg RAE', 'value' => 0],
|
||||||
|
['name' => 'VitaminB1', 'name_ch' => '硫胺素', 'unit' => 'mg', 'value' => 0],
|
||||||
|
['name' => 'VitaminB2', 'name_ch' => '核黄素', 'unit' => 'mg', 'value' => 0],
|
||||||
|
['name' => 'VitaminB6', 'name_ch' => '维生素B6', 'unit' => 'mg', 'value' => 0],
|
||||||
|
['name' => 'VitaminB12', 'name_ch' => '维生素B12', 'unit' => 'μg', 'value' => 0],
|
||||||
|
['name' => 'VitaminD', 'name_ch' => '维生素D', 'unit' => 'μg', 'value' => 0],
|
||||||
|
['name' => 'VitaminK', 'name_ch' => '维生素K', 'unit' => 'μg', 'value' => 0],
|
||||||
|
['name' => 'Niacin', 'name_ch' => '烟酸', 'unit' => 'mg', 'value' => 0],
|
||||||
|
['name' => 'VitaminC', 'name_ch' => '维生素C', 'unit' => 'mg', 'value' => 0],
|
||||||
|
['name' => 'VitaminE', 'name_ch' => '维生素E', 'unit' => 'mg α-TE', 'value' => 0],
|
||||||
|
['name' => 'FolicAcid', 'name_ch' => '叶酸', 'unit' => 'μg', 'value' => 0],
|
||||||
|
['name' => 'Biotin', 'name_ch' => '生物素', 'unit' => 'μg', 'value' => 0],
|
||||||
|
['name' => 'PantothenicAcid', 'name_ch' => '泛酸', 'unit' => 'mg', 'value' => 0],
|
||||||
|
['name' => 'TotalCholine', 'name_ch' => '总胆碱', 'unit' => 'mg', 'value' => 0],
|
||||||
|
['name' => 'Ca', 'name_ch' => '钙', 'unit' => 'mg', 'value' => 0],
|
||||||
|
['name' => 'Phosphorus', 'name_ch' => '磷', 'unit' => 'mg', 'value' => 0],
|
||||||
|
['name' => 'Kalium', 'name_ch' => '钾', 'unit' => 'mg', 'value' => 0],
|
||||||
|
['name' => 'Mg', 'name_ch' => '镁', 'unit' => 'mg', 'value' => 0],
|
||||||
|
['name' => 'Na', 'name_ch' => '钠', 'unit' => 'mg', 'value' => 0],
|
||||||
|
['name' => 'Fe', 'name_ch' => '铁', 'unit' => 'mg', 'value' => 0],
|
||||||
|
['name' => 'Zn', 'name_ch' => '锌', 'unit' => 'mg', 'value' => 0],
|
||||||
|
['name' => 'Se', 'name_ch' => '硒', 'unit' => 'μg', 'value' => 0],
|
||||||
|
['name' => 'Cu', 'name_ch' => '铜', 'unit' => 'mg', 'value' => 0],
|
||||||
|
['name' => 'Mn', 'name_ch' => '锰', 'unit' => 'mg', 'value' => 0],
|
||||||
|
['name' => 'Iodine', 'name_ch' => '碘', 'unit' => 'μg', 'value' => 0]
|
||||||
|
],
|
||||||
|
'list' => [
|
||||||
|
[
|
||||||
|
'name' => '早餐',
|
||||||
|
'val' => 0,
|
||||||
|
'unit' => 'kcal',
|
||||||
|
'color' => '#0992B4',
|
||||||
|
'icon' => 'https://tc.pcxbc.com/kitchenscale_all/meal_1.png',
|
||||||
|
'icon_home' => '/static/1.png',
|
||||||
|
'bgimg_home' => '/static/2.png',
|
||||||
|
'kcal_proportion' => 0,
|
||||||
|
'nutrients_four' => [
|
||||||
|
['name' => '卡路里', 'unit' => 'kcal', 'color' => '', 'value' => 0, 'proportion' => 0],
|
||||||
|
['name' => '碳水化合物', 'unit' => 'g', 'color' => '#FFB169', 'value' => 0, 'proportion' => 0],
|
||||||
|
['name' => '蛋白质', 'unit' => 'g', 'color' => '#5180D8', 'value' => 0, 'proportion' => 0],
|
||||||
|
['name' => '脂肪', 'unit' => 'g', 'color' => '#ED7886', 'value' => 0, 'proportion' => 0]
|
||||||
|
],
|
||||||
|
'list' => []
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => '午餐',
|
||||||
|
'val' => 0,
|
||||||
|
'unit' => 'kcal',
|
||||||
|
'color' => '#4F9211',
|
||||||
|
'icon' => 'https://tc.pcxbc.com/kitchenscale_all/meal_2.png',
|
||||||
|
'icon_home' => '/static/3.png',
|
||||||
|
'bgimg_home' => '/static/4.png',
|
||||||
|
'kcal_proportion' => 0,
|
||||||
|
'nutrients_four' => [
|
||||||
|
['name' => '卡路里', 'unit' => 'kcal', 'color' => '', 'value' => 0, 'proportion' => 0],
|
||||||
|
['name' => '蛋白质', 'unit' => 'g', 'color' => '#5180D8', 'value' => 0, 'proportion' => 0],
|
||||||
|
['name' => '脂肪', 'unit' => 'g', 'color' => '#ED7886', 'value' => 0, 'proportion' => 0],
|
||||||
|
['name' => '碳水化合物', 'unit' => 'g', 'color' => '#FFB169', 'value' => 0, 'proportion' => 0]
|
||||||
|
],
|
||||||
|
'list' => []
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => '晚餐',
|
||||||
|
'val' => 0,
|
||||||
|
'unit' => 'kcal',
|
||||||
|
'color' => '#B354B0',
|
||||||
|
'icon' => 'https://tc.pcxbc.com/kitchenscale_all/meal_3.png',
|
||||||
|
'icon_home' => '/static/5.png',
|
||||||
|
'bgimg_home' => '/static/6.png',
|
||||||
|
'kcal_proportion' => 0,
|
||||||
|
'nutrients_four' => [
|
||||||
|
['name' => '卡路里', 'unit' => 'kcal', 'color' => '', 'value' => 0, 'proportion' => 0],
|
||||||
|
['name' => '蛋白质', 'unit' => 'g', 'color' => '#5180D8', 'value' => 0, 'proportion' => 0],
|
||||||
|
['name' => '脂肪', 'unit' => 'g', 'color' => '#ED7886', 'value' => 0, 'proportion' => 0],
|
||||||
|
['name' => '碳水化合物', 'unit' => 'g', 'color' => '#FFB169', 'value' => 0, 'proportion' => 0]
|
||||||
|
],
|
||||||
|
'list' => []
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => '加餐',
|
||||||
|
'val' => 0,
|
||||||
|
'unit' => 'kcal',
|
||||||
|
'color' => '#C08433',
|
||||||
|
'icon' => 'https://tc.pcxbc.com/kitchenscale_all/meal_4.png',
|
||||||
|
'icon_home' => '/static/7.png',
|
||||||
|
'bgimg_home' => '/static/8.png',
|
||||||
|
'kcal_proportion' => 0,
|
||||||
|
'nutrients_four' => [
|
||||||
|
['name' => '卡路里', 'unit' => 'kcal', 'color' => '', 'value' => 0, 'proportion' => 0],
|
||||||
|
['name' => '蛋白质', 'unit' => 'g', 'color' => '#5180D8', 'value' => 0, 'proportion' => 0],
|
||||||
|
['name' => '脂肪', 'unit' => 'g', 'color' => '#ED7886', 'value' => 0, 'proportion' => 0],
|
||||||
|
['name' => '碳水化合物', 'unit' => 'g', 'color' => '#FFB169', 'value' => 0, 'proportion' => 0]
|
||||||
|
],
|
||||||
|
'list' => []
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'nutrients_four' => [
|
||||||
|
['name' => '卡路里', 'unit' => 'kcal', 'suggestion' => '0', 'today_intake' => 0, 'icon' => 'https://tc.pcxbc.com/kitchenscale_all/icon_kcal.png', 'color' => '#5180D8', 'proportion' => '0.00', 'proportion_fp' => 0],
|
||||||
|
['name' => '碳水', 'unit' => 'g', 'suggestion' => '0', 'today_intake' => 0, 'icon' => 'https://tc.pcxbc.com/kitchenscale_all/icon_carbohydrate.png', 'color' => '#ED7886', 'proportion' => '0.00', 'proportion_fp' => '0'],
|
||||||
|
['name' => '蛋白质', 'unit' => 'g', 'suggestion' => '0', 'today_intake' => 0, 'icon' => 'https://tc.pcxbc.com/kitchenscale_all/icon_protein.png', 'color' => '#FFB169', 'proportion' => '0.00', 'proportion_fp' => '0'],
|
||||||
|
['name' => '脂肪', 'unit' => 'g', 'suggestion' => '0', 'today_intake' => 0, 'icon' => 'https://tc.pcxbc.com/kitchenscale_all/icon_fat.png', 'color' => '#3CB383', 'proportion' => '0.00', 'proportion_fp' => '0']
|
||||||
|
]
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
// $food_count = ;
|
||||||
|
|
||||||
|
// 处理厨房秤config
|
||||||
|
// $cf_index = new Cfindex;
|
||||||
|
// $cf_confog = $cf_index->get_default_config_action($data)->getData()['data'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$temporary = $this->login_invalid_version($data);
|
|
||||||
$return_data['version_msg'] = $temporary[1];
|
|
||||||
$return_data['login_status'] = $temporary[0];
|
|
||||||
|
|
||||||
$return_data['business_cooperation_url'] = Db::table($this->index_db_name['shangwuhezuo'])->where(['is_del'=>0])->field('title,data_url as url')->select();
|
$return_data['business_cooperation_url'] = Db::table($this->index_db_name['shangwuhezuo'])->where(['is_del'=>0])->field('title,data_url as url')->select();
|
||||||
|
|
||||||
|
|
@ -324,6 +414,20 @@ class Index extends Base{
|
||||||
unset($return_data['banner'][$i]['sort_num']);
|
unset($return_data['banner'][$i]['sort_num']);
|
||||||
unset($return_data['banner'][$i]['ROW_NUMBER']);
|
unset($return_data['banner'][$i]['ROW_NUMBER']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 添加菜谱类型start
|
||||||
|
$cfc = Db::connect('cfc_db');
|
||||||
|
$cookbook_label = $cfc->table($this->index_db_name['cookbook_label'])->where(["is_del"=>0])->field('id,name')->select();
|
||||||
|
$return_data['cookbook_label'] = $cookbook_label;
|
||||||
|
// 添加菜谱类型end
|
||||||
|
|
||||||
|
// foreach ($cf_confog as $key => $value) {
|
||||||
|
// // dump($key);
|
||||||
|
// $return_data[$key] = $value;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $return_data['cfc'] = $cf_confog;
|
||||||
return $this->msg($return_data);
|
return $this->msg($return_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -345,68 +449,7 @@ class Index extends Base{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// public function bmi_evaluation_action($data){
|
|
||||||
// // 加 bcadd(,,20)
|
|
||||||
// // 减 bcsub(,,20)
|
|
||||||
// // 乘 bcmul(,,20)
|
|
||||||
// // 除 bcdiv(,,20)
|
|
||||||
// if(!array_key_exists('code',$data) || !array_key_exists('data',$data)){
|
|
||||||
// return $this->msg(99999,'网络异常,请稍后重试1');
|
|
||||||
// }
|
|
||||||
// if($data['code'] != 0){
|
|
||||||
// return $this->msg(99999,'网络异常,请稍后重试2');
|
|
||||||
// }
|
|
||||||
// if(!is_array($data['data'])){
|
|
||||||
// return $this->msg(99999,'网络异常,请稍后重试3');
|
|
||||||
// }
|
|
||||||
// if(!array_key_exists('bmi',$data['data']) || !array_key_exists('bmilevel',$data['data']) || !array_key_exists('bmilevelcolor',$data['data']) || !array_key_exists('bmilevellist',$data['data'])){
|
|
||||||
// return $this->msg(99999,'网络异常,请稍后重试4');
|
|
||||||
// }
|
|
||||||
// if(!is_array($data['data']['bmilevellist'])){
|
|
||||||
// return $this->msg(99999,'网络异常,请稍后重试5');
|
|
||||||
// }
|
|
||||||
// $num = 0;
|
|
||||||
// $subsection_val = 0;
|
|
||||||
// $temporary_subsection_val = null;
|
|
||||||
// foreach ($data['data']['bmilevellist'] as $key => $value) {
|
|
||||||
// if(!array_key_exists('maxvalue',$value) || !array_key_exists('minvalue',$value)){
|
|
||||||
// return $this->msg(99999,'网络异常,请稍后重试6');
|
|
||||||
// }
|
|
||||||
// // 判断是否可以进行比较,规则是否正确
|
|
||||||
// if(is_numeric($value['maxvalue']) && is_numeric($value['minvalue'])){
|
|
||||||
// if($data['data']['bmi'] >= $value['minvalue'] && $data['data']['bmi'] < $value['maxvalue']){
|
|
||||||
// // 在落点内
|
|
||||||
// $subsection_val = bcsub($value['maxvalue'],$value['minvalue'],1);//获取最大最小值差
|
|
||||||
// $temporary_subsection_val = bcsub($data['data']['bmi'],$value['minvalue'],1);//获取当前值与最小值差
|
|
||||||
// $temporary_subsection_val = bcdiv($temporary_subsection_val,$subsection_val,1);//获取当前值与最小值差与最大最小值差之比
|
|
||||||
// $subsection_val = bcdiv(100,count($data['data']['bmilevellist']),1);//每段应该的百分比
|
|
||||||
// $temporary_subsection_val = bcmul($subsection_val,$temporary_subsection_val,1);//获取当前值与最小值差与最大最小值差之比与总段数之比
|
|
||||||
// $temporary_subsection_val = bcadd($temporary_subsection_val,bcmul($subsection_val,$num,1),1);
|
|
||||||
// }else{
|
|
||||||
// $num = $num + 1;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if($temporary_subsection_val === null){
|
|
||||||
// if($data['data']['bmi'] >= $data['data']['bmilevellist'][count($data['data']['bmilevellist'])-1]['maxvalue']){
|
|
||||||
// $temporary_subsection_val = 100;
|
|
||||||
// }else{
|
|
||||||
// return $this->msg(99999,'网络异常,请稍后重试7');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// $data['data']['offset'] = $temporary_subsection_val;
|
|
||||||
// $data = $data['data'];
|
|
||||||
// // 处理key名称一致start
|
|
||||||
// foreach ($data['bmilevellist'] as $key => $value) {
|
|
||||||
// $data['bmilevellist'][$key]['max_val'] = $value['maxvalue'];
|
|
||||||
// $data['bmilevellist'][$key]['min_val'] = $value['minvalue'];
|
|
||||||
// unset($data['bmilevellist'][$key]['minvalue']);
|
|
||||||
// unset($data['bmilevellist'][$key]['maxvalue']);
|
|
||||||
// }
|
|
||||||
// // 处理key名称一致end
|
|
||||||
// return $this->msg($data);
|
|
||||||
// }
|
|
||||||
// // 数据对比(身体)
|
// // 数据对比(身体)
|
||||||
// public function get_body_data_contrast($data){
|
// public function get_body_data_contrast($data){
|
||||||
// $data2 = [$data['before_id'],$data['after_id']];
|
// $data2 = [$data['before_id'],$data['after_id']];
|
||||||
|
|
@ -696,58 +739,7 @@ class Index extends Base{
|
||||||
|
|
||||||
################################################################内部调用################################################################
|
################################################################内部调用################################################################
|
||||||
################################################################内部调用################################################################
|
################################################################内部调用################################################################
|
||||||
// 检测版本及判断是否登录失效
|
|
||||||
public function login_invalid_version($data){
|
|
||||||
// 获取客户端IP
|
|
||||||
$ip = request()->ip();
|
|
||||||
// 调用IP识别方法
|
|
||||||
$region = $this->getIpInfo($ip);
|
|
||||||
// 解析地区信息
|
|
||||||
$regionParts = explode('|', $region);
|
|
||||||
$country = $regionParts[0] ?? '';
|
|
||||||
// 判断国家是否在支持的语言列表中
|
|
||||||
$language = '';
|
|
||||||
if ($country && $country !== '0') {
|
|
||||||
$languageMap = [
|
|
||||||
'中国' => 'zh-Hans',
|
|
||||||
'美国' => 'en',
|
|
||||||
'英国' => 'en',
|
|
||||||
'西班牙' => 'es',
|
|
||||||
'法国' => 'fr',
|
|
||||||
'葡萄牙' => 'pt',
|
|
||||||
'阿拉伯联合酋长国' => 'ar',
|
|
||||||
'俄罗斯' => 'ru',
|
|
||||||
'德国' => 'de'
|
|
||||||
];
|
|
||||||
$language = $languageMap[$country] ?? '';
|
|
||||||
}
|
|
||||||
// 检查语言是否在支持列表中
|
|
||||||
$language_all = new Language();
|
|
||||||
$isSupportedLanguage = array_key_exists($language, $language_all->getSupportedLanguages());
|
|
||||||
|
|
||||||
$result = Db::table($this->index_db_name['banben'])->order('is_del,id desc')->find();
|
|
||||||
if($result){
|
|
||||||
$version = $result['version_num_original'];
|
|
||||||
$url = $result['download_url'];
|
|
||||||
}else{
|
|
||||||
$version = '';
|
|
||||||
$url = '';
|
|
||||||
}
|
|
||||||
if(!array_key_exists('token', $data)){
|
|
||||||
return [['code'=>-1,'description'=>'已过期'],['version'=>$version,'url'=>$url,'language'=>'zh-Hans','language_arr'=>$this->process_Language()]];
|
|
||||||
}else{
|
|
||||||
if(!$this->verify_data_is_ok($data['token'],'str')){
|
|
||||||
return $this->msg(10005);
|
|
||||||
}
|
|
||||||
$user_token_state = $this->token_time_validate($data['token']);
|
|
||||||
$language_data = $this->pd_language($user_token_state['language'],$isSupportedLanguage,$language);
|
|
||||||
if($user_token_state['state'] === false){
|
|
||||||
return [['code'=>-1,'description'=>'已过期'],['version'=>$version,'url'=>$url,'language'=>$language_data,'language_arr'=>$this->process_Language()]];
|
|
||||||
}else{
|
|
||||||
return [['code'=>0,'description'=>'未过期'],['version'=>$version,'url'=>$url,'language'=>$language_data,'language_arr'=>$this->process_Language()]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 添加IP信息获取方法
|
// 添加IP信息获取方法
|
||||||
protected function getIpInfo($ip) {
|
protected function getIpInfo($ip) {
|
||||||
// 默认IP
|
// 默认IP
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -22,8 +22,9 @@ class Login extends Base{
|
||||||
|
|
||||||
// 注册
|
// 注册
|
||||||
public function register(){
|
public function register(){
|
||||||
|
$data = input('post.');
|
||||||
try {
|
try {
|
||||||
$data = input('post.');
|
|
||||||
// 验证数据项是否完整
|
// 验证数据项是否完整
|
||||||
if(!array_key_exists('data', $data) || !array_key_exists('password', $data) || !array_key_exists('code', $data)){
|
if(!array_key_exists('data', $data) || !array_key_exists('password', $data) || !array_key_exists('code', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
|
|
@ -57,8 +58,9 @@ class Login extends Base{
|
||||||
}
|
}
|
||||||
// 登录
|
// 登录
|
||||||
public function login(){
|
public function login(){
|
||||||
|
$data = input('post.');
|
||||||
try {
|
try {
|
||||||
$data = input('post.');
|
|
||||||
if(!array_key_exists('data', $data) || !array_key_exists('validate_data', $data) || !array_key_exists('validate_type', $data)){
|
if(!array_key_exists('data', $data) || !array_key_exists('validate_data', $data) || !array_key_exists('validate_type', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
|
|
@ -90,8 +92,9 @@ class Login extends Base{
|
||||||
}
|
}
|
||||||
// 重置密码
|
// 重置密码
|
||||||
public function reset_password(){
|
public function reset_password(){
|
||||||
|
$data = input('post.');
|
||||||
try {
|
try {
|
||||||
$data = input('post.');
|
|
||||||
// 验证数据项是否完整
|
// 验证数据项是否完整
|
||||||
if(!array_key_exists('data', $data) || !array_key_exists('password', $data) || !array_key_exists('c_password', $data) || !array_key_exists('code', $data)){
|
if(!array_key_exists('data', $data) || !array_key_exists('password', $data) || !array_key_exists('c_password', $data) || !array_key_exists('code', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
|
|
@ -356,6 +359,7 @@ class Login extends Base{
|
||||||
return $this->msg(10005);
|
return $this->msg(10005);
|
||||||
}
|
}
|
||||||
$verify_result[$montage_data] = $data['data'];
|
$verify_result[$montage_data] = $data['data'];
|
||||||
|
$verify_result['is_del'] = 0;
|
||||||
// $verify_result['is_del'] = 0;
|
// $verify_result['is_del'] = 0;
|
||||||
// 检测校验途径
|
// 检测校验途径
|
||||||
if($data['validate_type'] == 'code'){
|
if($data['validate_type'] == 'code'){
|
||||||
|
|
@ -363,10 +367,10 @@ class Login extends Base{
|
||||||
if($this->check_code($code_name,$data['validate_data']) === true){
|
if($this->check_code($code_name,$data['validate_data']) === true){
|
||||||
$result = Db::table($this->login_use_db_name['zhanghao'])->where($verify_result)->field('id,token,is_del')->find();
|
$result = Db::table($this->login_use_db_name['zhanghao'])->where($verify_result)->field('id,token,is_del')->find();
|
||||||
if($result){
|
if($result){
|
||||||
if($result['is_del'] == 1){
|
// if($result['is_del'] == 1){
|
||||||
return $this->msg(10002,'该账号已注销');
|
// return $this->msg(10002,'该账号已注销');
|
||||||
}
|
// }
|
||||||
Db::table($this->login_use_db_name['zhanghao'])->where($verify_result)->update(['login_time'=>date('Y-m-d H:i:s')]);
|
Db::table($this->login_use_db_name['zhanghao'])->where(['id'=>$result['id']])->update(['login_time'=>date('Y-m-d H:i:s')]);
|
||||||
$return_data = $this->msg(['token'=>$result['token'],'aan_id'=>$result['id']]);
|
$return_data = $this->msg(['token'=>$result['token'],'aan_id'=>$result['id']]);
|
||||||
}else{
|
}else{
|
||||||
$set_data['password'] = '';
|
$set_data['password'] = '';
|
||||||
|
|
@ -390,16 +394,16 @@ class Login extends Base{
|
||||||
// $verify_result['password'] = $data['validate_data'];
|
// $verify_result['password'] = $data['validate_data'];
|
||||||
$result = Db::table($this->login_use_db_name['zhanghao'])->where($verify_result)->field('id,token,password,is_del')->find();
|
$result = Db::table($this->login_use_db_name['zhanghao'])->where($verify_result)->field('id,token,password,is_del')->find();
|
||||||
if($result){
|
if($result){
|
||||||
if($result['is_del'] == 1){
|
// if($result['is_del'] == 1){
|
||||||
return $this->msg(10002,'该账号已注销');
|
// return $this->msg(10002,'该账号已注销');
|
||||||
}
|
// }
|
||||||
if($result['password'] == ''){
|
if($result['password'] == ''){
|
||||||
$return_data = $this->msg(10002,'该账户未设密码,请用验证码登录');
|
$return_data = $this->msg(10002,'该账户未设密码,请用验证码登录');
|
||||||
}
|
}
|
||||||
if($data['validate_data'] != $result['password']){
|
if($data['validate_data'] != $result['password']){
|
||||||
$return_data = $this->msg(10002,'账号或密码错误');
|
$return_data = $this->msg(10002,'账号或密码错误');
|
||||||
}else{
|
}else{
|
||||||
Db::table($this->login_use_db_name['zhanghao'])->where($verify_result)->update(['login_time'=>date('Y-m-d H:i:s')]);
|
Db::table($this->login_use_db_name['zhanghao'])->where(['id'=>$result['id']])->update(['login_time'=>date('Y-m-d H:i:s')]);
|
||||||
$return_data = $this->msg(['token'=>$result['token'],'aan_id'=>$result['id']],'登录成功');
|
$return_data = $this->msg(['token'=>$result['token'],'aan_id'=>$result['id']],'登录成功');
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,18 @@
|
||||||
|
|
||||||
namespace app\NewReedaw\controller\app;
|
namespace app\NewReedaw\controller\app;
|
||||||
|
|
||||||
use think\Controller;
|
|
||||||
use think\Db;
|
use think\Db;
|
||||||
use think\Cache;
|
use app\NewReedaw\controller\app\Login;
|
||||||
use think\Log;
|
use app\NewReedaw\controller\app\Kitchenscale;
|
||||||
use PHPMailer\PHPMailer\PHPMailer;
|
|
||||||
|
|
||||||
class Role extends Base{
|
class Role extends Base{
|
||||||
|
|
||||||
protected $role_db_name = [
|
protected $role_db_name = [
|
||||||
'zhanghao'=>'app_account_number',
|
'zhanghao'=>'app_account_number',
|
||||||
'juese'=>'app_user_data',
|
'juese'=>'app_user_data',
|
||||||
'quyu_card'=>'admin_estimate'
|
'quyu_card'=>'admin_estimate',
|
||||||
|
'cfc_user'=>'app_user_data'
|
||||||
];
|
];
|
||||||
protected $identity_list = ['P0'=>'陌生人','P1'=>'爸爸','P2'=>'妈妈','P3'=>'大宝','P4'=>'二宝','P5'=>'三宝','P6'=>'四宝','P7'=>'爷爷','P8'=>'奶奶'];
|
protected $identity_list = ['P0'=>'陌生人','P1'=>'爸爸','P2'=>'妈妈','P3'=>'大宝','P4'=>'二宝','P5'=>'三宝','P6'=>'四宝','P7'=>'爷爷','P8'=>'奶奶'];
|
||||||
protected $grade_list = [
|
protected $grade_list = [
|
||||||
|
|
@ -66,11 +66,158 @@ class Role extends Base{
|
||||||
################################################################接口################################################################
|
################################################################接口################################################################
|
||||||
################################################################接口################################################################
|
################################################################接口################################################################
|
||||||
|
|
||||||
|
// 获取账号下信息
|
||||||
|
public function get_my_account_msg(){
|
||||||
|
$data = input('post.');
|
||||||
|
try {
|
||||||
|
if(!array_key_exists('token', $data)){
|
||||||
|
return $this->msg(10001);
|
||||||
|
}
|
||||||
|
if($data['token'] == ''){
|
||||||
|
return $this->msg(-2,'特殊状态',[]);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
$return_data = $this->get_my_account_msg_action($data);
|
||||||
|
// 成功
|
||||||
|
$this->record_api_log($data, null, $return_data);
|
||||||
|
return $return_data;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// 捕获异常
|
||||||
|
$logContent["flie"] = $e->getFile();
|
||||||
|
$logContent["line"] = $e->getLine();
|
||||||
|
$logContent['all_content'] = "异常信息:\n";
|
||||||
|
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||||
|
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||||
|
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||||
|
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||||
|
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||||
|
$this->record_api_log($data, $logContent, null);
|
||||||
|
return $this->msg(99999);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 邮箱/手机绑定
|
||||||
|
public function update_my_account_msg(){
|
||||||
|
$data = input('post.');
|
||||||
|
try {
|
||||||
|
|
||||||
|
if(!array_key_exists('data', $data) || !array_key_exists('token', $data) || !array_key_exists('code', $data)){
|
||||||
|
return $this->msg(10001);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['code'],'intnum')){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->update_my_account_msg_action($data);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// 捕获异常
|
||||||
|
$logContent["flie"] = $e->getFile();
|
||||||
|
$logContent["line"] = $e->getLine();
|
||||||
|
$logContent['all_content'] = "异常信息:\n";
|
||||||
|
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||||
|
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||||
|
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||||
|
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||||
|
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||||
|
$this->record_api_log($data, $logContent, null);
|
||||||
|
return $this->msg(99999);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// 修改密码
|
||||||
|
public function update_my_password(){
|
||||||
|
$data = input('post.');
|
||||||
|
try {
|
||||||
|
|
||||||
|
if(!array_key_exists('password', $data) || !array_key_exists('c_password', $data) || !array_key_exists('token', $data)){
|
||||||
|
return $this->msg(10001);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['password'],'str')){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['c_password'],'str')){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
$return_data = $this->update_my_password_action($data);
|
||||||
|
// 成功
|
||||||
|
$this->record_api_log($data, null, $return_data);
|
||||||
|
return $return_data;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// 捕获异常
|
||||||
|
$logContent["flie"] = $e->getFile();
|
||||||
|
$logContent["line"] = $e->getLine();
|
||||||
|
$logContent['all_content'] = "异常信息:\n";
|
||||||
|
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||||
|
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||||
|
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||||
|
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||||
|
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||||
|
$this->record_api_log($data, $logContent, null);
|
||||||
|
return $this->msg(99999);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// 修改密码
|
||||||
|
public function set_my_account_msg(){
|
||||||
|
$data = input('post.');
|
||||||
|
try {
|
||||||
|
|
||||||
|
if(!array_key_exists('weight', $data) || !array_key_exists('height', $data) || !array_key_exists('birthday', $data) || !array_key_exists('gender', $data) || !array_key_exists('activity_level', $data) || !array_key_exists('token', $data)){
|
||||||
|
return $this->msg(10001);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['weight'],'num')){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['height'],'num')){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['birthday'],'datetime')){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['gender'],'num')){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['activity_level'],'num')){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
$return_data = $this->set_my_account_msg_action($data);
|
||||||
|
// 成功
|
||||||
|
$this->record_api_log($data, null, $return_data);
|
||||||
|
return $return_data;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// 捕获异常
|
||||||
|
$logContent["flie"] = $e->getFile();
|
||||||
|
$logContent["line"] = $e->getLine();
|
||||||
|
$logContent['all_content'] = "异常信息:\n";
|
||||||
|
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||||
|
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||||
|
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||||
|
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||||
|
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||||
|
$this->record_api_log($data, $logContent, null);
|
||||||
|
return $this->msg(99999);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 添加角色
|
// 添加角色
|
||||||
public function add_member(){
|
public function add_member(){
|
||||||
|
$data = input('post.');
|
||||||
try {
|
try {
|
||||||
// 你的业务逻辑
|
// 你的业务逻辑
|
||||||
$data = input('post.');
|
|
||||||
if(!array_key_exists('token', $data) || !array_key_exists('nickname', $data) || !array_key_exists('birthday', $data) || !array_key_exists('gender', $data) || !array_key_exists('height', $data) || !array_key_exists('weight', $data) || !array_key_exists('measure_model', $data)){
|
if(!array_key_exists('token', $data) || !array_key_exists('nickname', $data) || !array_key_exists('birthday', $data) || !array_key_exists('gender', $data) || !array_key_exists('height', $data) || !array_key_exists('weight', $data) || !array_key_exists('measure_model', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
|
|
@ -109,9 +256,10 @@ class Role extends Base{
|
||||||
}
|
}
|
||||||
// 更新角色
|
// 更新角色
|
||||||
public function update_member(){
|
public function update_member(){
|
||||||
|
$data = input('post.');
|
||||||
try {
|
try {
|
||||||
// 你的业务逻辑
|
// 你的业务逻辑
|
||||||
$data = input('post.');
|
|
||||||
if(!array_key_exists('token', $data) || !array_key_exists('id', $data) || !array_key_exists('nickname', $data) || !array_key_exists('birthday', $data) || !array_key_exists('gender', $data) || !array_key_exists('height', $data) || !array_key_exists('weight', $data) || !array_key_exists('measure_model', $data)){
|
if(!array_key_exists('token', $data) || !array_key_exists('id', $data) || !array_key_exists('nickname', $data) || !array_key_exists('birthday', $data) || !array_key_exists('gender', $data) || !array_key_exists('height', $data) || !array_key_exists('weight', $data) || !array_key_exists('measure_model', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
|
|
@ -153,9 +301,10 @@ class Role extends Base{
|
||||||
}
|
}
|
||||||
// 获取角色列表
|
// 获取角色列表
|
||||||
public function role_list(){
|
public function role_list(){
|
||||||
|
$data = input('post.');
|
||||||
try {
|
try {
|
||||||
// 你的业务逻辑
|
// 你的业务逻辑
|
||||||
$data = input('post.');
|
|
||||||
if(!array_key_exists('token', $data)){
|
if(!array_key_exists('token', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
|
|
@ -177,9 +326,211 @@ class Role extends Base{
|
||||||
return $this->msg(99999);
|
return $this->msg(99999);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 修改昵称
|
||||||
|
public function update_my_nickname(){
|
||||||
|
|
||||||
|
$data = input('post.');
|
||||||
|
try {
|
||||||
|
if(!array_key_exists('nickname', $data) || !array_key_exists('token', $data)){
|
||||||
|
return $this->msg(10001);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['nickname'],'str')){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
$return_data = $this->update_my_nickname_action($data);
|
||||||
|
// 成功
|
||||||
|
$this->record_api_log($data, null, $return_data);
|
||||||
|
return $return_data;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// 捕获异常
|
||||||
|
$logContent["flie"] = $e->getFile();
|
||||||
|
$logContent["line"] = $e->getLine();
|
||||||
|
$logContent['all_content'] = "异常信息:\n";
|
||||||
|
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||||
|
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||||
|
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||||
|
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||||
|
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||||
|
$this->record_api_log($data, $logContent, null);
|
||||||
|
return $this->msg(99999);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// 获取指定用户详细信息
|
||||||
|
public function get_user_data_information(){
|
||||||
|
$data = input('post.');
|
||||||
|
// try {
|
||||||
|
|
||||||
|
if(!array_key_exists('token', $data)){
|
||||||
|
return $this->msg(10001);
|
||||||
|
}
|
||||||
|
if(!array_key_exists('aud_id', $data)){
|
||||||
|
return $this->msg(10001);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
return $this->get_user_data_information_action($data);
|
||||||
|
// } catch (\Exception $e) {
|
||||||
|
// // 捕获异常
|
||||||
|
// $logContent["flie"] = $e->getFile();
|
||||||
|
// $logContent["line"] = $e->getLine();
|
||||||
|
// $logContent['all_content'] = "异常信息:\n";
|
||||||
|
// $logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||||
|
// $logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||||
|
// $logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||||
|
// $logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||||
|
// $logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||||
|
// $this->record_api_log($data, $logContent, null);
|
||||||
|
// return $this->msg(99999);
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
################################################################action################################################################
|
################################################################action################################################################
|
||||||
################################################################action################################################################
|
################################################################action################################################################
|
||||||
|
|
||||||
|
|
||||||
|
public function get_my_account_msg_action($data){
|
||||||
|
$result = Db::table($this->role_db_name['zhanghao'])->where(['token'=>$data['token'],'is_del'=>0])->find();
|
||||||
|
$cfc = Db::connect('cfc_db');
|
||||||
|
$cfc_user = $cfc->table($this->role_db_name['cfc_user'])
|
||||||
|
->where(['token'=>$data['token']])
|
||||||
|
->find(); // 然后获取结果
|
||||||
|
|
||||||
|
//
|
||||||
|
if($result){
|
||||||
|
$return_data = [
|
||||||
|
'my_tel'=>$result['tel'],
|
||||||
|
'my_email'=>$result['email'],
|
||||||
|
'create_time'=>$result['create_time'],
|
||||||
|
'token'=>$result['token'],
|
||||||
|
'nickname'=>$result['nickname'],
|
||||||
|
'head_pic'=>$result['head_pic'],
|
||||||
|
];
|
||||||
|
if($cfc_user){
|
||||||
|
// dump($result);
|
||||||
|
|
||||||
|
$return_data['weight'] = $cfc_user['weight'];
|
||||||
|
$return_data['height'] = $cfc_user['height'];
|
||||||
|
$return_data['birthday'] = $cfc_user['birthday'];
|
||||||
|
$return_data['gender'] = $cfc_user['gender'];
|
||||||
|
$return_data['activity_level'] = $cfc_user['activity_level'];
|
||||||
|
}else{
|
||||||
|
$return_data['weight'] = 0;
|
||||||
|
$return_data['height'] = 0;
|
||||||
|
$return_data['birthday'] = '';
|
||||||
|
$return_data['gender'] = '';
|
||||||
|
$return_data['activity_level'] = '';
|
||||||
|
}
|
||||||
|
return $this->msg($return_data);
|
||||||
|
}else{
|
||||||
|
return $this->msg(10002);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function update_my_account_msg_action($data){
|
||||||
|
$login_action = new Login();
|
||||||
|
$validate_result = $login_action->check_code($data['data'],$data['code']);
|
||||||
|
if($validate_result !== true){
|
||||||
|
return $this->msg(10001,$validate_result);
|
||||||
|
}
|
||||||
|
$montage_data = $this->is_tel_email($data['data']);
|
||||||
|
if($montage_data == false){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
$result = Db::table($this->role_db_name['zhanghao'])->where(['token'=>$data['token'],'is_del'=>0])->update([
|
||||||
|
$montage_data=>$data['data'],
|
||||||
|
'update_time'=>date('Y-m-d H:i:s')
|
||||||
|
]);
|
||||||
|
if($result){
|
||||||
|
return $this->msg([]);
|
||||||
|
}else{
|
||||||
|
return $this->msg(10002);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function update_my_password_action($data){
|
||||||
|
if($data['password'] != $data['c_password']){
|
||||||
|
return $this->msg(10003,'两次密码不一致');
|
||||||
|
}
|
||||||
|
if($data['password'] == ''){
|
||||||
|
return $this->msg(10003,'密码不能为空');
|
||||||
|
}
|
||||||
|
$result = Db::table($this->role_db_name['zhanghao'])->where(['token'=>$data['token'],'is_del'=>0])->update([
|
||||||
|
'password'=>$data['password'],
|
||||||
|
'update_time'=>date('Y-m-d H:i:s')
|
||||||
|
]);
|
||||||
|
if($result){
|
||||||
|
return $this->msg([]);
|
||||||
|
}else{
|
||||||
|
return $this->msg(10002);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function set_my_account_msg_action($data){
|
||||||
|
$cfc = Db::connect('cfc_db');
|
||||||
|
$user = Db::table($this->role_db_name['zhanghao'])->where(['token'=>$data['token'],'is_del'=>0])->find();
|
||||||
|
if($user){
|
||||||
|
$cfc_user = $cfc->table($this->role_db_name['cfc_user'])
|
||||||
|
->where(['token'=>$data['token']])
|
||||||
|
->find(); // 然后获取结果
|
||||||
|
if($cfc_user){
|
||||||
|
$cfc_user = $cfc->table($this->role_db_name['cfc_user'])
|
||||||
|
->where(['token'=>$data['token']])
|
||||||
|
->update([
|
||||||
|
'weight'=>$data['weight'],
|
||||||
|
'height'=>$data['height'],
|
||||||
|
'birthday'=>$data['birthday'],
|
||||||
|
'gender'=>$data['gender'],
|
||||||
|
'activity_level'=>$data['activity_level'],
|
||||||
|
]);
|
||||||
|
}else{
|
||||||
|
$add_data = [
|
||||||
|
'token'=>$data['token'],
|
||||||
|
'nickname'=>$user['nickname'],
|
||||||
|
'gender'=>$data['gender'],
|
||||||
|
'height'=>$data['height'],
|
||||||
|
'weight'=>$data['weight'],
|
||||||
|
'birthday'=>$data['birthday'],
|
||||||
|
'activity_level'=>$data['activity_level'],
|
||||||
|
];
|
||||||
|
$user_age = $this->calculate_age($data['birthday']);
|
||||||
|
if($data['gender'] == 2){
|
||||||
|
if($user_age <= 18){
|
||||||
|
$data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman1.png";
|
||||||
|
}else if($user_age <= 39 && $user_age > 18){
|
||||||
|
$data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman2.png";
|
||||||
|
}else if($user_age <= 59 && $user_age > 39){
|
||||||
|
$data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman3.png";
|
||||||
|
}else if($user_age >= 60){
|
||||||
|
$data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman4.png";
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if($user_age <= 18){
|
||||||
|
$data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man1.png";
|
||||||
|
}else if($user_age <= 39 && $user_age > 18){
|
||||||
|
$data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man2.png";
|
||||||
|
}else if($user_age <= 59 && $user_age > 39){
|
||||||
|
$data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man3.png";
|
||||||
|
}else if($user_age >= 60){
|
||||||
|
$data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man4.png";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$cfc_user = $cfc->table($this->role_db_name['cfc_user'])->insert($add_data);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->msg(10003);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function add_member_action($data){
|
public function add_member_action($data){
|
||||||
$aan_id = Db::table($this->role_db_name['zhanghao'])->where(['token'=>$data['token']])->field('id,token')->find();
|
$aan_id = Db::table($this->role_db_name['zhanghao'])->where(['token'=>$data['token']])->field('id,token')->find();
|
||||||
if(!$aan_id){
|
if(!$aan_id){
|
||||||
|
|
@ -320,6 +671,137 @@ class Role extends Base{
|
||||||
}
|
}
|
||||||
return $this->msg($temporary_data);
|
return $this->msg($temporary_data);
|
||||||
}
|
}
|
||||||
|
public function update_my_nickname_action($data){
|
||||||
|
$result = Db::table($this->role_db_name['zhanghao'])->where(['token'=>$data['token'],'is_del'=>0])->update([
|
||||||
|
'nickname'=>$data['nickname'],
|
||||||
|
'update_time'=>date('Y-m-d H:i:s')
|
||||||
|
]);
|
||||||
|
if($result){
|
||||||
|
return $this->msg([]);
|
||||||
|
}else{
|
||||||
|
return $this->msg(10002);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function get_user_data_information_action($data){
|
||||||
|
|
||||||
|
// 获取账号下信息以及用户信息
|
||||||
|
$zhanghao_data = Db::table($this->role_db_name['zhanghao'])->where(['token'=>$data['token']])->field('id,token,nickname,head_pic,tel,email')->find();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(!$zhanghao_data){
|
||||||
|
return $this->msg(10004);
|
||||||
|
}
|
||||||
|
// 获取账号下信息以及用户信息start
|
||||||
|
$user_all_data['aud_id'] = '';
|
||||||
|
$user_all_data['token'] = $zhanghao_data['token'];
|
||||||
|
$user_all_data['nickname'] = '';
|
||||||
|
$user_all_data['head_pic'] = $zhanghao_data['head_pic'];
|
||||||
|
$user_all_data['gender'] = '';
|
||||||
|
$user_all_data['age'] = '';
|
||||||
|
$user_all_data['height'] = '';
|
||||||
|
$user_all_data['weight'] = '';
|
||||||
|
$user_all_data['set_kcal'] = '';
|
||||||
|
$user_all_data['is_use_set_kcal'] = '';
|
||||||
|
$user_all_data['tel'] = $zhanghao_data['tel'];
|
||||||
|
$user_all_data['email'] = $zhanghao_data['email'];
|
||||||
|
|
||||||
|
$user_all_data['aan_id'] = $zhanghao_data['id'];
|
||||||
|
$user_all_data['card_order'] = [];
|
||||||
|
$user_all_data['target_weight'] = 0;
|
||||||
|
$user_all_data['initial_weight'] = 0;
|
||||||
|
$user_all_data['initial_date'] = 0;
|
||||||
|
$user_all_data['address'] = '';
|
||||||
|
$user_all_data['identity_id'] = 'P0';
|
||||||
|
$user_all_data['measure_model'] = 1;
|
||||||
|
$user_all_data['head_data'] = 0;
|
||||||
|
$user_all_data['stage'] = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$user_account = Db::table($this->role_db_name['juese'])
|
||||||
|
->where(["id"=>$data['aud_id']])
|
||||||
|
// ->field('id as aud_id,nickname,head_pic,gender,height,weight,birthday,set_kcal,is_use_set_kcal,activity_level')
|
||||||
|
->field('id as aud_id,nickname,head_pic,gender,height,weight,birthday,card_order,target_weight,initial_weight,initial_date,address,identity_id,measure_model,head_data,set_kcal,is_use_set_kcal,activity_level')
|
||||||
|
->find();
|
||||||
|
|
||||||
|
if($user_account){
|
||||||
|
if($user_account['set_kcal'] == '.00'){
|
||||||
|
$user_account['set_kcal'] = 0;
|
||||||
|
}
|
||||||
|
$user_all_data['aud_id'] = $user_account['aud_id'];
|
||||||
|
$user_all_data['nickname'] = $user_account['nickname'];
|
||||||
|
$user_all_data['gender'] = $user_account['gender'];
|
||||||
|
$user_all_data['age'] = $this->calculate_age($user_account['birthday']);
|
||||||
|
$user_all_data['height'] = $user_account['height'];
|
||||||
|
$user_all_data['weight'] = $user_account['weight'];
|
||||||
|
$user_all_data['set_kcal'] = $user_account['set_kcal'];
|
||||||
|
$user_all_data['is_use_set_kcal'] = $user_account['is_use_set_kcal'];
|
||||||
|
$user_all_data['birthday'] = $user_account['birthday'];
|
||||||
|
$user_all_data['activity_level'] = $user_account['activity_level'];
|
||||||
|
|
||||||
|
$user_all_data['card_order'] = explode(',',$user_account['card_order']);
|
||||||
|
$user_all_data['target_weight'] = $user_account['target_weight'];
|
||||||
|
$user_all_data['initial_weight'] = $user_account['initial_weight'];
|
||||||
|
$user_all_data['initial_date'] = $user_account['initial_date'];
|
||||||
|
$user_all_data['address'] = $user_account['address'];
|
||||||
|
$user_all_data['identity_id'] = $user_account['identity_id'];
|
||||||
|
$user_all_data['measure_model'] = $user_account['measure_model'];
|
||||||
|
$user_all_data['head_data'] = $user_account['head_data'];
|
||||||
|
|
||||||
|
foreach ($this->stage_appellation as $key => $value) {
|
||||||
|
if($user_all_data['age'] >= $value['min'] && $user_all_data['age'] < $value['max']){
|
||||||
|
$user_all_data['stage'] = $value['value'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if($user_all_data['gender'] == 2){
|
||||||
|
// if($user_all_data['age'] <= 18){
|
||||||
|
// $user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman1.png";
|
||||||
|
// }else if($user_all_data['age'] <= 39 && $user_all_data['age'] > 18){
|
||||||
|
// $user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman2.png";
|
||||||
|
// }else if($user_all_data['age'] <= 59 && $user_all_data['age'] > 39){
|
||||||
|
// $user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman3.png";
|
||||||
|
// }else if($user_all_data['age'] >= 60){
|
||||||
|
// $user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman4.png";
|
||||||
|
// }
|
||||||
|
// }else{
|
||||||
|
// if($user_all_data['age'] <= 18){
|
||||||
|
// $user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man1.png";
|
||||||
|
// }else if($user_all_data['age'] <= 39 && $user_all_data['age'] > 18){
|
||||||
|
// $user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man2.png";
|
||||||
|
// }else if($user_all_data['age'] <= 59 && $user_all_data['age'] > 39){
|
||||||
|
// $user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man3.png";
|
||||||
|
// }else if($user_all_data['age'] >= 60){
|
||||||
|
// $user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man4.png";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
$kitchenscale = NEW Kitchenscale;
|
||||||
|
$user_all_data['food_count'] = $kitchenscale->get_countfoot_content_action(['token'=>$data['token'],'aud_id'=>$user_all_data['aud_id'],'time'=>date('Y-m-d')]);
|
||||||
|
$user_all_data['food_count'] = ($user_all_data['food_count']->getData())['data'];
|
||||||
|
// dump($user_all_data['food_count']);
|
||||||
|
}else{
|
||||||
|
$user_account['set_kcal'] = 0;
|
||||||
|
$user_all_data['aud_id'] = null;
|
||||||
|
$user_all_data['gender'] = 0;
|
||||||
|
$user_all_data['age'] = false;
|
||||||
|
$user_all_data['height'] = null;
|
||||||
|
$user_all_data['weight'] = null;
|
||||||
|
$user_all_data['set_kcal'] = 0;
|
||||||
|
$user_all_data['is_use_set_kcal'] = 0;
|
||||||
|
$user_all_data['birthday'] = null;
|
||||||
|
$user_all_data['activity_level'] = null;
|
||||||
|
$user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man1.png";
|
||||||
|
|
||||||
|
$user_all_data['food_count'] = [];
|
||||||
|
// $user_all_data['food_count'] = ($user_all_data['food_count']->getData())['data'];
|
||||||
|
}
|
||||||
|
return $this->msg($user_all_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,10 @@ class Skip extends Base{
|
||||||
|
|
||||||
// 手动记录
|
// 手动记录
|
||||||
public function manual_record(){
|
public function manual_record(){
|
||||||
|
$data = input('post.');
|
||||||
try {
|
try {
|
||||||
$data = input('post.');
|
|
||||||
if(!array_key_exists('aud_id', $data) || !array_key_exists('r_time', $data) || !array_key_exists('num', $data) || !array_key_exists('time_m', $data) || !array_key_exists('time_s', $data) || !array_key_exists('type', $data) || !array_key_exists('token', $data)){
|
if(!array_key_exists('aud_id', $data) || !array_key_exists('r_time', $data) || !array_key_exists('num', $data) || !array_key_exists('time_m', $data) || !array_key_exists('time_s', $data) || !array_key_exists('type', $data) || !array_key_exists('token', $data)){
|
||||||
$return_data = $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||||||
return $this->msg(10005,'aud_id type error');
|
return $this->msg(10005,'aud_id type error');
|
||||||
|
|
@ -78,10 +78,10 @@ class Skip extends Base{
|
||||||
}
|
}
|
||||||
// 设备记录
|
// 设备记录
|
||||||
public function device_record(){
|
public function device_record(){
|
||||||
|
$data = input('post.');
|
||||||
try {
|
try {
|
||||||
$data = input('post.');
|
|
||||||
if(!array_key_exists('aud_id', $data) || !array_key_exists('kcal', $data) || !array_key_exists('num', $data) || !array_key_exists('time_m', $data) || !array_key_exists('time_s', $data) || !array_key_exists('type', $data) || !array_key_exists('token', $data)){
|
if(!array_key_exists('aud_id', $data) || !array_key_exists('kcal', $data) || !array_key_exists('num', $data) || !array_key_exists('time_m', $data) || !array_key_exists('time_s', $data) || !array_key_exists('type', $data) || !array_key_exists('token', $data)){
|
||||||
$return_data = $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||||||
return $this->msg(10005);
|
return $this->msg(10005);
|
||||||
|
|
@ -93,23 +93,19 @@ class Skip extends Base{
|
||||||
return $this->msg(10005);
|
return $this->msg(10005);
|
||||||
}
|
}
|
||||||
if(!$this->isValidInteger($data['num']+0) || !$this->isValidInteger($data['time_m']+0) || !$this->isValidInteger($data['time_s']+0)){
|
if(!$this->isValidInteger($data['num']+0) || !$this->isValidInteger($data['time_m']+0) || !$this->isValidInteger($data['time_s']+0)){
|
||||||
$return_data = $this->msg(10005,'跳绳数量或者分钟、秒钟值必须为整数');
|
return $this->msg(10005,'跳绳数量或者分钟、秒钟值必须为整数');
|
||||||
}
|
}
|
||||||
if($data['num'] <= 0){
|
if($data['num'] <= 0){
|
||||||
$return_data = $this->msg(10005,'跳绳数不能小于等于0');
|
return $this->msg(10005,'跳绳数不能小于等于0');
|
||||||
}
|
}
|
||||||
if(abs($data['time_s']) >= 60){
|
if(abs($data['time_s']) >= 60){
|
||||||
$return_data = $this->msg(10005,'秒钟值不能大于60');
|
return $this->msg(10005,'秒钟值不能大于60');
|
||||||
}
|
}
|
||||||
unset($data['token']);
|
unset($data['token']);
|
||||||
if($this->validate_user_identity($data['aud_id']) === false){
|
if($this->validate_user_identity($data['aud_id']) === false){
|
||||||
$return_data = $this->msg(10003);
|
return $this->msg(10003);
|
||||||
}
|
}
|
||||||
$return_data = $this->manual_record_action($data);
|
return $this->manual_record_action($data);
|
||||||
|
|
||||||
// 成功
|
|
||||||
$this->record_api_log($data, null, $return_data);
|
|
||||||
return $return_data;
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// 捕获异常
|
// 捕获异常
|
||||||
$logContent["flie"] = $e->getFile();
|
$logContent["flie"] = $e->getFile();
|
||||||
|
|
@ -126,8 +122,9 @@ class Skip extends Base{
|
||||||
}
|
}
|
||||||
// 数据报告
|
// 数据报告
|
||||||
public function data_report(){
|
public function data_report(){
|
||||||
|
$data = input('post.');
|
||||||
try {
|
try {
|
||||||
$data = input('post.');
|
|
||||||
if(!array_key_exists('aud_id', $data) || !array_key_exists('token', $data)){
|
if(!array_key_exists('aud_id', $data) || !array_key_exists('token', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
|
|
@ -152,8 +149,9 @@ class Skip extends Base{
|
||||||
}
|
}
|
||||||
// 曲线
|
// 曲线
|
||||||
public function curve_chart(){
|
public function curve_chart(){
|
||||||
|
$data = input('post.');
|
||||||
try {
|
try {
|
||||||
$data = input('post.');
|
|
||||||
if(!array_key_exists('aud_id', $data) || !array_key_exists('time', $data) || !array_key_exists('token', $data)){
|
if(!array_key_exists('aud_id', $data) || !array_key_exists('time', $data) || !array_key_exists('token', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
|
|
@ -179,8 +177,9 @@ class Skip extends Base{
|
||||||
}
|
}
|
||||||
// 获取历史列表(分页)
|
// 获取历史列表(分页)
|
||||||
public function record_list_page(){
|
public function record_list_page(){
|
||||||
|
$data = input('post.');
|
||||||
try {
|
try {
|
||||||
$data = input('post.');
|
|
||||||
if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data) || !array_key_exists('page', $data)){
|
if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data) || !array_key_exists('page', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
|
|
@ -210,8 +209,9 @@ class Skip extends Base{
|
||||||
}
|
}
|
||||||
// 获取历史列表(分组)
|
// 获取历史列表(分组)
|
||||||
public function record_list_group(){
|
public function record_list_group(){
|
||||||
|
$data = input('post.');
|
||||||
try {
|
try {
|
||||||
$data = input('post.');
|
|
||||||
if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data) || !array_key_exists('s_time', $data) || !array_key_exists('e_time', $data)){
|
if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data) || !array_key_exists('s_time', $data) || !array_key_exists('e_time', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
|
|
@ -244,8 +244,9 @@ class Skip extends Base{
|
||||||
}
|
}
|
||||||
// 历史记录(详细)
|
// 历史记录(详细)
|
||||||
public function detailed_record(){
|
public function detailed_record(){
|
||||||
|
$data = input('post.');
|
||||||
try {
|
try {
|
||||||
$data = input('post.');
|
|
||||||
if(!array_key_exists('token', $data) || !array_key_exists('id', $data)){
|
if(!array_key_exists('token', $data) || !array_key_exists('id', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
|
|
@ -272,21 +273,58 @@ class Skip extends Base{
|
||||||
}
|
}
|
||||||
// 删除历史数据
|
// 删除历史数据
|
||||||
public function del_record(){
|
public function del_record(){
|
||||||
|
$data = input('post.');
|
||||||
try {
|
try {
|
||||||
$data = input('post.');
|
|
||||||
if(!array_key_exists('id', $data) || !array_key_exists('token', $data)){
|
if(!array_key_exists('id', $data) || !array_key_exists('token', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
if(!$this->verify_data_is_ok($data['id'],'intnum')){
|
if(!$this->verify_data_is_ok($data['id'],'intnum')){
|
||||||
return $this->msg(10005);
|
return $this->msg(10005);
|
||||||
}
|
}
|
||||||
unset($data['token']);
|
// unset($data['token']);
|
||||||
$user_data = Db::table($this->skip_db_name['skip'])->where(['id'=>$data['id']])->update(['is_del'=>1]);
|
// 核实账号
|
||||||
if($user_data){
|
$zh_data = Db::table($this->skip_db_name['zhanghao'])->where(['token'=>$data['token'],'is_del'=>0])->field('id,token')->find();
|
||||||
return $this->msg([]);
|
if(!$zh_data){
|
||||||
}else{
|
return $this->msg(10003);
|
||||||
return $this->msg(10002);
|
|
||||||
}
|
}
|
||||||
|
// dump($zh_data);
|
||||||
|
// 核实角色
|
||||||
|
$js_data = Db::table($this->skip_db_name['juese'])->where(['aan_id'=>$zh_data['id'],'is_del'=>0])->field('id')->select();
|
||||||
|
if(!$js_data){
|
||||||
|
return $this->msg(10003);
|
||||||
|
}
|
||||||
|
|
||||||
|
// dump($js_data);
|
||||||
|
$skip_data = Db::table($this->skip_db_name['skip'])->where(['id'=>$data['id']])->field('id,aud_id')->find();
|
||||||
|
|
||||||
|
if(!$skip_data){
|
||||||
|
return $this->msg(10004);
|
||||||
|
}
|
||||||
|
|
||||||
|
// dump($skip_data);
|
||||||
|
$pd = false;
|
||||||
|
|
||||||
|
foreach ($js_data as $key => $value) {
|
||||||
|
if($value['id'] == $skip_data['aud_id']){
|
||||||
|
$pd = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($pd == true){
|
||||||
|
$user_data = Db::table($this->skip_db_name['skip'])->where(['id'=>$data['id']])->update(['is_del'=>1]);
|
||||||
|
if($user_data){
|
||||||
|
return $this->msg([]);
|
||||||
|
}else{
|
||||||
|
return $this->msg(10002);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->msg(10002,'请勿操作他人数据');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// 捕获异常
|
// 捕获异常
|
||||||
$logContent["flie"] = $e->getFile();
|
$logContent["flie"] = $e->getFile();
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -635,6 +635,8 @@ class Card extends Base{
|
||||||
$result_end['score'] = $result_end['score'];
|
$result_end['score'] = $result_end['score'];
|
||||||
$result_end['body_type'] = $result_end['body_type'];
|
$result_end['body_type'] = $result_end['body_type'];
|
||||||
$result_end = $cardparts->conversion_interval($result_end);
|
$result_end = $cardparts->conversion_interval($result_end);
|
||||||
|
// dump($result_end);
|
||||||
|
// die;
|
||||||
$result_end['cplist'] = $this->grow_up_recommendation([
|
$result_end['cplist'] = $this->grow_up_recommendation([
|
||||||
'birthday'=>$result[0]['birthday'],
|
'birthday'=>$result[0]['birthday'],
|
||||||
'body'=>[
|
'body'=>[
|
||||||
|
|
@ -668,6 +670,7 @@ class Card extends Base{
|
||||||
'initial_date'=>$result[0]['initial_date']!=null?$result[0]['initial_date']:0,
|
'initial_date'=>$result[0]['initial_date']!=null?$result[0]['initial_date']:0,
|
||||||
]);
|
]);
|
||||||
// dump($result_end);
|
// dump($result_end);
|
||||||
|
// dump($result_end);
|
||||||
if(count($result_end['top_list'][2]['list']) <= 0){
|
if(count($result_end['top_list'][2]['list']) <= 0){
|
||||||
// 这是16岁以上人群
|
// 这是16岁以上人群
|
||||||
$data = [
|
$data = [
|
||||||
|
|
@ -679,6 +682,7 @@ class Card extends Base{
|
||||||
|
|
||||||
$temporary_arr_bmi_list = $this->card_bmi_evaluation($data,true);
|
$temporary_arr_bmi_list = $this->card_bmi_evaluation($data,true);
|
||||||
// dump($temporary_arr_bmi_list);
|
// dump($temporary_arr_bmi_list);
|
||||||
|
// die;
|
||||||
$temporary_arr_bmi_list = $temporary_arr_bmi_list->getData();
|
$temporary_arr_bmi_list = $temporary_arr_bmi_list->getData();
|
||||||
// dump($temporary_arr_bmi_list);
|
// dump($temporary_arr_bmi_list);
|
||||||
// die;
|
// die;
|
||||||
|
|
@ -688,10 +692,10 @@ class Card extends Base{
|
||||||
$result_end['top_list'][2]['list'] = $temporary_arr_bmi_list['data']['bmilevellist'];
|
$result_end['top_list'][2]['list'] = $temporary_arr_bmi_list['data']['bmilevellist'];
|
||||||
$result_end['top_list'][2]['offset'] = $temporary_arr_bmi_list['data']['offset'];
|
$result_end['top_list'][2]['offset'] = $temporary_arr_bmi_list['data']['offset'];
|
||||||
}
|
}
|
||||||
// dump($result_end);
|
|
||||||
// die;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
// dump($result_end);
|
||||||
|
// die;
|
||||||
// 加入曲线板块底部的减肥计划数据end
|
// 加入曲线板块底部的减肥计划数据end
|
||||||
// 添加头围数据(如果有的话)start
|
// 添加头围数据(如果有的话)start
|
||||||
if($head_circumference !== false && $this->calculate_age($result[0]['birthday']) < 3){
|
if($head_circumference !== false && $this->calculate_age($result[0]['birthday']) < 3){
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,15 @@ class Cardparts extends Base{
|
||||||
foreach ($temporary_arr['top_list'] as $key => $value) {
|
foreach ($temporary_arr['top_list'] as $key => $value) {
|
||||||
|
|
||||||
if(count($value['list']) > 0){
|
if(count($value['list']) > 0){
|
||||||
$temporary_arr['top_list'][$key]['offset'] = $this->calculate_landing_point($value['list'],$value['value'],$value['standard'])[0];
|
// dump($value['list']);
|
||||||
|
// dump($value['value']);
|
||||||
|
// dump($value['standard']);
|
||||||
|
|
||||||
|
// dump($value['name']);
|
||||||
|
// dump($value['value']);
|
||||||
|
// dump($this->calculate_landing_point($value['list'],$value['value'],$value['standard']));
|
||||||
|
$temporary_arr['top_list'][$key]['offset'] = $this->calculate_landing_point($value['list'],$value['value'],$value['standard']);
|
||||||
|
// dump()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 如果是没有阻抗的测试,那么就不要底部的其他数据了
|
// 如果是没有阻抗的测试,那么就不要底部的其他数据了
|
||||||
|
|
@ -379,6 +387,9 @@ class Cardparts extends Base{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(count($temporary_data) <= 0){
|
if(count($temporary_data) <= 0){
|
||||||
|
if($val >= $data[count($data)-1]['max_val']){
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// 加 bcadd(,,20)
|
// 加 bcadd(,,20)
|
||||||
|
|
|
||||||
|
|
@ -451,10 +451,15 @@ class Index extends Base{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 从这里开始进入体脂还是体测的判断
|
// 从这里开始进入体脂还是体测的判断
|
||||||
$result['card_order'] = $result['card_order'] == ""?[]:explode(',',$result['card_order']);
|
$result['card_order'] = $result['card_order'] == ""?[]:explode(',',$result['card_order']);
|
||||||
if($result['measure_model'] == 1){// 这里是体测
|
if($result['measure_model'] == 1){// 这里是体测
|
||||||
|
// dump($result);
|
||||||
|
// die;
|
||||||
$calculation_results = $this->get_user_card_data_list($result,$result['id']);
|
$calculation_results = $this->get_user_card_data_list($result,$result['id']);
|
||||||
|
// dump($calculation_results);
|
||||||
|
// die;
|
||||||
$result['card_data_list'] = $calculation_results[0];
|
$result['card_data_list'] = $calculation_results[0];
|
||||||
$result['card_order'] = $calculation_results[1];
|
$result['card_order'] = $calculation_results[1];
|
||||||
// dump($result);
|
// dump($result);
|
||||||
|
|
@ -466,6 +471,7 @@ class Index extends Base{
|
||||||
$this->record_api_log($data, null, ['code'=>10001,'msg'=>'measure_model数据不是1或者2',[]]);
|
$this->record_api_log($data, null, ['code'=>10001,'msg'=>'measure_model数据不是1或者2',[]]);
|
||||||
return $this->msg(10004);
|
return $this->msg(10004);
|
||||||
}
|
}
|
||||||
|
|
||||||
// // 获取设备信息进入卡片 start
|
// // 获取设备信息进入卡片 start
|
||||||
// $likePattern = '%' . $result['aan_id'] . '%';
|
// $likePattern = '%' . $result['aan_id'] . '%';
|
||||||
// $result_device = Db::table($this->index_use_db_name['4'])
|
// $result_device = Db::table($this->index_use_db_name['4'])
|
||||||
|
|
@ -494,7 +500,7 @@ class Index extends Base{
|
||||||
if($result['head_data'] == null){
|
if($result['head_data'] == null){
|
||||||
$result['head_data'] = 0;
|
$result['head_data'] = 0;
|
||||||
}
|
}
|
||||||
$this->record_api_log($data, null, ['code'=>0,'msg'=>'success',$result]);
|
// $this->record_api_log($data, null, ['code'=>0,'msg'=>'success',$result]);
|
||||||
return $this->msg($result);
|
return $this->msg($result);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// 捕获异常
|
// 捕获异常
|
||||||
|
|
@ -740,7 +746,7 @@ class Index extends Base{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// dump($data);
|
|
||||||
$data['card_order'] = array_values($data['card_order']);
|
$data['card_order'] = array_values($data['card_order']);
|
||||||
// 获取卡片背景图,及背景色信息及其他信息
|
// 获取卡片背景图,及背景色信息及其他信息
|
||||||
$card_all_data = Db::table($this->index_use_db_name['6'])->where(['is_del'=>0])->field('id,name,page_url_record,page_url_report,page_url_bluetooth,key_word,background_color,background_pic')->select();
|
$card_all_data = Db::table($this->index_use_db_name['6'])->where(['is_del'=>0])->field('id,name,page_url_record,page_url_report,page_url_bluetooth,key_word,background_color,background_pic')->select();
|
||||||
|
|
@ -748,6 +754,7 @@ class Index extends Base{
|
||||||
foreach ($card_all_data as $key => $value) {
|
foreach ($card_all_data as $key => $value) {
|
||||||
$card_all_data_result[$value['id']] = $value;
|
$card_all_data_result[$value['id']] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取卡片路径及卡片数组处理end
|
// 获取卡片路径及卡片数组处理end
|
||||||
// // 添加目标体重于当前体重差数据
|
// // 添加目标体重于当前体重差数据
|
||||||
// if(array_key_exists('2', $db_arr)){
|
// if(array_key_exists('2', $db_arr)){
|
||||||
|
|
@ -766,31 +773,39 @@ class Index extends Base{
|
||||||
// ]);
|
// ]);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
if(count($db_arr) <= 0){
|
if(count($db_arr) <= 0){
|
||||||
// 没有数据,传递一个空的卡片
|
// 没有数据,传递一个空的卡片
|
||||||
|
|
||||||
|
// dump($data['card_order']);
|
||||||
|
// dump($card_all_data_result);
|
||||||
foreach ($data['card_order'] as $key => $value) {
|
foreach ($data['card_order'] as $key => $value) {
|
||||||
$temporary_arr = [];
|
if(array_key_exists($value,$card_all_data_result)){
|
||||||
$temporary_arr['id'] = '';
|
$temporary_arr = [];
|
||||||
$temporary_arr['acd_id'] = $value;
|
$temporary_arr['id'] = '';
|
||||||
$temporary_arr['record_time'] = '';
|
$temporary_arr['acd_id'] = $value;
|
||||||
$temporary_arr['card_name'] = $card_all_data_result[$value]['name'];
|
$temporary_arr['record_time'] = '';
|
||||||
$temporary_arr['card_key'] = $card_all_data_result[$value]['key_word'];
|
$temporary_arr['card_name'] = $card_all_data_result[$value]['name'];
|
||||||
$temporary_arr['page_url_record'] = $card_all_data_result[$value]['page_url_record'];
|
$temporary_arr['card_key'] = $card_all_data_result[$value]['key_word'];
|
||||||
$temporary_arr['page_url_report'] = $card_all_data_result[$value]['page_url_report'];
|
$temporary_arr['page_url_record'] = $card_all_data_result[$value]['page_url_record'];
|
||||||
$temporary_arr['page_url_bluetooth'] = $card_all_data_result[$value]['page_url_bluetooth'];
|
$temporary_arr['page_url_report'] = $card_all_data_result[$value]['page_url_report'];
|
||||||
$temporary_arr['background_color'] = $card_all_data_result[$value]['background_color'];
|
$temporary_arr['page_url_bluetooth'] = $card_all_data_result[$value]['page_url_bluetooth'];
|
||||||
$temporary_arr['background_pic'] = $card_all_data_result[$value]['background_pic'];
|
$temporary_arr['background_color'] = $card_all_data_result[$value]['background_color'];
|
||||||
$temporary_arr['inside_data'] = [];
|
$temporary_arr['background_pic'] = $card_all_data_result[$value]['background_pic'];
|
||||||
array_push($temporary_arr['inside_data'],[
|
$temporary_arr['inside_data'] = [];
|
||||||
'key'=>'last_time',
|
array_push($temporary_arr['inside_data'],[
|
||||||
'name'=>'最近一次',
|
'key'=>'last_time',
|
||||||
'value'=>"--",
|
'name'=>'最近一次',
|
||||||
'unit'=>'',
|
'value'=>"--",
|
||||||
'standard'=>'*分',
|
'unit'=>'',
|
||||||
'color'=>''
|
'standard'=>'*分',
|
||||||
]);
|
'color'=>''
|
||||||
array_push($result,$temporary_arr);
|
]);
|
||||||
|
array_push($result,$temporary_arr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// die;
|
||||||
}else{
|
}else{
|
||||||
foreach ($data['card_order'] as $key => $value) {
|
foreach ($data['card_order'] as $key => $value) {
|
||||||
$temporary_arr = [];
|
$temporary_arr = [];
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,20 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace app\KitchenScale2\controller\app;
|
namespace app\app\controller;
|
||||||
|
|
||||||
class Language extends Base
|
class Language extends Base
|
||||||
{
|
{
|
||||||
// 支持的语言列表
|
// 支持的语言列表
|
||||||
protected $supportedLanguages = [
|
protected $supportedLanguages = [
|
||||||
'en' => 'English',
|
'en' => 'English',
|
||||||
'zh' => '中文',
|
'zh-Hans' => 'Chinese',
|
||||||
// 'es' => 'Spanish',
|
'es' => 'Spanish',
|
||||||
// 'fr' => 'French',
|
'fr' => 'French',
|
||||||
// 'pt' => 'Portuguese',
|
'pt' => 'Portuguese',
|
||||||
// 'ar' => 'Arabic',
|
'ar' => 'Arabic',
|
||||||
// 'ru' => 'Russian',
|
'ru' => 'Russian',
|
||||||
// 'de' => 'German'
|
'de' => 'German'
|
||||||
];
|
];
|
||||||
// zh, //中文
|
|
||||||
// en, // 英语
|
|
||||||
// jp, //日语(变化)
|
|
||||||
// fra, //法语(变化)
|
|
||||||
// de, //德语
|
|
||||||
// kor, //韩语(变化)
|
|
||||||
// ru, //俄语
|
|
||||||
// pt, //葡萄牙
|
|
||||||
// spa, //西班牙(变化)
|
|
||||||
// ara, //阿拉伯(变化)
|
|
||||||
|
|
||||||
// 语言映射表
|
// 语言映射表
|
||||||
protected $languageMap = [
|
protected $languageMap = [
|
||||||
|
|
|
||||||
|
|
@ -660,7 +660,10 @@ Route::any('/kitchenscale3/register_action', 'app/kitchenscale3/app.login/regist
|
||||||
Route::any('/kitchenscale3/login_action', 'app/kitchenscale3/app.login/login_action');
|
Route::any('/kitchenscale3/login_action', 'app/kitchenscale3/app.login/login_action');
|
||||||
// 退出登录
|
// 退出登录
|
||||||
Route::any('/kitchenscale3/user_quit_account', 'app/kitchenscale3/app.login/user_quit_account');
|
Route::any('/kitchenscale3/user_quit_account', 'app/kitchenscale3/app.login/user_quit_account');
|
||||||
|
// 修改密码
|
||||||
|
Route::any('/kitchenscale3/reset_password', 'app/kitchenscale3/app.login/reset_password');
|
||||||
|
// 删除账户
|
||||||
|
Route::any('/kitchenscale3/delete_account', 'app/kitchenscale3/app.login/delete_account');
|
||||||
|
|
||||||
|
|
||||||
// 首页内容################################################################
|
// 首页内容################################################################
|
||||||
|
|
@ -837,11 +840,19 @@ Route::any('/de/admin/device/device_all', 'app/DeviceEnter/admin.device/device_a
|
||||||
// 检测是否已录入设备
|
// 检测是否已录入设备
|
||||||
Route::any('/de/check_device_msg', 'app/DeviceEnter/Appinterface/check_device_msg');
|
Route::any('/de/check_device_msg', 'app/DeviceEnter/Appinterface/check_device_msg');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
################################################################下面是新版reedaw(体侧+厨房秤)################################################################
|
################################################################下面是新版reedaw(体侧+厨房秤)################################################################
|
||||||
#############################################################################################################################################################
|
#############################################################################################################################################################
|
||||||
|
|
||||||
################################################################接口(API)################################################################
|
################################################################接口(API)################################################################
|
||||||
################################################################登录注册部分(OK)
|
################################################################登录注册部分(OK)
|
||||||
|
// 检测版本及判断是否登录失效
|
||||||
|
Route::any('/reedaw/login_invalid_version', 'app/NewReedaw/app.index/login_invalid_version');
|
||||||
|
|
||||||
// 注册账号
|
// 注册账号
|
||||||
Route::any('/reedaw/register', 'app/NewReedaw/app.login/register');
|
Route::any('/reedaw/register', 'app/NewReedaw/app.login/register');
|
||||||
// 登录账号
|
// 登录账号
|
||||||
|
|
@ -863,15 +874,127 @@ Route::any('/reedaw/config', 'app/NewReedaw/app.index/config');
|
||||||
// 获取角色列表
|
// 获取角色列表
|
||||||
Route::any('/reedaw/get_user_list', 'app/NewReedaw/app.index/get_user_list');
|
Route::any('/reedaw/get_user_list', 'app/NewReedaw/app.index/get_user_list');
|
||||||
|
|
||||||
|
|
||||||
################################################################首页(身体数据)
|
################################################################首页(身体数据)
|
||||||
// 角色报告(简要)
|
// 角色报告(简要)
|
||||||
Route::any('/reedaw/body_report_brief', 'app/NewReedaw/app.Userbody/body_report_brief');
|
Route::any('/reedaw/body_report_brief', 'app/NewReedaw/app.Userbody/body_report_brief');
|
||||||
// 角色报告(详细)
|
// 角色报告(详细)
|
||||||
Route::any('/reedaw/body_report_detailed', 'app/NewReedaw/app.Userbody/body_report_detailed');
|
Route::any('/reedaw/body_report_detailed', 'app/NewReedaw/app.Userbody/body_report_detailed');
|
||||||
|
// 手动记录
|
||||||
|
Route::any('/reedaw/manual_record', 'app/NewReedaw/app.Userbody/manual_record');
|
||||||
|
// 设备记录
|
||||||
|
Route::any('/reedaw/device_record', 'app/NewReedaw/app.Userbody/device_record');
|
||||||
|
// 修改目标体重
|
||||||
|
Route::any('/reedaw/set_target_weight', 'app/NewReedaw/app.Userbody/set_target_weight');
|
||||||
|
|
||||||
|
################################################################首页(饮食数据)
|
||||||
|
// 根据用户获取他的饮食信息
|
||||||
|
// Route::any('/reedaw/user_diet_content', 'app/NewReedaw/app.Kitchenscale/user_diet_content');
|
||||||
|
// 获取记食器板块内容
|
||||||
|
Route::any('/reedaw/get_countfoot_content', 'app/NewReedaw/app.Kitchenscale/get_countfoot_content');
|
||||||
|
// 修改角色信息
|
||||||
|
Route::any('/reedaw/update_user_msg', 'app/NewReedaw/app.Kitchenscale/update_user_msg');
|
||||||
|
// 搜索页面的默认信息数据
|
||||||
|
Route::any('/reedaw/search_default_msg', 'app/NewReedaw/app.Kitchenscale/search_default_msg');
|
||||||
|
// 搜索食材列表
|
||||||
|
Route::any('/reedaw/get_food_list', 'app/NewReedaw/app.Kitchenscale/get_food_list');
|
||||||
|
// 搜索食材列表
|
||||||
|
Route::any('/reedaw/search_column', 'app/NewReedaw/app.Kitchenscale/search_column');
|
||||||
|
// 查询食谱的详情
|
||||||
|
Route::any('/reedaw/cookbook_details', 'app/NewReedaw/app.Kitchenscale/cookbook_details');
|
||||||
|
// 点赞收藏菜谱
|
||||||
|
Route::any('/reedaw/cookbook_like', 'app/NewReedaw/app.Kitchenscale/cookbook_like');
|
||||||
|
// 点赞收藏菜谱
|
||||||
|
Route::any('/reedaw/add_intake_food', 'app/NewReedaw/app.Kitchenscale/add_intake_food');
|
||||||
|
// 获取记食器饮食记录
|
||||||
|
Route::any('/reedaw/get_log_list', 'app/NewReedaw/app.Kitchenscale/get_log_list');
|
||||||
|
// 设置角色营养比例
|
||||||
|
Route::any('/reedaw/set_user_kcal', 'app/NewReedaw/app.Kitchenscale/set_nutrition_proportion');
|
||||||
|
// 删除一条指定的饮食记录
|
||||||
|
Route::any('/reedaw/del_user_eat_log', 'app/NewReedaw/app.Kitchenscale/del_user_eat_log');
|
||||||
|
// 搜索历史删除
|
||||||
|
Route::any('/reedaw/del_search_history', 'app/NewReedaw/app.Kitchenscale/del_search_history');
|
||||||
|
// 设置角色营养比例
|
||||||
|
Route::any('/reedaw/del_user_eat_list_log', 'app/NewReedaw/app.Kitchenscale/del_user_eat_list_log');
|
||||||
|
// 我的收藏
|
||||||
|
Route::any('/reedaw/get_user_collect_list', 'app/NewReedaw/app.Kitchenscale/get_user_collect_list');
|
||||||
|
// 设置营养占比页面数据
|
||||||
|
Route::any('/reedaw/set_up_content', 'app/NewReedaw/app.Kitchenscale/set_up_content');
|
||||||
|
// 本次添加食材的营养统计
|
||||||
|
Route::any('/reedaw/current_food_statistics', 'app/NewReedaw/app.Kitchenscale/current_food_statistics');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 使用国内轻厨记的
|
||||||
|
################################################################首页(健康工具)
|
||||||
|
// 卡片列表
|
||||||
|
Route::any('/reedaw/card_list_all', 'app/NewReedaw/app.Card/card_list_all');
|
||||||
|
// 保存用户所选的卡片列表
|
||||||
|
Route::any('/reedaw/save_card_list', 'app/NewReedaw/app.Card/save_card_list');
|
||||||
|
// 角色卡片列表信息
|
||||||
|
Route::any('/reedaw/user_card_list', 'app/NewReedaw/app.Card/user_card_list');
|
||||||
|
// // BMI评测
|
||||||
|
Route::any('/reedaw/bmi_evaluation', 'app/NewReedaw/app.Card/bmi_evaluation');
|
||||||
|
// // 遗传身高
|
||||||
|
Route::any('/reedaw/genetic_height', 'app/NewReedaw/app.Card/genetic_height');
|
||||||
|
// ###############################跳绳部分
|
||||||
|
// 手动记录
|
||||||
|
Route::any('/reedaw/skip/manual_record', 'app/NewReedaw/app.skip/manual_record');
|
||||||
|
// 设备记录
|
||||||
|
Route::any('/reedaw/skip/device_record', 'app/NewReedaw/app.skip/device_record');
|
||||||
|
// 上一次数据
|
||||||
|
Route::any('/reedaw/skip/data_report', 'app/NewReedaw/app.skip/data_report');
|
||||||
|
// 曲线
|
||||||
|
Route::any('/reedaw/skip/curve_chart', 'app/NewReedaw/app.skip/curve_chart');
|
||||||
|
// 历史记录(分页)
|
||||||
|
Route::any('/reedaw/skip/record_list_page', 'app/NewReedaw/app.skip/record_list_page');
|
||||||
|
// 历史记录(分组)
|
||||||
|
Route::any('/reedaw/skip/record_list_group', 'app/NewReedaw/app.skip/record_list_group');
|
||||||
|
// 历史记录(详细)
|
||||||
|
Route::any('/reedaw/skip/detailed_record', 'app/NewReedaw/app.skip/detailed_record');
|
||||||
|
// 删除历史记录
|
||||||
|
Route::any('/reedaw/skip/del_record', 'app/NewReedaw/app.skip/del_record');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
################################################################我的
|
||||||
|
// 创建角色
|
||||||
|
Route::any('/reedaw/add_member', 'app/NewReedaw/app.role/add_member');
|
||||||
|
// 更新角色
|
||||||
|
Route::any('/reedaw/update_member', 'app/NewReedaw/app.role/update_member');
|
||||||
|
// 获取指定角色详细信息(含厨房秤的当日信息)
|
||||||
|
Route::any('/reedaw/get_user_data_information', 'app/NewReedaw/app.role/get_user_data_information');
|
||||||
|
// 修改账号昵称
|
||||||
|
Route::any('/reedaw/update_my_nickname', 'app/NewReedaw/app.role/update_my_nickname');
|
||||||
|
// 获取账号信息
|
||||||
|
Route::any('/reedaw/get_my_account_msg', 'app/NewReedaw/app.role/get_my_account_msg');
|
||||||
|
// 邮箱/手机绑定
|
||||||
|
Route::any('/reedaw/update_my_account_msg', 'app/NewReedaw/app.role/update_my_account_msg');
|
||||||
|
// 修改密码
|
||||||
|
Route::any('/reedaw/update_my_password', 'app/NewReedaw/app.role/update_my_password');
|
||||||
|
// 修改账号信息
|
||||||
|
Route::any('/reedaw/set_my_account_msg', 'app/NewReedaw/app.role/set_my_account_msg');
|
||||||
|
|
||||||
|
|
||||||
|
// https://tc.pcxbc.comreedaw/pdate_my_nickname
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 角色报告(详细)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -888,10 +1011,8 @@ Route::any('/reedaw/body_report_detailed', 'app/NewReedaw/app.Userbody/body_repo
|
||||||
// Route::any('/reedaw/all_data_contrast', 'app/NewReedaw/app.index/all_data_contrast');
|
// Route::any('/reedaw/all_data_contrast', 'app/NewReedaw/app.index/all_data_contrast');
|
||||||
|
|
||||||
// ################################################################金刚区部分
|
// ################################################################金刚区部分
|
||||||
// // 遗传身高
|
|
||||||
// Route::any('/reedaw/genetic_height', 'app/NewReedaw/app.index/genetic_height');
|
|
||||||
// // BMI评测
|
|
||||||
// Route::any('/reedaw/bmi_evaluation', 'app/NewReedaw/app.index/bmi_evaluation');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -903,10 +1024,8 @@ Route::any('/reedaw/body_report_detailed', 'app/NewReedaw/app.Userbody/body_repo
|
||||||
|
|
||||||
|
|
||||||
// ################################################################角色部分
|
// ################################################################角色部分
|
||||||
// // 创建角色
|
|
||||||
// Route::any('/reedaw/add_member', 'app/NewReedaw/app.role/add_member');
|
|
||||||
// // 更新角色
|
|
||||||
// Route::any('/reedaw/update_member', 'app/NewReedaw/app.role/update_member');
|
|
||||||
// // 获取角色列表
|
// // 获取角色列表
|
||||||
// Route::any('/reedaw/role_list', 'app/NewReedaw/app.role/role_list');
|
// Route::any('/reedaw/role_list', 'app/NewReedaw/app.role/role_list');
|
||||||
// ################################################################卡片部分
|
// ################################################################卡片部分
|
||||||
|
|
@ -946,23 +1065,7 @@ Route::any('/reedaw/body_report_detailed', 'app/NewReedaw/app.Userbody/body_repo
|
||||||
// Route::any('/reedaw/vitalcapacity/detailed_record', 'app/NewReedaw/app.vitalcapacity/detailed_record');
|
// Route::any('/reedaw/vitalcapacity/detailed_record', 'app/NewReedaw/app.vitalcapacity/detailed_record');
|
||||||
// // 历史记录(详细)
|
// // 历史记录(详细)
|
||||||
// Route::any('/reedaw/vitalcapacity/del_record', 'app/NewReedaw/app.vitalcapacity/del_record');
|
// Route::any('/reedaw/vitalcapacity/del_record', 'app/NewReedaw/app.vitalcapacity/del_record');
|
||||||
// ################################################################跳绳部分
|
|
||||||
// // 手动记录
|
|
||||||
// Route::any('/reedaw/skip/manual_record', 'app/NewReedaw/app.skip/manual_record');
|
|
||||||
// // 设备记录
|
|
||||||
// Route::any('/reedaw/skip/device_record', 'app/NewReedaw/app.skip/device_record');
|
|
||||||
// // 上一次数据
|
|
||||||
// Route::any('/reedaw/skip/data_report', 'app/NewReedaw/app.skip/data_report');
|
|
||||||
// // 曲线
|
|
||||||
// Route::any('/reedaw/skip/curve_chart', 'app/NewReedaw/app.skip/curve_chart');
|
|
||||||
// // 历史记录(分页)
|
|
||||||
// Route::any('/reedaw/skip/record_list_page', 'app/NewReedaw/app.skip/record_list_page');
|
|
||||||
// // 历史记录(分组)
|
|
||||||
// Route::any('/reedaw/skip/record_list_group', 'app/NewReedaw/app.skip/record_list_group');
|
|
||||||
// // 历史记录(详细)
|
|
||||||
// Route::any('/reedaw/skip/detailed_record', 'app/NewReedaw/app.skip/detailed_record');
|
|
||||||
// // 历史记录(详细)
|
|
||||||
// Route::any('/reedaw/skip/del_record', 'app/NewReedaw/app.skip/del_record');
|
|
||||||
// ################################################################跳绳部分
|
// ################################################################跳绳部分
|
||||||
// // 获取单个地区数据
|
// // 获取单个地区数据
|
||||||
// Route::any('/reedaw/gf/get_single_data', 'app/NewReedaw/app.gufen/get_single_data');
|
// Route::any('/reedaw/gf/get_single_data', 'app/NewReedaw/app.gufen/get_single_data');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue