260407提交
This commit is contained in:
parent
cfef33b710
commit
502490cd30
|
|
@ -33,10 +33,11 @@ class Login extends Base{
|
|||
|
||||
// 注册
|
||||
public function register_action(){
|
||||
$data = input('post.');
|
||||
try {
|
||||
// 你的业务逻辑
|
||||
// 验证是否前段发送过来的数据
|
||||
$data = input('post.');
|
||||
|
||||
// 验证数据项是否完整
|
||||
if(!array_key_exists('data', $data)){
|
||||
return $this->msg(10001,'data is miss');
|
||||
|
|
@ -129,9 +130,10 @@ class Login extends Base{
|
|||
}
|
||||
// 登录
|
||||
public function login_action(){
|
||||
$data = input('post.');
|
||||
try {
|
||||
// 你的业务逻辑
|
||||
$data = input('post.');
|
||||
|
||||
|
||||
if(!array_key_exists('data', $data)){
|
||||
return $this->msg(10001,'data is miss');
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class Body extends Base{
|
|||
protected $body_db_name = [
|
||||
'zhanghao'=>'app_account_number',
|
||||
'juese'=>'app_user_data',
|
||||
'body_data'=>'app_card_body_data',
|
||||
'body_data'=>'app_card_body_data_new',
|
||||
'bmi'=>'pc_bmistand',
|
||||
'heigh'=>'pc_heightstand',
|
||||
'weigh'=>'pc_weightstand',
|
||||
|
|
|
|||
|
|
@ -310,9 +310,7 @@ class Role extends Base{
|
|||
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||
return $this->msg(10005,'token type error');
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||||
return $this->msg(10005,'aud_id type error');
|
||||
}
|
||||
|
||||
if(!$this->verify_data_is_ok($data['birthday'],'datetime')){
|
||||
return $this->msg(10005,'birthday type error');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,15 +11,14 @@ use PHPMailer\PHPMailer\PHPMailer;
|
|||
class Base extends Controller{
|
||||
|
||||
protected $base_use_db_name = [
|
||||
'1'=>'app_data_log',
|
||||
'2'=>'app_card_data',
|
||||
'3'=>'app_user_data',
|
||||
'4'=>'pc_vitalcapacity_standard',
|
||||
'5'=>'admin_estimate',
|
||||
'6'=>'app_account_number',
|
||||
'search_history'=>'app_user_search_history',
|
||||
// '1'=>'app_data_log',
|
||||
// '2'=>'app_card_data',
|
||||
'juese'=>'app_user_data',
|
||||
'biaozhun_vitalcapacity'=>'pc_vitalcapacity_standard',
|
||||
'zhanghao'=>'app_account_number_multilingual',
|
||||
'search_history'=>'app_user_search_history_multilingual',
|
||||
'foodlist4'=>'app_z_national_standard_food_type_4',
|
||||
'user'=>'app_user_data'
|
||||
'user'=>'app_user_data_multilingual'
|
||||
];
|
||||
|
||||
public $test_token = ['57bd45e3a963b372ea2d873e4bd8d1f8','e0966788d02cc93290d9d674921d9715'];
|
||||
|
|
@ -65,24 +64,24 @@ class Base extends Controller{
|
|||
Log::record($logContent, 'api_log');
|
||||
|
||||
}
|
||||
// 检查变量是否是一个只有数字的一维数组
|
||||
public function is_num_array($array = [1,2,3]) {
|
||||
if (!is_array($array)) {
|
||||
return false; // 变量不是数组
|
||||
}
|
||||
foreach ($array as $value) {
|
||||
if (!is_numeric($value)) {
|
||||
return false; // 数组中包含非数字元素
|
||||
}
|
||||
}
|
||||
// // 检查变量是否是一个只有数字的一维数组
|
||||
// public function is_num_array($array = [1,2,3]) {
|
||||
// if (!is_array($array)) {
|
||||
// return false; // 变量不是数组
|
||||
// }
|
||||
// foreach ($array as $value) {
|
||||
// if (!is_numeric($value)) {
|
||||
// return false; // 数组中包含非数字元素
|
||||
// }
|
||||
// }
|
||||
|
||||
$result = Db::table($this->base_use_db_name['2'])->where(['is_del'=>0])->cache(true,600)->select();//查询结果缓存3600秒
|
||||
if(empty(array_diff($array, array_column($result, 'id')))){
|
||||
return true;// 数组是一维的且只包含数字,且已经跟数据库比对过,每个数值都是有效
|
||||
}else{
|
||||
return false;//跟数据库比对过,存在无效数值
|
||||
}
|
||||
}
|
||||
// $result = Db::table($this->base_use_db_name['2'])->where(['is_del'=>0])->cache(true,600)->select();//查询结果缓存3600秒
|
||||
// if(empty(array_diff($array, array_column($result, 'id')))){
|
||||
// return true;// 数组是一维的且只包含数字,且已经跟数据库比对过,每个数值都是有效
|
||||
// }else{
|
||||
// return false;//跟数据库比对过,存在无效数值
|
||||
// }
|
||||
// }
|
||||
|
||||
// 判断字符串是手机还是邮箱(有用)
|
||||
public function is_tel_email($str) {
|
||||
|
|
@ -144,7 +143,7 @@ class Base extends Controller{
|
|||
return ['state'=>false,'language'=>null];
|
||||
}
|
||||
|
||||
$user_login = Db::table($this->base_use_db_name['6'])->where(['token'=>$token])->field('id,login_time,language')->find();
|
||||
$user_login = Db::table($this->base_use_db_name['zhanghao'])->where(['token'=>$token])->field('id,login_time,language')->find();
|
||||
if(!$user_login){
|
||||
Log::record('用户尝试更新token时间,token:' . $token.',但是更新token失败,未找到用户token', 'token_log');
|
||||
return ['state'=>false,'language'=>null];
|
||||
|
|
@ -173,7 +172,7 @@ class Base extends Controller{
|
|||
return ['state'=>false,'language'=>$user_login['language']];
|
||||
} else {
|
||||
// echo "未超过 {$specifiedDays} 天";
|
||||
$user_login = Db::table($this->base_use_db_name['6'])->where(['token'=>$token])->update(['login_time'=>date('Y-m-d H:i:s')]);
|
||||
$user_login = Db::table($this->base_use_db_name['zhanghao'])->where(['token'=>$token])->update(['login_time'=>date('Y-m-d H:i:s')]);
|
||||
if($user_login){
|
||||
Log::record('用户尝试更新token时间,token:' . $token.',记录成功,最新的时间为'.date('Y-m-d H:i:s'), 'token_log');
|
||||
return ['state'=>true,'language'=>$user_login['language']];
|
||||
|
|
@ -222,28 +221,28 @@ class Base extends Controller{
|
|||
}
|
||||
|
||||
|
||||
// // 曲线页面-底部统计动作
|
||||
// public function base_target_initial_cumulative_weight($data = []){
|
||||
// // 第一种:用户详情(所有数据都有)
|
||||
// // 第二种:手动记录(只有最新体重)
|
||||
// // 第三种:修改原始体重(只有原始体重)
|
||||
// // $result_data['target_weight'] 目标体重
|
||||
// // $result_data['initial_weight'] 最初体重
|
||||
// // $result_data['weight'] 最近一次测量重量
|
||||
// // $result_data['initial_date'] 初始体重日期
|
||||
// if(count($data) > 0){
|
||||
// $result_data['target_weight'] = $data['target_weight'];
|
||||
// $result_data['initial_weight'] = $data['initial_weight'];
|
||||
// $result_data['cumulative_weight'] = bcsub($data['weight'],$data['initial_weight'],2);
|
||||
// $result_data['cumulative_day'] = $data['initial_date'] == 0?0:$this->daysSince($data['initial_date']);
|
||||
// }else{
|
||||
// $result_data['target_weight'] = 0;
|
||||
// $result_data['initial_weight'] = 0;
|
||||
// $result_data['cumulative_weight'] = 0;
|
||||
// $result_data['cumulative_day'] = 0;
|
||||
// }
|
||||
// return $result_data;
|
||||
// }
|
||||
// // 曲线页面-底部统计动作(有用)
|
||||
public function base_target_initial_cumulative_weight($data = []){
|
||||
// 第一种:用户详情(所有数据都有)
|
||||
// 第二种:手动记录(只有最新体重)
|
||||
// 第三种:修改原始体重(只有原始体重)
|
||||
// $result_data['target_weight'] 目标体重
|
||||
// $result_data['initial_weight'] 最初体重
|
||||
// $result_data['weight'] 最近一次测量重量
|
||||
// $result_data['initial_date'] 初始体重日期
|
||||
if(count($data) > 0){
|
||||
$result_data['target_weight'] = $data['target_weight'];
|
||||
$result_data['initial_weight'] = $data['initial_weight'];
|
||||
$result_data['cumulative_weight'] = bcsub($data['weight'],$data['initial_weight'],2);
|
||||
$result_data['cumulative_day'] = $data['initial_date'] == 0?0:$this->daysSince($data['initial_date']);
|
||||
}else{
|
||||
$result_data['target_weight'] = 0;
|
||||
$result_data['initial_weight'] = 0;
|
||||
$result_data['cumulative_weight'] = 0;
|
||||
$result_data['cumulative_day'] = 0;
|
||||
}
|
||||
return $result_data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -281,7 +280,7 @@ class Base extends Controller{
|
|||
['min_val'=>'10','max_val'=>'59','text'=>'不及格','color'=>'#FF5656'],
|
||||
['min_val'=>'0','max_val'=>'9','text'=>'无效','color'=>'#FF5656'],
|
||||
];
|
||||
$grade = Db::table($this->base_use_db_name['3'])->where(['id'=>$id])->field('id,grade,gender,birthday')->find();
|
||||
$grade = Db::table($this->base_use_db_name['juese'])->where(['id'=>$id])->field('id,grade,gender,birthday')->find();
|
||||
if(!$grade){
|
||||
return [];
|
||||
}
|
||||
|
|
@ -326,7 +325,7 @@ class Base extends Controller{
|
|||
".$grade['grade'].",
|
||||
ROW_NUMBER() OVER(PARTITION BY level ORDER BY ".$grade['grade']." ASC, id ASC) AS rn
|
||||
FROM
|
||||
".$this->base_use_db_name['4']."
|
||||
".$this->base_use_db_name['biaozhun_vitalcapacity']."
|
||||
WHERE
|
||||
sex = ".$grade['gender']."
|
||||
)
|
||||
|
|
@ -601,7 +600,6 @@ class Base extends Controller{
|
|||
case 'intnum_0':
|
||||
// 整数验证 - 必须是整型或纯整数字符串
|
||||
// 使用 filter_var 同时验证整型和整数字符串
|
||||
// 必须是 >0 的整数或字符串整数
|
||||
$filtered = filter_var($data, FILTER_VALIDATE_INT);
|
||||
return $filtered !== false;
|
||||
|
||||
|
|
@ -1012,6 +1010,9 @@ class Base extends Controller{
|
|||
public function ceshiyong_page(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function ceshiyong(){
|
||||
|
||||
// 老身体数据并入新身体数据
|
||||
|
|
|
|||
|
|
@ -8,15 +8,16 @@ use think\Db;
|
|||
class Card extends Base{
|
||||
|
||||
protected $card_db_name = [
|
||||
'zhanghao'=>'app_account_number',
|
||||
'juese'=>'app_user_data',
|
||||
'zhanghao'=>'app_account_number_multilingual',
|
||||
'juese'=>'app_user_data_multilingual',
|
||||
'card'=>'app_card_data',
|
||||
'skip'=>'app_card_skip_data',
|
||||
'vitalcapacity'=>'app_card_vitalcapacity_data',
|
||||
'zhongzhao'=>'app_sportstesting_data',
|
||||
'body_data_new'=>'app_card_body_data_new',
|
||||
'card_log'=>'app_card_data_val_log',
|
||||
'skip'=>'app_card_skip_data_multilingual',
|
||||
'vitalcapacity'=>'app_card_vitalcapacity_data_multilingual',
|
||||
// 'zhongzhao'=>'app_sportstesting_data',
|
||||
'body_data_new'=>'app_card_body_data_new_multilingual',
|
||||
'vitalcapacity_biaozhun'=>'pc_vitalcapacity_standard',
|
||||
'card_bz'=>'app_card_data_sub_item',
|
||||
// 'card_bz'=>'app_card_data_sub_item',
|
||||
];
|
||||
|
||||
protected $vitalcapacity_color = ['无效'=>'#FF5656','不及格'=>'#FF5656','及格'=>'#FFAB00','良好'=>'#5AD06D','优秀'=>'#6492F6','牛逼'=>'#3967D6'];
|
||||
|
|
@ -58,6 +59,8 @@ class Card extends Base{
|
|||
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||||
return $this->msg(10005,'aud_id type error');
|
||||
}
|
||||
// dump($data);
|
||||
|
||||
return $this->card_list_all_action($data);
|
||||
} catch (\Exception $e) {
|
||||
// 捕获异常
|
||||
|
|
@ -74,64 +77,64 @@ class Card extends Base{
|
|||
}
|
||||
}
|
||||
// 保存用户所选的卡片列表
|
||||
public function save_card_list(){
|
||||
$data = input('post.');
|
||||
try {
|
||||
// 你的业务逻辑
|
||||
if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data) || !array_key_exists('card_list', $data)){
|
||||
return $this->msg(10001);
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||
return $this->msg(10005,'token type error');
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||||
return $this->msg(10005,'aud_id type error');
|
||||
}
|
||||
// public function save_card_list(){
|
||||
// $data = input('post.');
|
||||
// try {
|
||||
// // 你的业务逻辑
|
||||
// if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data) || !array_key_exists('card_list', $data)){
|
||||
// return $this->msg(10001);
|
||||
// }
|
||||
// if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||
// return $this->msg(10005,'token type error');
|
||||
// }
|
||||
// if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||||
// return $this->msg(10005,'aud_id type error');
|
||||
// }
|
||||
|
||||
return $this->save_card_list_action($data);
|
||||
} catch (\Exception $e) {
|
||||
// 捕获异常
|
||||
$logContent["flie"] = $e->getFile();
|
||||
$logContent["line"] = $e->getLine();
|
||||
$logContent['all_content'] = "异常信息:\n";
|
||||
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||
$this->record_api_log($data, $logContent, null);
|
||||
return $this->msg(99999);
|
||||
}
|
||||
}
|
||||
// return $this->save_card_list_action($data);
|
||||
// } catch (\Exception $e) {
|
||||
// // 捕获异常
|
||||
// $logContent["flie"] = $e->getFile();
|
||||
// $logContent["line"] = $e->getLine();
|
||||
// $logContent['all_content'] = "异常信息:\n";
|
||||
// $logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||
// $logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||
// $logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||
// $logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||
// $logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||
// $this->record_api_log($data, $logContent, null);
|
||||
// return $this->msg(99999);
|
||||
// }
|
||||
// }
|
||||
// 角色卡片列表信息
|
||||
public function user_card_list(){
|
||||
$data = input('post.');
|
||||
try {
|
||||
// 你的业务逻辑
|
||||
if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data)){
|
||||
return $this->msg(10001);
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||
return $this->msg(10005,'token type error');
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||||
return $this->msg(10005,'aud_id type error');
|
||||
}
|
||||
return $this->user_card_list_action($data);
|
||||
} catch (\Exception $e) {
|
||||
// 捕获异常
|
||||
$logContent["flie"] = $e->getFile();
|
||||
$logContent["line"] = $e->getLine();
|
||||
$logContent['all_content'] = "异常信息:\n";
|
||||
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||
$this->record_api_log($data, $logContent, null);
|
||||
return $this->msg(99999);
|
||||
}
|
||||
}
|
||||
// public function user_card_list(){
|
||||
// $data = input('post.');
|
||||
// try {
|
||||
// // 你的业务逻辑
|
||||
// if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data)){
|
||||
// return $this->msg(10001);
|
||||
// }
|
||||
// if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||
// return $this->msg(10005,'token type error');
|
||||
// }
|
||||
// if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||||
// return $this->msg(10005,'aud_id type error');
|
||||
// }
|
||||
// return $this->user_card_list_action($data);
|
||||
// } catch (\Exception $e) {
|
||||
// // 捕获异常
|
||||
// $logContent["flie"] = $e->getFile();
|
||||
// $logContent["line"] = $e->getLine();
|
||||
// $logContent['all_content'] = "异常信息:\n";
|
||||
// $logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||
// $logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||
// $logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||
// $logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||
// $logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||
// $this->record_api_log($data, $logContent, null);
|
||||
// return $this->msg(99999);
|
||||
// }
|
||||
// }
|
||||
// BMI测评
|
||||
public function bmi_evaluation(){
|
||||
$cbe_data = input('post.');
|
||||
|
|
@ -235,10 +238,10 @@ class Card extends Base{
|
|||
$data = input('post.');
|
||||
try {
|
||||
|
||||
if(!array_key_exists('aud_id', $data)){
|
||||
return $this->msg(10001);
|
||||
}
|
||||
type类型:
|
||||
// if(!array_key_exists('aud_id', $data)){
|
||||
// return $this->msg(10001);
|
||||
// }
|
||||
// type类型:
|
||||
// 数字输入框:number
|
||||
// 文本输入框:text
|
||||
// 日期下拉框:date Y-m-d
|
||||
|
|
@ -265,53 +268,73 @@ class Card extends Base{
|
|||
['name'=>'第二次','key_word'=>'two','type'=>'number','unit'=>'ml','value'=>''],
|
||||
['name'=>'第三次','key_word'=>'three','type'=>'number','unit'=>'ml','value'=>''],
|
||||
]
|
||||
],
|
||||
[
|
||||
'id'=>27,
|
||||
'name'=>'走路、步行(慢)',
|
||||
'key_word'=>'walk_slow',
|
||||
'list'=>[
|
||||
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
||||
['name'=>'耗时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
||||
]
|
||||
],
|
||||
[
|
||||
'id'=>28,
|
||||
'name'=>'走路、步行(快)',
|
||||
'key_word'=>'walk_fast',
|
||||
'list'=>[
|
||||
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
||||
['name'=>'耗时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
||||
]
|
||||
],
|
||||
[
|
||||
'id'=>29,
|
||||
'name'=>'跑步(慢)',
|
||||
'key_word'=>'running_slow',
|
||||
'list'=>[
|
||||
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
||||
['name'=>'耗时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
||||
]
|
||||
],
|
||||
[
|
||||
'id'=>30,
|
||||
'name'=>'跑步(快)',
|
||||
'key_word'=>'running_fast',
|
||||
'list'=>[
|
||||
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
||||
['name'=>'耗时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
||||
]
|
||||
],
|
||||
[
|
||||
'id'=>31,
|
||||
'name'=>'骑车',
|
||||
'key_word'=>'cycling',
|
||||
'list'=>[
|
||||
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
||||
['name'=>'耗时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
||||
]
|
||||
],
|
||||
[
|
||||
'id'=>32,
|
||||
'name'=>'爬楼梯',
|
||||
'key_word'=>'climb_stairs',
|
||||
'list'=>[
|
||||
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
||||
['name'=>'耗时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
||||
]
|
||||
],
|
||||
[
|
||||
'id'=>33,
|
||||
'name'=>'平板支撑',
|
||||
'key_word'=>'plank',
|
||||
'list'=>[
|
||||
['name'=>'日期','key_word'=>'r_time','type'=>'date','unit'=>'','value'=>''],
|
||||
['name'=>'耗时','key_word'=>'time_m','type'=>'number','unit'=>'min','value'=>''],
|
||||
]
|
||||
]
|
||||
];
|
||||
// if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||||
// return $this->msg(10005);
|
||||
// }
|
||||
// $user_data = Db::table($this->card_db_name['juese'])->where(['id'=>$data['aud_id']])->field('id,gender')->find();
|
||||
// if(!$user_data){
|
||||
// return $this->msg(10004);
|
||||
// }
|
||||
// $card_data_c = Db::table($this->card_db_name['card_bz'])
|
||||
// ->where(['is_del'=>0])
|
||||
// ->field('id,name,type,unit,unit2,suit_gender,acd_id')
|
||||
// ->select();
|
||||
// $card_data_c2 = [];
|
||||
// foreach ($card_data_c as $key => $value) {
|
||||
// $temporary_arr = [];
|
||||
// $temporary_arr['id'] = $value['acd_id'];
|
||||
// $temporary_arr['height'] = false;
|
||||
// $temporary_arr['weight'] = false;
|
||||
// $temporary_arr['number'] = false;
|
||||
// $temporary_arr['time'] = false;
|
||||
// $temporary_arr['list'] = [];
|
||||
// $card_data_c2[$value['acd_id']] = $temporary_arr;
|
||||
// }
|
||||
// foreach ($card_data_c as $key => $value) {
|
||||
// if(in_array($user_data['gender'], explode(",", $value['suit_gender']))){
|
||||
// $temporary_arr = [];
|
||||
// $temporary_arr['id'] = $value['id'];
|
||||
// $temporary_arr['name'] = $value['name'];
|
||||
// $temporary_arr['number'] = $value['unit2'] == '时长'?false:true;
|
||||
// $temporary_arr['type'] = $value['type'];
|
||||
// $temporary_arr['time'] = $value['unit2'] == '时长'?true:false;
|
||||
// $temporary_arr['describe'] = $value['unit2'];
|
||||
// $temporary_arr['unit'] = $value['unit'] == "分/秒"?'': $value['unit'];
|
||||
// array_push($card_data_c2[$value['acd_id']]['list'],$temporary_arr);
|
||||
// }else{
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// }
|
||||
// $card_data = [
|
||||
// ['id'=>'2','height'=>true,'weight'=>true,'number'=>false,'time'=>false,'list'=>[]],
|
||||
// ['id'=>'6','height'=>false,'weight'=>false,'number'=>true,'time'=>true,'list'=>[]],
|
||||
// ];
|
||||
// foreach ($card_data_c2 as $key => $value) {
|
||||
// array_push($card_data,$value);
|
||||
// }
|
||||
];
|
||||
|
||||
// 成功
|
||||
return $this->msg($card_data);
|
||||
// return $return_data;
|
||||
|
|
@ -332,7 +355,7 @@ class Card extends Base{
|
|||
|
||||
|
||||
|
||||
// 通用型接口
|
||||
// 通用型接口(跳绳,肺活)
|
||||
// 手动记录
|
||||
public function manual_record(){
|
||||
$data = input('post.');
|
||||
|
|
@ -555,7 +578,6 @@ class Card extends Base{
|
|||
return $this->msg(99999);
|
||||
}
|
||||
}
|
||||
|
||||
// 历史记录(详细)
|
||||
public function detailed_record(){
|
||||
$data = input('post.');
|
||||
|
|
@ -593,7 +615,6 @@ class Card extends Base{
|
|||
return $this->msg(99999);
|
||||
}
|
||||
}
|
||||
|
||||
// 删除历史数据
|
||||
public function del_record(){
|
||||
try {
|
||||
|
|
@ -641,6 +662,157 @@ class Card extends Base{
|
|||
return $this->msg(99999);
|
||||
}
|
||||
}
|
||||
|
||||
// 通用型接口(一般运动)
|
||||
public function exercise_type1_manual_record(){
|
||||
$data = input('post.');
|
||||
try {
|
||||
if(!array_key_exists('token', $data)){
|
||||
return $this->msg(10001);
|
||||
}
|
||||
if(!array_key_exists('aud_id', $data)){
|
||||
return $this->msg(10001);
|
||||
}
|
||||
if(!array_key_exists('card_id', $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['token'],'str')){
|
||||
return $this->msg(10005,'token type error');
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||||
return $this->msg(10005,'aud_id type error');
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['card_id'],'intnum')){
|
||||
return $this->msg(10005,'card_id type error');
|
||||
}
|
||||
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');
|
||||
}
|
||||
$card = Db::table($this->card_db_name['card'])->where(['id'=>$data['card_id'],'is_del'=>0])->field('id,name,content,is_sub_item,key_word')->find();
|
||||
if($card){
|
||||
if($card['is_sub_item'] != 2){
|
||||
return $this->msg(10004);
|
||||
}
|
||||
preg_match_all('/\d+/', $card['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'=>$data['card_id'],
|
||||
'aud_id'=>$data['aud_id'],
|
||||
'achievement'=>$data['time_m'],
|
||||
'record_time'=>$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);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// 捕获异常
|
||||
$logContent["flie"] = $e->getFile();
|
||||
$logContent["line"] = $e->getLine();
|
||||
$logContent['all_content'] = "异常信息:\n";
|
||||
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||
$this->record_api_log($data, $logContent, null);
|
||||
return $this->msg(99999);
|
||||
}
|
||||
}
|
||||
public function exercise_type1_list(){
|
||||
$data = input('post.');
|
||||
// try {
|
||||
if(!array_key_exists('token', $data)){
|
||||
return $this->msg(10001);
|
||||
}
|
||||
if(!array_key_exists('aud_id', $data)){
|
||||
return $this->msg(10001);
|
||||
}
|
||||
if(!array_key_exists('page_num', $data)){
|
||||
return $this->msg(10001);
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||
return $this->msg(10005,'token type error');
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||||
return $this->msg(10005,'aud_id type error');
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['page_num'],'intnum')){
|
||||
return $this->msg(10005,'page_num type error');
|
||||
}
|
||||
|
||||
$page_num = $data['page_num'];
|
||||
|
||||
// dump($page_num);
|
||||
// dump($card);
|
||||
// die;
|
||||
$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_num'];
|
||||
$return_result['pagesize'] = $this->pagesize;
|
||||
$return_result['totalpage'] = ceil($return_result['totalrows']/$this->pagesize);
|
||||
|
||||
$card = Db::table($this->card_db_name['card_log'])->where(['aud_id'=>$data['aud_id'],'is_del'=>0])->page($data['page_num'],$this->pagesize)->order('id desc')->select();
|
||||
if(count($card)>=1){
|
||||
foreach ($card as $key => $value) {
|
||||
$return_result['rows'][] = [
|
||||
'id'=>$value['id'],
|
||||
'acd_id'=>$value['acd_id'],
|
||||
'achievement'=>$value['achievement'],
|
||||
'unit'=>$value['unit'],
|
||||
'record_time'=>$value['record_time'],
|
||||
'kcal_val'=>$value['kcal_val']
|
||||
];
|
||||
}
|
||||
return $this->msg($return_result);
|
||||
}else{
|
||||
return $this->msg($return_result);
|
||||
}
|
||||
// } catch (\Exception $e) {
|
||||
// // 捕获异常
|
||||
// $logContent["flie"] = $e->getFile();
|
||||
// $logContent["line"] = $e->getLine();
|
||||
// $logContent['all_content'] = "异常信息:\n";
|
||||
// $logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||
// $logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||
// $logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||
// $logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||
// $logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||
// $this->record_api_log($data, $logContent, null);
|
||||
// return $this->msg(99999);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -673,7 +845,7 @@ class Card extends Base{
|
|||
$return_data = [
|
||||
'title'=>[],
|
||||
'chosen_fixed'=>[
|
||||
['id'=>'20','name'=>'中招估分','key_word'=>"zz_score",'background_color'=>'','icon'=>'https://tc.pcxbc.com/new_reedaw/icon/report.png','page_jump'=>'/pageTwo/score/score'],
|
||||
// ['id'=>'20','name'=>'中招估分','key_word'=>"zz_score",'background_color'=>'','icon'=>'https://tc.pcxbc.com/new_reedaw/icon/report.png','page_jump'=>'/pageTwo/score/score'],
|
||||
['id'=>'21','name'=>'BMI测评','key_word'=>"bmi",'background_color'=>'','icon'=>'https://tc.pcxbc.com/new_reedaw/icon/bmi.png','page_jump'=>'/pageTwo/bmi/bmi'],
|
||||
['id'=>'22','name'=>'遗传身高','key_word'=>"heredity",'background_color'=>'','icon'=>'https://tc.pcxbc.com/new_reedaw/icon/inheritHeighet.png','page_jump'=>'/pageTwo/inheritHeighet/inheritHeighet'],
|
||||
],
|
||||
|
|
@ -688,10 +860,10 @@ class Card extends Base{
|
|||
}
|
||||
// dump($user_data['card_order']);
|
||||
// die;
|
||||
// 对照处理用户的卡片信息
|
||||
foreach ($user_data['card_order'] as $key => $value) {
|
||||
// 对照处理用户的卡片信息(新版全选)
|
||||
// foreach ($user_data['card_order'] as $key => $value) {
|
||||
foreach ($card_data as $k => $v) {
|
||||
if(in_array($v['id'],$user_data['card_order']) && $v['id'] == $value){
|
||||
// if(in_array($v['id'],$user_data['card_order']) && $v['id'] == $value){
|
||||
if($v['id'] == 20 || $v['id'] == 21 || $v['id'] == 22){
|
||||
continue;
|
||||
}else{
|
||||
|
|
@ -699,12 +871,12 @@ class Card extends Base{
|
|||
unset($card_data[$k]);
|
||||
}
|
||||
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
foreach ($card_data as $key => $value) {
|
||||
$return_data['chosen_no'][] = $value;
|
||||
}
|
||||
// }
|
||||
// foreach ($card_data as $key => $value) {
|
||||
// $return_data['chosen_no'][] = $value;
|
||||
// }
|
||||
// 剔除不必要的数据
|
||||
foreach ($return_data as $key => $value) {
|
||||
if($key == 'chosen_yes' || $key == 'chosen_no'){
|
||||
|
|
@ -713,7 +885,7 @@ class Card extends Base{
|
|||
unset($return_data[$key][$k]['background_pic']);
|
||||
$return_data[$key][$k]['page_jump'] = $return_data[$key][$k]['page_url_report'];
|
||||
unset($return_data[$key][$k]['page_url_report']);
|
||||
unset($return_data[$key][$k]['content']);
|
||||
// unset($return_data[$key][$k]['content']);
|
||||
unset($return_data[$key][$k]['is_sub_item']);
|
||||
unset($return_data[$key][$k]['ROW_NUMBER']);
|
||||
}
|
||||
|
|
@ -728,81 +900,81 @@ class Card extends Base{
|
|||
|
||||
return $this->msg($return_data);
|
||||
}
|
||||
public function save_card_list_action($data){
|
||||
// 检查角色
|
||||
$user_data = Db::table($this->card_db_name['juese'])->where(['id'=>$data['aud_id'],'is_del'=>0])->field('id,card_order')->find();
|
||||
if(!$user_data){
|
||||
return $this->msg(10003,'未核实到角色信息');
|
||||
}
|
||||
// public function save_card_list_action($data){
|
||||
// // 检查角色
|
||||
// $user_data = Db::table($this->card_db_name['juese'])->where(['id'=>$data['aud_id'],'is_del'=>0])->field('id,card_order')->find();
|
||||
// if(!$user_data){
|
||||
// return $this->msg(10003,'未核实到角色信息');
|
||||
// }
|
||||
|
||||
if($data['card_list']){
|
||||
if(!$this->verify_data_is_ok(explode(',',$data['card_list']),'arr_intnum')){
|
||||
return $this->msg(10005,'card_list type error');
|
||||
}
|
||||
// 查一下卡片数据
|
||||
$card_data = Db::table($this->card_db_name['card'])->where("id in (".$data['card_list'].")")->field('id')->select();
|
||||
if(count(explode(',',$data['card_list'])) == count($card_data)){
|
||||
$result = Db::table($this->card_db_name['juese'])->where(['id'=>$data['aud_id'],'is_del'=>0])->update([
|
||||
'card_order' => $data['card_list']
|
||||
]);
|
||||
if($result){
|
||||
return $this->msg([]);
|
||||
}else{
|
||||
return $this->msg(10002);
|
||||
}
|
||||
}else{
|
||||
return $this->msg(10003,'卡片数据错误');
|
||||
}
|
||||
}else{
|
||||
$result = Db::table($this->card_db_name['juese'])->where(['id'=>$data['aud_id'],'is_del'=>0])->update(['card_order' => ""]);
|
||||
if($result){
|
||||
return $this->msg([]);
|
||||
}else{
|
||||
return $this->msg(10002);
|
||||
}
|
||||
}
|
||||
// if($data['card_list']){
|
||||
// if(!$this->verify_data_is_ok(explode(',',$data['card_list']),'arr_intnum')){
|
||||
// return $this->msg(10005,'card_list type error');
|
||||
// }
|
||||
// // 查一下卡片数据
|
||||
// $card_data = Db::table($this->card_db_name['card'])->where("id in (".$data['card_list'].")")->field('id')->select();
|
||||
// if(count(explode(',',$data['card_list'])) == count($card_data)){
|
||||
// $result = Db::table($this->card_db_name['juese'])->where(['id'=>$data['aud_id'],'is_del'=>0])->update([
|
||||
// 'card_order' => $data['card_list']
|
||||
// ]);
|
||||
// if($result){
|
||||
// return $this->msg([]);
|
||||
// }else{
|
||||
// return $this->msg(10002);
|
||||
// }
|
||||
// }else{
|
||||
// return $this->msg(10003,'卡片数据错误');
|
||||
// }
|
||||
// }else{
|
||||
// $result = Db::table($this->card_db_name['juese'])->where(['id'=>$data['aud_id'],'is_del'=>0])->update(['card_order' => ""]);
|
||||
// if($result){
|
||||
// return $this->msg([]);
|
||||
// }else{
|
||||
// return $this->msg(10002);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
public function user_card_list_action($data){
|
||||
// 检查角色
|
||||
$user_data = Db::table($this->card_db_name['juese'])->where(['id'=>$data['aud_id'],'is_del'=>0])->field('id,card_order')->find();
|
||||
if(!$user_data){
|
||||
return $this->msg(10003,'未核实到角色信息');
|
||||
}
|
||||
if($user_data['card_order'] == '' || $user_data['card_order'] == '2'){
|
||||
// == 2是为了兼容老数据
|
||||
return $this->msg([]);
|
||||
}
|
||||
// }
|
||||
// public function user_card_list_action($data){
|
||||
// // 检查角色
|
||||
// $user_data = Db::table($this->card_db_name['juese'])->where(['id'=>$data['aud_id'],'is_del'=>0])->field('id,card_order')->find();
|
||||
// if(!$user_data){
|
||||
// return $this->msg(10003,'未核实到角色信息');
|
||||
// }
|
||||
// if($user_data['card_order'] == '' || $user_data['card_order'] == '2'){
|
||||
// // == 2是为了兼容老数据
|
||||
// return $this->msg([]);
|
||||
// }
|
||||
|
||||
$card_data = Db::table($this->card_db_name['card'])->where(['is_del'=>0])->field('id,name,content,page_url_report,is_sub_item,background_color,background_pic,key_word')->cache(86400)->select();
|
||||
// $card_data = Db::table($this->card_db_name['card'])->where(['is_del'=>0])->field('id,name,content,page_url_report,is_sub_item,background_color,background_pic,key_word')->cache(86400)->select();
|
||||
|
||||
// 处理卡片映射
|
||||
$card_data_map = [];
|
||||
foreach ($card_data as $key => $value) {
|
||||
$card_data_map[$value['key_word']] = $value;
|
||||
}
|
||||
// // 处理卡片映射
|
||||
// $card_data_map = [];
|
||||
// foreach ($card_data as $key => $value) {
|
||||
// $card_data_map[$value['key_word']] = $value;
|
||||
// }
|
||||
|
||||
// 开始处理列表数据
|
||||
$user_card_list = explode(',',$user_data['card_order']);
|
||||
$return_data = [];
|
||||
// // 开始处理列表数据
|
||||
// $user_card_list = explode(',',$user_data['card_order']);
|
||||
// $return_data = [];
|
||||
|
||||
// dump($card_data_map);
|
||||
// die;
|
||||
// // dump($card_data_map);
|
||||
// // die;
|
||||
|
||||
foreach ($user_card_list as $key => $value) {
|
||||
// dump('本次card_id:'.$value);
|
||||
$temporary_data = $this->little_tool_one($card_data_map,$data['aud_id'],$value);
|
||||
// foreach ($user_card_list as $key => $value) {
|
||||
// // dump('本次card_id:'.$value);
|
||||
// $temporary_data = $this->little_tool_one($card_data_map,$data['aud_id'],$value);
|
||||
|
||||
// dump('最终结果如下');
|
||||
// dump($temporary_data);
|
||||
if(count($temporary_data) > 0){
|
||||
$return_data[] = $temporary_data;
|
||||
}
|
||||
}
|
||||
// // dump('最终结果如下');
|
||||
// // dump($temporary_data);
|
||||
// if(count($temporary_data) > 0){
|
||||
// $return_data[] = $temporary_data;
|
||||
// }
|
||||
// }
|
||||
|
||||
return $this->msg($return_data);
|
||||
// return $this->msg($return_data);
|
||||
|
||||
}
|
||||
// }
|
||||
public function bmi_evaluation_action($data){
|
||||
// 加 bcadd(,,20)
|
||||
// 减 bcsub(,,20)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use think\Cache;
|
|||
class Countfood extends Base{
|
||||
|
||||
protected $card_db_name = [
|
||||
'zhanghao'=>'app_account_number',
|
||||
'zhanghao'=>'app_account_number_multilingual',
|
||||
];
|
||||
// 加 bcadd(,,20)
|
||||
// 减 bcsub(,,20)
|
||||
|
|
@ -22,9 +22,10 @@ class Countfood extends Base{
|
|||
|
||||
// 卡片列表信息
|
||||
public function card_list_msg(){
|
||||
$data = input('post.');
|
||||
try {
|
||||
// 你的业务逻辑
|
||||
$data = input('post.');
|
||||
|
||||
if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data)){
|
||||
return $this->msg(10001);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,15 +14,12 @@ use app\KitchenScale2\controller\app\Index as Cfindex;//厨房秤的config
|
|||
class Index extends Base{
|
||||
|
||||
protected $index_db_name = [
|
||||
'zhanghao'=>'app_account_number',
|
||||
'juese'=>'app_user_data',
|
||||
'body_data'=>'app_card_body_data',
|
||||
'zhanghao'=>'app_account_number_multilingual',
|
||||
'juese'=>'app_user_data_multilingual',
|
||||
'banben'=>'app_version_log',
|
||||
'shangwuhezuo'=>'admin_business_cooperation',
|
||||
'diqu'=>'admin_estimate',
|
||||
'banner'=>'admin_notice_banner',
|
||||
'skip'=>'app_card_skip_data',
|
||||
'vitalcapacity'=>'app_card_vitalcapacity_data',
|
||||
'cookbook_label'=>'app_user_cookbook_label',//菜谱标签表
|
||||
];
|
||||
protected $request_result = [
|
||||
|
|
@ -48,6 +45,18 @@ class Index extends Base{
|
|||
['id'=>'grade_u_12','name'=>'大学一、二年级'],
|
||||
['id'=>'grade_u_34','name'=>'大学三、四年级']
|
||||
];
|
||||
protected $language_country = [
|
||||
'zh' => ['中文','zh'], // 中文(简体)★
|
||||
'en' => ['English','en'], // 英语(通用)★
|
||||
'jp' => ['日本語(Japanese)','ja'], // 日语(变化)
|
||||
'fra' => ['Français(French)','fr'], // 法语(变化)
|
||||
'de' => ['Deutsch(German)','de'], // 德语
|
||||
'kor' => ['한국어(Korean)','ko'], // 韩语(变化)
|
||||
'ru' => ['Русский(Russian)','ru'], // 俄语
|
||||
'pt' => ['Português(Portuguese)','pt'], // 葡萄牙
|
||||
'spa' => ["Español(Spanish)",'es'], // 西班牙(变化)
|
||||
'ara' => ['Arabic(العربية)','ar'], // 阿拉伯(变化)
|
||||
];
|
||||
// 加 bcadd(,,20)
|
||||
// 减 bcsub(,,20)
|
||||
// 乘 bcmul(,,20)
|
||||
|
|
@ -66,8 +75,11 @@ class Index extends Base{
|
|||
if(!array_key_exists('token', $data)){
|
||||
return $this->msg(10001);
|
||||
}
|
||||
|
||||
|
||||
// 处理版本信息
|
||||
$result = Db::table($this->index_db_name['banben'])->order('is_del,id desc')->field('id,version_num_original,download_url,is_del')->find();
|
||||
|
||||
$result = Db::table($this->index_db_name['banben'])->order('is_del,id desc')->find();
|
||||
if($result){
|
||||
$version = $result['version_num_original'];
|
||||
$url = $result['download_url'];
|
||||
|
|
@ -75,18 +87,21 @@ class Index extends Base{
|
|||
$version = '';
|
||||
$url = '';
|
||||
}
|
||||
// 处理登录和语言信息
|
||||
if($data['token'] == ''){
|
||||
return $this->msg(-2,'未登录',['version'=>$version,'url'=>$url,]);
|
||||
// return $this->msg(-2,'未登录',['version'=>$version,'url'=>$url,'language'=>'zh-Hans','language_arr'=>$this->process_Language()]);
|
||||
}
|
||||
$user_token_state = $this->token_time_validate($data['token']);
|
||||
|
||||
if($user_token_state['state'] === false){
|
||||
return $this->msg(-1,'未登录',['version'=>$version,'url'=>$url,]);
|
||||
// return $this->msg(-1,'未登录',['version'=>$version,'url'=>$url,'language'=>$language_data,'language_arr'=>$this->process_Language()]);
|
||||
return $this->msg(-2,'未登录',['version'=>$version,'url'=>$url,'language'=>'zh']);
|
||||
}else{
|
||||
return $this->msg(['version'=>$version,'url'=>$url,]);
|
||||
// return $this->msg(['version'=>$version,'url'=>$url,'language'=>$language_data,'language_arr'=>$this->process_Language()]);
|
||||
$user_token_state = $this->token_time_validate($data['token']);
|
||||
if($user_token_state === false){
|
||||
return $this->msg(-1,'未登录',['version'=>$version,'url'=>$url,'language'=>'zh']);
|
||||
}else{
|
||||
$language_data = Db::table($this->index_db_name['zhanghao'])->where(['token'=>$data['token']])->field('id,language')->find();
|
||||
if(!$language_data['language']){
|
||||
$language_data['language'] = 'zh';
|
||||
}
|
||||
$language_str = $this->language_country[$language_data['language']][1];
|
||||
return $this->msg(['version'=>$version,'url'=>$url,'language'=>$language_str]);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// 捕获异常
|
||||
|
|
@ -107,7 +122,7 @@ class Index extends Base{
|
|||
// 配置信息
|
||||
public function config(){
|
||||
$data = input('post.');
|
||||
// try {
|
||||
try {
|
||||
if(!array_key_exists('token', $data)){
|
||||
return $this->msg(10001,'token is miss');
|
||||
}
|
||||
|
|
@ -115,20 +130,20 @@ class Index extends Base{
|
|||
return $this->msg(10005,'token type error');
|
||||
}
|
||||
return $this->config_action($data);
|
||||
// } catch (\Exception $e) {
|
||||
// // 捕获异常
|
||||
// $logContent["flie"] = $e->getFile();
|
||||
// $logContent["line"] = $e->getLine();
|
||||
// $logContent['all_content'] = "异常信息:\n";
|
||||
// $logContent['all_content'] .= "函数: config" . "\n";
|
||||
// $logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||
// $logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||
// $logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||
// $logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||
// $logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||
// $this->record_api_log($data, $logContent, null);
|
||||
// return $this->msg(99999);
|
||||
// }
|
||||
} catch (\Exception $e) {
|
||||
// 捕获异常
|
||||
$logContent["flie"] = $e->getFile();
|
||||
$logContent["line"] = $e->getLine();
|
||||
$logContent['all_content'] = "异常信息:\n";
|
||||
$logContent['all_content'] .= "函数: config" . "\n";
|
||||
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||
$this->record_api_log($data, $logContent, null);
|
||||
return $this->msg(99999);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取角色信息
|
||||
|
|
@ -168,52 +183,6 @@ class Index extends Base{
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// // 数据对比(包含身体、跳绳、肺活量)
|
||||
// public function all_data_contrast($data = ['before_id'=>'171','after_id'=>'174','type'=>'2','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
||||
// try {
|
||||
// $data = input('post.');
|
||||
// if(!array_key_exists('before_id', $data) || !array_key_exists('after_id', $data) || !array_key_exists('type', $data) || !array_key_exists('token', $data)){
|
||||
// return $this->msg(10001);
|
||||
// }
|
||||
// if(!$this->verify_data_is_ok($data['before_id'],'intnum')){
|
||||
// return $this->msg(10005);
|
||||
// }
|
||||
// if(!$this->verify_data_is_ok($data['after_id'],'intnum')){
|
||||
// return $this->msg(10005);
|
||||
// }
|
||||
// if(!$this->verify_data_is_ok($data['type'],'intnum')){
|
||||
// return $this->msg(10005);
|
||||
// }
|
||||
// unset($data['token']);
|
||||
// if($data['type'] == '2'){
|
||||
// return $this->get_body_data_contrast($data);
|
||||
// }else if($data['type'] == '6'){
|
||||
// return $this->get_skip_data_contrast($data);
|
||||
// }else if($data['type'] == '8'){
|
||||
// return $this->get_vitalcapacity_data_contrast($data);
|
||||
// }
|
||||
// } catch (\Exception $e) {
|
||||
// // 捕获异常
|
||||
// $logContent["flie"] = $e->getFile();
|
||||
// $logContent["line"] = $e->getLine();
|
||||
// $logContent['all_content'] = "异常信息:\n";
|
||||
// $logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||
// $logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||
// $logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||
// $logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||
// $logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||
// $this->record_api_log($data, $logContent, null);
|
||||
// return $this->msg(99999);
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
|
||||
################################################################action################################################################
|
||||
|
|
@ -244,12 +213,6 @@ class Index extends Base{
|
|||
'此测量数据仅供参考,不可替代医学专业测试!'
|
||||
]
|
||||
],
|
||||
// 'king_kong_region'=>[
|
||||
// ['title'=>'减值对比','icon'=>'https://tc.pcxbc.com/new_reedaw/icon/contrast.png','jump'=>'/pageTwo/compk/contrast'],
|
||||
// ['title'=>'中招估分','icon'=>'https://tc.pcxbc.com/new_reedaw/icon/report.png','jump'=>'/pageTwo/score/report'],
|
||||
// ['title'=>'遗传身高','icon'=>'https://tc.pcxbc.com/new_reedaw/icon/inheritHeighet.png','jump'=>'/pageTwo/home/inheritHeighet'],
|
||||
// ['title'=>'BMI测评','icon'=>'https://tc.pcxbc.com/new_reedaw/icon/bmi.png','jump'=>'/pageTwo/home/bmi'],
|
||||
// ],
|
||||
'business_cooperation_url'=>[],
|
||||
'area_list'=>[],
|
||||
'identity_list'=>[],
|
||||
|
|
@ -414,8 +377,9 @@ class Index extends Base{
|
|||
['name' => '碳水', 'unit' => 'g', 'suggestion' => '0', 'today_intake' => 0, 'icon' => 'https://tc.pcxbc.com/kitchenscale_all/icon_carbohydrate.png', 'color' => '#ED7886', 'proportion' => '0.00', 'proportion_fp' => '0'],
|
||||
['name' => '蛋白质', 'unit' => 'g', 'suggestion' => '0', 'today_intake' => 0, 'icon' => 'https://tc.pcxbc.com/kitchenscale_all/icon_protein.png', 'color' => '#FFB169', 'proportion' => '0.00', 'proportion_fp' => '0'],
|
||||
['name' => '脂肪', 'unit' => 'g', 'suggestion' => '0', 'today_intake' => 0, 'icon' => 'https://tc.pcxbc.com/kitchenscale_all/icon_fat.png', 'color' => '#3CB383', 'proportion' => '0.00', 'proportion_fp' => '0']
|
||||
]
|
||||
],
|
||||
],
|
||||
'language_arr'=>$this->process_Language(),
|
||||
];
|
||||
// $food_count = ;
|
||||
|
||||
|
|
@ -477,300 +441,18 @@ class Index extends Base{
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// // 数据对比(身体)
|
||||
// public function get_body_data_contrast($data){
|
||||
// $data2 = [$data['before_id'],$data['after_id']];
|
||||
// $data3 = implode(',',$data2);
|
||||
// $calculate_arr = [];
|
||||
// $result = Db::query("
|
||||
// select
|
||||
// acbd.id,
|
||||
// acbd.height,
|
||||
// acbd.weight,
|
||||
// acbd.bmi,
|
||||
// acbd.fat_r,
|
||||
// acbd.fat_w,
|
||||
// acbd.muscle,
|
||||
// acbd.muscleval,
|
||||
// acbd.water,
|
||||
// acbd.proteinval,
|
||||
// acbd.bone,
|
||||
// acbd.protein,
|
||||
// acbd.kcal,
|
||||
// acbd.visceral,
|
||||
// acbd.sfr,
|
||||
// acbd.record_time,
|
||||
// acbd.record_type,
|
||||
// acbd.head_circumference,
|
||||
// REPLACE(CONVERT(varchar(10), acbd.record_time, 23), '-', '-') AS b_time,
|
||||
// aud.nickname,
|
||||
// aud.gender,
|
||||
// aud.birthday,
|
||||
// aud.head_pic
|
||||
// from ".$this->index_db_name['body_data']." as acbd
|
||||
// left join ".$this->index_db_name['juese']." as aud on acbd.aud_id=aud.id
|
||||
// where acbd.id in ($data3)
|
||||
// and acbd.is_del = 0
|
||||
// ");
|
||||
|
||||
// if(!$result || count($result)<2){
|
||||
// return $this->msg(10004);
|
||||
// }
|
||||
// // 调整顺序
|
||||
// foreach ($result as $key => $value) {
|
||||
// if($value['id'] == $data2[0]){
|
||||
// $calculate_arr['before'] = $value;
|
||||
// }else{
|
||||
// $calculate_arr['after'] = $value;
|
||||
// }
|
||||
// }
|
||||
|
||||
// $return_data['time'] = $calculate_arr['before']['b_time'].'与'.$calculate_arr['after']['b_time'];
|
||||
// $return_data['headimg'] = $calculate_arr['before']['head_pic'];
|
||||
// $return_data['name'] = $calculate_arr['before']['nickname'];
|
||||
// $return_data['gender'] = $calculate_arr['before']['gender'];
|
||||
// $return_data['age'] = $this->calculate_age($calculate_arr['before']['birthday']);
|
||||
// $return_data['day'] = abs($this->daysSince($calculate_arr['before']['record_time'],$calculate_arr['after']['record_time']));
|
||||
// $return_data['list'] = [];
|
||||
// // 处理如果没有阻抗的数据为0,显示异常start;同步处理,如果两个对比数据,都没有阻抗数据,则只显示基础信息
|
||||
// if($calculate_arr['before']['record_type'] != 'by_device_adc' && $calculate_arr['after']['record_type'] != 'by_device_adc'){
|
||||
// foreach ($calculate_arr['before'] as $key => $value) {
|
||||
// if(!in_array($key, ['height','weight','bmi','head_circumference'])){
|
||||
// unset($calculate_arr['before'][$key]);
|
||||
// unset($calculate_arr['after'][$key]);
|
||||
// }
|
||||
// }
|
||||
// if($return_data['age']>=3){
|
||||
// unset($calculate_arr['before']['head_circumference']);
|
||||
// unset($calculate_arr['after']['head_circumference']);
|
||||
// }else{
|
||||
// $calculate_arr['before']['head_circumference'] = json_decode($calculate_arr['before']['head_circumference'],true);
|
||||
// $calculate_arr['after']['head_circumference'] = json_decode($calculate_arr['after']['head_circumference'],true);
|
||||
// foreach ($calculate_arr as $key => $value) {
|
||||
// if(array_key_exists('value',$value['head_circumference'])){
|
||||
// $calculate_arr[$key]['head'][0] = $value['head_circumference']['value'];
|
||||
// }else{
|
||||
// $calculate_arr[$key]['head'][0] = 0;
|
||||
// }
|
||||
// if(array_key_exists('level',$value['head_circumference'])){
|
||||
// $calculate_arr[$key]['head'][1] = $value['head_circumference']['level'];
|
||||
// }else{
|
||||
// $calculate_arr[$key]['head'][1] = '异常';
|
||||
// }
|
||||
// if(array_key_exists('color',$value['head_circumference'])){
|
||||
// $calculate_arr[$key]['head'][2] = $value['head_circumference']['color'];
|
||||
// }else{
|
||||
// $calculate_arr[$key]['head'][2] = '';
|
||||
// }
|
||||
// $calculate_arr[$key]['head'] = implode(',',$calculate_arr[$key]['head']);
|
||||
// unset($calculate_arr['before']['head_circumference']);
|
||||
// unset($calculate_arr['after']['head_circumference']);
|
||||
// }
|
||||
// }
|
||||
// }else{
|
||||
// foreach ($calculate_arr as $key => $value) {
|
||||
// if($value['record_type'] != 'by_device_adc'){
|
||||
// $calculate_arr[$key]['fat_r'] = "0,异常";
|
||||
// $calculate_arr[$key]['fat_w'] = "0,异常";
|
||||
// $calculate_arr[$key]['muscle'] = "0,异常";
|
||||
// $calculate_arr[$key]['muscleval'] = "0,异常";
|
||||
// $calculate_arr[$key]['water'] = "0,异常";
|
||||
// $calculate_arr[$key]['proteinval'] = "0,异常";
|
||||
// $calculate_arr[$key]['bone'] = "0,异常";
|
||||
// $calculate_arr[$key]['protein'] = "0,异常";
|
||||
// $calculate_arr[$key]['kcal'] = "0,异常";
|
||||
// $calculate_arr[$key]['visceral'] = "0,异常";
|
||||
// $calculate_arr[$key]['sfr'] = "0,异常";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// // 处理如果没有阻抗的数据为0,显示异常end;同步处理,如果两个对比数据,都没有阻抗数据,则只显示基础信息
|
||||
// foreach ($calculate_arr['before'] as $key => $value) {
|
||||
// if(in_array($key, ['height','weight','bmi','head','fat_r','fat_w','muscle','muscleval','water','proteinval','bone','protein','kcal','visceral','sfr'])){
|
||||
// $before_arr = explode(',', $value);
|
||||
// $after_arr = explode(',', $calculate_arr['after'][$key]);
|
||||
// array_push($return_data['list'], [
|
||||
// 'firstresult'=>[
|
||||
// 'color'=>'',
|
||||
// 'level'=>$before_arr[1],
|
||||
// 'value'=>$before_arr[0],
|
||||
// 'title'=>$this->request_result['2'][$key][0],
|
||||
// 'unit'=>$this->request_result['2'][$key][1],
|
||||
// 'name'=>$key,
|
||||
// ],
|
||||
// 'secondresult'=>[
|
||||
// 'color'=>'',
|
||||
// 'level'=>$after_arr[1],
|
||||
// 'value'=>$after_arr[0],
|
||||
// 'title'=>$this->request_result['2'][$key][0],
|
||||
// 'unit'=>$this->request_result['2'][$key][1],
|
||||
// 'name'=>$key,
|
||||
// ],
|
||||
// 'diffval'=>bcsub($after_arr[0],$before_arr[0],2),
|
||||
// ]);
|
||||
// }
|
||||
// }
|
||||
// // 添加头围数据(如果需要的话)end
|
||||
// return $this->msg($return_data);
|
||||
// }
|
||||
// // 数据对比(跳绳)
|
||||
// public function get_skip_data_contrast($data){
|
||||
// $data2 = [$data['before_id'],$data['after_id']];
|
||||
// $data3 = implode(',',$data2);
|
||||
// $calculate_arr = [];
|
||||
// $result = Db::query("
|
||||
// select
|
||||
// acsd.id,
|
||||
// acsd.jump_num,
|
||||
// acsd.jump_time,
|
||||
// acsd.jump_kcal,
|
||||
// acsd.record_time,
|
||||
// REPLACE(CONVERT(varchar(10), acsd.record_time, 23), '-', '-') AS b_time,
|
||||
// aud.nickname,
|
||||
// aud.gender,
|
||||
// aud.birthday,
|
||||
// aud.head_pic
|
||||
// from ".$this->index_db_name['skip']." as acsd
|
||||
// left join ".$this->index_db_name['juese']." as aud on acsd.aud_id=aud.id
|
||||
// where acsd.id in ($data3)
|
||||
// and acsd.is_del = 0
|
||||
// ");
|
||||
|
||||
// if(!$result || count($result)<2){
|
||||
// return $this->msg(10004);
|
||||
// }
|
||||
// // 调整顺序
|
||||
// foreach ($result as $key => $value) {
|
||||
// if($value['id'] == $data2[0]){
|
||||
// $calculate_arr['before'] = $value;
|
||||
// }else{
|
||||
// $calculate_arr['after'] = $value;
|
||||
// }
|
||||
// }
|
||||
// $return_data['time'] = $calculate_arr['before']['b_time'].'-'.$calculate_arr['after']['b_time'];
|
||||
// $return_data['headimg'] = $calculate_arr['before']['head_pic'];
|
||||
// $return_data['name'] = $calculate_arr['before']['nickname'];
|
||||
// $return_data['gender'] = $calculate_arr['before']['gender'];
|
||||
// $return_data['age'] = $this->calculate_age($calculate_arr['before']['birthday']);
|
||||
// $return_data['day'] = abs($this->daysSince($calculate_arr['before']['record_time'],$calculate_arr['after']['record_time']));
|
||||
|
||||
// $return_data['list'] = [];
|
||||
// foreach ($calculate_arr['before'] as $key => $value) {
|
||||
// if(in_array($key, ['jump_num','jump_time','jump_kcal'])){
|
||||
// $before_arr = $value;
|
||||
// $after_arr = $calculate_arr['after'][$key];
|
||||
// $temporary_arr = [
|
||||
// 'firstresult'=>[
|
||||
// 'color'=>'',
|
||||
// 'level'=>'',
|
||||
// 'value'=>$key=='jump_time'?implode(':',$this->handle_hour_branch_second($before_arr)):$before_arr,
|
||||
// 'title'=>$this->request_result['6'][$key][0],
|
||||
// 'unit'=>$this->request_result['6'][$key][1],
|
||||
// 'name'=>$key,
|
||||
// ],
|
||||
// 'secondresult'=>[
|
||||
// 'color'=>'',
|
||||
// 'level'=>'',
|
||||
// 'value'=>$key=='jump_time'?implode(':',$this->handle_hour_branch_second($after_arr)):$after_arr,
|
||||
// 'title'=>$this->request_result['6'][$key][0],
|
||||
// 'unit'=>$this->request_result['6'][$key][1],
|
||||
// 'name'=>$key,
|
||||
// ],
|
||||
// 'diffval'=>bcsub($after_arr,$before_arr,2)
|
||||
// ];
|
||||
// if($key=='jump_time'){
|
||||
// $temporary_arr['diffval'] = $temporary_arr['diffval'] >= 0?implode(':',$this->handle_hour_branch_second($temporary_arr['diffval'])):'-'.implode(':',$this->handle_hour_branch_second($temporary_arr['diffval']));
|
||||
// }
|
||||
// array_push($return_data['list'], $temporary_arr);
|
||||
|
||||
// }
|
||||
|
||||
// }
|
||||
// return $this->msg($return_data);
|
||||
// }
|
||||
// // 数据对比(肺活)
|
||||
// public function get_vitalcapacity_data_contrast($data){
|
||||
// $data2 = [$data['before_id'],$data['after_id']];
|
||||
// $data3 = implode(',',$data2);
|
||||
// $calculate_arr = [];
|
||||
// $result = Db::query("
|
||||
// select
|
||||
// acsd.id,
|
||||
// acsd.one_val,
|
||||
// acsd.two_val,
|
||||
// acsd.three_val,
|
||||
// acsd.average_val,
|
||||
// acsd.score_val as score,
|
||||
// acsd.record_time,
|
||||
// REPLACE(CONVERT(varchar(10), acsd.record_time, 23), '-', '-') AS b_time,
|
||||
// aud.nickname,
|
||||
// aud.gender,
|
||||
// aud.birthday,
|
||||
// aud.head_pic
|
||||
// from ".$this->index_db_name['vitalcapacity']." as acsd
|
||||
// left join ".$this->index_db_name['juese']." as aud on acsd.aud_id=aud.id
|
||||
// where acsd.id in ($data3)
|
||||
// and acsd.is_del = 0
|
||||
// ");
|
||||
|
||||
// if(!$result || count($result)<2){
|
||||
// return $this->msg(10004);
|
||||
// }
|
||||
// // 调整顺序
|
||||
// foreach ($result as $key => $value) {
|
||||
// if($value['id'] == $data2[0]){
|
||||
// $calculate_arr['before'] = $value;
|
||||
// }else{
|
||||
// $calculate_arr['after'] = $value;
|
||||
// }
|
||||
// }
|
||||
// $return_data['time'] = $calculate_arr['before']['b_time'].'-'.$calculate_arr['after']['b_time'];
|
||||
// $return_data['headimg'] = $calculate_arr['before']['head_pic'];
|
||||
// $return_data['name'] = $calculate_arr['before']['nickname'];
|
||||
// $return_data['gender'] = $calculate_arr['before']['gender'];
|
||||
// $return_data['age'] = $this->calculate_age($calculate_arr['before']['birthday']);
|
||||
// $return_data['day'] = abs($this->daysSince($calculate_arr['before']['record_time'],$calculate_arr['after']['record_time']));
|
||||
|
||||
// $return_data['list'] = [];
|
||||
// foreach ($calculate_arr['before'] as $key => $value) {
|
||||
// if(in_array($key, ['one_val','two_val','three_val','average_val','score_val'])){
|
||||
// $before_arr = $value;
|
||||
// $after_arr = $calculate_arr['after'][$key];
|
||||
// $temporary_arr = [
|
||||
// 'firstresult'=>[
|
||||
// 'color'=>'',
|
||||
// 'level'=>'',
|
||||
// 'value'=>$before_arr,
|
||||
// 'title'=>$this->request_result['8'][$key][0],
|
||||
// 'unit'=>$this->request_result['8'][$key][1],
|
||||
// 'name'=>$key,
|
||||
// ],
|
||||
// 'secondresult'=>[
|
||||
// 'color'=>'',
|
||||
// 'level'=>'',
|
||||
// 'value'=>$after_arr,
|
||||
// 'title'=>$this->request_result['8'][$key][0],
|
||||
// 'unit'=>$this->request_result['8'][$key][1],
|
||||
// 'name'=>$key,
|
||||
// ],
|
||||
// 'diffval'=>bcsub($after_arr,$before_arr,2)
|
||||
// ];
|
||||
// array_push($return_data['list'], $temporary_arr);
|
||||
|
||||
// }
|
||||
|
||||
// }
|
||||
// return $this->msg($return_data);
|
||||
// }
|
||||
|
||||
|
||||
################################################################内部调用################################################################
|
||||
################################################################内部调用################################################################
|
||||
|
||||
|
||||
// 处理返回的语言数组
|
||||
public function process_Language(){
|
||||
$temporary_arr = [];
|
||||
foreach ($this->language_country as $key => $value) {
|
||||
array_push($temporary_arr,['name'=>$value[0],'val'=>$key,'key'=>$value[1]]);
|
||||
}
|
||||
return $temporary_arr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,9 +13,21 @@ class Login extends Base{
|
|||
// protected $token_time = 2592000;//30天的秒数
|
||||
protected $default_head_pic = 'https://tc.pcxbc.com/tsf/head_pic.png';
|
||||
protected $login_use_db_name = [
|
||||
'zhanghao'=>'app_account_number',
|
||||
'zhanghao'=>'app_account_number_multilingual',
|
||||
|
||||
];
|
||||
protected $language_country = [
|
||||
'zh' => ['中文','zh'], // 中文(简体)★
|
||||
'en' => ['English','en'], // 英语(通用)★
|
||||
'jp' => ['日本語(Japanese)','ja'], // 日语(变化)
|
||||
'fra' => ['Français(French)','fr'], // 法语(变化)
|
||||
'de' => ['Deutsch(German)','de'], // 德语
|
||||
'kor' => ['한국어(Korean)','ko'], // 韩语(变化)
|
||||
'ru' => ['Русский(Russian)','ru'], // 俄语
|
||||
'pt' => ['Português(Portuguese)','pt'], // 葡萄牙
|
||||
'spa' => ["Español(Spanish)",'es'], // 西班牙(变化)
|
||||
'ara' => ['Arabic(العربية)','ar'], // 阿拉伯(变化)
|
||||
];
|
||||
|
||||
################################################################接口################################################################
|
||||
################################################################接口################################################################
|
||||
################################################################接口################################################################
|
||||
|
|
@ -26,20 +38,79 @@ class Login extends Base{
|
|||
try {
|
||||
|
||||
// 验证数据项是否完整
|
||||
if(!array_key_exists('data', $data) || !array_key_exists('password', $data) || !array_key_exists('code', $data)){
|
||||
return $this->msg(10001);
|
||||
if(!array_key_exists('data', $data)){
|
||||
return $this->msg(10001,'data is miss');
|
||||
}
|
||||
// 验证数据值是否合规
|
||||
if(!$data['data'] || !$data['password'] || !$data['code']){
|
||||
return $this->msg(10006);
|
||||
if(!array_key_exists('password', $data)){
|
||||
return $this->msg(10001,'password is miss');
|
||||
}
|
||||
if(!array_key_exists('confirm_password', $data)){
|
||||
return $this->msg(10001,'confirm_password is miss');
|
||||
}
|
||||
if(!array_key_exists('code', $data)){
|
||||
return $this->msg(10001,'code is miss');
|
||||
}
|
||||
if(!array_key_exists('language', $data)){
|
||||
return $this->msg(10001,'language is miss');
|
||||
}
|
||||
|
||||
if (!preg_match('/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/', $data['data'])) {
|
||||
return $this->msg(10005,'data type is error');
|
||||
}else{
|
||||
if(strlen($data['data']) > 50){
|
||||
return $this->msg(10005,'email too long');
|
||||
}
|
||||
}
|
||||
|
||||
if(!$this->verify_data_is_ok($data['password'],'str')){
|
||||
return $this->msg(10005);
|
||||
return $this->msg(10005,'password type is error');
|
||||
}else{
|
||||
if(!strlen($data['password']) > 50){
|
||||
return $this->msg(10005,'password too long');
|
||||
}else{
|
||||
if($data['password'] != $data['confirm_password']){
|
||||
return $this->msg(10005,'The two passwords entered do not match.');
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['code'],'num')){
|
||||
return $this->msg(10005);
|
||||
if(!array_key_exists($data['language'],$this->language_country)){
|
||||
return $this->msg(10005,'language type is error');
|
||||
}
|
||||
return $this->register_action($data);
|
||||
|
||||
// 查询账号是否已经注册
|
||||
$inspect_repeat = Db::table($this->login_use_db_name['zhanghao'])->where(['email'=>$data['data'],'is_del'=>0])->field('id,token')->find();
|
||||
|
||||
if($inspect_repeat){
|
||||
return $this->msg(10002,'Registration failed. Account already exists.');
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 检查验证码
|
||||
$code_result = $this->check_code($data['data'],$data['code']);
|
||||
if($code_result !== true){
|
||||
return $this->msg(10002,'Verification code is incorrect or invalid.');
|
||||
}
|
||||
|
||||
// 验证完之后
|
||||
$set_data = [];
|
||||
$set_data['password'] = $data['password'];
|
||||
$set_data['email'] = $data['data'];
|
||||
$set_data['head_pic'] = $this->default_head_pic;
|
||||
$set_data['nickname'] = '用户'.time();
|
||||
$set_data['create_time'] = date('Y-m-d H:i:s');
|
||||
$set_data['login_time'] = date('Y-m-d H:i:s');
|
||||
$set_data['language'] = $data['language'];
|
||||
$set_data['token'] = md5($data['data'].$this->create_random_string(12).time());
|
||||
|
||||
$result = Db::table($this->login_use_db_name['zhanghao'])->insertGetId($set_data);
|
||||
if($result){
|
||||
return $this->msg(['token'=>$set_data['token'],'aan_id'=>$result]);
|
||||
}else{
|
||||
return $this->msg(10002);
|
||||
}
|
||||
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// 捕获异常
|
||||
$logContent["flie"] = $e->getFile();
|
||||
|
|
@ -60,21 +131,102 @@ class Login extends Base{
|
|||
public function login(){
|
||||
$data = input('post.');
|
||||
try {
|
||||
if(!array_key_exists('data', $data)){
|
||||
return $this->msg(10001,'data is miss');
|
||||
}
|
||||
if(!array_key_exists('validate_data', $data)){
|
||||
return $this->msg(10001,'validate_data is miss');
|
||||
}
|
||||
if(!array_key_exists('validate_type', $data)){
|
||||
return $this->msg(10001,'validate_type is miss');
|
||||
}
|
||||
if(!array_key_exists('language', $data)){
|
||||
return $this->msg(10001,'language is miss');
|
||||
}
|
||||
|
||||
if (!preg_match('/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/', $data['data'])) {
|
||||
return $this->msg(10005,'data type is error');
|
||||
}else{
|
||||
if(strlen($data['data']) > 50){
|
||||
return $this->msg(10005,'email too long');
|
||||
}
|
||||
}
|
||||
if(!array_key_exists($data['language'],$this->language_country)){
|
||||
return $this->msg(10005,'language type is error');
|
||||
}
|
||||
|
||||
if(!array_key_exists('data', $data) || !array_key_exists('validate_data', $data) || !array_key_exists('validate_type', $data)){
|
||||
return $this->msg(10001);
|
||||
|
||||
$verify_result['email'] = $data['data'];
|
||||
$verify_result['is_del'] = 0;
|
||||
// $verify_result['is_del'] = 0;
|
||||
// 检测校验途径
|
||||
if($data['validate_type'] == 'code'){
|
||||
$code_name = $data['data'];
|
||||
if($this->check_code($code_name,$data['validate_data']) === true){
|
||||
$result = Db::table($this->login_use_db_name['zhanghao'])->where($verify_result)->field('id,token,is_del')->find();
|
||||
if($result){
|
||||
// if($result['is_del'] == 1){
|
||||
// return $this->msg(10002,'该账号已注销');
|
||||
// }
|
||||
Db::table($this->login_use_db_name['zhanghao'])->where(['id'=>$result['id']])->update(['login_time'=>date('Y-m-d H:i:s')]);
|
||||
$return_data = $this->msg(['token'=>$result['token'],'aan_id'=>$result['id']]);
|
||||
}else{
|
||||
$set_data['password'] = '';
|
||||
$set_data['email'] = $data['data'];
|
||||
$set_data['head_pic'] = $this->default_head_pic;
|
||||
$set_data['nickname'] = '用户'.$data['data'];
|
||||
$set_data['create_time'] = date('Y-m-d H:i:s');
|
||||
$set_data['login_time'] = date('Y-m-d H:i:s');
|
||||
$set_data['token'] = md5($data['data'].$this->create_random_string(12).time());
|
||||
$result = Db::table($this->login_use_db_name['zhanghao'])->insertGetId($set_data);
|
||||
if($result){
|
||||
$return_data = $this->msg(['token'=>$set_data['token'],'aan_id'=>$result],'登录成功');
|
||||
}else{
|
||||
$return_data = $this->msg(10002);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$return_data = $this->msg(10002,'登录失败,验证码错误或失效');
|
||||
}
|
||||
}else if($data['validate_type'] == 'password'){
|
||||
// $verify_result['password'] = $data['validate_data'];
|
||||
$result = Db::table($this->login_use_db_name['zhanghao'])->where($verify_result)->field('id,token,password,is_del')->find();
|
||||
if($result){
|
||||
// if($result['is_del'] == 1){
|
||||
// return $this->msg(10002,'该账号已注销');
|
||||
// }
|
||||
if($result['password'] == ''){
|
||||
$return_data = $this->msg(10002,'该账户未设密码,请用验证码登录');
|
||||
}
|
||||
if($data['validate_data'] != $result['password']){
|
||||
$return_data = $this->msg(10002,'账号或密码错误');
|
||||
}else{
|
||||
Db::table($this->login_use_db_name['zhanghao'])->where(['id'=>$result['id']])->update(['login_time'=>date('Y-m-d H:i:s')]);
|
||||
$return_data = $this->msg(['token'=>$result['token'],'aan_id'=>$result['id']],'登录成功');
|
||||
}
|
||||
}else{
|
||||
$return_data = $this->msg(10003,'账号未注册,请先注册');
|
||||
}
|
||||
}else{
|
||||
$return_data = $this->msg(10003,'校验参数错误');
|
||||
}
|
||||
// 验证数据值是否合规
|
||||
if(!$this->verify_data_is_ok($data['data'],'str')){
|
||||
return $this->msg(10005);
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['validate_data'],'str')){
|
||||
return $this->msg(10005);
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['validate_type'],'str')){
|
||||
return $this->msg(10005);
|
||||
}
|
||||
return $this->login_action($data);
|
||||
return $return_data;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// 捕获异常
|
||||
$logContent["flie"] = $e->getFile();
|
||||
|
|
@ -112,6 +264,34 @@ class Login extends Base{
|
|||
if(!$this->verify_data_is_ok($data['code'],'num')){
|
||||
return $this->msg(10005);
|
||||
}
|
||||
|
||||
|
||||
// 检查验证码
|
||||
$code_result = $this->check_code($data['data'],$data['code']);
|
||||
if($code_result !== true){
|
||||
return $this->msg(10003,$code_result);
|
||||
}
|
||||
$t_y = $this->is_tel_email($data['data']);
|
||||
if($t_y !== 'email'){
|
||||
return $this->msg(10003,'账号格式错误');
|
||||
}
|
||||
// 检查账号是否存在
|
||||
$find_data = Db::table($this->login_use_db_name['zhanghao'])->where(['email'=>$data['data']])->field('id,token,password')->find();
|
||||
if(!$find_data){
|
||||
return $this->msg(10003,'未核实到账号信息');
|
||||
}
|
||||
if($find_data['password'] == $data['password']){
|
||||
return $this->msg(10002,'新密码不可与旧密码相同');
|
||||
}
|
||||
$result = Db::table($this->login_use_db_name['zhanghao'])->where(['email'=>$data['data']])->update(['password'=>$data['password']]);
|
||||
if($result){
|
||||
$return_data = $this->msg(['token'=>$find_data['token'],'aan_id'=>$find_data['id']]);
|
||||
}else{
|
||||
$return_data = $this->msg(10002);
|
||||
}
|
||||
return $return_data;
|
||||
|
||||
|
||||
return $this->reset_password_action($data);
|
||||
} catch (\Exception $e) {
|
||||
// 捕获异常
|
||||
|
|
@ -129,79 +309,7 @@ class Login extends Base{
|
|||
}
|
||||
|
||||
}
|
||||
// 微信手机号快捷登录
|
||||
public function wechat_quick_login(){
|
||||
$data = input('post.');
|
||||
try {
|
||||
|
||||
if(!array_key_exists('code', $data)){
|
||||
// return $this->msg(10001,'');
|
||||
return $this->msg(10001,'code is miss');
|
||||
}
|
||||
if(!array_key_exists('encryptedData', $data)){
|
||||
return $this->msg(10001,'encryptedData is miss');
|
||||
}
|
||||
if(!array_key_exists('iv', $data)){
|
||||
return $this->msg(10001,'iv is miss');
|
||||
}
|
||||
// 校验参数
|
||||
if (empty($data['code'])) {
|
||||
return $this->msg(10001,'code is miss.');
|
||||
}
|
||||
if (empty($data['encryptedData'])) {
|
||||
return $this->msg(10001,'encryptedData is miss.');
|
||||
}
|
||||
if (empty($data['iv'])) {
|
||||
return $this->msg(10001,'iv is miss.');
|
||||
}
|
||||
|
||||
// 调用Wechat服务类处理微信登录逻辑
|
||||
$wechatService = new Wechat();
|
||||
$result = $wechatService->handleWechatLogin($data['code'], $data['encryptedData'], $data['iv']);
|
||||
|
||||
if($result['code'] == 0){
|
||||
$user_data = Db::table($this->login_use_db_name['zhanghao'])->where(['tel'=>$result['data']['phoneNumber']])->field('token,id,is_del')->find();
|
||||
// dump($result);
|
||||
// die;
|
||||
if($user_data){
|
||||
if($user_data['is_del'] == 1){
|
||||
return $this->msg(10002,'该账号已注销');
|
||||
}
|
||||
Db::table($this->login_use_db_name['zhanghao'])->where(['token'=>$user_data['token']])->update(['login_time'=>date('Y-m-d H:i:s')]);
|
||||
return $this->msg(['token'=>$user_data['token'],'aan_id'=>$user_data['id']]);
|
||||
}else{
|
||||
$set_data['password'] = '';
|
||||
$set_data['tel'] = $result['data']['phoneNumber'];
|
||||
$set_data['head_pic'] = $this->default_head_pic;
|
||||
$set_data['nickname'] = '用户'.$result['data']['phoneNumber'];
|
||||
$set_data['create_time'] = date('Y-m-d H:i:s');
|
||||
$set_data['login_time'] = date('Y-m-d H:i:s');
|
||||
$set_data['token'] = md5($result['data']['phoneNumber'].$this->create_random_string(12).time());
|
||||
$set_user_result = Db::table($this->login_use_db_name['zhanghao'])->insertGetId($set_data);
|
||||
if($set_user_result){
|
||||
return $this->msg(['token'=>$set_data['token'],'aan_id'=>$set_user_result],'登录成功');
|
||||
}else{
|
||||
return $this->msg(10002);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
return $this->msg($result['code'],$result['msg']);
|
||||
}
|
||||
} 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'] .= "方法: " . __METHOD__ . "\n";
|
||||
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||
$this->record_api_log($data, $logContent, null);
|
||||
return $this->msg(99999);
|
||||
}
|
||||
}
|
||||
|
||||
// 退出登录操作
|
||||
public function quit_account(){
|
||||
try {
|
||||
|
|
@ -288,229 +396,34 @@ class Login extends Base{
|
|||
if(!array_key_exists('data', $data)){
|
||||
return $this->msg(10001);
|
||||
}
|
||||
|
||||
// 验证是手机还是邮箱
|
||||
$montage_data = $this->is_tel_email($data['data']);
|
||||
if($montage_data == false){
|
||||
return $this->msg(10005);
|
||||
}
|
||||
|
||||
if($montage_data != 'email'){
|
||||
return $this->msg(10005,'The account is not an email');
|
||||
}
|
||||
|
||||
if(cache($data['data'])){
|
||||
return $this->msg(10002,'60秒仅可发送一次验证码');
|
||||
if(cache($data['data'].'_reedaw_multilingual')){
|
||||
return $this->msg(10002,'You can only send a verification code once every 60 seconds.');
|
||||
}
|
||||
$num = mt_rand(100000,999999);
|
||||
// 验证是手机还是邮箱
|
||||
$montage_data = $this->is_tel_email($data['data']);
|
||||
if($montage_data == false){
|
||||
return $this->msg(10005,'账号格式错误,不是手机号或者邮箱');
|
||||
}
|
||||
if($montage_data == 'tel'){
|
||||
// 本公司短信
|
||||
// $result = $this->send_tel_code($data['data'],$num);
|
||||
// 阿里云短信
|
||||
$sms_all = new Smsaliyun;
|
||||
$result = $sms_all->send_sms($data['data'],$num);
|
||||
}else{
|
||||
$result = $this->send_email_code([$data['data']],['title'=>'Reedaw验证码','from_user_name'=>'Reedaw验证码','content'=>$num]);
|
||||
}
|
||||
|
||||
$result = $this->send_email_code([$data['data']],['title'=>'CAPTCHA','from_user_name'=>'Wendu','content'=>$num]);
|
||||
if(is_array($result) && $result['code'] == 0){
|
||||
cache($data['data'], $num, $this->code_time);
|
||||
// return $this->msg(['code'=>$num]);
|
||||
cache($data['data'].'_reedaw_multilingual', $num, $this->code_time);
|
||||
return $this->msg([]);
|
||||
}else{
|
||||
return $this->msg(10010,'验证码发送失败');
|
||||
return $this->msg(10010,'Failed to send verification code.');
|
||||
}
|
||||
}
|
||||
###############################################################action################################################################
|
||||
###############################################################action################################################################
|
||||
###############################################################action################################################################
|
||||
public function register_action($data){
|
||||
// 验证是手机还是邮箱
|
||||
$montage_data = $this->is_tel_email($data['data']);
|
||||
if($montage_data == false){
|
||||
return $this->msg(10005);
|
||||
}
|
||||
|
||||
// 查询账号是否已经注册
|
||||
$inspect_repeat = Db::table($this->login_use_db_name['zhanghao'])->where([$montage_data=>$data['data']])->count();
|
||||
if($inspect_repeat > 0){
|
||||
return $this->msg(10002,'注册失败,账号已存在');
|
||||
}
|
||||
// 检查验证码
|
||||
$code_result = $this->check_code($data['data'],$data['code']);
|
||||
if($code_result !== true){
|
||||
return $this->msg(10002,$code_result);
|
||||
}
|
||||
// 验证完之后
|
||||
$set_data = [];
|
||||
if($montage_data == 'tel'){
|
||||
$set_data['tel'] = $data['data'];
|
||||
}else{
|
||||
$set_data['email'] = $data['data'];
|
||||
}
|
||||
$set_data['password'] = $data['password'];
|
||||
$set_data['head_pic'] = $this->default_head_pic;
|
||||
$set_data['nickname'] = '用户'.time();
|
||||
$set_data['create_time'] = date('Y-m-d H:i:s');
|
||||
$set_data['login_time'] = date('Y-m-d H:i:s');
|
||||
$set_data['token'] = md5($data['data'].$this->create_random_string(12).time());
|
||||
$result = Db::table($this->login_use_db_name['zhanghao'])->insertGetId($set_data);
|
||||
if($result){
|
||||
$return_data = $this->msg(['token'=>$set_data['token'],'aan_id'=>$result]);
|
||||
}else{
|
||||
$return_data = $this->msg(10002);
|
||||
}
|
||||
return $return_data;
|
||||
}
|
||||
public function login_action($data){
|
||||
// 检测是否为手机
|
||||
$montage_data = $this->is_tel_email($data['data']);
|
||||
if($montage_data == false){
|
||||
return $this->msg(10005);
|
||||
}
|
||||
$verify_result[$montage_data] = $data['data'];
|
||||
$verify_result['is_del'] = 0;
|
||||
// $verify_result['is_del'] = 0;
|
||||
// 检测校验途径
|
||||
if($data['validate_type'] == 'code'){
|
||||
$code_name = $data['data'];
|
||||
if($this->check_code($code_name,$data['validate_data']) === true){
|
||||
$result = Db::table($this->login_use_db_name['zhanghao'])->where($verify_result)->field('id,token,is_del')->find();
|
||||
if($result){
|
||||
// if($result['is_del'] == 1){
|
||||
// return $this->msg(10002,'该账号已注销');
|
||||
// }
|
||||
Db::table($this->login_use_db_name['zhanghao'])->where(['id'=>$result['id']])->update(['login_time'=>date('Y-m-d H:i:s')]);
|
||||
$return_data = $this->msg(['token'=>$result['token'],'aan_id'=>$result['id']]);
|
||||
}else{
|
||||
$set_data['password'] = '';
|
||||
$set_data[$montage_data] = $data['data'];
|
||||
$set_data['head_pic'] = $this->default_head_pic;
|
||||
$set_data['nickname'] = '用户'.$data['data'];
|
||||
$set_data['create_time'] = date('Y-m-d H:i:s');
|
||||
$set_data['login_time'] = date('Y-m-d H:i:s');
|
||||
$set_data['token'] = md5($data['data'].$this->create_random_string(12).time());
|
||||
$result = Db::table($this->login_use_db_name['zhanghao'])->insertGetId($set_data);
|
||||
if($result){
|
||||
$return_data = $this->msg(['token'=>$set_data['token'],'aan_id'=>$result],'登录成功');
|
||||
}else{
|
||||
$return_data = $this->msg(10002);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$return_data = $this->msg(10002,'登录失败,验证码错误或失效');
|
||||
}
|
||||
}else if($data['validate_type'] == 'password'){
|
||||
// $verify_result['password'] = $data['validate_data'];
|
||||
$result = Db::table($this->login_use_db_name['zhanghao'])->where($verify_result)->field('id,token,password,is_del')->find();
|
||||
if($result){
|
||||
// if($result['is_del'] == 1){
|
||||
// return $this->msg(10002,'该账号已注销');
|
||||
// }
|
||||
if($result['password'] == ''){
|
||||
$return_data = $this->msg(10002,'该账户未设密码,请用验证码登录');
|
||||
}
|
||||
if($data['validate_data'] != $result['password']){
|
||||
$return_data = $this->msg(10002,'账号或密码错误');
|
||||
}else{
|
||||
Db::table($this->login_use_db_name['zhanghao'])->where(['id'=>$result['id']])->update(['login_time'=>date('Y-m-d H:i:s')]);
|
||||
$return_data = $this->msg(['token'=>$result['token'],'aan_id'=>$result['id']],'登录成功');
|
||||
}
|
||||
}else{
|
||||
$return_data = $this->msg(10003,'账号未注册,请先注册');
|
||||
}
|
||||
}else{
|
||||
$return_data = $this->msg(10003,'校验参数错误');
|
||||
}
|
||||
return $return_data;
|
||||
|
||||
}
|
||||
public function reset_password_action($data){
|
||||
// 检查验证码
|
||||
$code_result = $this->check_code($data['data'],$data['code']);
|
||||
if($code_result !== true){
|
||||
return $this->msg(10003,$code_result);
|
||||
}
|
||||
$t_y = $this->is_tel_email($data['data']);
|
||||
if($t_y === false){
|
||||
return $this->msg(10003,'账号格式错误');
|
||||
}
|
||||
// 检查账号是否存在
|
||||
$find_data = Db::table($this->login_use_db_name['zhanghao'])->where([$t_y=>$data['data']])->field('id,token,password')->find();
|
||||
if(!$find_data){
|
||||
return $this->msg(10003,'未核实到账号信息');
|
||||
}
|
||||
if($find_data['password'] == $data['password']){
|
||||
return $this->msg(10002,'新密码不可与旧密码相同');
|
||||
}
|
||||
$result = Db::table($this->login_use_db_name['zhanghao'])->where([$t_y=>$data['data']])->update(['password'=>$data['password']]);
|
||||
if($result){
|
||||
$return_data = $this->msg(['token'=>$find_data['token'],'aan_id'=>$find_data['id']]);
|
||||
}else{
|
||||
$return_data = $this->msg(10002);
|
||||
}
|
||||
return $return_data;
|
||||
}
|
||||
// 发送手机短信(本公司接口)
|
||||
public function send_tel_code($tel,$code){
|
||||
// 初始化cURL会话
|
||||
$ch = curl_init();
|
||||
$headers = [
|
||||
'Accept: application/json',
|
||||
'Content-Type: application/json',
|
||||
];
|
||||
// 设置头部信息
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
// 设置请求的URL
|
||||
$url = "http://sms.ybhdmob.com/Message/Send?token=ybhdmob";
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
// 设置为POST请求
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
// 设置POST数据
|
||||
$postData = array(
|
||||
'phone' => $tel,
|
||||
// 'content' => '【巨天】您好,欢迎使用Reedaw,您的手机验证码是:'.$code.',验证码一分钟内有效,若非本人操作,请忽略本短信'
|
||||
// 'content' => '【郑州品传科技】您好,欢迎使用Reedaw,您的手机验证码是:'.$code.',验证码一分钟内有效,若非本人操作,请忽略本短信'
|
||||
// 'content' => '【每日一称】您好,欢迎使用Reedaw,您的手机验证码是:'.$code.',验证码一分钟内有效,若非本人操作,请忽略本短信'
|
||||
'content' => '【小白健康】您好,欢迎使用Reedaw,您的手机验证码是:'.$code.',验证码一分钟内有效,若非本人操作,请忽略本短信'
|
||||
);
|
||||
$postData = json_encode($postData);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
|
||||
// 设置返回结果不直接输出,而是返回到变量中
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
// 发送请求并获取响应
|
||||
$response = curl_exec($ch);
|
||||
// dump($response);
|
||||
// 检查是否有错误发生
|
||||
if (curl_errno($ch)) {
|
||||
$error_message = curl_error($ch);
|
||||
return "请求错误: " . $error_message;
|
||||
}
|
||||
// 关闭cURL会话
|
||||
curl_close($ch);
|
||||
// 处理响应
|
||||
// dump(json_decode($response,true));
|
||||
if ($response) {
|
||||
return json_decode($response,true);
|
||||
} else {
|
||||
echo "未收到响应";
|
||||
}
|
||||
}
|
||||
// 手机号区分
|
||||
public function getCarrierByPhone($phone) {
|
||||
// 验证手机号格式(11位数字且以1开头)
|
||||
if (!preg_match('/^1[3-9]\d{9}$/', $phone)) {
|
||||
return '无效手机号';
|
||||
}
|
||||
$prefix3 = substr($phone, 0, 3);
|
||||
// 2025年最新3位号段(排除4位号段)
|
||||
$carriers = [
|
||||
'中国移动' => ['134', '135', '136', '137', '138', '139', '150', '151', '152', '157', '158', '159', '178', '182', '183', '184', '187', '188', '195', '197', '198'],
|
||||
'中国联通' => ['130', '131', '132', '155', '156', '166', '175', '176', '185', '186', '196'],
|
||||
'中国电信' => ['133', '153', '173', '177', '180', '181', '189', '190', '191', '193', '199'],
|
||||
'中国广电' => ['192']
|
||||
];
|
||||
foreach ($carriers as $carrier => $segments) {
|
||||
if (in_array($prefix3, $segments)) {
|
||||
return $carrier;
|
||||
}
|
||||
}
|
||||
return '未知运营商';
|
||||
}
|
||||
|
||||
/* 接口说明(发邮件)
|
||||
* $address(收件人的邮箱地址) 数组 格式: ['460834639@qq.com','460834639@qq.com'.......]
|
||||
* $content(邮件的主题数据信息) 数组 格式:['title'=>'123','from_user_name'=>'123','content'=>'123']
|
||||
|
|
@ -549,6 +462,11 @@ class Login extends Base{
|
|||
|
||||
$mail->IsHTML(true); //支持html格式内容
|
||||
|
||||
$huashu1 = 'Wendu';
|
||||
$huashu2 = 'Thank you for choosing Wendu products!';
|
||||
$huashu3 = 'The following 6-digit number is the email verification code. Please enter it in the required field to pass verification.';
|
||||
$huashu4 = '(If you did not request an email verification code, please ignore this message.)';
|
||||
|
||||
$neirong = '<div style="margin: 0; padding: 0;">
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="background: #f3f3f3; min-width: 350px; font-size: 1px; line-height: normal;">
|
||||
|
|
@ -573,7 +491,7 @@ class Login extends Base{
|
|||
<td align="left" valign="top">
|
||||
<div style="height: 39px; line-height: 39px; font-size: 37px;"> </div>
|
||||
<font class="mob_title1" face="\'Source Sans Pro\', sans-serif" color="#1a1a1a" style="font-size: 52px; line-height: 55px; font-weight: 300; letter-spacing: -1.5px;">
|
||||
<span class="mob_title1" style="font-family: \'Nunito\', Arial, Tahoma, Geneva, sans-serif; color: #fb966e; font-size: 48px; line-height: 55px; font-weight: 700; letter-spacing: -1.5px;">Reedaw!</span>
|
||||
<span class="mob_title1" style="font-family: \'Nunito\', Arial, Tahoma, Geneva, sans-serif; color: #fb966e; font-size: 48px; line-height: 55px; font-weight: 700; letter-spacing: -1.5px;">'.$huashu1.'</span>
|
||||
</font>
|
||||
<div style="height: 73px; line-height: 73px; font-size: 71px;"> </div>
|
||||
</td>
|
||||
|
|
@ -585,15 +503,15 @@ class Login extends Base{
|
|||
<td align="left" valign="top">
|
||||
<div style="height: 33px; line-height: 33px; font-size: 31px;"> </div>
|
||||
<font face="\'Nunito\', sans-serif" color="#585858" style="font-size: 24px; line-height: 32px;">
|
||||
<span style="font-family: \'Nunito\', Arial, Tahoma, Geneva, sans-serif; color: #585858; font-size: 24px; line-height: 32px;">感谢您选择锐动产品!</span>
|
||||
<span style="font-family: \'Nunito\', Arial, Tahoma, Geneva, sans-serif; color: #585858; font-size: 24px; line-height: 32px;">'.$huashu2.'</span>
|
||||
</font>
|
||||
<div style="height: 33px; line-height: 33px; font-size: 31px;"> </div>
|
||||
<font face="\'Nunito\', sans-serif" color="#585858" style="font-size: 24px; line-height: 32px;">
|
||||
<span style="font-family: \'Nunito\', Arial, Tahoma, Geneva, sans-serif; color: #585858; font-size: 24px; line-height: 32px;">以下6位数字是邮箱验证码,请在需要的位置填写以通过验证</span>
|
||||
<span style="font-family: \'Nunito\', Arial, Tahoma, Geneva, sans-serif; color: #585858; font-size: 24px; line-height: 32px;">'.$huashu3.'</span>
|
||||
</font>
|
||||
<div style="height: 18px; line-height: 33px; font-size: 31px;"> </div>
|
||||
<font face="\'Nunito\', sans-serif" color="#585858" style="font-size: 24px; line-height: 32px;">
|
||||
<span style="font-family: \'Nunito\', Arial, Tahoma, Geneva, sans-serif; color: #aaaaaa; font-size: 16px; line-height: 32px;">(如果您从未请求发送邮箱验证码,请忽略此邮件)</span>
|
||||
<span style="font-family: \'Nunito\', Arial, Tahoma, Geneva, sans-serif; color: #aaaaaa; font-size: 16px; line-height: 32px;">'.$huashu4.'</span>
|
||||
</font>
|
||||
<div style="height: 33px; line-height: 33px; font-size: 31px;"> </div>
|
||||
<table class="mob_btn" cellpadding="0" cellspacing="0" border="0" style="background: #fb966e; border-radius: 4px;">
|
||||
|
|
@ -663,15 +581,16 @@ class Login extends Base{
|
|||
################################################################other################################################################
|
||||
// 检查验证码
|
||||
public function check_code($data = 18530934717 , $code = 123456){
|
||||
// 默认验证码正确start
|
||||
if($code == 88888888){
|
||||
return true;
|
||||
|
||||
// return true;
|
||||
if(date('Y-m-d H:i:s') <= '2026-04-15 00:00:00' && $code = 888888){
|
||||
return true;
|
||||
}
|
||||
// 默认验证码正确end
|
||||
if(cache($data) == false){
|
||||
|
||||
if(cache($data.'_reedaw_multilingual') == false){
|
||||
return '验证码过期';
|
||||
}else{
|
||||
if($code != cache($data)){
|
||||
if($code != cache($data.'_reedaw_multilingual')){
|
||||
return '验证码错误';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,10 +10,9 @@ use app\NewReedaw2\controller\app\Kitchenscale;
|
|||
class Role extends Base{
|
||||
|
||||
protected $role_db_name = [
|
||||
'zhanghao'=>'app_account_number',
|
||||
'juese'=>'app_user_data',
|
||||
'quyu_card'=>'admin_estimate',
|
||||
'cfc_user'=>'app_user_data'
|
||||
'zhanghao'=>'app_account_number_multilingual',
|
||||
'juese'=>'app_user_data_multilingual',
|
||||
// 'cfc_user'=>'app_user_data'
|
||||
];
|
||||
protected $identity_list = ['P0'=>'陌生人','P1'=>'爸爸','P2'=>'妈妈','P3'=>'大宝','P4'=>'二宝','P5'=>'三宝','P6'=>'四宝','P7'=>'爷爷','P8'=>'奶奶'];
|
||||
protected $grade_list = [
|
||||
|
|
@ -165,50 +164,50 @@ class Role extends Base{
|
|||
|
||||
}
|
||||
// 修改账号信息
|
||||
public function set_my_account_msg(){
|
||||
$data = input('post.');
|
||||
try {
|
||||
// public function set_my_account_msg(){
|
||||
// $data = input('post.');
|
||||
// try {
|
||||
|
||||
if(!array_key_exists('weight', $data) || !array_key_exists('height', $data) || !array_key_exists('birthday', $data) || !array_key_exists('gender', $data) || !array_key_exists('activity_level', $data) || !array_key_exists('token', $data)){
|
||||
return $this->msg(10001);
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||
return $this->msg(10005);
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['weight'],'num')){
|
||||
return $this->msg(10005);
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['height'],'num')){
|
||||
return $this->msg(10005);
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['birthday'],'datetime')){
|
||||
return $this->msg(10005);
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['gender'],'num')){
|
||||
return $this->msg(10005);
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['activity_level'],'num')){
|
||||
return $this->msg(10005);
|
||||
}
|
||||
$return_data = $this->set_my_account_msg_action($data);
|
||||
// 成功
|
||||
$this->record_api_log($data, null, $return_data);
|
||||
return $return_data;
|
||||
} catch (\Exception $e) {
|
||||
// 捕获异常
|
||||
$logContent["flie"] = $e->getFile();
|
||||
$logContent["line"] = $e->getLine();
|
||||
$logContent['all_content'] = "异常信息:\n";
|
||||
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||
$this->record_api_log($data, $logContent, null);
|
||||
return $this->msg(99999);
|
||||
}
|
||||
// if(!array_key_exists('weight', $data) || !array_key_exists('height', $data) || !array_key_exists('birthday', $data) || !array_key_exists('gender', $data) || !array_key_exists('activity_level', $data) || !array_key_exists('token', $data)){
|
||||
// return $this->msg(10001);
|
||||
// }
|
||||
// if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||
// return $this->msg(10005);
|
||||
// }
|
||||
// if(!$this->verify_data_is_ok($data['weight'],'num')){
|
||||
// return $this->msg(10005);
|
||||
// }
|
||||
// if(!$this->verify_data_is_ok($data['height'],'num')){
|
||||
// return $this->msg(10005);
|
||||
// }
|
||||
// if(!$this->verify_data_is_ok($data['birthday'],'datetime')){
|
||||
// return $this->msg(10005);
|
||||
// }
|
||||
// if(!$this->verify_data_is_ok($data['gender'],'num')){
|
||||
// return $this->msg(10005);
|
||||
// }
|
||||
// if(!$this->verify_data_is_ok($data['activity_level'],'num')){
|
||||
// return $this->msg(10005);
|
||||
// }
|
||||
// $return_data = $this->set_my_account_msg_action($data);
|
||||
// // 成功
|
||||
// $this->record_api_log($data, null, $return_data);
|
||||
// return $return_data;
|
||||
// } catch (\Exception $e) {
|
||||
// // 捕获异常
|
||||
// $logContent["flie"] = $e->getFile();
|
||||
// $logContent["line"] = $e->getLine();
|
||||
// $logContent['all_content'] = "异常信息:\n";
|
||||
// $logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||
// $logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||
// $logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||
// $logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||
// $logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||
// $this->record_api_log($data, $logContent, null);
|
||||
// return $this->msg(99999);
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
|
@ -310,9 +309,7 @@ class Role extends Base{
|
|||
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||
return $this->msg(10005,'token type error');
|
||||
}
|
||||
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||||
return $this->msg(10005,'aud_id type error');
|
||||
}
|
||||
|
||||
if(!$this->verify_data_is_ok($data['birthday'],'datetime')){
|
||||
return $this->msg(10005,'birthday type error');
|
||||
}
|
||||
|
|
@ -373,7 +370,7 @@ class Role extends Base{
|
|||
return $this->msg(99999);
|
||||
}
|
||||
}
|
||||
// 修改昵称
|
||||
// 修改账号昵称
|
||||
public function update_my_nickname(){
|
||||
|
||||
$data = input('post.');
|
||||
|
|
@ -477,9 +474,9 @@ class Role extends Base{
|
|||
public function get_my_account_msg_action($data){
|
||||
$result = Db::table($this->role_db_name['zhanghao'])->where(['token'=>$data['token'],'is_del'=>0])->find();
|
||||
$cfc = Db::connect('cfc_db');
|
||||
$cfc_user = $cfc->table($this->role_db_name['cfc_user'])
|
||||
->where(['token'=>$data['token']])
|
||||
->find(); // 然后获取结果
|
||||
// $cfc_user = $cfc->table($this->role_db_name['cfc_user'])
|
||||
// ->where(['token'=>$data['token']])
|
||||
// ->find(); // 然后获取结果
|
||||
|
||||
//
|
||||
if($result){
|
||||
|
|
@ -491,21 +488,22 @@ class Role extends Base{
|
|||
'nickname'=>$result['nickname'],
|
||||
'head_pic'=>$result['head_pic'],
|
||||
];
|
||||
if($cfc_user){
|
||||
// dump($result);
|
||||
// $return_data['weight'] = 0;
|
||||
// $return_data['height'] = 0;
|
||||
// $return_data['birthday'] = '';
|
||||
// $return_data['gender'] = '';
|
||||
// $return_data['activity_level'] = '';
|
||||
// if($cfc_user){
|
||||
// // dump($result);
|
||||
|
||||
$return_data['weight'] = $cfc_user['weight'];
|
||||
$return_data['height'] = $cfc_user['height'];
|
||||
$return_data['birthday'] = $cfc_user['birthday'];
|
||||
$return_data['gender'] = $cfc_user['gender'];
|
||||
$return_data['activity_level'] = $cfc_user['activity_level'];
|
||||
}else{
|
||||
$return_data['weight'] = 0;
|
||||
$return_data['height'] = 0;
|
||||
$return_data['birthday'] = '';
|
||||
$return_data['gender'] = '';
|
||||
$return_data['activity_level'] = '';
|
||||
}
|
||||
// $return_data['weight'] = $cfc_user['weight'];
|
||||
// $return_data['height'] = $cfc_user['height'];
|
||||
// $return_data['birthday'] = $cfc_user['birthday'];
|
||||
// $return_data['gender'] = $cfc_user['gender'];
|
||||
// $return_data['activity_level'] = $cfc_user['activity_level'];
|
||||
// }else{
|
||||
|
||||
// }
|
||||
return $this->msg($return_data);
|
||||
}else{
|
||||
return $this->msg(10002);
|
||||
|
|
@ -518,11 +516,11 @@ class Role extends Base{
|
|||
return $this->msg(10001,$validate_result);
|
||||
}
|
||||
$montage_data = $this->is_tel_email($data['data']);
|
||||
if($montage_data == false){
|
||||
if($montage_data != 'email'){
|
||||
return $this->msg(10005);
|
||||
}
|
||||
$result = Db::table($this->role_db_name['zhanghao'])->where(['token'=>$data['token'],'is_del'=>0])->update([
|
||||
$montage_data=>$data['data'],
|
||||
'email'=>$data['data'],
|
||||
'update_time'=>date('Y-m-d H:i:s')
|
||||
]);
|
||||
if($result){
|
||||
|
|
@ -548,62 +546,62 @@ class Role extends Base{
|
|||
return $this->msg(10002);
|
||||
}
|
||||
}
|
||||
public function set_my_account_msg_action($data){
|
||||
$cfc = Db::connect('cfc_db');
|
||||
$user = Db::table($this->role_db_name['zhanghao'])->where(['token'=>$data['token'],'is_del'=>0])->find();
|
||||
if($user){
|
||||
$cfc_user = $cfc->table($this->role_db_name['cfc_user'])
|
||||
->where(['token'=>$data['token']])
|
||||
->find(); // 然后获取结果
|
||||
if($cfc_user){
|
||||
$cfc_user = $cfc->table($this->role_db_name['cfc_user'])
|
||||
->where(['token'=>$data['token']])
|
||||
->update([
|
||||
'weight'=>$data['weight'],
|
||||
'height'=>$data['height'],
|
||||
'birthday'=>$data['birthday'],
|
||||
'gender'=>$data['gender'],
|
||||
'activity_level'=>$data['activity_level'],
|
||||
]);
|
||||
}else{
|
||||
$add_data = [
|
||||
'token'=>$data['token'],
|
||||
'nickname'=>$user['nickname'],
|
||||
'gender'=>$data['gender'],
|
||||
'height'=>$data['height'],
|
||||
'weight'=>$data['weight'],
|
||||
'birthday'=>$data['birthday'],
|
||||
'activity_level'=>$data['activity_level'],
|
||||
];
|
||||
$user_age = $this->calculate_age($data['birthday']);
|
||||
if($data['gender'] == 2){
|
||||
if($user_age <= 18){
|
||||
$data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman1.png";
|
||||
}else if($user_age <= 39 && $user_age > 18){
|
||||
$data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman2.png";
|
||||
}else if($user_age <= 59 && $user_age > 39){
|
||||
$data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman3.png";
|
||||
}else if($user_age >= 60){
|
||||
$data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman4.png";
|
||||
}
|
||||
}else{
|
||||
if($user_age <= 18){
|
||||
$data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man1.png";
|
||||
}else if($user_age <= 39 && $user_age > 18){
|
||||
$data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man2.png";
|
||||
}else if($user_age <= 59 && $user_age > 39){
|
||||
$data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man3.png";
|
||||
}else if($user_age >= 60){
|
||||
$data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man4.png";
|
||||
}
|
||||
}
|
||||
$cfc_user = $cfc->table($this->role_db_name['cfc_user'])->insert($add_data);
|
||||
}
|
||||
}else{
|
||||
return $this->msg(10003);
|
||||
}
|
||||
// public function set_my_account_msg_action($data){
|
||||
// $cfc = Db::connect('cfc_db');
|
||||
// $user = Db::table($this->role_db_name['zhanghao'])->where(['token'=>$data['token'],'is_del'=>0])->find();
|
||||
// if($user){
|
||||
// $cfc_user = $cfc->table($this->role_db_name['cfc_user'])
|
||||
// ->where(['token'=>$data['token']])
|
||||
// ->find(); // 然后获取结果
|
||||
// if($cfc_user){
|
||||
// $cfc_user = $cfc->table($this->role_db_name['cfc_user'])
|
||||
// ->where(['token'=>$data['token']])
|
||||
// ->update([
|
||||
// 'weight'=>$data['weight'],
|
||||
// 'height'=>$data['height'],
|
||||
// 'birthday'=>$data['birthday'],
|
||||
// 'gender'=>$data['gender'],
|
||||
// 'activity_level'=>$data['activity_level'],
|
||||
// ]);
|
||||
// }else{
|
||||
// $add_data = [
|
||||
// 'token'=>$data['token'],
|
||||
// 'nickname'=>$user['nickname'],
|
||||
// 'gender'=>$data['gender'],
|
||||
// 'height'=>$data['height'],
|
||||
// 'weight'=>$data['weight'],
|
||||
// 'birthday'=>$data['birthday'],
|
||||
// 'activity_level'=>$data['activity_level'],
|
||||
// ];
|
||||
// $user_age = $this->calculate_age($data['birthday']);
|
||||
// if($data['gender'] == 2){
|
||||
// if($user_age <= 18){
|
||||
// $data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman1.png";
|
||||
// }else if($user_age <= 39 && $user_age > 18){
|
||||
// $data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman2.png";
|
||||
// }else if($user_age <= 59 && $user_age > 39){
|
||||
// $data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman3.png";
|
||||
// }else if($user_age >= 60){
|
||||
// $data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman4.png";
|
||||
// }
|
||||
// }else{
|
||||
// if($user_age <= 18){
|
||||
// $data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man1.png";
|
||||
// }else if($user_age <= 39 && $user_age > 18){
|
||||
// $data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man2.png";
|
||||
// }else if($user_age <= 59 && $user_age > 39){
|
||||
// $data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man3.png";
|
||||
// }else if($user_age >= 60){
|
||||
// $data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man4.png";
|
||||
// }
|
||||
// }
|
||||
// $cfc_user = $cfc->table($this->role_db_name['cfc_user'])->insert($add_data);
|
||||
// }
|
||||
// }else{
|
||||
// return $this->msg(10003);
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
|
@ -627,34 +625,6 @@ class Role extends Base{
|
|||
if($is_nickname_ok>0){
|
||||
return $this->msg(10002,'该角色已存在');
|
||||
}
|
||||
// if($parameter['measure_model'] == 1){
|
||||
// if(!array_key_exists('grade',$data) || !array_key_exists('identity_id',$data) || !array_key_exists('address',$data)){
|
||||
// return $this->msg(10001);
|
||||
// }
|
||||
// if(!array_key_exists($data['identity_id'],$this->identity_lis3t)){
|
||||
// return $this->msg(10005,'身份信息错误');
|
||||
// }
|
||||
// if(!array_key_exists($data['grade'],$this->grade_list2)){
|
||||
// return $this->msg(10005,'年级信息错误');
|
||||
// }
|
||||
// $parameter['grade'] = $data['grade'];
|
||||
// $parameter['identity_id'] = $data['identity_id'];
|
||||
// $parameter['identity_name'] = $this->identity_list[$data['identity_id']];
|
||||
// $parameter['address'] = $data['address'];
|
||||
// $address_data = Db::table($this->role_db_name['quyu_card'])->where(['province'=>explode(',',$parameter['address'])[0],'is_del'=>0])->field('id,recommend_cards')->find();
|
||||
// $parameter['card_order'] = $address_data['recommend_cards'];
|
||||
// }else{
|
||||
// $parameter['grade'] = 'nothing';
|
||||
// $parameter['identity_id'] = 'P0';
|
||||
// $parameter['identity_name'] = '陌生人';
|
||||
// $parameter['address'] = '';
|
||||
// }
|
||||
// if($parameter['identity_id'] != 'P0'){
|
||||
// $result = Db::table($this->role_db_name['juese'])->where(['identity_id'=>$parameter['identity_id'],'aan_id'=>$parameter['aan_id'],'is_del'=>0])->count();
|
||||
// if($result>0){
|
||||
// return $this->msg(10005,'该身份已存在');
|
||||
// }
|
||||
// }
|
||||
$return_result = Db::table($this->role_db_name['juese'])->insertGetId($parameter);
|
||||
if($return_result){
|
||||
return $this->msg(['aud_id'=>$return_result]);
|
||||
|
|
@ -676,29 +646,7 @@ class Role extends Base{
|
|||
$parameter['head_pic'] = $data['gender'] == 2?'http://tc.pcxbc.com/tsf/2.png':'http://tc.pcxbc.com/tsf/1.png';
|
||||
$parameter['last_update_time'] = date('Y-m-d H:i:s');
|
||||
$parameter['activity_level'] = $data['activity_level'];
|
||||
// if($parameter['measure_model'] == 1){
|
||||
// if(!array_key_exists('grade',$data) || !array_key_exists('identity_id',$data) || !array_key_exists('address',$data)){
|
||||
// return $this->msg(10001);
|
||||
// }
|
||||
// if(!array_key_exists($data['identity_id'],$this->identity_list)){
|
||||
// return $this->msg(10005,'身份信息错误');
|
||||
// }
|
||||
// if(!array_key_exists($data['grade'],$this->grade_list2)){
|
||||
// return $this->msg(10005,'年级信息错误');
|
||||
// }
|
||||
// $parameter['grade'] = $data['grade'];
|
||||
// $parameter['identity_id'] = $data['identity_id'];
|
||||
// $parameter['identity_name'] = $this->identity_list[$data['identity_id']];
|
||||
// $parameter['address'] = $data['address'];
|
||||
// if($parameter['identity_id'] != 'P0'){
|
||||
// $result = Db::table($this->role_db_name['juese'])->where(['identity_id'=>$parameter['identity_id'],'aan_id'=>$aan_id['id'],'is_del'=>0])->count();
|
||||
// if($result>0){
|
||||
// return $this->msg(10005,'该身份已存在');
|
||||
// }
|
||||
// }
|
||||
// $address_data = Db::table($this->role_db_name['quyu_card'])->where(['province'=>explode(',',$parameter['address'])[0],'is_del'=>0])->field('id,recommend_cards')->find();
|
||||
// $parameter['card_order'] = $address_data['recommend_cards'];
|
||||
// }
|
||||
|
||||
|
||||
$return_result = Db::table($this->role_db_name['juese'])->where(['id'=>$data['id']])->update($parameter);
|
||||
if($return_result){
|
||||
|
|
@ -839,27 +787,27 @@ class Role extends Base{
|
|||
|
||||
}
|
||||
}
|
||||
// if($user_all_data['gender'] == 2){
|
||||
// if($user_all_data['age'] <= 18){
|
||||
// $user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman1.png";
|
||||
// }else if($user_all_data['age'] <= 39 && $user_all_data['age'] > 18){
|
||||
// $user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman2.png";
|
||||
// }else if($user_all_data['age'] <= 59 && $user_all_data['age'] > 39){
|
||||
// $user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman3.png";
|
||||
// }else if($user_all_data['age'] >= 60){
|
||||
// $user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman4.png";
|
||||
// }
|
||||
// }else{
|
||||
// if($user_all_data['age'] <= 18){
|
||||
// $user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man1.png";
|
||||
// }else if($user_all_data['age'] <= 39 && $user_all_data['age'] > 18){
|
||||
// $user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man2.png";
|
||||
// }else if($user_all_data['age'] <= 59 && $user_all_data['age'] > 39){
|
||||
// $user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man3.png";
|
||||
// }else if($user_all_data['age'] >= 60){
|
||||
// $user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man4.png";
|
||||
// }
|
||||
// }
|
||||
if($user_all_data['gender'] == 2){
|
||||
if($user_all_data['age'] <= 18){
|
||||
$user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman1.png";
|
||||
}else if($user_all_data['age'] <= 39 && $user_all_data['age'] > 18){
|
||||
$user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman2.png";
|
||||
}else if($user_all_data['age'] <= 59 && $user_all_data['age'] > 39){
|
||||
$user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman3.png";
|
||||
}else if($user_all_data['age'] >= 60){
|
||||
$user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/woman4.png";
|
||||
}
|
||||
}else{
|
||||
if($user_all_data['age'] <= 18){
|
||||
$user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man1.png";
|
||||
}else if($user_all_data['age'] <= 39 && $user_all_data['age'] > 18){
|
||||
$user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man2.png";
|
||||
}else if($user_all_data['age'] <= 59 && $user_all_data['age'] > 39){
|
||||
$user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man3.png";
|
||||
}else if($user_all_data['age'] >= 60){
|
||||
$user_all_data['head_pic'] = "https://tc.pcxbc.com/kitchenscale_all/man4.png";
|
||||
}
|
||||
}
|
||||
|
||||
$kitchenscale = NEW Kitchenscale;
|
||||
$user_all_data['food_count'] = $kitchenscale->get_countfoot_content_action(['token'=>$data['token'],'aud_id'=>$user_all_data['aud_id'],'time'=>date('Y-m-d')]);
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
namespace app\NewReedaw2\controller\app;
|
||||
|
||||
use think\Db;
|
||||
use app\NewReedaw2\controller\app\Cardparts;
|
||||
use app\NewReedaw2\controller\app\Calculatebody;
|
||||
|
||||
class Userbody extends Base{
|
||||
|
||||
|
|
|
|||
|
|
@ -1,119 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace app\NewReedaw2\controller\app;
|
||||
|
||||
class Wechat extends Base{
|
||||
// reedaw的小程序信息
|
||||
private $app_id = 'wx9c0b7a436ada6d1e'; // 微信小程序的AppID
|
||||
private $app_secret = 'ed7cda5874f0eef3360e782a3db73c80'; // 微信小程序的AppSecret
|
||||
|
||||
// ed7cda5874f0eef3360e782a3db73c80
|
||||
|
||||
################################################################接口################################################################
|
||||
################################################################接口################################################################
|
||||
################################################################接口################################################################
|
||||
/**
|
||||
* 处理微信登录
|
||||
*
|
||||
* @param string $code 微信登录凭证
|
||||
* @param string $encryptedData 加密的用户信息
|
||||
* @param string $iv 解密算法的初始向量
|
||||
* @return array
|
||||
*/
|
||||
public function handleWechatLogin($code, $encryptedData, $iv)
|
||||
{
|
||||
// try {
|
||||
// 1. 通过code获取openid和session_key
|
||||
$sessionData = $this->getSessionKey($code);
|
||||
|
||||
if (empty($sessionData['openid']) || empty($sessionData['session_key'])) {
|
||||
// throw new Exception('获取openid或session_key失败');
|
||||
// return false;
|
||||
// return $this->msg(10001);
|
||||
return ['code'=>10002,'msg'=>'获取openid或session_key失败'];
|
||||
}
|
||||
|
||||
// 2. 解密用户信息
|
||||
$userInfo = $this->decryptData($encryptedData, $iv, $sessionData['session_key']);
|
||||
|
||||
if(array_key_exists('phoneNumber',$userInfo)){
|
||||
return ['code'=>0,'msg'=>'seccess','data'=>$userInfo];
|
||||
}else{
|
||||
return ['code'=>10002,'msg'=>'解密用户信息失败'];
|
||||
}
|
||||
// if (empty($userInfo['phoneNumber'])) {
|
||||
// // throw new Exception('获取手机号失败');
|
||||
|
||||
// }else{
|
||||
|
||||
// }
|
||||
|
||||
// // 3. 保存或更新用户信息
|
||||
// $user = User::where('openid', $sessionData['openid'])->find();
|
||||
// if (!$user) {
|
||||
// $user = new User();
|
||||
// $user->openid = $sessionData['openid'];
|
||||
// }
|
||||
// $user->phone = $userInfo['phoneNumber'];
|
||||
// $user->save();
|
||||
|
||||
// 返回成功信息
|
||||
// return ['code' => 0, 'msg' => '登录成功', 'data' => $user];
|
||||
// } catch (Exception $e) {
|
||||
// // 返回错误信息
|
||||
// return ['code' => 500, 'msg' => $e->getMessage()];
|
||||
// }
|
||||
}
|
||||
/**
|
||||
* 通过code获取openid和session_key
|
||||
*
|
||||
* @param string $code
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
private function getSessionKey($code)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/sns/jscode2session?appid={$this->app_id}&secret={$this->app_secret}&js_code={$code}&grant_type=authorization_code";
|
||||
$result = file_get_contents($url);
|
||||
$data = json_decode($result, true);
|
||||
|
||||
if (isset($data['openid']) && isset($data['session_key'])) {
|
||||
return $data;
|
||||
} else {
|
||||
return ['code'=>10002,'msg'=>'获取openid或session_key失败'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密用户信息
|
||||
*
|
||||
* @param string $encryptedData
|
||||
* @param string $iv
|
||||
* @param string $sessionKey
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
private function decryptData($encryptedData, $iv, $sessionKey)
|
||||
{
|
||||
// require_once 'wx_crypt/WXBizDataCrypt.php'; // 引入微信解密类
|
||||
// require_once env('root_path') . 'extend/wx_crypt/WXBizDataCrypt.php';
|
||||
// dump(ROOT_PATH . 'extend\wx_crypt\wxBizDataCrypt.php');
|
||||
require_once ROOT_PATH . 'extend\wx_crypt\wxBizDataCrypt.php';
|
||||
|
||||
$pc = new \WXBizDataCrypt($this->app_id, $sessionKey);
|
||||
$errCode = $pc->decryptData($encryptedData, $iv, $data);
|
||||
|
||||
if ($errCode == 0) {
|
||||
return json_decode($data, true);
|
||||
} else {
|
||||
return ['code'=>10002,'msg'=>'解密用户信息失败('.$errCode.')'];
|
||||
// throw new Exception('解密失败: ' . $errCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 注册
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -9,9 +9,9 @@ use app\NewReedaw2\controller\app\Calculatebody;
|
|||
class Body extends Base{
|
||||
|
||||
protected $body_db_name = [
|
||||
'zhanghao'=>'app_account_number',
|
||||
'juese'=>'app_user_data',
|
||||
'body_data'=>'app_card_body_data',
|
||||
'zhanghao'=>'app_account_number_multilingual',
|
||||
'juese'=>'app_user_data_multilingual',
|
||||
'body_data'=>'app_card_body_data_new_multilingual',
|
||||
'bmi'=>'pc_bmistand',
|
||||
'heigh'=>'pc_heightstand',
|
||||
'weigh'=>'pc_weightstand',
|
||||
|
|
@ -83,8 +83,9 @@ class Body extends Base{
|
|||
public function body_report(){
|
||||
// phpinfo();
|
||||
// die;
|
||||
$data = input('post.');
|
||||
try {
|
||||
$data = input('post.');
|
||||
|
||||
if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data)){
|
||||
return $this->msg(10001);
|
||||
}
|
||||
|
|
@ -209,8 +210,9 @@ class Body extends Base{
|
|||
}
|
||||
// 获取历史列表(分页)
|
||||
public function record_list_page(){
|
||||
$data = input('post.');
|
||||
try {
|
||||
$data = input('post.');
|
||||
|
||||
if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data) || !array_key_exists('page', $data)){
|
||||
return $this->msg(10001);
|
||||
}
|
||||
|
|
@ -240,8 +242,9 @@ class Body extends Base{
|
|||
}
|
||||
// 获取历史列表(分组)
|
||||
public function record_list_group(){
|
||||
$data = input('post.');
|
||||
try {
|
||||
$data = input('post.');
|
||||
|
||||
if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data) || !array_key_exists('s_time', $data) || !array_key_exists('e_time', $data)){
|
||||
return $this->msg(10001);
|
||||
}
|
||||
|
|
@ -274,8 +277,9 @@ class Body extends Base{
|
|||
}
|
||||
// 历史记录(详细)
|
||||
public function detailed_record(){
|
||||
$data = input('post.');
|
||||
try {
|
||||
$data = input('post.');
|
||||
|
||||
if(!array_key_exists('token', $data) || !array_key_exists('id', $data)){
|
||||
return $this->msg(10001);
|
||||
}
|
||||
|
|
@ -1027,174 +1027,187 @@ Route::any('/reedaw/privacy_policy', 'app/NewReedaw/app.index/privacy_policy');
|
|||
################################################################接口(API)################################################################
|
||||
|
||||
|
||||
// 检测版本及判断是否登录失效
|
||||
Route::any('/reedaw2/ceshiyong', 'app/NewReedaw/app.base/ceshiyong');
|
||||
// // 检测版本及判断是否登录失效
|
||||
// Route::any('/reedaw2/ceshiyong', 'app/NewReedaw2/app.base/ceshiyong');
|
||||
|
||||
|
||||
// 检测版本及判断是否登录失效
|
||||
Route::any('/reedaw2/login_invalid_version', 'app/NewReedaw2/app.index/login_invalid_version');
|
||||
// 默认配置
|
||||
Route::any('/reedaw2/config', 'app/NewReedaw2/app.index/config');
|
||||
|
||||
################################################################登录注册部分(OK)
|
||||
// 检测版本及判断是否登录失效
|
||||
Route::any('/reedaw2/login_invalid_version', 'app/NewReedaw/app.index/login_invalid_version');
|
||||
|
||||
// 注册账号
|
||||
Route::any('/reedaw2/register', 'app/NewReedaw/app.login/register');
|
||||
Route::any('/reedaw2/register', 'app/NewReedaw2/app.login/register');
|
||||
// 登录账号
|
||||
Route::any('/reedaw2/login', 'app/NewReedaw/app.login/login');
|
||||
Route::any('/reedaw2/login', 'app/NewReedaw2/app.login/login');
|
||||
// 重置密码
|
||||
Route::any('/reedaw2/reset_password', 'app/NewReedaw/app.login/reset_password');
|
||||
Route::any('/reedaw2/reset_password', 'app/NewReedaw2/app.login/reset_password');
|
||||
// 微信快捷登录
|
||||
Route::any('/reedaw2/wechat_quick_login', 'app/NewReedaw/app.login/wechat_quick_login');
|
||||
// Route::any('/reedaw2/wechat_quick_login', 'app/NewReedaw2/app.login/wechat_quick_login');
|
||||
// 退出登录
|
||||
Route::any('/reedaw2/quit_account', 'app/NewReedaw/app.login/quit_account');
|
||||
Route::any('/reedaw2/quit_account', 'app/NewReedaw2/app.login/quit_account');
|
||||
// 账号注销
|
||||
Route::any('/reedaw2/delete_account', 'app/NewReedaw/app.login/delete_account');
|
||||
Route::any('/reedaw2/delete_account', 'app/NewReedaw2/app.login/delete_account');
|
||||
// 发送验证码
|
||||
Route::any('/reedaw2/send_phone_email_code', 'app/NewReedaw/app.login/send_phone_email_code');
|
||||
Route::any('/reedaw2/send_phone_email_code', 'app/NewReedaw2/app.login/send_phone_email_code');
|
||||
|
||||
################################################################首页(其他)
|
||||
// 默认配置
|
||||
Route::any('/reedaw2/config', 'app/NewReedaw/app.index/config');
|
||||
|
||||
// 获取角色列表
|
||||
Route::any('/reedaw2/get_user_list', 'app/NewReedaw/app.index/get_user_list');
|
||||
Route::any('/reedaw2/get_user_list', 'app/NewReedaw2/app.index/get_user_list');
|
||||
|
||||
################################################################首页(身体数据)
|
||||
// 角色报告(简要)
|
||||
Route::any('/reedaw2/body_report_brief', 'app/NewReedaw/app.Userbody/body_report_brief');
|
||||
Route::any('/reedaw2/body_report_brief', 'app/NewReedaw2/app.Userbody/body_report_brief');
|
||||
// 角色报告(详细)
|
||||
Route::any('/reedaw2/body_report_detailed', 'app/NewReedaw/app.Userbody/body_report_detailed');
|
||||
Route::any('/reedaw2/body_report_detailed', 'app/NewReedaw2/app.Userbody/body_report_detailed');
|
||||
// 角色报告(深度)
|
||||
Route::any('/reedaw2/body_report_depth', 'app/NewReedaw/app.Userbody/body_report_depth');
|
||||
Route::any('/reedaw2/body_report_depth', 'app/NewReedaw2/app.Userbody/body_report_depth');
|
||||
// 手动记录
|
||||
Route::any('/reedaw2/manual_record', 'app/NewReedaw/app.Userbody/manual_record');
|
||||
Route::any('/reedaw2/manual_record', 'app/NewReedaw2/app.Userbody/manual_record');
|
||||
// 设备记录
|
||||
Route::any('/reedaw2/device_record', 'app/NewReedaw/app.Userbody/device_record');
|
||||
Route::any('/reedaw2/device_record', 'app/NewReedaw2/app.Userbody/device_record');
|
||||
// 修改目标体重
|
||||
Route::any('/reedaw2/set_target_weight', 'app/NewReedaw/app.Userbody/set_target_weight');
|
||||
Route::any('/reedaw2/set_target_weight', 'app/NewReedaw2/app.Userbody/set_target_weight');
|
||||
// 修改初始体重
|
||||
Route::any('/reedaw2/set_initial_weight', 'app/NewReedaw/app.Userbody/set_initial_weight');
|
||||
Route::any('/reedaw2/set_initial_weight', 'app/NewReedaw2/app.Userbody/set_initial_weight');
|
||||
// 历史数据(分页)
|
||||
Route::any('/reedaw2/history_list_page', 'app/NewReedaw/app.Userbody/history_list_page');
|
||||
Route::any('/reedaw2/history_list_page', 'app/NewReedaw2/app.Userbody/history_list_page');
|
||||
// 历史详情
|
||||
Route::any('/reedaw2/history_detailed', 'app/NewReedaw/app.Userbody/history_detailed');
|
||||
Route::any('/reedaw2/history_detailed', 'app/NewReedaw2/app.Userbody/history_detailed');
|
||||
// 删除历史数据
|
||||
Route::any('/reedaw2/history_del', 'app/NewReedaw/app.Userbody/history_del');
|
||||
Route::any('/reedaw2/history_del', 'app/NewReedaw2/app.Userbody/history_del');
|
||||
// 曲线详情
|
||||
Route::any('/reedaw2/curve_detailed', 'app/NewReedaw/app.Userbody/curve_detailed');
|
||||
Route::any('/reedaw2/curve_detailed', 'app/NewReedaw2/app.Userbody/curve_detailed');
|
||||
|
||||
|
||||
|
||||
################################################################首页(饮食数据)
|
||||
// 根据用户获取他的饮食信息
|
||||
// Route::any('/reedaw2/user_diet_content', 'app/NewReedaw/app.Kitchenscale/user_diet_content');
|
||||
// Route::any('/reedaw2/user_diet_content', 'app/NewReedaw2/app.Kitchenscale/user_diet_content');
|
||||
// 获取记食器板块内容
|
||||
Route::any('/reedaw2/get_countfoot_content', 'app/NewReedaw/app.Kitchenscale/get_countfoot_content');
|
||||
Route::any('/reedaw2/get_countfoot_content', 'app/NewReedaw2/app.Kitchenscale/get_countfoot_content');
|
||||
// 修改角色信息
|
||||
Route::any('/reedaw2/update_user_msg', 'app/NewReedaw/app.Kitchenscale/update_user_msg');
|
||||
Route::any('/reedaw2/update_user_msg', 'app/NewReedaw2/app.Kitchenscale/update_user_msg');
|
||||
// 搜索页面的默认信息数据
|
||||
Route::any('/reedaw2/search_default_msg', 'app/NewReedaw/app.Kitchenscale/search_default_msg');
|
||||
Route::any('/reedaw2/search_default_msg', 'app/NewReedaw2/app.Kitchenscale/search_default_msg');
|
||||
// 搜索食材列表
|
||||
Route::any('/reedaw2/get_food_list', 'app/NewReedaw/app.Kitchenscale/get_food_list');
|
||||
Route::any('/reedaw2/get_food_list', 'app/NewReedaw2/app.Kitchenscale/get_food_list');
|
||||
// 搜索食材列表
|
||||
Route::any('/reedaw2/search_column', 'app/NewReedaw/app.Kitchenscale/search_column');
|
||||
Route::any('/reedaw2/search_column', 'app/NewReedaw2/app.Kitchenscale/search_column');
|
||||
// 查询食谱的详情
|
||||
Route::any('/reedaw2/cookbook_details', 'app/NewReedaw/app.Kitchenscale/cookbook_details');
|
||||
Route::any('/reedaw2/cookbook_details', 'app/NewReedaw2/app.Kitchenscale/cookbook_details');
|
||||
// 点赞收藏菜谱
|
||||
Route::any('/reedaw2/cookbook_like', 'app/NewReedaw/app.Kitchenscale/cookbook_like');
|
||||
Route::any('/reedaw2/cookbook_like', 'app/NewReedaw2/app.Kitchenscale/cookbook_like');
|
||||
// 点赞收藏菜谱
|
||||
Route::any('/reedaw2/add_intake_food', 'app/NewReedaw/app.Kitchenscale/add_intake_food');
|
||||
Route::any('/reedaw2/add_intake_food', 'app/NewReedaw2/app.Kitchenscale/add_intake_food');
|
||||
// 获取记食器饮食记录
|
||||
Route::any('/reedaw2/get_log_list', 'app/NewReedaw/app.Kitchenscale/get_log_list');
|
||||
Route::any('/reedaw2/get_log_list', 'app/NewReedaw2/app.Kitchenscale/get_log_list');
|
||||
// 设置角色营养比例
|
||||
Route::any('/reedaw2/set_user_kcal', 'app/NewReedaw/app.Kitchenscale/set_nutrition_proportion');
|
||||
Route::any('/reedaw2/set_user_kcal', 'app/NewReedaw2/app.Kitchenscale/set_nutrition_proportion');
|
||||
// 删除一条指定的饮食记录
|
||||
Route::any('/reedaw2/del_user_eat_log', 'app/NewReedaw/app.Kitchenscale/del_user_eat_log');
|
||||
Route::any('/reedaw2/del_user_eat_log', 'app/NewReedaw2/app.Kitchenscale/del_user_eat_log');
|
||||
// 搜索历史删除
|
||||
Route::any('/reedaw2/del_search_history', 'app/NewReedaw/app.Kitchenscale/del_search_history');
|
||||
Route::any('/reedaw2/del_search_history', 'app/NewReedaw2/app.Kitchenscale/del_search_history');
|
||||
// 设置角色营养比例
|
||||
Route::any('/reedaw2/del_user_eat_list_log', 'app/NewReedaw/app.Kitchenscale/del_user_eat_list_log');
|
||||
Route::any('/reedaw2/del_user_eat_list_log', 'app/NewReedaw2/app.Kitchenscale/del_user_eat_list_log');
|
||||
// 我的收藏
|
||||
Route::any('/reedaw2/get_user_collect_list', 'app/NewReedaw/app.Kitchenscale/get_user_collect_list');
|
||||
Route::any('/reedaw2/get_user_collect_list', 'app/NewReedaw2/app.Kitchenscale/get_user_collect_list');
|
||||
// 设置营养占比页面数据
|
||||
Route::any('/reedaw2/set_up_content', 'app/NewReedaw/app.Kitchenscale/set_up_content');
|
||||
Route::any('/reedaw2/set_up_content', 'app/NewReedaw2/app.Kitchenscale/set_up_content');
|
||||
// 本次添加食材的营养统计
|
||||
Route::any('/reedaw2/current_food_statistics', 'app/NewReedaw/app.Kitchenscale/current_food_statistics');
|
||||
Route::any('/reedaw2/current_food_statistics', 'app/NewReedaw2/app.Kitchenscale/current_food_statistics');
|
||||
|
||||
// 查询条形码数据信息
|
||||
Route::any('/reedaw2/search_food_barcode', 'app/kitchenscale2/app.barcode/search_food_barcode');
|
||||
|
||||
################################################################首页(健康工具)
|
||||
// 卡片列表
|
||||
Route::any('/reedaw2/card_list_all', 'app/NewReedaw/app.Card/card_list_all');
|
||||
Route::any('/reedaw2/card_list_all', 'app/NewReedaw2/app.Card/card_list_all');
|
||||
// 保存用户所选的卡片列表
|
||||
Route::any('/reedaw2/save_card_list', 'app/NewReedaw/app.Card/save_card_list');
|
||||
// Route::any('/reedaw2/save_card_list', 'app/NewReedaw2/app.Card/save_card_list');
|
||||
// // BMI评测
|
||||
Route::any('/reedaw2/bmi_evaluation', 'app/NewReedaw/app.Card/bmi_evaluation');
|
||||
Route::any('/reedaw2/bmi_evaluation', 'app/NewReedaw2/app.Card/bmi_evaluation');
|
||||
// // 遗传身高
|
||||
Route::any('/reedaw2/genetic_height', 'app/NewReedaw/app.Card/genetic_height');
|
||||
Route::any('/reedaw2/genetic_height', 'app/NewReedaw2/app.Card/genetic_height');
|
||||
// 获取手动记录内容
|
||||
Route::any('/reedaw2/obtain_manual_record_content', 'app/NewReedaw/app.Card/obtain_manual_record_content');
|
||||
Route::any('/reedaw2/obtain_manual_record_content', 'app/NewReedaw2/app.Card/obtain_manual_record_content');
|
||||
|
||||
|
||||
// ###############################跳绳&肺活通用部分
|
||||
// 手动记录
|
||||
Route::any('/reedaw2/card/manual_record', 'app/NewReedaw/app.card/manual_record');
|
||||
Route::any('/reedaw2/card/manual_record', 'app/NewReedaw2/app.card/manual_record');
|
||||
// 曲线
|
||||
Route::any('/reedaw2/card/curve_chart', 'app/NewReedaw/app.card/curve_chart');
|
||||
Route::any('/reedaw2/card/curve_chart', 'app/NewReedaw2/app.card/curve_chart');
|
||||
// 数据对比列表(分组)
|
||||
Route::any('/reedaw2/card/record_list_group', 'app/NewReedaw/app.card/record_list_group');
|
||||
Route::any('/reedaw2/card/record_list_group', 'app/NewReedaw2/app.card/record_list_group');
|
||||
// 数据对比详情
|
||||
Route::any('/reedaw2/card/data_compare', 'app/NewReedaw/app.card/data_compare');
|
||||
Route::any('/reedaw2/card/data_compare', 'app/NewReedaw2/app.card/data_compare');
|
||||
// 历史记录(分页)
|
||||
Route::any('/reedaw2/card/record_list_page', 'app/NewReedaw/app.card/record_list_page');
|
||||
Route::any('/reedaw2/card/record_list_page', 'app/NewReedaw2/app.card/record_list_page');
|
||||
// 删除历史记录
|
||||
Route::any('/reedaw2/card/del_record', 'app/NewReedaw/app.card/del_record');
|
||||
Route::any('/reedaw2/card/del_record', 'app/NewReedaw2/app.card/del_record');
|
||||
// 历史记录(详细)
|
||||
Route::any('/reedaw2/card/detailed_record', 'app/NewReedaw/app.card/detailed_record');
|
||||
Route::any('/reedaw2/card/detailed_record', 'app/NewReedaw2/app.card/detailed_record');
|
||||
|
||||
// ###############################跳绳部分
|
||||
// 设备记录
|
||||
Route::any('/reedaw2/skip/device_record', 'app/NewReedaw/app.skip/device_record');
|
||||
Route::any('/reedaw2/skip/device_record', 'app/NewReedaw2/app.skip/device_record');
|
||||
// 上一次数据
|
||||
Route::any('/reedaw2/skip/data_report', 'app/NewReedaw/app.skip/data_report');
|
||||
Route::any('/reedaw2/skip/data_report', 'app/NewReedaw2/app.skip/data_report');
|
||||
// ###############################肺活部分
|
||||
// 设备记录
|
||||
Route::any('/reedaw2/vitalcapacity/device_record', 'app/NewReedaw/app.vitalcapacity/device_record');
|
||||
Route::any('/reedaw2/vitalcapacity/device_record', 'app/NewReedaw2/app.vitalcapacity/device_record');
|
||||
// 上一次数据
|
||||
Route::any('/reedaw2/vitalcapacity/data_report', 'app/NewReedaw/app.vitalcapacity/data_report');
|
||||
Route::any('/reedaw2/vitalcapacity/data_report', 'app/NewReedaw2/app.vitalcapacity/data_report');
|
||||
// ###############################体侧部分
|
||||
// 获取地区标准
|
||||
Route::any('/reedaw2/sportstesting/sportstesting_get_region_list', 'app/NewReedaw/app.sportstesting/sportstesting_get_region_list');
|
||||
Route::any('/reedaw2/sportstesting/sportstesting_get_region_list', 'app/NewReedaw2/app.sportstesting/sportstesting_get_region_list');
|
||||
// 计算获取结果
|
||||
Route::any('/reedaw2/sportstesting/sportstesting_set_once_data', 'app/NewReedaw/app.sportstesting/sportstesting_set_once_data');
|
||||
Route::any('/reedaw2/sportstesting/sportstesting_set_once_data', 'app/NewReedaw2/app.sportstesting/sportstesting_set_once_data');
|
||||
// ###############################通用运动类型1
|
||||
// 通用运动类型1手动记录
|
||||
Route::any('/reedaw2/exercise_type1_manual_record', 'app/NewReedaw2/app.Card/exercise_type1_manual_record');
|
||||
// 通用运动类型1历史记录
|
||||
Route::any('/reedaw2/exercise_type1_list', 'app/NewReedaw2/app.Card/exercise_type1_list');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
################################################################我的
|
||||
// 创建角色
|
||||
Route::any('/reedaw2/add_member', 'app/NewReedaw/app.role/add_member');
|
||||
// 更新角色
|
||||
Route::any('/reedaw2/update_member', 'app/NewReedaw/app.role/update_member');
|
||||
// 删除角色
|
||||
Route::any('/reedaw2/del_member', 'app/NewReedaw/app.role/del_member');
|
||||
// 获取指定角色详细信息(含厨房秤的当日信息)
|
||||
Route::any('/reedaw2/get_user_data_information', 'app/NewReedaw/app.role/get_user_data_information');
|
||||
// 修改账号昵称
|
||||
Route::any('/reedaw2/update_my_nickname', 'app/NewReedaw/app.role/update_my_nickname');
|
||||
// 获取账号信息
|
||||
Route::any('/reedaw2/get_my_account_msg', 'app/NewReedaw/app.role/get_my_account_msg');
|
||||
Route::any('/reedaw2/get_my_account_msg', 'app/NewReedaw2/app.role/get_my_account_msg');
|
||||
// 邮箱/手机绑定
|
||||
Route::any('/reedaw2/update_my_account_msg', 'app/NewReedaw/app.role/update_my_account_msg');
|
||||
Route::any('/reedaw2/update_my_account_msg', 'app/NewReedaw2/app.role/update_my_account_msg');
|
||||
// 修改密码
|
||||
Route::any('/reedaw2/update_my_password', 'app/NewReedaw/app.role/update_my_password');
|
||||
Route::any('/reedaw2/update_my_password', 'app/NewReedaw2/app.role/update_my_password');
|
||||
// 创建角色
|
||||
Route::any('/reedaw2/add_member', 'app/NewReedaw2/app.role/add_member');
|
||||
// 更新角色
|
||||
Route::any('/reedaw2/update_member', 'app/NewReedaw2/app.role/update_member');
|
||||
// 获取角色列表
|
||||
Route::any('/reedaw2/role_list', 'app/NewReedaw2/app.role/role_list');
|
||||
// 删除角色
|
||||
Route::any('/reedaw2/del_member', 'app/NewReedaw2/app.role/del_member');
|
||||
// 获取指定角色详细信息(含厨房秤的当日信息)
|
||||
Route::any('/reedaw2/get_user_data_information', 'app/NewReedaw2/app.role/get_user_data_information');
|
||||
// 修改账号昵称
|
||||
Route::any('/reedaw2/update_my_nickname', 'app/NewReedaw2/app.role/update_my_nickname');
|
||||
// 修改账号信息
|
||||
Route::any('/reedaw2/set_my_account_msg', 'app/NewReedaw/app.role/set_my_account_msg');
|
||||
// Route::any('/reedaw2/set_my_account_msg', 'app/NewReedaw2/app.role/set_my_account_msg');
|
||||
|
||||
|
||||
|
||||
// 商务合作页面
|
||||
Route::any('/reedaw2/business_cooperation', 'app/NewReedaw/app.business/business_cooperation');
|
||||
Route::any('/reedaw2/business_cooperation', 'app/NewReedaw2/app.business/business_cooperation');
|
||||
// 商务合作提交
|
||||
Route::any('/reedaw2/business_cooperation_action', 'app/NewReedaw/app.business/business_cooperation_action');
|
||||
Route::any('/reedaw2/business_cooperation_action', 'app/NewReedaw2/app.business/business_cooperation_action');
|
||||
// 隐私协议
|
||||
Route::any('/reedaw2/privacy_policy', 'app/NewReedaw/app.index/privacy_policy');
|
||||
Route::any('/reedaw2/privacy_policy', 'app/NewReedaw2/app.index/privacy_policy');
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue