260408
This commit is contained in:
parent
502490cd30
commit
ac61d9996e
|
|
@ -1277,7 +1277,7 @@ class Card extends Base{
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$result = Db::table($this->card_db_name['skip'])->where(['aud_id'=>$data['aud_id'],'is_del'=>0])->field("id,record_time,REPLACE(record_time, '-', '-') AS b_time,jump_num,jump_time,jump_kcal")->order('record_time desc')->page($data['page'],$this->pagesize)->select();
|
$result = Db::table($this->card_db_name['skip'])->where(['aud_id'=>$data['aud_id'],'is_del'=>0])->field("id,record_time,REPLACE(record_time, '-', '-') AS b_time,jump_num,jump_time,jump_kcal")->order('record_time desc')->page($data['page'],$this->pagesize)->select();
|
||||||
$return_result['totalrows'] = Db::table($this->card_db_name['skip'])->where(['aud_id'=>$data['aud_id']])->count();
|
$return_result['totalrows'] = Db::table($this->card_db_name['skip'])->where([['aud_id'=>$data['aud_id'],'is_del'=>0]])->count();
|
||||||
$return_result['rows'] = [];
|
$return_result['rows'] = [];
|
||||||
$return_result['pageno'] = $data['page'];
|
$return_result['pageno'] = $data['page'];
|
||||||
$return_result['pagesize'] = $this->pagesize;
|
$return_result['pagesize'] = $this->pagesize;
|
||||||
|
|
@ -1341,7 +1341,7 @@ class Card extends Base{
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$result = Db::table($this->card_db_name['vitalcapacity'])->where(['aud_id'=>$data['aud_id'],'is_del'=>0])->field("id,record_time,REPLACE(record_time, '-', '-') AS b_time,one_val,two_val,three_val,average_val,score")->order('record_time desc')->page($data['page'],$this->pagesize)->select();
|
$result = Db::table($this->card_db_name['vitalcapacity'])->where(['aud_id'=>$data['aud_id'],'is_del'=>0])->field("id,record_time,REPLACE(record_time, '-', '-') AS b_time,one_val,two_val,three_val,average_val,score")->order('record_time desc')->page($data['page'],$this->pagesize)->select();
|
||||||
$return_result['totalrows'] = Db::table($this->card_db_name['vitalcapacity'])->where(['aud_id'=>$data['aud_id']])->count();
|
$return_result['totalrows'] = Db::table($this->card_db_name['vitalcapacity'])->where([['aud_id'=>$data['aud_id'],'is_del'=>0]])->count();
|
||||||
$return_result['rows'] = [];
|
$return_result['rows'] = [];
|
||||||
$return_result['pageno'] = $data['page'];
|
$return_result['pageno'] = $data['page'];
|
||||||
$return_result['pagesize'] = $this->pagesize;
|
$return_result['pagesize'] = $this->pagesize;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ class Base extends Controller{
|
||||||
protected $base_use_db_name = [
|
protected $base_use_db_name = [
|
||||||
// '1'=>'app_data_log',
|
// '1'=>'app_data_log',
|
||||||
// '2'=>'app_card_data',
|
// '2'=>'app_card_data',
|
||||||
'juese'=>'app_user_data',
|
'juese'=>'app_user_data_multilingual',
|
||||||
'biaozhun_vitalcapacity'=>'pc_vitalcapacity_standard',
|
'biaozhun_vitalcapacity'=>'pc_vitalcapacity_standard',
|
||||||
'zhanghao'=>'app_account_number_multilingual',
|
'zhanghao'=>'app_account_number_multilingual',
|
||||||
'search_history'=>'app_user_search_history_multilingual',
|
'search_history'=>'app_user_search_history_multilingual',
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ class Card extends Base{
|
||||||
protected $vitalcapacity_color = ['无效'=>'#FF5656','不及格'=>'#FF5656','及格'=>'#FFAB00','良好'=>'#5AD06D','优秀'=>'#6492F6','牛逼'=>'#3967D6'];
|
protected $vitalcapacity_color = ['无效'=>'#FF5656','不及格'=>'#FF5656','及格'=>'#FFAB00','良好'=>'#5AD06D','优秀'=>'#6492F6','牛逼'=>'#3967D6'];
|
||||||
protected $curve_data_format_skip = ['jump_num'=>['跳绳个数','个','#009DFF'],'jump_time'=>['跳绳时长','分钟','#009DFF'],'jump_kcal'=>['消耗卡路里','kcal','#009DFF']];
|
protected $curve_data_format_skip = ['jump_num'=>['跳绳个数','个','#009DFF'],'jump_time'=>['跳绳时长','分钟','#009DFF'],'jump_kcal'=>['消耗卡路里','kcal','#009DFF']];
|
||||||
protected $curve_data_format_vitalcapacity = ['one_val'=>['第一次','容积/ml','#009DFF'],'two_val'=>['第二次','容积/ml','#009DFF'],'three_val'=>['第三次','容积/ml','#009DFF'],'average_val'=>['平均','容积/ml','#009DFF']];
|
protected $curve_data_format_vitalcapacity = ['one_val'=>['第一次','容积/ml','#009DFF'],'two_val'=>['第二次','容积/ml','#009DFF'],'three_val'=>['第三次','容积/ml','#009DFF'],'average_val'=>['平均','容积/ml','#009DFF']];
|
||||||
|
protected $curve_data_format_exercise_type1 = ['achievement_val'=>['用时','分钟','#009DFF'],'kcal_val'=>['消耗卡路里','kcal','#009DFF']];
|
||||||
protected $card_standard_arr_data = [
|
protected $card_standard_arr_data = [
|
||||||
'id'=>'',
|
'id'=>'',
|
||||||
'name'=>'',
|
'name'=>'',
|
||||||
|
|
@ -275,7 +276,7 @@ class Card extends Base{
|
||||||
'key_word'=>'walk_slow',
|
'key_word'=>'walk_slow',
|
||||||
'list'=>[
|
'list'=>[
|
||||||
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
||||||
['name'=>'耗时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
['name'=>'用时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -284,7 +285,7 @@ class Card extends Base{
|
||||||
'key_word'=>'walk_fast',
|
'key_word'=>'walk_fast',
|
||||||
'list'=>[
|
'list'=>[
|
||||||
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
||||||
['name'=>'耗时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
['name'=>'用时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -293,7 +294,7 @@ class Card extends Base{
|
||||||
'key_word'=>'running_slow',
|
'key_word'=>'running_slow',
|
||||||
'list'=>[
|
'list'=>[
|
||||||
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
||||||
['name'=>'耗时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
['name'=>'用时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -302,7 +303,7 @@ class Card extends Base{
|
||||||
'key_word'=>'running_fast',
|
'key_word'=>'running_fast',
|
||||||
'list'=>[
|
'list'=>[
|
||||||
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
||||||
['name'=>'耗时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
['name'=>'用时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -311,7 +312,7 @@ class Card extends Base{
|
||||||
'key_word'=>'cycling',
|
'key_word'=>'cycling',
|
||||||
'list'=>[
|
'list'=>[
|
||||||
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
||||||
['name'=>'耗时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
['name'=>'用时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -320,7 +321,7 @@ class Card extends Base{
|
||||||
'key_word'=>'climb_stairs',
|
'key_word'=>'climb_stairs',
|
||||||
'list'=>[
|
'list'=>[
|
||||||
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
||||||
['name'=>'耗时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
['name'=>'用时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -329,7 +330,7 @@ class Card extends Base{
|
||||||
'key_word'=>'plank',
|
'key_word'=>'plank',
|
||||||
'list'=>[
|
'list'=>[
|
||||||
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
||||||
['name'=>'耗时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
['name'=>'用时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -383,6 +384,8 @@ class Card extends Base{
|
||||||
return $this->manual_record_skip_action($data);
|
return $this->manual_record_skip_action($data);
|
||||||
}else if($data['type'] == 'vitalcapacity'){//肺活
|
}else if($data['type'] == 'vitalcapacity'){//肺活
|
||||||
return $this->manual_record_vitalcapacity_action($data);
|
return $this->manual_record_vitalcapacity_action($data);
|
||||||
|
}else if(in_array($data['type'],['walk_slow','walk_fast','running_slow','running_fast','cycling','climb_stairs','plank'])){//一般项目
|
||||||
|
return $this->exercise_type1_manual_record_action($data);
|
||||||
}else{
|
}else{
|
||||||
return $this->msg(10005,'type data error');
|
return $this->msg(10005,'type data error');
|
||||||
}
|
}
|
||||||
|
|
@ -426,6 +429,8 @@ class Card extends Base{
|
||||||
return $this->curve_chart_skip_action($data);
|
return $this->curve_chart_skip_action($data);
|
||||||
}else if($data['type'] == 'vitalcapacity'){//肺活
|
}else if($data['type'] == 'vitalcapacity'){//肺活
|
||||||
return $this->curve_chart_vitalcapacity_action($data);
|
return $this->curve_chart_vitalcapacity_action($data);
|
||||||
|
}else if(in_array($data['type'],['walk_slow','walk_fast','running_slow','running_fast','cycling','climb_stairs','plank'])){//一般项目
|
||||||
|
return $this->curve_chart_exercise_type1_action($data);
|
||||||
}else{
|
}else{
|
||||||
return $this->msg(10005,'type data error');
|
return $this->msg(10005,'type data error');
|
||||||
}
|
}
|
||||||
|
|
@ -447,7 +452,7 @@ class Card extends Base{
|
||||||
// 获取历史列表(分组)
|
// 获取历史列表(分组)
|
||||||
public function record_list_group(){
|
public function record_list_group(){
|
||||||
$data = input('post.');
|
$data = input('post.');
|
||||||
try {
|
// try {
|
||||||
|
|
||||||
if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data) || !array_key_exists('s_time', $data) || !array_key_exists('e_time', $data) || !array_key_exists('type', $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) || !array_key_exists('type', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
|
|
@ -472,24 +477,26 @@ class Card extends Base{
|
||||||
return $this->record_list_group_skip_action($data,'group');
|
return $this->record_list_group_skip_action($data,'group');
|
||||||
}else if($data['type'] == 'vitalcapacity'){//肺活
|
}else if($data['type'] == 'vitalcapacity'){//肺活
|
||||||
return $this->record_list_group_vitalcapacity_action($data,'group');
|
return $this->record_list_group_vitalcapacity_action($data,'group');
|
||||||
|
}else if(in_array($data['type'],['walk_slow','walk_fast','running_slow','running_fast','cycling','climb_stairs','plank'])){//一般项目
|
||||||
|
return $this->record_list_group_exercise_type1_action($data,'group');
|
||||||
}else{
|
}else{
|
||||||
return $this->msg(10005,'type data error');
|
return $this->msg(10005,'type data error');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} 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'] .= "行号: " . $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 data_compare(){
|
public function data_compare(){
|
||||||
|
|
@ -676,9 +683,9 @@ class Card extends Base{
|
||||||
if(!array_key_exists('card_id', $data)){
|
if(!array_key_exists('card_id', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
if(!array_key_exists('r_time', $data)){
|
// if(!array_key_exists('r_time', $data)){
|
||||||
return $this->msg(10001);
|
// return $this->msg(10001);
|
||||||
}
|
// }
|
||||||
if(!array_key_exists('time_m', $data)){
|
if(!array_key_exists('time_m', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
|
|
@ -691,9 +698,9 @@ class Card extends Base{
|
||||||
if(!$this->verify_data_is_ok($data['card_id'],'intnum')){
|
if(!$this->verify_data_is_ok($data['card_id'],'intnum')){
|
||||||
return $this->msg(10005,'card_id type error');
|
return $this->msg(10005,'card_id type error');
|
||||||
}
|
}
|
||||||
if(!$this->verify_data_is_ok($data['r_time'],'datetime')){
|
// if(!$this->verify_data_is_ok($data['r_time'],'datetime')){
|
||||||
return $this->msg(10005,'r_time type error');
|
// return $this->msg(10005,'r_time type error');
|
||||||
}
|
// }
|
||||||
if(!$this->verify_data_is_ok($data['time_m'],'intnum')){
|
if(!$this->verify_data_is_ok($data['time_m'],'intnum')){
|
||||||
return $this->msg(10005,'time_m type error');
|
return $this->msg(10005,'time_m type error');
|
||||||
}
|
}
|
||||||
|
|
@ -716,9 +723,10 @@ class Card extends Base{
|
||||||
$kcal_val = bcmul($pj_val,$data['time_m'],2);
|
$kcal_val = bcmul($pj_val,$data['time_m'],2);
|
||||||
$set_data = [
|
$set_data = [
|
||||||
'acd_id'=>$data['card_id'],
|
'acd_id'=>$data['card_id'],
|
||||||
|
'acd_name'=>$card['name'],
|
||||||
'aud_id'=>$data['aud_id'],
|
'aud_id'=>$data['aud_id'],
|
||||||
'achievement'=>$data['time_m'],
|
'achievement'=>$data['time_m'],
|
||||||
'record_time'=>$data['r_time']." ".date('H:i:s'),
|
'record_time'=>date('Y-m-d H:i:s'),
|
||||||
'create_time'=>date('Y-m-d H:i:s'),
|
'create_time'=>date('Y-m-d H:i:s'),
|
||||||
'kcal_val'=>$kcal_val,
|
'kcal_val'=>$kcal_val,
|
||||||
'unit'=>'min',
|
'unit'=>'min',
|
||||||
|
|
@ -751,7 +759,7 @@ class Card extends Base{
|
||||||
}
|
}
|
||||||
public function exercise_type1_list(){
|
public function exercise_type1_list(){
|
||||||
$data = input('post.');
|
$data = input('post.');
|
||||||
// try {
|
try {
|
||||||
if(!array_key_exists('token', $data)){
|
if(!array_key_exists('token', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
|
|
@ -771,7 +779,7 @@ class Card extends Base{
|
||||||
return $this->msg(10005,'page_num type error');
|
return $this->msg(10005,'page_num type error');
|
||||||
}
|
}
|
||||||
|
|
||||||
$page_num = $data['page_num'];
|
// $page_num = $data['page_num'];
|
||||||
|
|
||||||
// dump($page_num);
|
// dump($page_num);
|
||||||
// dump($card);
|
// dump($card);
|
||||||
|
|
@ -788,6 +796,7 @@ class Card extends Base{
|
||||||
$return_result['rows'][] = [
|
$return_result['rows'][] = [
|
||||||
'id'=>$value['id'],
|
'id'=>$value['id'],
|
||||||
'acd_id'=>$value['acd_id'],
|
'acd_id'=>$value['acd_id'],
|
||||||
|
'name'=>$value['acd_name'],
|
||||||
'achievement'=>$value['achievement'],
|
'achievement'=>$value['achievement'],
|
||||||
'unit'=>$value['unit'],
|
'unit'=>$value['unit'],
|
||||||
'record_time'=>$value['record_time'],
|
'record_time'=>$value['record_time'],
|
||||||
|
|
@ -798,19 +807,51 @@ class Card extends Base{
|
||||||
}else{
|
}else{
|
||||||
return $this->msg($return_result);
|
return $this->msg($return_result);
|
||||||
}
|
}
|
||||||
// } 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'] .= "行号: " . $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 exercise_type1_del(){
|
||||||
|
$data = input('post.');
|
||||||
|
try {
|
||||||
|
if(!array_key_exists('id', $data)){
|
||||||
|
return $this->msg(10001);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['id'],'intnum')){
|
||||||
|
return $this->msg(10005,'aud_id type error');
|
||||||
|
}
|
||||||
|
|
||||||
|
$return_result= Db::table($this->card_db_name['card_log'])->where(['id'=>$data['id']])->update(['is_del'=>1]);
|
||||||
|
|
||||||
|
if($return_result){
|
||||||
|
|
||||||
|
return $this->msg([]);
|
||||||
|
}else{
|
||||||
|
return $this->msg(10002);
|
||||||
|
}
|
||||||
|
} 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1269,6 +1310,81 @@ class Card extends Base{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// 通用型接口(一般运动)
|
||||||
|
public function exercise_type1_manual_record_action($data){
|
||||||
|
|
||||||
|
$temporary_data = [];
|
||||||
|
foreach ($data['data'] as $key => $value) {
|
||||||
|
$temporary_data[$value['key_word']] = $value['value'];
|
||||||
|
}
|
||||||
|
if(!array_key_exists('r_time', $temporary_data) || !array_key_exists('time_m', $temporary_data)){
|
||||||
|
return $this->msg(10001);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!array_key_exists('r_time', $data)){
|
||||||
|
return $this->msg(10001);
|
||||||
|
}
|
||||||
|
if(!array_key_exists('time_m', $data)){
|
||||||
|
return $this->msg(10001);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$this->verify_data_is_ok($data['r_time'],'datetime')){
|
||||||
|
return $this->msg(10005,'r_time type error');
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['time_m'],'intnum')){
|
||||||
|
return $this->msg(10005,'time_m type error');
|
||||||
|
}
|
||||||
|
$cards = Db::table($this->card_db_name['card'])->where(['is_del'=>0])->field('id,name,content,is_sub_item,key_word')->select();
|
||||||
|
|
||||||
|
$temporary_data2 = null;
|
||||||
|
foreach ($cards as $key => $value) {
|
||||||
|
if($data['type'] == $value['key_word']){
|
||||||
|
$temporary_data2 = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if($temporary_data2){
|
||||||
|
if($temporary_data2['is_sub_item'] != 2){
|
||||||
|
return $this->msg(10004);
|
||||||
|
}
|
||||||
|
preg_match_all('/\d+/', $temporary_data2['content'], $matches);
|
||||||
|
|
||||||
|
if (count($matches[0]) >= 2) {
|
||||||
|
$calories = $matches[0][0]; // 第一个数字是卡路里
|
||||||
|
$minutes = $matches[0][1]; // 第二个数字是分钟
|
||||||
|
// 加 bcadd(,,20)
|
||||||
|
// 减 bcsub(,,20)
|
||||||
|
// 乘 bcmul(,,20)
|
||||||
|
// 除 bcdiv(,,20)
|
||||||
|
$pj_val = bcdiv($calories,$minutes,20);
|
||||||
|
|
||||||
|
$kcal_val = bcmul($pj_val,$data['time_m'],2);
|
||||||
|
$set_data = [
|
||||||
|
'acd_id'=>$temporary_data2['id'],
|
||||||
|
'acd_name'=>$temporary_data2['name'],
|
||||||
|
'aud_id'=>$data['aud_id'],
|
||||||
|
'achievement'=>$temporary_data['time_m'],
|
||||||
|
'record_time'=>$temporary_data['r_time']." ".date('H:i:s'),
|
||||||
|
'create_time'=>date('Y-m-d H:i:s'),
|
||||||
|
'kcal_val'=>$kcal_val,
|
||||||
|
'unit'=>'min',
|
||||||
|
];
|
||||||
|
$return_result = Db::table($this->card_db_name['card_log'])->insert($set_data);
|
||||||
|
if($return_result){
|
||||||
|
return $this->msg([]);
|
||||||
|
}else{
|
||||||
|
return $this->msg(10002);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->msg(10004);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->msg(10004);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// 跳绳曲线
|
// 跳绳曲线
|
||||||
public function curve_chart_skip_action($data){
|
public function curve_chart_skip_action($data){
|
||||||
$audid = $data['aud_id'];
|
$audid = $data['aud_id'];
|
||||||
|
|
@ -1412,6 +1528,107 @@ class Card extends Base{
|
||||||
}
|
}
|
||||||
return $this->msg($return_data);
|
return $this->msg($return_data);
|
||||||
}
|
}
|
||||||
|
// 通用型接口(一般运动)曲线
|
||||||
|
public function curve_chart_exercise_type1_action($data){
|
||||||
|
$audid = $data['aud_id'];
|
||||||
|
$timeData = explode('-', $data['time']);
|
||||||
|
|
||||||
|
// 根据$timeData的长度构建不同的查询条件
|
||||||
|
$map = ['aud_id' => $audid];
|
||||||
|
switch (count($timeData)) {
|
||||||
|
case 3: // 年月日
|
||||||
|
$map['record_time'] = ['between', [date('Y-m-d 00:00:00', strtotime($timeData[0] . '-' . $timeData[1] . '-' . $timeData[2])), date('Y-m-d 23:59:59', strtotime($timeData[0] . '-' . $timeData[1] . '-' . $timeData[2]))]];
|
||||||
|
break;
|
||||||
|
case 2: // 年月
|
||||||
|
$map['record_time'] = ['between', [date('Y-m-01 00:00:00', strtotime($timeData[0] . '-' . $timeData[1])), date('Y-m-t 23:59:59', strtotime($timeData[0] . '-' . $timeData[1]))]];
|
||||||
|
break;
|
||||||
|
case 1: // 年
|
||||||
|
$map['record_time'] = ['between', [date('Y-01-01 00:00:00', strtotime($timeData[0])), date('Y-12-31 23:59:59', strtotime($timeData[0]))]];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return $this->msg(10005); // 无效的时间数据格式
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$cards = Db::table($this->card_db_name['card'])->where(['is_del'=>0])->field('id,name,content,is_sub_item,key_word')->select();
|
||||||
|
|
||||||
|
$temporary_data = null;
|
||||||
|
foreach ($cards as $key => $value) {
|
||||||
|
if($data['type'] == $value['key_word']){
|
||||||
|
$temporary_data = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$temporary_data){
|
||||||
|
return $this->msg(10004);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($temporary_data['is_sub_item'] != 2){
|
||||||
|
return $this->msg(10004);
|
||||||
|
}
|
||||||
|
|
||||||
|
$map['acd_id'] = $temporary_data['id'];
|
||||||
|
$map['is_del'] = 0;
|
||||||
|
// 使用查询构造器进行查询
|
||||||
|
$result = Db::name($this->card_db_name['card_log'])->where($map)->field('id,achievement as achievement_val,kcal_val,aud_id,record_time,DATEPART(hour, record_time) AS hour,DATEPART(day, record_time) AS day,DATEPART(month, record_time) AS month')->order('record_time')->select();
|
||||||
|
|
||||||
|
$return_data = [];
|
||||||
|
if(count($timeData) == 3){
|
||||||
|
$key_condition = 'hour';
|
||||||
|
}else if(count($timeData) == 2){
|
||||||
|
$key_condition = 'day';
|
||||||
|
}else if(count($timeData) == 1){
|
||||||
|
$key_condition = 'month';
|
||||||
|
}
|
||||||
|
|
||||||
|
// dump($result);
|
||||||
|
// die;
|
||||||
|
foreach ($this->curve_data_format_exercise_type1 as $key => $value) {
|
||||||
|
$temporary_arr['title'] = $value[0].'('.$value[1].')';
|
||||||
|
$temporary_arr['key'] = $key;
|
||||||
|
$temporary_arr['line']['categories'] = [];
|
||||||
|
$temporary_arr['line']['series'][0]['color'] = $value[2];
|
||||||
|
$temporary_arr['line']['series'][0]['name'] = $value[0].'('.$value[1].')';
|
||||||
|
$temporary_arr['line']['series'][0]['data'] = [];
|
||||||
|
foreach ($result as $k => $v) {
|
||||||
|
if($key_condition == 'hour'){
|
||||||
|
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);
|
||||||
|
$temporary_arr['line']['series'][0]['data'][$num] = $temporary_arr['line']['series'][0]['data'][$num] >= $result[$k][$key]?$temporary_arr['line']['series'][0]['data'][$num]:$result[$k][$key];
|
||||||
|
|
||||||
|
}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'){
|
||||||
|
if(in_array($result[$k]['month'].'-'.$result[$k][$key_condition],$temporary_arr['line']['categories'])){
|
||||||
|
$num = array_search($result[$k]['month'].'-'.$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);
|
||||||
|
$temporary_arr['line']['series'][0]['data'][$num] = $temporary_arr['line']['series'][0]['data'][$num] >= $result[$k][$key]?$temporary_arr['line']['series'][0]['data'][$num]:$result[$k][$key];
|
||||||
|
}else{
|
||||||
|
array_push($temporary_arr['line']['categories'],$result[$k]['month'].'-'.$result[$k][$key_condition]);
|
||||||
|
array_push($temporary_arr['line']['series'][0]['data'],$result[$k][$key]);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(in_array($result[$k]['month'].'月',$temporary_arr['line']['categories'])){
|
||||||
|
$num = array_search($result[$k]['month'].'月', $temporary_arr['line']['categories']);
|
||||||
|
// $temporary_arr['line']['series'][0]['data'][$num] = bcadd($temporary_arr['line']['series'][0]['data'][$num],$result[$k][$key],2);
|
||||||
|
$temporary_arr['line']['series'][0]['data'][$num] = $temporary_arr['line']['series'][0]['data'][$num] >= $result[$k][$key]?$temporary_arr['line']['series'][0]['data'][$num]:$result[$k][$key];
|
||||||
|
}else{
|
||||||
|
array_push($temporary_arr['line']['categories'],$result[$k]['month'].'月');
|
||||||
|
array_push($temporary_arr['line']['series'][0]['data'],$result[$k][$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
array_push($return_data,$temporary_arr);
|
||||||
|
}
|
||||||
|
return $this->msg($return_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 跳绳历史
|
// 跳绳历史
|
||||||
public function record_list_group_skip_action($data,$type){
|
public function record_list_group_skip_action($data,$type){
|
||||||
|
|
@ -1449,7 +1666,7 @@ class Card extends Base{
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$result = Db::table($this->card_db_name['skip'])->where(['aud_id'=>$data['aud_id'],'is_del'=>0])->field("id,record_time,REPLACE(record_time, '-', '-') AS b_time,jump_num,jump_time,jump_kcal")->order('record_time desc')->page($data['page'],$this->pagesize)->select();
|
$result = Db::table($this->card_db_name['skip'])->where(['aud_id'=>$data['aud_id'],'is_del'=>0])->field("id,record_time,REPLACE(record_time, '-', '-') AS b_time,jump_num,jump_time,jump_kcal")->order('record_time desc')->page($data['page'],$this->pagesize)->select();
|
||||||
$return_result['totalrows'] = Db::table($this->card_db_name['skip'])->where(['aud_id'=>$data['aud_id']])->count();
|
$return_result['totalrows'] = Db::table($this->card_db_name['skip'])->where([['aud_id'=>$data['aud_id'],'is_del'=>0]])->count();
|
||||||
$return_result['rows'] = [];
|
$return_result['rows'] = [];
|
||||||
$return_result['pageno'] = $data['page'];
|
$return_result['pageno'] = $data['page'];
|
||||||
$return_result['pagesize'] = $this->pagesize;
|
$return_result['pagesize'] = $this->pagesize;
|
||||||
|
|
@ -1513,7 +1730,7 @@ class Card extends Base{
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$result = Db::table($this->card_db_name['vitalcapacity'])->where(['aud_id'=>$data['aud_id'],'is_del'=>0])->field("id,record_time,REPLACE(record_time, '-', '-') AS b_time,one_val,two_val,three_val,average_val,score")->order('record_time desc')->page($data['page'],$this->pagesize)->select();
|
$result = Db::table($this->card_db_name['vitalcapacity'])->where(['aud_id'=>$data['aud_id'],'is_del'=>0])->field("id,record_time,REPLACE(record_time, '-', '-') AS b_time,one_val,two_val,three_val,average_val,score")->order('record_time desc')->page($data['page'],$this->pagesize)->select();
|
||||||
$return_result['totalrows'] = Db::table($this->card_db_name['vitalcapacity'])->where(['aud_id'=>$data['aud_id']])->count();
|
$return_result['totalrows'] = Db::table($this->card_db_name['vitalcapacity'])->where([['aud_id'=>$data['aud_id'],'is_del'=>0]])->count();
|
||||||
$return_result['rows'] = [];
|
$return_result['rows'] = [];
|
||||||
$return_result['pageno'] = $data['page'];
|
$return_result['pageno'] = $data['page'];
|
||||||
$return_result['pagesize'] = $this->pagesize;
|
$return_result['pagesize'] = $this->pagesize;
|
||||||
|
|
@ -1539,6 +1756,86 @@ class Card extends Base{
|
||||||
}
|
}
|
||||||
return $this->msg($return_result);
|
return $this->msg($return_result);
|
||||||
}
|
}
|
||||||
|
// 通用型接口(一般运动)历史
|
||||||
|
public function record_list_group_exercise_type1_action($data,$type){
|
||||||
|
|
||||||
|
|
||||||
|
$cards = Db::table($this->card_db_name['card'])->where(['is_del'=>0])->field('id,name,content,is_sub_item,key_word')->select();
|
||||||
|
|
||||||
|
$temporary_data = null;
|
||||||
|
foreach ($cards as $key => $value) {
|
||||||
|
if($data['type'] == $value['key_word']){
|
||||||
|
$temporary_data = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$temporary_data){
|
||||||
|
return $this->msg(10004);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($temporary_data['is_sub_item'] != 2){
|
||||||
|
return $this->msg(10004);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$return_result = [];
|
||||||
|
|
||||||
|
if($type == 'group'){
|
||||||
|
$data['s_time'] = $data['s_time'].' 00:00:00';
|
||||||
|
$data['e_time'] = $data['e_time'].' 23:59:59';
|
||||||
|
$result = Db::query("
|
||||||
|
select
|
||||||
|
id,
|
||||||
|
CONVERT(varchar(10), record_time, 120) AS r_t,
|
||||||
|
CONVERT(varchar(19), record_time, 120) AS record_time,
|
||||||
|
achievement as v1,
|
||||||
|
kcal_val as v2
|
||||||
|
from ".$this->card_db_name['card_log']."
|
||||||
|
where aud_id='".$data['aud_id']."'
|
||||||
|
and record_time between '".$data['s_time']."' and '".$data['e_time']."'
|
||||||
|
and is_del = 0
|
||||||
|
order by record_time desc");
|
||||||
|
foreach ($result as $key => $value) {
|
||||||
|
|
||||||
|
array_push($return_result, [
|
||||||
|
'id'=>$value['id'],
|
||||||
|
'v1'=>$value['v1'].'min',
|
||||||
|
'v2'=>$value['v2'],
|
||||||
|
'v1_name'=>'用时',
|
||||||
|
'v2_name'=>'消耗卡路里',
|
||||||
|
'r_t'=>$value['r_t']
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$result = Db::table($this->card_db_name['card_log'])->where(['aud_id'=>$data['aud_id'],'is_del'=>0])->field("id,record_time,REPLACE(record_time, '-', '-') AS b_time,achievement,kcal_val")->order('record_time desc')->page($data['page'],$this->pagesize)->select();
|
||||||
|
$return_result['totalrows'] = Db::table($this->card_db_name['card_log'])->where(['aud_id'=>$data['aud_id'],'is_del'=>0])->count();
|
||||||
|
$return_result['rows'] = [];
|
||||||
|
$return_result['pageno'] = $data['page'];
|
||||||
|
$return_result['pagesize'] = $this->pagesize;
|
||||||
|
$return_result['totalpage'] = ceil($return_result['totalrows']/$this->pagesize);
|
||||||
|
foreach ($result as $key => $value) {
|
||||||
|
|
||||||
|
array_push($return_result['rows'],[
|
||||||
|
'id'=>$value['id'],
|
||||||
|
'v1'=>$value['achievement'].'min',
|
||||||
|
'v2'=>$value['kcal_val'],
|
||||||
|
'v1_name'=>'用时',
|
||||||
|
'v2_name'=>'消耗卡路里',
|
||||||
|
'record_time'=>$value['b_time'],
|
||||||
|
'is_have_details'=>'no'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->msg($return_result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 数据对比
|
// 数据对比
|
||||||
public function data_compare_skip_action($data){
|
public function data_compare_skip_action($data){
|
||||||
$data2 = [$data['before_id'],$data['after_id']];
|
$data2 = [$data['before_id'],$data['after_id']];
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,11 @@ use think\Cache;
|
||||||
class Skip extends Base{
|
class Skip extends Base{
|
||||||
|
|
||||||
protected $skip_db_name = [
|
protected $skip_db_name = [
|
||||||
'zhanghao'=>'app_account_number',
|
'zhanghao'=>'app_account_number_multilingual',
|
||||||
'juese'=>'app_user_data',
|
'juese'=>'app_user_data_multilingual',
|
||||||
'body'=>'app_card_body_data',
|
// 'body'=>'app_card_body_data',
|
||||||
'body_new'=>'app_card_body_data_new',
|
'body_new'=>'app_card_body_data_new_multilingual',
|
||||||
'skip'=>'app_card_skip_data',
|
'skip'=>'app_card_skip_data_multilingual',
|
||||||
|
|
||||||
];
|
];
|
||||||
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']];
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@ use think\Db;
|
||||||
class Userbody extends Base{
|
class Userbody extends Base{
|
||||||
|
|
||||||
protected $body_db_name = [
|
protected $body_db_name = [
|
||||||
'zhanghao'=>'app_account_number',
|
'zhanghao'=>'app_account_number_multilingual',
|
||||||
'juese'=>'app_user_data',
|
'juese'=>'app_user_data_multilingual',
|
||||||
'body_data'=>'app_card_body_data',
|
// 'body_data'=>'app_card_body_data',
|
||||||
'body_data_new'=>'app_card_body_data_new',
|
'body_data_new'=>'app_card_body_data_new_multilingual',
|
||||||
'bmi'=>'pc_bmistand',
|
'bmi'=>'pc_bmistand',
|
||||||
'height'=>'pc_heightstand',
|
'height'=>'pc_heightstand',
|
||||||
'weight'=>'pc_weightstand2',
|
'weight'=>'pc_weightstand2',
|
||||||
|
|
@ -635,7 +635,7 @@ class Userbody extends Base{
|
||||||
// 设备记录
|
// 设备记录
|
||||||
public function device_record(){
|
public function device_record(){
|
||||||
$data = input('post.');
|
$data = input('post.');
|
||||||
// try {
|
try {
|
||||||
if(!array_key_exists('aud_id', $data) || !array_key_exists('height', $data) || !array_key_exists('weight', $data) || !array_key_exists('adc', $data) || !array_key_exists('token', $data)){
|
if(!array_key_exists('aud_id', $data) || !array_key_exists('height', $data) || !array_key_exists('weight', $data) || !array_key_exists('adc', $data) || !array_key_exists('token', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
|
|
@ -672,25 +672,25 @@ class Userbody extends Base{
|
||||||
// dump($data);
|
// dump($data);
|
||||||
// die;
|
// die;
|
||||||
return $this->set_user_body_data($data,'by_device');
|
return $this->set_user_body_data($data,'by_device');
|
||||||
// } 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'] .= "函数: device_record" . "\n";
|
$logContent['all_content'] .= "函数: device_record" . "\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);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
// 获取角色报告(简要)
|
// 获取角色报告(简要)
|
||||||
public function body_report_brief(){
|
public function body_report_brief(){
|
||||||
$data = input('post.');
|
$data = input('post.');
|
||||||
// try {
|
try {
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
@ -701,25 +701,25 @@ class Userbody extends Base{
|
||||||
return $this->msg(10005,'aud_id type error');
|
return $this->msg(10005,'aud_id type error');
|
||||||
}
|
}
|
||||||
return $this->body_report_brief_action($data);
|
return $this->body_report_brief_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'] .= "函数: body_report_brief" . "\n";
|
$logContent['all_content'] .= "函数: body_report_brief" . "\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);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
// 获取角色报告(详细)
|
// 获取角色报告(详细)
|
||||||
public function body_report_detailed(){
|
public function body_report_detailed(){
|
||||||
$data = input('post.');
|
$data = input('post.');
|
||||||
// try {
|
try {
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
@ -730,25 +730,25 @@ class Userbody extends Base{
|
||||||
return $this->msg(10005,'aud_id type error');
|
return $this->msg(10005,'aud_id type error');
|
||||||
}
|
}
|
||||||
return $this->body_report_detailed_action($data);
|
return $this->body_report_detailed_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'] .= "函数: body_report_detailed" . "\n";
|
$logContent['all_content'] .= "函数: body_report_detailed" . "\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);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
// 获取角色报告(深度)
|
// 获取角色报告(深度)
|
||||||
public function body_report_depth(){
|
public function body_report_depth(){
|
||||||
$data = input('post.');
|
$data = input('post.');
|
||||||
// try {
|
try {
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
@ -759,20 +759,20 @@ class Userbody extends Base{
|
||||||
return $this->msg(10005,'aud_id type error');
|
return $this->msg(10005,'aud_id type error');
|
||||||
}
|
}
|
||||||
return $this->body_report_depth_action($data);
|
return $this->body_report_depth_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'] .= "函数: body_report_detailed" . "\n";
|
$logContent['all_content'] .= "函数: body_report_detailed" . "\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);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
// 修改目标体重
|
// 修改目标体重
|
||||||
public function set_target_weight(){
|
public function set_target_weight(){
|
||||||
|
|
@ -1019,7 +1019,7 @@ class Userbody extends Base{
|
||||||
$db_data['head_circumference'] = $data['head_data'];
|
$db_data['head_circumference'] = $data['head_data'];
|
||||||
$send_data['head'] = $data['head_data'];
|
$send_data['head'] = $data['head_data'];
|
||||||
}else{
|
}else{
|
||||||
$send_data['head'] = $data['head_data'];
|
// $send_data['head'] = $data['head_data'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$send_data['adc'] = 550;
|
$send_data['adc'] = 550;
|
||||||
|
|
@ -1046,6 +1046,7 @@ class Userbody extends Base{
|
||||||
$db_data['body_level'] = $get_body_value['fatlevelname'];//肥胖等级
|
$db_data['body_level'] = $get_body_value['fatlevelname'];//肥胖等级
|
||||||
$db_data['body_type'] = $get_body_value['body'];//身体类型
|
$db_data['body_type'] = $get_body_value['body'];//身体类型
|
||||||
$db_data['body_age'] = $get_body_value['bodyage'];
|
$db_data['body_age'] = $get_body_value['bodyage'];
|
||||||
|
$db_data['body_age'] = $get_body_value['bodyage'];
|
||||||
// 如果年纪小于三岁,处理头围数据star
|
// 如果年纪小于三岁,处理头围数据star
|
||||||
$standardlist = [];
|
$standardlist = [];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@ use think\Cache;
|
||||||
class Vitalcapacity extends Base{
|
class Vitalcapacity extends Base{
|
||||||
|
|
||||||
protected $vitalcapacity_db_name = [
|
protected $vitalcapacity_db_name = [
|
||||||
'zhanghao'=>'app_account_number',
|
'zhanghao'=>'app_account_number_multilingual',
|
||||||
'juese'=>'app_user_data',
|
'juese'=>'app_user_data_multilingual',
|
||||||
'vitalcapacity'=>'app_card_vitalcapacity_data',
|
'vitalcapacity'=>'app_card_vitalcapacity_data_multilingual',
|
||||||
'biaozhun'=>'pc_vitalcapacity_standard',
|
'biaozhun'=>'pc_vitalcapacity_standard',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
@ -29,7 +29,7 @@ class Vitalcapacity extends Base{
|
||||||
|
|
||||||
// 设备记录
|
// 设备记录
|
||||||
public function device_record(){
|
public function device_record(){
|
||||||
try {
|
// try {
|
||||||
$data = input('post.');
|
$data = input('post.');
|
||||||
if(!array_key_exists('aud_id', $data) || !array_key_exists('one', $data) || !array_key_exists('two', $data) || !array_key_exists('three', $data) || !array_key_exists('token', $data)){
|
if(!array_key_exists('aud_id', $data) || !array_key_exists('one', $data) || !array_key_exists('two', $data) || !array_key_exists('three', $data) || !array_key_exists('token', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
|
|
@ -49,19 +49,19 @@ class Vitalcapacity extends Base{
|
||||||
}
|
}
|
||||||
$data['time'] = date('Y-m-d H:i:s');
|
$data['time'] = date('Y-m-d H:i:s');
|
||||||
return $this->manual_record_action($data,'by_device');
|
return $this->manual_record_action($data,'by_device');
|
||||||
} 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'] .= "行号: " . $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 data_report(){
|
public function data_report(){
|
||||||
|
|
@ -114,9 +114,10 @@ class Vitalcapacity extends Base{
|
||||||
|
|
||||||
$user_msg = Db::name($this->vitalcapacity_db_name['juese'])->where(['id'=>$data['aud_id']])->field('id,grade,gender,birthday')->find();
|
$user_msg = Db::name($this->vitalcapacity_db_name['juese'])->where(['id'=>$data['aud_id']])->field('id,grade,gender,birthday')->find();
|
||||||
// die;
|
// die;
|
||||||
|
|
||||||
if($user_msg){
|
if($user_msg){
|
||||||
// 根据性别&年级&年龄查规则
|
// 根据性别&年级&年龄查规则
|
||||||
if($user_msg['grade'] == 'nothing'){
|
if($user_msg['grade'] == 'nothing' || $user_msg['grade'] == ''){
|
||||||
// 计算年龄判断是属于哪个年级
|
// 计算年龄判断是属于哪个年级
|
||||||
$user_age = $this->calculate_age($user_msg['birthday']);
|
$user_age = $this->calculate_age($user_msg['birthday']);
|
||||||
if($user_age <= 7){
|
if($user_age <= 7){
|
||||||
|
|
@ -161,6 +162,8 @@ class Vitalcapacity extends Base{
|
||||||
return $this->msg(10004,'未找到有效数据');
|
return $this->msg(10004,'未找到有效数据');
|
||||||
}
|
}
|
||||||
$standard_data = $this->get_vitalcapacity_data($data['aud_id']);
|
$standard_data = $this->get_vitalcapacity_data($data['aud_id']);
|
||||||
|
// dump($standard_data);
|
||||||
|
// die;
|
||||||
$temporary_arr['standard_data'] = json_encode($standard_data);
|
$temporary_arr['standard_data'] = json_encode($standard_data);
|
||||||
$result = Db::table($this->vitalcapacity_db_name['vitalcapacity'])->insert($temporary_arr);
|
$result = Db::table($this->vitalcapacity_db_name['vitalcapacity'])->insert($temporary_arr);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1172,6 +1172,9 @@ Route::any('/reedaw2/sportstesting/sportstesting_set_once_data', 'app/NewReedaw2
|
||||||
Route::any('/reedaw2/exercise_type1_manual_record', 'app/NewReedaw2/app.Card/exercise_type1_manual_record');
|
Route::any('/reedaw2/exercise_type1_manual_record', 'app/NewReedaw2/app.Card/exercise_type1_manual_record');
|
||||||
// 通用运动类型1历史记录
|
// 通用运动类型1历史记录
|
||||||
Route::any('/reedaw2/exercise_type1_list', 'app/NewReedaw2/app.Card/exercise_type1_list');
|
Route::any('/reedaw2/exercise_type1_list', 'app/NewReedaw2/app.Card/exercise_type1_list');
|
||||||
|
// 通用运动类型1历史记录
|
||||||
|
Route::any('/reedaw2/exercise_type1_del', 'app/NewReedaw2/app.Card/exercise_type1_del');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue