2025-11-21 19:13:01 +08:00
< ? php
2026-04-06 17:50:05 +08:00
namespace app\NewReedaw2\controller\app ;
2025-11-21 19:13:01 +08:00
use think\Db ;
2026-04-06 17:50:05 +08:00
// use think\Cache;
// use think\Log;
// use PHPMailer\PHPMailer\PHPMailer;
// use app\NewReedaw\controller\app\Role;
// use app\app\controller\Language;
use app\KitchenScale2\controller\app\Index as Cfindex ; //厨房秤的config
2025-11-21 19:13:01 +08:00
class Index extends Base {
protected $index_db_name = [
2026-04-07 18:54:15 +08:00
'zhanghao' => 'app_account_number_multilingual' ,
'juese' => 'app_user_data_multilingual' ,
2026-04-06 17:50:05 +08:00
'banben' => 'app_version_log' ,
'shangwuhezuo' => 'admin_business_cooperation' ,
'diqu' => 'admin_estimate' ,
'banner' => 'admin_notice_banner' ,
'cookbook_label' => 'app_user_cookbook_label' , //菜谱标签表
];
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' => [ '体型' , '' ]],
'6' => [ 'jump_num' => [ '个数' , '' ], 'jump_time' => [ '时长' , '' ], 'jump_kcal' => [ '卡路里' , 'kcal' ]],
'8' => [ 'one_val' => [ '第一次' , 'ml' ], 'two_val' => [ '第二次' , 'ml' ], 'three_val' => [ '第三次' , 'ml' ], 'average_val' => [ '三次平均' , 'ml' ], 'score' => [ '最后成绩' , '分' ]]
];
protected $identity_list = [ 'P0' => '陌生人' , 'P1' => '爸爸' , 'P2' => '妈妈' , 'P3' => '大宝' , 'P4' => '二宝' , 'P5' => '三宝' , 'P6' => '四宝' , 'P7' => '爷爷' , 'P8' => '奶奶' ];
protected $grade_list = [
[ 'id' => 'nothing' , 'name' => '无' ],
[ 'id' => 'grade_s_1' , 'name' => '小学一年级' ],
[ 'id' => 'grade_s_2' , 'name' => '小学二年级' ],
[ 'id' => 'grade_s_3' , 'name' => '小学三年级' ],
[ 'id' => 'grade_s_4' , 'name' => '小学四年级' ],
[ 'id' => 'grade_s_5' , 'name' => '小学五年级' ],
[ 'id' => 'grade_s_6' , 'name' => '小学六年级' ],
[ 'id' => 'grade_m_1' , 'name' => '初中一年级' ],
[ 'id' => 'grade_m_2' , 'name' => '初中二年级' ],
[ 'id' => 'grade_m_3' , 'name' => '初中三年级' ],
[ 'id' => 'grade_h_1' , 'name' => '高中一年级' ],
[ 'id' => 'grade_h_2' , 'name' => '高中二年级' ],
[ 'id' => 'grade_h_3' , 'name' => '高中三年级' ],
[ 'id' => 'grade_u_12' , 'name' => '大学一、二年级' ],
[ 'id' => 'grade_u_34' , 'name' => '大学三、四年级' ]
2025-11-21 19:13:01 +08:00
];
2026-04-07 18:54:15 +08:00
protected $language_country = [
'zh' => [ '中文' , 'zh' ], // 中文(简体)★
'en' => [ 'English' , 'en' ], // 英语(通用)★
'jp' => [ '日本語(Japanese)' , 'ja' ], // 日语(变化)
'fra' => [ 'Français(French)' , 'fr' ], // 法语(变化)
'de' => [ 'Deutsch(German)' , 'de' ], // 德语
'kor' => [ '한국어(Korean)' , 'ko' ], // 韩语(变化)
'ru' => [ 'Русский(Russian)' , 'ru' ], // 俄语
'pt' => [ 'Português(Portuguese)' , 'pt' ], // 葡萄牙
'spa' => [ " Español(Spanish) " , 'es' ], // 西班牙(变化)
'ara' => [ 'Arabic(العربية)' , 'ar' ], // 阿拉伯(变化)
];
2025-11-21 19:13:01 +08:00
// 加 bcadd(,,20)
// 减 bcsub(,,20)
// 乘 bcmul(,,20)
// 除 bcdiv(,,20)
// 测试token=>'caadd1be045a65f30b92aa805f1de54a'
################################################################接口################################################################
################################################################接口################################################################
################################################################接口################################################################
2026-04-06 17:50:05 +08:00
// 检测版本及判断是否登录失效
public function login_invalid_version (){
$data = input ( 'post.' );
try {
if ( ! array_key_exists ( 'token' , $data )){
2025-11-21 19:13:01 +08:00
return $this -> msg ( 10001 );
}
2026-04-07 18:54:15 +08:00
// 处理版本信息
$result = Db :: table ( $this -> index_db_name [ 'banben' ]) -> order ( 'is_del,id desc' ) -> field ( 'id,version_num_original,download_url,is_del' ) -> find ();
2026-04-06 17:50:05 +08:00
if ( $result ){
$version = $result [ 'version_num_original' ];
$url = $result [ 'download_url' ];
} else {
$version = '' ;
$url = '' ;
2025-11-21 19:13:01 +08:00
}
2026-04-07 18:54:15 +08:00
// 处理登录和语言信息
2026-04-06 17:50:05 +08:00
if ( $data [ 'token' ] == '' ){
2026-04-07 18:54:15 +08:00
return $this -> msg ( - 2 , '未登录' ,[ 'version' => $version , 'url' => $url , 'language' => 'zh' ]);
2026-04-06 17:50:05 +08:00
} else {
2026-04-07 18:54:15 +08:00
$user_token_state = $this -> token_time_validate ( $data [ 'token' ]);
if ( $user_token_state === false ){
return $this -> msg ( - 1 , '未登录' ,[ 'version' => $version , 'url' => $url , 'language' => 'zh' ]);
} else {
$language_data = Db :: table ( $this -> index_db_name [ 'zhanghao' ]) -> where ([ 'token' => $data [ 'token' ]]) -> field ( 'id,language' ) -> find ();
if ( ! $language_data [ 'language' ]){
$language_data [ 'language' ] = 'zh' ;
}
$language_str = $this -> language_country [ $language_data [ 'language' ]][ 1 ];
return $this -> msg ([ 'version' => $version , 'url' => $url , 'language' => $language_str ]);
}
2025-11-21 19:13:01 +08:00
}
} 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 " ;
2026-04-06 17:50:05 +08:00
$logContent [ 'all_content' ] .= " 方法: " . __METHOD__ . " \n " ;
2025-11-21 19:13:01 +08:00
$logContent [ 'all_content' ] .= " 行号: " . $e -> getLine () . " \n " ;
$logContent [ 'all_content' ] .= " 跟踪信息: \n " . $e -> getTraceAsString () . " \n " ;
$this -> record_api_log ( $data , $logContent , null );
return $this -> msg ( 99999 );
2026-04-06 17:50:05 +08:00
}
2025-11-21 19:13:01 +08:00
}
2026-04-06 17:50:05 +08:00
// 配置信息
public function config (){
$data = input ( 'post.' );
2026-04-07 18:54:15 +08:00
try {
2026-04-06 17:50:05 +08:00
if ( ! array_key_exists ( 'token' , $data )){
return $this -> msg ( 10001 , 'token is miss' );
2025-11-21 19:13:01 +08:00
}
2026-04-06 17:50:05 +08:00
if ( ! $this -> verify_data_is_ok ( $data [ 'token' ], 'str' )){
return $this -> msg ( 10005 , 'token type error' );
2025-11-21 19:13:01 +08:00
}
2026-04-06 17:50:05 +08:00
return $this -> config_action ( $data );
2026-04-07 18:54:15 +08:00
} catch ( \Exception $e ) {
// 捕获异常
$logContent [ " flie " ] = $e -> getFile ();
$logContent [ " line " ] = $e -> getLine ();
$logContent [ 'all_content' ] = " 异常信息: \n " ;
$logContent [ 'all_content' ] .= " 函数: config " . " \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 );
}
2025-11-21 19:13:01 +08:00
}
2026-04-06 17:50:05 +08:00
// 获取角色信息
public function get_user_list (){
$data = input ( 'post.' );
try {
if ( ! array_key_exists ( 'token' , $data )){
return $this -> msg ( 10001 , 'token is miss' );
2025-11-21 19:13:01 +08:00
}
if ( ! $this -> verify_data_is_ok ( $data [ 'token' ], 'str' )){
return $this -> msg ( 10005 , 'token type error' );
}
2026-04-06 17:50:05 +08:00
return $this -> get_user_list_action ( $data );
2025-11-21 19:13:01 +08:00
} catch ( \Exception $e ) {
// 捕获异常
$logContent [ " flie " ] = $e -> getFile ();
$logContent [ " line " ] = $e -> getLine ();
$logContent [ 'all_content' ] = " 异常信息: \n " ;
2026-04-06 17:50:05 +08:00
$logContent [ 'all_content' ] .= " 函数: get_user_list " . " \n " ;
2025-11-21 19:13:01 +08:00
$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 );
}
}
2026-04-06 17:50:05 +08:00
// 隐私协议手机网页端
public function privacy_policy (){
return $this -> fetch ();
}
2025-11-21 19:13:01 +08:00
################################################################action################################################################
################################################################action################################################################
public function config_action ( $data ){
$return_data = [
'literature' => [
'index' => [
'*数据参考:' ,
'《中华人民共和国卫生行业标准WS/T 423-2022》' ,
'《中华人民共和国卫生行业标准WS/T 612-2018》' ,
'《中华人民共和国卫生行业标准WS/T 586-2018》' ,
'《WHO 5~19岁身高/体重判定标准》' ,
],
'bmi_evaluation' => [
2026-04-06 17:50:05 +08:00
" BMI是身体质量指数,是目前国际上常用的衡量人体胖瘦程度以及是否健康的一个标准。 " ,
2025-11-21 19:13:01 +08:00
'*数据参考:' ,
'《WHO 5~19岁身高/体重判定标准》'
],
'height_prediction' => [
'*数据参考:' ,
'Khamis-Roche方法' ,
'北京积水潭医院儿科临床参考公式' ,
'《中国妇幼保健》等相关学术期刊文献' ,
],
'warning' => [
'此测量数据仅供参考,不可替代医学专业测试!'
]
],
2026-04-06 17:50:05 +08:00
'business_cooperation_url' => [],
'area_list' => [],
'identity_list' => [],
'grade_list' => [],
'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' ]
2026-04-07 18:54:15 +08:00
],
2025-11-21 19:13:01 +08:00
],
2026-04-07 18:54:15 +08:00
'language_arr' => $this -> process_Language (),
2025-11-21 19:13:01 +08:00
];
2026-04-06 17:50:05 +08:00
// $food_count = ;
// 处理厨房秤config
// $cf_index = new Cfindex;
// $cf_confog = $cf_index->get_default_config_action($data)->getData()['data'];
$return_data [ 'business_cooperation_url' ] = Db :: table ( $this -> index_db_name [ 'shangwuhezuo' ]) -> where ([ 'is_del' => 0 ]) -> field ( 'title,data_url as url' ) -> select ();
$address_data = Db :: table ( $this -> index_db_name [ 'diqu' ]) -> where ([ 'type' => '2' ]) -> cache ( 86400 ) -> field ( 'id,content,city,area' ) -> find ();
$return_data [ 'area_list' ] = json_decode ( $address_data [ 'content' ], true );
$return_data [ 'identity_list' ] = [];
foreach ( $this -> identity_list as $key => $value ) {
array_push ( $return_data [ 'identity_list' ],[ 'id' => $key , 'name' => $value ]);
2025-11-21 19:13:01 +08:00
}
2026-04-06 17:50:05 +08:00
$return_data [ 'grade_list' ] = $this -> grade_list ;
$return_data [ 'banner' ] = Db :: table ( $this -> index_db_name [ 'banner' ]) -> where ([ 'scene_data' => '3' , 'is_del' => 0 ]) -> cache ( 3600 ) -> order ( 'sort_num desc' ) -> field ( 'id,type,pic,jump_url,parameter_data,sort_num' ) -> select ();
2025-11-21 19:13:01 +08:00
2026-04-06 17:50:05 +08:00
for ( $i = 0 ; $i < count ( $return_data [ 'banner' ]); $i ++ ) {
if ( $return_data [ 'banner' ][ $i ][ 'type' ] != 1 ){
$return_data [ 'banner' ][ $i ][ 'parameter_data' ] = '' ;
2025-11-21 19:13:01 +08:00
}
2026-04-06 17:50:05 +08:00
unset ( $return_data [ 'banner' ][ $i ][ 'sort_num' ]);
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
// $return_data['cfc'] = $cf_confog;
return $this -> msg ( $return_data );
}
public function get_user_list_action ( $data ){
$account_data = Db :: table ( $this -> index_db_name [ 'zhanghao' ]) -> where ([ 'token' => $data [ 'token' ], 'is_del' => 0 ]) -> field ( 'token,id,default_user_id' ) -> find ();
if ( ! $account_data ){
return $this -> msg ( 10003 );
2025-11-21 19:13:01 +08:00
}
2026-04-06 17:50:05 +08:00
$user_list = Db :: table ( $this -> index_db_name [ 'juese' ]) -> where ([ 'aan_id' => $account_data [ 'id' ], 'is_del' => 0 ]) -> field ( 'id,id as aud_id,activity_level,nickname,birthday,gender,card_order,head_pic,grade,weight,height,identity_name,identity_id' ) -> select ();
foreach ( $user_list as $key => $value ) {
$user_list [ $key ][ 'age' ] = $this -> calculate_age ( $value [ 'birthday' ]);
2025-11-21 19:13:01 +08:00
}
2026-04-06 17:50:05 +08:00
$result_data = [ 'default_user_id' => $account_data [ 'default_user_id' ], 'user_list' => $user_list ];
return $this -> msg ( $result_data );
2025-11-21 19:13:01 +08:00
}
2026-04-06 17:50:05 +08:00
################################################################内部调用################################################################
################################################################内部调用################################################################
2026-04-07 18:54:15 +08:00
// 处理返回的语言数组
public function process_Language (){
$temporary_arr = [];
foreach ( $this -> language_country as $key => $value ) {
array_push ( $temporary_arr ,[ 'name' => $value [ 0 ], 'val' => $key , 'key' => $value [ 1 ]]);
}
return $temporary_arr ;
}
2026-04-06 17:50:05 +08:00
2025-11-21 19:13:01 +08:00
}