测试版部分BUG修改
This commit is contained in:
parent
3679aeea09
commit
dd94bde320
|
|
@ -420,17 +420,17 @@ class Base extends Controller{
|
||||||
|
|
||||||
public function ceshiyong($aa = 4,$gd = 0.2){
|
public function ceshiyong($aa = 4,$gd = 0.2){
|
||||||
$token = 'caadd1be045a65f30b92aa805f1de54a';
|
$token = 'caadd1be045a65f30b92aa805f1de54a';
|
||||||
$jieguo = $this->token_time_validate($token);
|
// $jieguo = $this->token_time_validate($token);
|
||||||
// // // Log::record('用户尝试更新token时间,token:' . $token, 'log');
|
// // // Log::record('用户尝试更新token时间,token:' . $token, 'log');
|
||||||
// // // phpinfo();
|
// // // phpinfo();
|
||||||
// // dump($jieguo);
|
// // dump($jieguo);
|
||||||
// // // return $jieguo;
|
// // // return $jieguo;
|
||||||
// // die;
|
// // die;
|
||||||
// // cache($token, time());
|
// // cache($token, time());
|
||||||
$time = cache($token);
|
// $time = cache($token);
|
||||||
dump($jieguo);
|
dump($token);
|
||||||
dump($time);
|
// dump($time);
|
||||||
// // die;
|
die;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,13 @@ class Base extends Controller{
|
||||||
'2'=>'test_app_card_data',
|
'2'=>'test_app_card_data',
|
||||||
'3'=>'test_app_user_data',
|
'3'=>'test_app_user_data',
|
||||||
'4'=>'test_pc_vitalcapacity_standard',
|
'4'=>'test_pc_vitalcapacity_standard',
|
||||||
'5'=>'test_admin_estimate'
|
'5'=>'test_admin_estimate',
|
||||||
|
'6'=>'test_app_account_number'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $ceshiyong_token = ['57bd45e3a963b372ea2d873e4bd8d1f8','e0966788d02cc93290d9d674921d9715'];
|
protected $ceshiyong_token = ['57bd45e3a963b372ea2d873e4bd8d1f8','e0966788d02cc93290d9d674921d9715'];
|
||||||
protected $base_call_method = ['内部'];
|
protected $base_call_method = ['内部'];
|
||||||
protected $token_time = 2592000;//30天的秒数
|
protected $token_time = 30;//30天的秒数
|
||||||
protected $return_data_all = [
|
protected $return_data_all = [
|
||||||
// '0' => ['success',[]],
|
// '0' => ['success',[]],
|
||||||
'10001'=>'关键参数缺失',
|
'10001'=>'关键参数缺失',
|
||||||
|
|
@ -151,22 +152,66 @@ class Base extends Controller{
|
||||||
|
|
||||||
// 判断token是否过期
|
// 判断token是否过期
|
||||||
public function token_time_validate($token){
|
public function token_time_validate($token){
|
||||||
|
// 591b70e0d80b5fa6d77e6e1384453ab9
|
||||||
if(is_string($token)){
|
if(is_string($token)){
|
||||||
$length = strlen($token);
|
$length = strlen($token);
|
||||||
if ($length < 10 ) {
|
if ($length < 10 ) {
|
||||||
|
Log::record('用户尝试更新token时间,token:' . $token.',但是更新token失败,字符串长度小于10', 'token_log');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
Log::record('用户尝试更新token时间,token:' . $token.',但是更新token失败,不是字符串', 'token_log');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(cache($token) === false){
|
|
||||||
|
$user_login = Db::table($this->base_use_db_name['6'])->where(['token'=>$token])->field('id,login_time')->find();
|
||||||
|
if(!$user_login){
|
||||||
|
Log::record('用户尝试更新token时间,token:' . $token.',但是更新token失败,未找到用户token', 'token_log');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建 DateTime 对象来表示指定的日期和时间
|
||||||
|
$specifiedDateTime = new \DateTime($user_login['login_time']);
|
||||||
|
|
||||||
|
// 获取当前时间的 DateTime 对象
|
||||||
|
$currentDateTime = new \DateTime();
|
||||||
|
|
||||||
|
// 计算两个日期之间的差异(以秒为单位)
|
||||||
|
$interval = $currentDateTime->diff($specifiedDateTime);
|
||||||
|
|
||||||
|
// 将差异转换为天数(注意:这里的天数可能不是整数,因为差异可能包括小时、分钟等)
|
||||||
|
$daysDifference = $interval->days;
|
||||||
|
|
||||||
|
// 如果需要更精确的计算(包括小时、分钟等转换成的天数),可以使用以下方式:
|
||||||
|
// $totalSecondsDifference = $interval->format('%a') * 86400 + $interval->format('%h') * 3600 + $interval->format('%i') * 60 + $interval->format('%s');
|
||||||
|
// $daysDifference = floor($totalSecondsDifference / 86400); // 将总秒数转换为天数并取整
|
||||||
|
|
||||||
|
// 判断差异是否超过指定的天数
|
||||||
|
if ($daysDifference > $this->token_time) {
|
||||||
|
// echo "超过 {$specifiedDays} 天";
|
||||||
Log::record('用户尝试更新token时间,token:' . $token.',但是更新token失败,原因没有找到该token,或该token已经超过30天', 'token_log');
|
Log::record('用户尝试更新token时间,token:' . $token.',但是更新token失败,原因没有找到该token,或该token已经超过30天', 'token_log');
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
$time_now = date('Y-m-d H:i:s');
|
// echo "未超过 {$specifiedDays} 天";
|
||||||
cache($token,$time_now,$this->token_time);
|
$user_login = Db::table($this->base_use_db_name['6'])->where(['token'=>$token])->update(['login_time'=>date('Y-m-d H:i:s')]);
|
||||||
Log::record('用户尝试更新token时间,token:' . $token.',记录成功,最新的时间为'.$time_now, 'token_log');
|
if($user_login){
|
||||||
|
Log::record('用户尝试更新token时间,token:' . $token.',记录成功,最新的时间为'.date('Y-m-d H:i:s'), 'token_log');
|
||||||
return true;
|
return true;
|
||||||
|
}else{
|
||||||
|
Log::record('用户尝试更新token时间,token:' . $token.',但是更新token失败,数据库更新时间未成功', 'token_log');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// if(cache($token) === false){
|
||||||
|
// Log::record('用户尝试更新token时间,token:' . $token.',但是更新token失败,原因没有找到该token,或该token已经超过30天', 'token_log');
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// $time_now = date('Y-m-d H:i:s');
|
||||||
|
// cache($token,$time_now,$this->token_time);
|
||||||
|
// Log::record('用户尝试更新token时间,token:' . $token.',记录成功,最新的时间为'.$time_now, 'token_log');
|
||||||
|
// return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算天数
|
// 计算天数
|
||||||
|
|
@ -493,8 +538,10 @@ class Base extends Controller{
|
||||||
|
|
||||||
|
|
||||||
public function ceshiyong($aa = 4,$gd = 0.2){
|
public function ceshiyong($aa = 4,$gd = 0.2){
|
||||||
dump('ok');
|
$token = 'cd3f27cf4c4002170ea7bceeb723ac91';
|
||||||
$this->send_email_api_error(["tsf3920322@126.com"],['title'=>'接口报错','from_user_name'=>'青测API','content'=>'123']);
|
dump(cache($token));
|
||||||
|
// dump('ok');
|
||||||
|
// $this->send_email_api_error(["tsf3920322@126.com"],['title'=>'接口报错','from_user_name'=>'青测API','content'=>'123']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,10 +65,7 @@ class Calculatebody extends Base{
|
||||||
'adc'=>$data['adc'],
|
'adc'=>$data['adc'],
|
||||||
'gender'=>$data['gender'],
|
'gender'=>$data['gender'],
|
||||||
];
|
];
|
||||||
// dump($temporary_parameter);
|
|
||||||
|
|
||||||
$request_result = $this->postRequest($url,$temporary_parameter);
|
$request_result = $this->postRequest($url,$temporary_parameter);
|
||||||
// dump($request_result);
|
|
||||||
$result['weight'] = $request_result['data']['weight'];
|
$result['weight'] = $request_result['data']['weight'];
|
||||||
$result['height'] = $request_result['data']['height'];
|
$result['height'] = $request_result['data']['height'];
|
||||||
$result['bmi'] = $request_result['data']['bmi'];
|
$result['bmi'] = $request_result['data']['bmi'];
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,9 @@ class Card extends Base{
|
||||||
'5'=>'test_pc_weightstand',
|
'5'=>'test_pc_weightstand',
|
||||||
'6'=>'test_pc_childrenprescription',
|
'6'=>'test_pc_childrenprescription',
|
||||||
'7'=>'test_pc_childprescriptionbyage',
|
'7'=>'test_pc_childprescriptionbyage',
|
||||||
'8'=>'test_pc_heightstand2',
|
'8'=>'test_pc_heightstand',
|
||||||
'9'=>'test_pc_weightstand2',
|
'9'=>'test_pc_weightstand',
|
||||||
'10'=>'test_pc_bmistand2',
|
'10'=>'test_pc_bmistand',
|
||||||
];
|
];
|
||||||
protected $age_limit = 16;
|
protected $age_limit = 16;
|
||||||
protected $unit_symbol = ['score'=>'分','height'=>'CM','weight'=>'公斤','bmi'=>'','fat_r'=>'%','fat_w'=>'kg','muscle'=>'%','muscleval'=>'kg','water'=>'kg','bone'=>'kg','protein'=>'%','proteinval'=>'kg','kcal'=>'kcal','visceral'=>'','sfr'=>'%',];
|
protected $unit_symbol = ['score'=>'分','height'=>'CM','weight'=>'公斤','bmi'=>'','fat_r'=>'%','fat_w'=>'kg','muscle'=>'%','muscleval'=>'kg','water'=>'kg','bone'=>'kg','protein'=>'%','proteinval'=>'kg','kcal'=>'kcal','visceral'=>'','sfr'=>'%',];
|
||||||
|
|
@ -84,7 +84,7 @@ class Card extends Base{
|
||||||
|
|
||||||
// 详细卡片信息
|
// 详细卡片信息
|
||||||
// $data = ['id'=>'2']
|
// $data = ['id'=>'2']
|
||||||
public function card_data_detailed($data=['aud_id'=>'87','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
public function card_data_detailed($data=['aud_id'=>'11','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
||||||
try {
|
try {
|
||||||
// 你的业务逻辑
|
// 你的业务逻辑
|
||||||
if(count(input('post.')) > 0){
|
if(count(input('post.')) > 0){
|
||||||
|
|
@ -116,7 +116,7 @@ class Card extends Base{
|
||||||
}
|
}
|
||||||
|
|
||||||
// 曲线页面-曲线接口
|
// 曲线页面-曲线接口
|
||||||
public function card_curve_chart($data = ['aud_id'=>'83','s_time'=>'2024-04-01','e_time'=>'2024-07-25','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
public function card_curve_chart($data = ['aud_id'=>'11','s_time'=>'2024-04-01','e_time'=>'2024-10-25','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
||||||
try {
|
try {
|
||||||
// 你的业务逻辑
|
// 你的业务逻辑
|
||||||
if(count(input('post.')) > 0){
|
if(count(input('post.')) > 0){
|
||||||
|
|
@ -148,7 +148,7 @@ class Card extends Base{
|
||||||
|
|
||||||
// 手动记录
|
// 手动记录
|
||||||
// $data = ['id'=>'2','time'=>'1991-04-20 10:10:10','height'=>'15.1','weight'=>'75.1']
|
// $data = ['id'=>'2','time'=>'1991-04-20 10:10:10','height'=>'15.1','weight'=>'75.1']
|
||||||
public function card_manual_recording($data = ['aud_id'=>'83','time'=>'2024-07-24','height'=>'145.7','weight'=>'41.3','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
public function card_manual_recording($data = ['aud_id'=>'11','time'=>'2024-10-12','height'=>'155.7','weight'=>'46.7','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
||||||
try {
|
try {
|
||||||
// 你的业务逻辑
|
// 你的业务逻辑
|
||||||
if(count(input('post.')) > 0){
|
if(count(input('post.')) > 0){
|
||||||
|
|
@ -198,7 +198,6 @@ class Card extends Base{
|
||||||
}
|
}
|
||||||
$data['time'] = date('Y-m-d H:i:s');
|
$data['time'] = date('Y-m-d H:i:s');
|
||||||
$data['acd_id'] = '2';
|
$data['acd_id'] = '2';
|
||||||
return
|
|
||||||
$return_data = $this->set_user_body_data($data);
|
$return_data = $this->set_user_body_data($data);
|
||||||
// 成功
|
// 成功
|
||||||
$this->record_api_log($data, null, $return_data);
|
$this->record_api_log($data, null, $return_data);
|
||||||
|
|
@ -294,25 +293,17 @@ class Card extends Base{
|
||||||
where acbd.aud_id='".$data['aud_id']."'
|
where acbd.aud_id='".$data['aud_id']."'
|
||||||
order by acbd.record_time desc
|
order by acbd.record_time desc
|
||||||
");
|
");
|
||||||
// dump($result);
|
|
||||||
// die;
|
|
||||||
if(!$result){
|
if(!$result){
|
||||||
return $this->msg(10004);
|
return $this->msg(10004);
|
||||||
}else{
|
}else{
|
||||||
// $curve_bottom = $this->card_curve_target_action($result);
|
// $curve_bottom = $this->card_curve_target_action($result);
|
||||||
$result_end = $this->processing_return_data_new($result[0]);
|
$result_end = $this->processing_return_data_new($result[0]);
|
||||||
// dump($result_end);
|
|
||||||
// die;
|
|
||||||
$cardparts = new Cardparts;
|
$cardparts = new Cardparts;
|
||||||
// dump($result_end);
|
|
||||||
$result_end['gender'] = $result[0]['gender'];
|
$result_end['gender'] = $result[0]['gender'];
|
||||||
$result_end['record_time'] = $result[0]['record_time'];
|
$result_end['record_time'] = $result[0]['record_time'];
|
||||||
$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);
|
|
||||||
// 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'=>[
|
||||||
|
|
@ -337,16 +328,11 @@ class Card extends Base{
|
||||||
}
|
}
|
||||||
// 返回数据处理
|
// 返回数据处理
|
||||||
public function processing_return_data_new($data){
|
public function processing_return_data_new($data){
|
||||||
// dump($data);
|
|
||||||
$result_end_data = [];
|
$result_end_data = [];
|
||||||
$month_num = $this->calculateAgeInMonthsWithPrecision($data['birthday']);
|
$month_num = $this->calculateAgeInMonthsWithPrecision($data['birthday']);
|
||||||
$gender_val = $data['gender'];
|
$gender_val = $data['gender'];
|
||||||
// dump($data);
|
|
||||||
// dump($this->result_end_data_mould);
|
|
||||||
// die;
|
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
if($key != 'aud_id' && $key != 'id' && $key != 'create_time' && $key != 'last_update_time' && $key != 'acd_id' && $key != 'ROW_NUMBER' && $key != 'record_time' && $key != 'gender' && $key != 'birthday'){
|
if($key != 'aud_id' && $key != 'id' && $key != 'create_time' && $key != 'last_update_time' && $key != 'acd_id' && $key != 'ROW_NUMBER' && $key != 'record_time' && $key != 'gender' && $key != 'birthday'){
|
||||||
// dump($key);
|
|
||||||
// 设置单个数据格式
|
// 设置单个数据格式
|
||||||
$result_end_data[$key] = $this->result_end_data_mould;
|
$result_end_data[$key] = $this->result_end_data_mould;
|
||||||
if(array_key_exists($key, $this->unit_name)){
|
if(array_key_exists($key, $this->unit_name)){
|
||||||
|
|
@ -359,11 +345,7 @@ class Card extends Base{
|
||||||
if(strpos($value, ',')){
|
if(strpos($value, ',')){
|
||||||
$result_end_data[$key]['standard'] = explode(',',$value)[1];
|
$result_end_data[$key]['standard'] = explode(',',$value)[1];
|
||||||
}
|
}
|
||||||
// dump($result_end_data[$key]);
|
|
||||||
if(array_key_exists($key, $this->standard_color)){
|
if(array_key_exists($key, $this->standard_color)){
|
||||||
// dump($key);
|
|
||||||
// dump($result_end_data[$key]);
|
|
||||||
// dump($this->standard_color[$key]);
|
|
||||||
if($result_end_data[$key]['standard'] != '异常'){
|
if($result_end_data[$key]['standard'] != '异常'){
|
||||||
$result_end_data[$key]['color'] = $this->standard_color[$key][$result_end_data[$key]['standard']];
|
$result_end_data[$key]['color'] = $this->standard_color[$key][$result_end_data[$key]['standard']];
|
||||||
}
|
}
|
||||||
|
|
@ -373,9 +355,7 @@ class Card extends Base{
|
||||||
if(array_key_exists($key, $this->bhw_list)){
|
if(array_key_exists($key, $this->bhw_list)){
|
||||||
$result_end_data[$key]['list'] = $this->bhw_list[$key];
|
$result_end_data[$key]['list'] = $this->bhw_list[$key];
|
||||||
if($key == 'bmi'){
|
if($key == 'bmi'){
|
||||||
// dump($month_num);
|
|
||||||
$bhw_date = Db::table($this->card_use_db_name['3'])->where("Month <= $month_num and Sex = '$gender_val'")->order('Month desc')->limit(1)->select();
|
$bhw_date = Db::table($this->card_use_db_name['3'])->where("Month <= $month_num and Sex = '$gender_val'")->order('Month desc')->limit(1)->select();
|
||||||
// dump($bhw_date);
|
|
||||||
if($bhw_date){
|
if($bhw_date){
|
||||||
$result_end_data[$key]['list'][0]['max_val'] = $bhw_date[0]['f1sd'];
|
$result_end_data[$key]['list'][0]['max_val'] = $bhw_date[0]['f1sd'];
|
||||||
$result_end_data[$key]['list'][1]['min_val'] = $bhw_date[0]['f1sd'];
|
$result_end_data[$key]['list'][1]['min_val'] = $bhw_date[0]['f1sd'];
|
||||||
|
|
@ -399,8 +379,6 @@ class Card extends Base{
|
||||||
}
|
}
|
||||||
}else if($key == 'weight'){
|
}else if($key == 'weight'){
|
||||||
$bhw_date = Db::table($this->card_use_db_name['5'])->where("Month <= $month_num and Sex = '$gender_val'")->order('Month desc')->limit(1)->select();
|
$bhw_date = Db::table($this->card_use_db_name['5'])->where("Month <= $month_num and Sex = '$gender_val'")->order('Month desc')->limit(1)->select();
|
||||||
// dump($value);
|
|
||||||
// dump($bhw_date);/
|
|
||||||
if($bhw_date){
|
if($bhw_date){
|
||||||
$result_end_data[$key]['list'][0]['max_val'] = $bhw_date[0]['f2sd'];
|
$result_end_data[$key]['list'][0]['max_val'] = $bhw_date[0]['f2sd'];
|
||||||
$result_end_data[$key]['list'][1]['min_val'] = $bhw_date[0]['f2sd'];
|
$result_end_data[$key]['list'][1]['min_val'] = $bhw_date[0]['f2sd'];
|
||||||
|
|
@ -417,10 +395,6 @@ class Card extends Base{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// $result_end_data['age'] = $data['age'];
|
|
||||||
// dump($data['age']);
|
|
||||||
// dump($result_end_data);
|
|
||||||
// die;
|
|
||||||
return $result_end_data;
|
return $result_end_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -457,7 +431,6 @@ class Card extends Base{
|
||||||
$min_key = array_search($min_value,$temporary_arr);
|
$min_key = array_search($min_value,$temporary_arr);
|
||||||
$type_num = $this->card_body_level[$min_key]['value'];
|
$type_num = $this->card_body_level[$min_key]['value'];
|
||||||
$temporary_arr2 = Db::table($this->card_use_db_name['6'])->where(['Type'=>$type_num,'Level'=>$min_value,'IsDeleted'=>0])->field('Nutrition,Sport')->find();
|
$temporary_arr2 = Db::table($this->card_use_db_name['6'])->where(['Type'=>$type_num,'Level'=>$min_value,'IsDeleted'=>0])->field('Nutrition,Sport')->find();
|
||||||
// dump($temporary_arr2);
|
|
||||||
array_push($result['nutritionlist'],$temporary_arr2['Nutrition']);
|
array_push($result['nutritionlist'],$temporary_arr2['Nutrition']);
|
||||||
array_push($result['sportlist'],$temporary_arr2['Sport']);
|
array_push($result['sportlist'],$temporary_arr2['Sport']);
|
||||||
// $result['nutritionlist'] = $temporary_arr2['Nutrition'];
|
// $result['nutritionlist'] = $temporary_arr2['Nutrition'];
|
||||||
|
|
@ -510,7 +483,6 @@ class Card extends Base{
|
||||||
// ->field("record_time,REPLACE(CONVERT(varchar(10), record_time, 23), '-', '/') AS b_time,$card_body_curve_arr")
|
// ->field("record_time,REPLACE(CONVERT(varchar(10), record_time, 23), '-', '/') AS b_time,$card_body_curve_arr")
|
||||||
->order('record_time desc')
|
->order('record_time desc')
|
||||||
->select();
|
->select();
|
||||||
// dump($user_data_list);
|
|
||||||
|
|
||||||
// 下面业务逻辑是取每天的,最近后一次记录成绩
|
// 下面业务逻辑是取每天的,最近后一次记录成绩
|
||||||
$data_arr = [];
|
$data_arr = [];
|
||||||
|
|
@ -529,9 +501,6 @@ class Card extends Base{
|
||||||
array_push($record_arr2,$user_data_list[$key]);
|
array_push($record_arr2,$user_data_list[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// dump($record_arr1);
|
|
||||||
// dump($record_arr2);
|
|
||||||
// die;
|
|
||||||
foreach ($this->card_body_curve_arr as $key => $value) {
|
foreach ($this->card_body_curve_arr as $key => $value) {
|
||||||
$temporary_arr = [];
|
$temporary_arr = [];
|
||||||
$temporary_arr['title'] = $this->card_body_curve_arr2[$key];
|
$temporary_arr['title'] = $this->card_body_curve_arr2[$key];
|
||||||
|
|
@ -546,7 +515,6 @@ class Card extends Base{
|
||||||
array_push($data_arr,$temporary_arr);
|
array_push($data_arr,$temporary_arr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// dump($data_arr);
|
|
||||||
return $this->msg($data_arr);
|
return $this->msg($data_arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -583,13 +551,17 @@ class Card extends Base{
|
||||||
$result_data['adc'] = $data['adc'];
|
$result_data['adc'] = $data['adc'];
|
||||||
}
|
}
|
||||||
$calculate_body_formula = new Calculatebody();
|
$calculate_body_formula = new Calculatebody();
|
||||||
|
|
||||||
// 计算身体数据
|
// 计算身体数据
|
||||||
$get_body_value = $calculate_body_formula->calculate_body_data_result($result_data);
|
$get_body_value = $calculate_body_formula->calculate_body_data_result($result_data);
|
||||||
|
// dump($get_body_value);
|
||||||
|
// die;
|
||||||
$get_body_value['gender'] = $user_data['gender'];
|
$get_body_value['gender'] = $user_data['gender'];
|
||||||
$get_body_value['birthday'] = $user_data['birthday'];
|
$get_body_value['birthday'] = $user_data['birthday'];
|
||||||
// 添加身高体重bmi的标尺标准
|
// 添加身高体重bmi的标尺标准
|
||||||
$get_body_value = $this->hwb_standard($get_body_value);
|
$get_body_value = $this->hwb_standard($get_body_value);
|
||||||
|
// dump($get_body_value);
|
||||||
|
// die;
|
||||||
$set_data = [
|
$set_data = [
|
||||||
'acd_id'=>$data['acd_id'],
|
'acd_id'=>$data['acd_id'],
|
||||||
'aud_id'=>$data['aud_id'],
|
'aud_id'=>$data['aud_id'],
|
||||||
|
|
@ -644,7 +616,8 @@ class Card extends Base{
|
||||||
|
|
||||||
// 添加身高体重bmi的标准
|
// 添加身高体重bmi的标准
|
||||||
public function hwb_standard($data){
|
public function hwb_standard($data){
|
||||||
|
// dump($data);
|
||||||
|
// die;
|
||||||
$linshi_data = [];
|
$linshi_data = [];
|
||||||
$month_num = $this->calculateAgeInMonthsWithPrecision($data['birthday']);
|
$month_num = $this->calculateAgeInMonthsWithPrecision($data['birthday']);
|
||||||
// dump($month_num);
|
// dump($month_num);
|
||||||
|
|
@ -654,6 +627,7 @@ class Card extends Base{
|
||||||
if($key =='身高'){
|
if($key =='身高'){
|
||||||
$linshi_data['身高'] = $this->bhw_list['height'];
|
$linshi_data['身高'] = $this->bhw_list['height'];
|
||||||
$bhw_date = Db::table($this->card_use_db_name['8'])->where("Month <= $month_num and Sex = '$gender_val'")->order('Month desc')->limit(1)->select();
|
$bhw_date = Db::table($this->card_use_db_name['8'])->where("Month <= $month_num and Sex = '$gender_val'")->order('Month desc')->limit(1)->select();
|
||||||
|
|
||||||
if($bhw_date){
|
if($bhw_date){
|
||||||
$linshi_data['身高'][0]['max_val'] = $bhw_date[0]['f2sd'];
|
$linshi_data['身高'][0]['max_val'] = $bhw_date[0]['f2sd'];
|
||||||
$linshi_data['身高'][1]['min_val'] = $bhw_date[0]['f2sd'];
|
$linshi_data['身高'][1]['min_val'] = $bhw_date[0]['f2sd'];
|
||||||
|
|
@ -665,9 +639,12 @@ class Card extends Base{
|
||||||
$linshi_data['身高'][4]['min_val'] = $bhw_date[0]['z2sd'];
|
$linshi_data['身高'][4]['min_val'] = $bhw_date[0]['z2sd'];
|
||||||
$linshi_data['身高'][4]['max_val'] = $bhw_date[0]['z3sd'];
|
$linshi_data['身高'][4]['max_val'] = $bhw_date[0]['z3sd'];
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if($key =='体重'){
|
}else if($key =='体重'){
|
||||||
$linshi_data['体重'] = $this->bhw_list['weight'];
|
$linshi_data['体重'] = $this->bhw_list['weight'];
|
||||||
$bhw_date = Db::table($this->card_use_db_name['9'])->where("Month <= $month_num and Sex = '$gender_val'")->order('Month desc')->limit(1)->select();
|
$bhw_date = Db::table($this->card_use_db_name['9'])->where("Month <= $month_num and Sex = '$gender_val'")->order('Month desc')->limit(1)->select();
|
||||||
|
// dump($data['体重']);
|
||||||
|
// dump($bhw_date);
|
||||||
if($bhw_date){
|
if($bhw_date){
|
||||||
$linshi_data['体重'][0]['max_val'] = $bhw_date[0]['f2sd'];
|
$linshi_data['体重'][0]['max_val'] = $bhw_date[0]['f2sd'];
|
||||||
$linshi_data['体重'][1]['min_val'] = $bhw_date[0]['f2sd'];
|
$linshi_data['体重'][1]['min_val'] = $bhw_date[0]['f2sd'];
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,6 @@ class Cardparts extends Base{
|
||||||
$temporary_arr['top_list'][$key]['offset'] = $this->calculate_landing_point($temporary_arr['top_list'][$key]['list'],$temporary_arr['top_list'][$key]['value'],$temporary_arr['top_list'][$key]['standard']);
|
$temporary_arr['top_list'][$key]['offset'] = $this->calculate_landing_point($temporary_arr['top_list'][$key]['list'],$temporary_arr['top_list'][$key]['value'],$temporary_arr['top_list'][$key]['standard']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理底部list
|
// 处理底部list
|
||||||
foreach ($temporary_arr['bottom_list'] as $key => $value) {
|
foreach ($temporary_arr['bottom_list'] as $key => $value) {
|
||||||
// dump($value['key_name']);
|
// dump($value['key_name']);
|
||||||
|
|
|
||||||
|
|
@ -75,13 +75,13 @@ class Cardpublic extends Base{
|
||||||
|
|
||||||
// {"acd_id":"11","name":"200米","record_time":"2024-09-27","data":"02:00","aud_id":"1","token":"57bd45e3a963b372ea2d873e4bd8d1f8","aan_id":"1"}
|
// {"acd_id":"11","name":"200米","record_time":"2024-09-27","data":"02:00","aud_id":"1","token":"57bd45e3a963b372ea2d873e4bd8d1f8","aan_id":"1"}
|
||||||
// 存储信息
|
// 存储信息
|
||||||
public function data_save($data = ['aud_id'=>'1','acd_id'=>'11','name'=>'200米','data'=>'02:00','record_time'=>'2024-09-27','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
public function data_save($data = ['aud_id'=>'1','acd_id'=>'10','name'=>'50米','data'=>'9.5','record_time'=>'2024-10-11']){
|
||||||
try {
|
try {
|
||||||
// 你的业务逻辑
|
// 你的业务逻辑
|
||||||
if(count(input('post.')) > 0){
|
if(count(input('post.')) > 0){
|
||||||
$data = input('post.');
|
$data = input('post.');
|
||||||
}
|
}
|
||||||
if(!array_key_exists('aud_id', $data) || !array_key_exists('acd_id', $data) || !array_key_exists('name', $data) || !array_key_exists('data', $data) || !array_key_exists('record_time', $data) || !array_key_exists('token', $data)){
|
if(!array_key_exists('aud_id', $data) || !array_key_exists('acd_id', $data) || !array_key_exists('name', $data) || !array_key_exists('data', $data) || !array_key_exists('record_time', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
$return_data = $this->data_save_action($data);
|
$return_data = $this->data_save_action($data);
|
||||||
|
|
@ -137,7 +137,7 @@ class Cardpublic extends Base{
|
||||||
}
|
}
|
||||||
|
|
||||||
// 卡片运动曲线
|
// 卡片运动曲线
|
||||||
public function card_motion_curve($data = ['aud_id'=>'1','acd_id'=>'10','s_time'=>'2024-04-01','e_time'=>'2024-07-25','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
public function card_motion_curve($data = ['aud_id'=>'1','acd_id'=>'10','s_time'=>'2024-04-01','e_time'=>'2024-11-25','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
||||||
try {
|
try {
|
||||||
// 你的业务逻辑
|
// 你的业务逻辑
|
||||||
if(count(input('post.')) > 0){
|
if(count(input('post.')) > 0){
|
||||||
|
|
@ -374,7 +374,7 @@ class Cardpublic extends Base{
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'id'=>'9',
|
'id'=>'9',
|
||||||
'name'=>'仰卧起坐',
|
'name'=>'1分钟仰卧起坐',
|
||||||
'number'=>true,
|
'number'=>true,
|
||||||
'type'=>1,
|
'type'=>1,
|
||||||
'time'=>false,
|
'time'=>false,
|
||||||
|
|
@ -561,7 +561,10 @@ class Cardpublic extends Base{
|
||||||
return $this->msg(10005);
|
return $this->msg(10005);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$score_all_data = $this->calculation_score($user_data['gender'],$data,$card_data_sub_item_data['type']);
|
$score_all_data = $this->calculation_score($user_data['gender'],$data,$card_data_sub_item_data['type']);
|
||||||
|
// dump($score_all_data);
|
||||||
|
// die;
|
||||||
$save_data = [
|
$save_data = [
|
||||||
'acd_id' => $card_data_sub_item_data['acd_id'],
|
'acd_id' => $card_data_sub_item_data['acd_id'],
|
||||||
'acdsi_id' => $card_data_sub_item_data['id'],
|
'acdsi_id' => $card_data_sub_item_data['id'],
|
||||||
|
|
@ -625,7 +628,8 @@ class Cardpublic extends Base{
|
||||||
if(!$user_data){
|
if(!$user_data){
|
||||||
return $this->msg(10004);
|
return $this->msg(10004);
|
||||||
}
|
}
|
||||||
$card_sub_item_data = Db::table($this->cardpublic_use_db_name['3'])->where(['acd_id'=>$data['acd_id'],'aud_id'=>$data['aud_id'],'is_del'=>0])->order('record_time desc')->field('id,acdsi_id,score,LEFT(record_time,10) as record_time')->select();
|
$card_sub_item_data = Db::table($this->cardpublic_use_db_name['3'])->where(['acd_id'=>$data['acd_id'],'aud_id'=>$data['aud_id'],'is_del'=>0])->order('record_time desc')->field('id,acdsi_id,score,LEFT(record_time,10) as r_t,record_time')->select();
|
||||||
|
// dump($card_sub_item_data);
|
||||||
$card_sub_item_type = Db::table($this->cardpublic_use_db_name['2'])->where("acd_id = ".$data['acd_id']." and is_del = 0 and suit_gender LIKE '%".$user_data['gender']."%'")->field('id,name,unit')->select();
|
$card_sub_item_type = Db::table($this->cardpublic_use_db_name['2'])->where("acd_id = ".$data['acd_id']." and is_del = 0 and suit_gender LIKE '%".$user_data['gender']."%'")->field('id,name,unit')->select();
|
||||||
$temporary_arr = [];
|
$temporary_arr = [];
|
||||||
$return_data = [];
|
$return_data = [];
|
||||||
|
|
@ -636,7 +640,7 @@ class Cardpublic extends Base{
|
||||||
// 往临时数组内填入数据
|
// 往临时数组内填入数据
|
||||||
foreach ($card_sub_item_data as $key => $value) {
|
foreach ($card_sub_item_data as $key => $value) {
|
||||||
// dump($value);
|
// dump($value);
|
||||||
array_push($temporary_arr[$value['acdsi_id']]['time'],$value['record_time']);
|
array_push($temporary_arr[$value['acdsi_id']]['time'],$value['r_t']);
|
||||||
array_push($temporary_arr[$value['acdsi_id']]['data'],$value['score']);
|
array_push($temporary_arr[$value['acdsi_id']]['data'],$value['score']);
|
||||||
}
|
}
|
||||||
$num = 0;
|
$num = 0;
|
||||||
|
|
@ -776,7 +780,9 @@ class Cardpublic extends Base{
|
||||||
|
|
||||||
// 计算得分成绩以及线性进度
|
// 计算得分成绩以及线性进度
|
||||||
public function calculation_score($gender,$data,$type){
|
public function calculation_score($gender,$data,$type){
|
||||||
// $card_name['card_name'] = ;
|
// dump($gender);
|
||||||
|
// dump($data);
|
||||||
|
// dump($type);
|
||||||
$card_name['project_name'] = $data['name'];
|
$card_name['project_name'] = $data['name'];
|
||||||
$card_name['score'] = 0;
|
$card_name['score'] = 0;
|
||||||
$card_name['offset'] = 0;
|
$card_name['offset'] = 0;
|
||||||
|
|
@ -800,8 +806,11 @@ class Cardpublic extends Base{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// dump($type);
|
||||||
foreach ($card_name['rule']['content'] as $key => $value) {
|
foreach ($card_name['rule']['content'] as $key => $value) {
|
||||||
if($type == '分/秒'){
|
// dump($key);
|
||||||
|
// dump($value);
|
||||||
|
if($type == '4'){
|
||||||
$rule_result = $this->convertMinutesSecondsToStringSeconds($value[0]);
|
$rule_result = $this->convertMinutesSecondsToStringSeconds($value[0]);
|
||||||
$data_result = $this->convertMinutesSecondsToStringSeconds($data['data']);
|
$data_result = $this->convertMinutesSecondsToStringSeconds($data['data']);
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -831,23 +840,37 @@ class Cardpublic extends Base{
|
||||||
// 如果比较符号不是上述任何一个,可以抛出一个异常或错误
|
// 如果比较符号不是上述任何一个,可以抛出一个异常或错误
|
||||||
throw new Exception("Unsupported comparison operator: " . $value[1]);
|
throw new Exception("Unsupported comparison operator: " . $value[1]);
|
||||||
}
|
}
|
||||||
if($result == true){
|
|
||||||
$card_name['score'] = $value[2];
|
|
||||||
if($value[2] < 100){
|
|
||||||
$card_name['offset'] = $value[2];
|
|
||||||
}else{
|
|
||||||
$card_name['offset'] = 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
// $card_name['offset'] = bcdiv($value[2],$card_name['diagram'][count($card_name['diagram'])-1]['max_val'],0);
|
if($result == true){
|
||||||
|
// dump($value[2]);
|
||||||
|
$card_name['score'] = $value[2];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 加 bcadd(,,20)
|
||||||
|
// 减 bcsub(,,20)
|
||||||
|
// 乘 bcmul(,,20)
|
||||||
|
// 除 bcdiv(,,20)
|
||||||
foreach ($describe_list as $key => $value) {
|
foreach ($describe_list as $key => $value) {
|
||||||
|
// dump($key);
|
||||||
if($card_name['score'] >= $value['min_val'] && $card_name['score'] <= $value['max_val']){
|
if($card_name['score'] >= $value['min_val'] && $card_name['score'] <= $value['max_val']){
|
||||||
$card_name['standard'] = $value['text'];
|
$card_name['standard'] = $value['text'];
|
||||||
$card_name['color'] = $value['color'];
|
$card_name['color'] = $value['color'];
|
||||||
|
// dump($card_name);
|
||||||
|
if($card_name['score'] < 100){
|
||||||
|
// 计算当前区间内的比值()
|
||||||
|
// dump($card_name['score']);
|
||||||
|
// dump($value);
|
||||||
|
// dump(bcsub($card_name['offset'],$value['min_val'],20));
|
||||||
|
// dump(bcsub($value['max_val'],$value['min_val'],20));
|
||||||
|
$card_name['offset'] = bcmul(bcdiv(bcsub($card_name['score'],$value['min_val'],20),bcsub($value['max_val'],$value['min_val'],20),4),25,2);
|
||||||
|
// 计算全线性下比值
|
||||||
|
$card_name['offset'] = bcadd($card_name['offset'],bcmul(($key),25,0),0);
|
||||||
|
}else{
|
||||||
|
$card_name['offset'] = '100';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -857,7 +880,11 @@ class Cardpublic extends Base{
|
||||||
// $card_name['default_data_format'] = $card_name['rule']['value'];
|
// $card_name['default_data_format'] = $card_name['rule']['value'];
|
||||||
// $card_name['default_data_type'] = $card_name['rule']['type'];
|
// $card_name['default_data_type'] = $card_name['rule']['type'];
|
||||||
// $card_name['list'] = $describe_list;
|
// $card_name['list'] = $describe_list;
|
||||||
|
|
||||||
unset($card_name['rule']);
|
unset($card_name['rule']);
|
||||||
|
|
||||||
|
// dump($card_name);
|
||||||
|
// die;
|
||||||
return $card_name;
|
return $card_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ class Index extends Base{
|
||||||
################################################################个人资料卡################################################################
|
################################################################个人资料卡################################################################
|
||||||
|
|
||||||
// 检测版本及判断是否登录失效
|
// 检测版本及判断是否登录失效
|
||||||
public function login_invalid_version($data = ['token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
public function login_invalid_version($data = ['token'=>NULL]){
|
||||||
try {
|
try {
|
||||||
// 你的业务逻辑
|
// 你的业务逻辑
|
||||||
if(count(input('post.')) > 0){
|
if(count(input('post.')) > 0){
|
||||||
|
|
@ -78,7 +78,6 @@ class Index extends Base{
|
||||||
$url = '';
|
$url = '';
|
||||||
}
|
}
|
||||||
if($this->token_time_validate($data['token']) === false){
|
if($this->token_time_validate($data['token']) === false){
|
||||||
|
|
||||||
$this->record_api_log($data, null, ['code'=>-1,'msg'=>'未登录',['version'=>$version,'url'=>$url]]);
|
$this->record_api_log($data, null, ['code'=>-1,'msg'=>'未登录',['version'=>$version,'url'=>$url]]);
|
||||||
return $this->msg(-1,'未登录',['version'=>$version,'url'=>$url]);
|
return $this->msg(-1,'未登录',['version'=>$version,'url'=>$url]);
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -247,7 +246,7 @@ class Index extends Base{
|
||||||
$temporary_data = [];
|
$temporary_data = [];
|
||||||
if($data['type'] == 1){
|
if($data['type'] == 1){
|
||||||
for ($i=0; $i < count($result); $i++) {
|
for ($i=0; $i < count($result); $i++) {
|
||||||
array_push($temporary_data,['id'=>$result[$i]['id'],'nickname'=>$result[$i]['nickname']]);
|
array_push($temporary_data,['id'=>$result[$i]['id'],'nickname'=>$result[$i]['nickname'],'identity_name'=>$result[$i]['identity_name'],'identity_id'=>$result[$i]['identity_id']]);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
for ($i=0; $i < count($result); $i++) {
|
for ($i=0; $i < count($result); $i++) {
|
||||||
|
|
@ -291,7 +290,7 @@ class Index extends Base{
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
$result = Db::table($this->index_use_db_name['2'])->where(['id'=>$data['aud_id']])->field('id,aan_id,nickname,head_pic,birthday,gender,card_order,target_weight,initial_weight,initial_date,weight')->find();
|
$result = Db::table($this->index_use_db_name['2'])->where(['id'=>$data['aud_id']])->field('id,aan_id,nickname,head_pic,birthday,gender,card_order,target_weight,initial_weight,initial_date,weight,address,identity_id')->find();
|
||||||
// 获取用户身体卡片信息
|
// 获取用户身体卡片信息
|
||||||
$weight_data_pd = Db::table($this->index_use_db_name['3'])->where(['aud_id'=>$data['aud_id']])->order('record_time desc')->field('id,weight_val,record_time')->find();
|
$weight_data_pd = Db::table($this->index_use_db_name['3'])->where(['aud_id'=>$data['aud_id']])->order('record_time desc')->field('id,weight_val,record_time')->find();
|
||||||
|
|
||||||
|
|
@ -359,7 +358,9 @@ class Index extends Base{
|
||||||
}
|
}
|
||||||
// 获取设备信息进入卡片 end
|
// 获取设备信息进入卡片 end
|
||||||
// 插入肺活量的卡片标准
|
// 插入肺活量的卡片标准
|
||||||
|
if($result['address'] == ''){
|
||||||
$result['address'] = $this->moren_gufen_diqu;
|
$result['address'] = $this->moren_gufen_diqu;
|
||||||
|
}
|
||||||
$result['vitalcapacity_data'] = $this->get_vitalcapacity_data($result['id']);
|
$result['vitalcapacity_data'] = $this->get_vitalcapacity_data($result['id']);
|
||||||
// 成功
|
// 成功
|
||||||
$this->record_api_log($data, null, ['code'=>0,'msg'=>'success',$result]);
|
$this->record_api_log($data, null, ['code'=>0,'msg'=>'success',$result]);
|
||||||
|
|
@ -491,13 +492,16 @@ class Index extends Base{
|
||||||
if(count(input('post.')) > 0){
|
if(count(input('post.')) > 0){
|
||||||
$data = input('post.');
|
$data = input('post.');
|
||||||
}
|
}
|
||||||
if(!array_key_exists('token', $data)){
|
// if(!array_key_exists('token', $data)){
|
||||||
$this->record_api_log($data, null, ['code'=>10001,'msg'=>'',[]]);
|
// $this->record_api_log($data, null, ['code'=>10001,'msg'=>'',[]]);
|
||||||
return $this->msg(10001);
|
// return $this->msg(10001);
|
||||||
}
|
// }
|
||||||
$address_data = Db::table($this->base_use_db_name['5'])->where(['type' => '2'])->cache(3600)->field('id,content,city,area')->find();
|
$address_data = Db::table($this->base_use_db_name['5'])->where(['type' => '2'])->cache(3600)->field('id,content,city,area')->find();
|
||||||
$return_data['area_list'] = json_decode($address_data['content'],true);
|
$return_data['area_list'] = json_decode($address_data['content'],true);
|
||||||
$return_data['identity_list'] = $this->identity_list;
|
$return_data['identity_list'] = [];
|
||||||
|
foreach ($this->identity_list as $key => $value) {
|
||||||
|
array_push($return_data['identity_list'],['id'=>$key,'name'=>$value]);
|
||||||
|
}
|
||||||
$return_data['grade_list'] = $this->grade_list;
|
$return_data['grade_list'] = $this->grade_list;
|
||||||
$this->record_api_log($data, null, ['code'=>0,'msg'=>'success',[]]);
|
$this->record_api_log($data, null, ['code'=>0,'msg'=>'success',[]]);
|
||||||
return $this->msg($return_data);
|
return $this->msg($return_data);
|
||||||
|
|
@ -518,7 +522,7 @@ class Index extends Base{
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改用户所属区域
|
// 修改用户所属区域
|
||||||
public function update_user_address($data=['aud_id'=>'1','address_data'=>'上海']){
|
public function update_user_address($data=['aud_id'=>'1','address_data'=>'上海,上海']){
|
||||||
try {
|
try {
|
||||||
if(count(input('post.')) > 0){
|
if(count(input('post.')) > 0){
|
||||||
$data = input('post.');
|
$data = input('post.');
|
||||||
|
|
@ -532,8 +536,8 @@ class Index extends Base{
|
||||||
$this->record_api_log($data, null, ['code'=>10003,'msg'=>'',[]]);
|
$this->record_api_log($data, null, ['code'=>10003,'msg'=>'',[]]);
|
||||||
return $this->msg(10003);
|
return $this->msg(10003);
|
||||||
}
|
}
|
||||||
|
$address_data = explode(',',$data['address_data']);
|
||||||
$address_result = Db::table($this->base_use_db_name['10'])->where(['province' => $data['address_data']])->cache(3600)->field('id,recommend_cards')->find();
|
$address_result = Db::table($this->base_use_db_name['10'])->where(['province' => $address_data[0]])->cache(3600)->field('id,recommend_cards')->find();
|
||||||
if(!$address_result){
|
if(!$address_result){
|
||||||
$this->record_api_log($data, null, ['code'=>10003,'msg'=>'',[]]);
|
$this->record_api_log($data, null, ['code'=>10003,'msg'=>'',[]]);
|
||||||
return $this->msg(10003);
|
return $this->msg(10003);
|
||||||
|
|
@ -836,6 +840,8 @@ class Index extends Base{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$address_data = Db::table($this->index_use_db_name['10'])->where(['province'=>explode(',',$parameter['address'])[0],'is_del'=>0])->field('id,recommend_cards')->find();
|
||||||
|
$parameter['card_order'] = $address_data['recommend_cards'];
|
||||||
return $parameter;
|
return $parameter;
|
||||||
}
|
}
|
||||||
public function verify_parameters2($data,$type){
|
public function verify_parameters2($data,$type){
|
||||||
|
|
@ -892,18 +898,28 @@ class Index extends Base{
|
||||||
$parameter['address'] = $data['address'];
|
$parameter['address'] = $data['address'];
|
||||||
// $parameter['identity_data'] = $data['identity'];
|
// $parameter['identity_data'] = $data['identity'];
|
||||||
$parameter['last_update_time'] = date('Y-m-d H:i:s');
|
$parameter['last_update_time'] = date('Y-m-d H:i:s');
|
||||||
|
$aan_id = $data['aan_id'];
|
||||||
|
|
||||||
|
|
||||||
if(!array_key_exists($parameter['identity_id'],$this->identity_list)){
|
if(!array_key_exists($parameter['identity_id'],$this->identity_list)){
|
||||||
return '身份信息错误';
|
return '身份信息错误';
|
||||||
}else{
|
}else{
|
||||||
if($parameter['identity_id'] != 'P0'){
|
if($parameter['identity_id'] != 'P0'){
|
||||||
$parameter['identity_name'] = $this->identity_list[$data['identity_id']];
|
$parameter['identity_name'] = $this->identity_list[$data['identity_id']];
|
||||||
$result = Db::table($this->index_use_db_name['2'])->where(['identity_id'=>$parameter['identity_id'],'aan_id'=>$parameter['aan_id'],'is_del'=>0])->count();
|
$result = Db::table($this->index_use_db_name['2'])->where(['identity_id'=>$parameter['identity_id'],'aan_id'=>$aan_id,'is_del'=>0])->field('id,identity_id')->find();
|
||||||
if($result>0){
|
if($result && $parameter['id'] != $result['id']){
|
||||||
return '该身份已存在';
|
return '该身份已存在';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if($data['address'] != ''){
|
||||||
|
$address_data = explode(',', $data['address']);
|
||||||
|
$card_result = Db::table($this->index_use_db_name['10'])->where(['province'=>$address_data[0],'is_del'=>0])->field('id,recommend_cards')->find();
|
||||||
|
$parameter['card_order'] = $card_result['recommend_cards'];
|
||||||
|
}else{
|
||||||
|
$parameter['card_order'] = '2';
|
||||||
|
}
|
||||||
|
|
||||||
return $parameter;
|
return $parameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ use think\Db;
|
||||||
class Skip extends Base{
|
class Skip extends Base{
|
||||||
|
|
||||||
protected $color = ['#FF5656','#FFAB00','#5AD06D','#6492F6','#3967D6'];
|
protected $color = ['#FF5656','#FFAB00','#5AD06D','#6492F6','#3967D6'];
|
||||||
protected $curve_data_format = ['jump_num'=>['跳绳个数','个数/个','#009DFF'],'jump_time'=>['跳绳时长','时长/分','#009DFF'],'jump_kcal'=>['消耗卡路里','卡路里/kcal','#009DFF']];
|
protected $curve_data_format = ['jump_num'=>['跳绳个数','个','#009DFF'],'jump_time'=>['跳绳时长','分钟','#009DFF'],'jump_kcal'=>['消耗卡路里','kcal','#009DFF']];
|
||||||
protected $skip_use_db_name = [
|
protected $skip_use_db_name = [
|
||||||
'1'=>'test_app_card_skip_data',
|
'1'=>'test_app_card_skip_data',
|
||||||
'2'=>'test_app_user_data',
|
'2'=>'test_app_user_data',
|
||||||
|
|
@ -146,7 +146,7 @@ class Skip extends Base{
|
||||||
|
|
||||||
}
|
}
|
||||||
// 曲线
|
// 曲线
|
||||||
public function skip_curve_chart($data = ['aud_id'=>'83','time'=>'2024-07-24','token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
public function skip_curve_chart($data = ['aud_id'=>'9','time'=>'2024-10','token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
||||||
try {
|
try {
|
||||||
// 你的业务逻辑
|
// 你的业务逻辑
|
||||||
if(count(input('post.')) > 0){
|
if(count(input('post.')) > 0){
|
||||||
|
|
@ -361,19 +361,9 @@ class Skip extends Base{
|
||||||
$temporary_arr['line']['series'][0]['data'] = [];
|
$temporary_arr['line']['series'][0]['data'] = [];
|
||||||
foreach ($result as $k => $v) {
|
foreach ($result as $k => $v) {
|
||||||
if($key_condition == 'hour'){
|
if($key_condition == 'hour'){
|
||||||
|
|
||||||
// 每一次的记录都添加进去
|
// 每一次的记录都添加进去
|
||||||
array_push($temporary_arr['line']['categories'],$result[$k]['hour'].':'.$result[$k]['minute']);
|
array_push($temporary_arr['line']['categories'],$result[$k]['hour'].':'.$result[$k]['minute']);
|
||||||
array_push($temporary_arr['line']['series'][0]['data'],$result[$k][$key]);
|
array_push($temporary_arr['line']['series'][0]['data'],$result[$k][$key]);
|
||||||
|
|
||||||
// // 根据小时分组
|
|
||||||
// if(in_array($result[$k][$key_condition].'时',$temporary_arr['line']['categories'])){
|
|
||||||
// $num = array_search($result[$k][$key_condition].'时', $temporary_arr['line']['categories']);
|
|
||||||
// $temporary_arr['line']['series'][0]['data'][$num] = bcadd($temporary_arr['line']['series'][0]['data'][$num],$result[$k][$key],2);
|
|
||||||
// }else{
|
|
||||||
// array_push($temporary_arr['line']['categories'],$result[$k][$key_condition].'时');
|
|
||||||
// array_push($temporary_arr['line']['series'][0]['data'],$result[$k][$key]);
|
|
||||||
// }
|
|
||||||
}else if($key_condition == 'day'){
|
}else if($key_condition == 'day'){
|
||||||
// 根据天分组
|
// 根据天分组
|
||||||
if(in_array($result[$k]['month'].'/'.$result[$k][$key_condition],$temporary_arr['line']['categories'])){
|
if(in_array($result[$k]['month'].'/'.$result[$k][$key_condition],$temporary_arr['line']['categories'])){
|
||||||
|
|
@ -398,8 +388,14 @@ class Skip extends Base{
|
||||||
// dump($temporary_arr);
|
// dump($temporary_arr);
|
||||||
array_push($return_data,$temporary_arr);
|
array_push($return_data,$temporary_arr);
|
||||||
}
|
}
|
||||||
|
// dump($return_data);
|
||||||
|
// dump($return_data[1]['line']['series'][0]['data']);
|
||||||
foreach ($return_data[1]['line']['series'][0]['data'] as $key => $value) {
|
foreach ($return_data[1]['line']['series'][0]['data'] as $key => $value) {
|
||||||
|
|
||||||
$return_data[1]['line']['series'][0]['data'][$key] = bcdiv($return_data[1]['line']['series'][0]['data'][$key],60,2);
|
$return_data[1]['line']['series'][0]['data'][$key] = bcdiv($return_data[1]['line']['series'][0]['data'][$key],60,2);
|
||||||
|
// $jump_time_long = $this->handle_hour_branch_second($return_data[1]['line']['series'][0]['data'][$key]);
|
||||||
|
// $return_data[1]['line']['series'][0]['data'][$key] = $jump_time_long['h'].':'.$jump_time_long['m'].':'.$jump_time_long['s'];
|
||||||
|
|
||||||
}
|
}
|
||||||
return $this->msg($return_data);
|
return $this->msg($return_data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue