提交测试2

This commit is contained in:
tiansf 2024-05-22 19:50:44 +08:00
parent fff1919ee7
commit e531bb7aa1
4 changed files with 19 additions and 31 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
composer.lock
*.log
/public/*.htaccess

View File

@ -162,28 +162,22 @@ class Base extends Controller{
// 曲线页面-底部统计动作
public function base_target_initial_cumulative_weight($id,$weight = '',$target_weight,$initial_weight,$initial_date){
if($weight != ''){
$user_data = Db::table('app_user_data')->where(['id'=>$id])->field('target_weight,initial_weight,initial_date')->find();
public function base_target_initial_cumulative_weight($data = []){
// 第一种:用户详情(所有数据都有)
// 第二种:手动记录(只有最新体重)
// 第三种:修改原始体重(只有原始体重)
if(count($data) > 0){
$result_data['target_weight'] = $data['target_weight'];
$result_data['initial_weight'] = $data['initial_weight'];
$result_data['cumulative_weight'] = $data['weight'] - $data['initial_weight'];
$result_data['cumulative_day'] = $this->daysSince($user_data['initial_date']);
}else{
$user_data = Db::table('app_user_data')->where(['id'=>$id])->field('target_weight,initial_weight,initial_date')->find();
$result_data['target_weight'] = 0;
$result_data['initial_weight'] = 0;
$result_data['cumulative_weight'] = 0;
$result_data['cumulative_day'] = 0;
}
if($user_data){
if($user_data['initial_date']){
$result_data['target_weight'] = $user_data['target_weight'];
$result_data['initial_weight'] = $user_data['initial_weight'];
$result_data['cumulative_weight'] = 0;
$result_data['cumulative_day'] = $this->daysSince($user_data['initial_date']).'天';
}else{
$result_data['target_weight'] = 0;
$result_data['initial_weight'] = 0;
$result_data['cumulative_weight'] = 0;
$result_data['cumulative_day'] = 0;
}
}else{
return $this->msg(10003);
}
dump($result_data);
return $result_data;
}

View File

@ -84,7 +84,7 @@ class Index extends Base{
if(count(input()) > 0){
$data = input();
}
if(!array_key_exists('token', $data)){
if(!array_key_exists('token', $data) || !array_key_exists('aan_id', $data) || !array_key_exists('type', $data)){
return $this->msg(10001);
}
@ -110,7 +110,7 @@ class Index extends Base{
if(count(input()) > 0){
$data = input();
}
if(!array_key_exists('token', $data)){
if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data)){
return $this->msg(10001);
}
@ -119,6 +119,7 @@ class Index extends Base{
}
unset($data['token']);
$result = Db::table('app_user_data')->where(['id'=>$data['aud_id']])->field('id,aan_id,nickname,head_pic,birthday,gender,card_order')->find();
if(!$result){
return $this->msg(10003);
}
@ -131,6 +132,7 @@ class Index extends Base{
$result['card_order'] = explode(',',$result['card_order']);
$result['card_data_list'] = $this->get_user_card_data_list($result['card_order'],$result['id']);
}
// base_target_initial_cumulative_weight
// dump($result);
// die;
$result['birthday'] = str_replace('-', '/', $result['birthday']);

View File

@ -1,9 +0,0 @@
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
## RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
</IfModule>