This commit is contained in:
parent
467601a859
commit
a420257c52
|
|
@ -4,10 +4,13 @@ namespace app\app\controller;
|
||||||
|
|
||||||
use think\Controller;
|
use think\Controller;
|
||||||
use think\Db;
|
use think\Db;
|
||||||
|
use think\Cache;
|
||||||
|
use think\Log;
|
||||||
|
|
||||||
class Base extends Controller{
|
class Base extends Controller{
|
||||||
|
|
||||||
protected $base_call_method = ['内部'];
|
protected $base_call_method = ['内部'];
|
||||||
|
protected $token_time = 86400*1;
|
||||||
|
|
||||||
################################################################接口################################################################
|
################################################################接口################################################################
|
||||||
################################################################接口################################################################
|
################################################################接口################################################################
|
||||||
|
|
@ -25,7 +28,7 @@ class Base extends Controller{
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查变量是否是一个只有数字的一维数组
|
// 检查变量是否是一个只有数字的一维数组
|
||||||
function is_num_array($array = [1,2,3]) {
|
public function is_num_array($array = [1,2,3]) {
|
||||||
if (!is_array($array)) {
|
if (!is_array($array)) {
|
||||||
return false; // 变量不是数组
|
return false; // 变量不是数组
|
||||||
}
|
}
|
||||||
|
|
@ -34,12 +37,10 @@ class Base extends Controller{
|
||||||
return false; // 数组中包含非数字元素
|
return false; // 数组中包含非数字元素
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// $result = Db::table('app_card_data')->where(['is_del'=>1])->cache(true,3600)->column('id');//查询结果缓存3600秒
|
// $result = Db::table('app_card_data')->where(['is_del'=>1])->cache(true,3600)->column('id');//查询结果缓存3600秒
|
||||||
$result = Db::table('app_card_data')->where(['is_del'=>0])->cache(true,3600)->select();//查询结果缓存3600秒
|
$result = Db::table('app_card_data')->where(['is_del'=>0])->cache(true,3600)->select();//查询结果缓存3600秒
|
||||||
dump($result);
|
// dump($result);
|
||||||
die;
|
// die;
|
||||||
// dump(array_column($result, 'id'));
|
// dump(array_column($result, 'id'));
|
||||||
// die;
|
// die;
|
||||||
if(empty(array_diff($array, array_column($result, 'id')))){
|
if(empty(array_diff($array, array_column($result, 'id')))){
|
||||||
|
|
@ -49,9 +50,30 @@ class Base extends Controller{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// 判断字符串是手机还是邮箱
|
||||||
|
public function is_tel_email($str) {
|
||||||
|
// 手机号码的正则表达式(中国大陆格式)(下面正则实际判断的是是否为11位数字)
|
||||||
|
$mobilePattern = '/^\d{11}$/';
|
||||||
|
|
||||||
|
// 电子邮件地址的正则表达式
|
||||||
|
$emailPattern = '/^[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/';
|
||||||
|
|
||||||
|
// 判断是否为手机号码
|
||||||
|
if (preg_match($mobilePattern, $str)) {
|
||||||
|
return 'tel';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断是否为电子邮件地址
|
||||||
|
if (preg_match($emailPattern, $str)) {
|
||||||
|
return 'email';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果都不是,返回其他
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// 计算年龄
|
// 计算年龄
|
||||||
function calculate_age($data = '1991-04-20'){
|
public function calculate_age($data = '1991-04-20'){
|
||||||
$today = time(); // 获取当前时间的 Unix 时间戳
|
$today = time(); // 获取当前时间的 Unix 时间戳
|
||||||
$birthDate = strtotime($data); // 将出生日期字符串转换为 Unix 时间戳
|
$birthDate = strtotime($data); // 将出生日期字符串转换为 Unix 时间戳
|
||||||
|
|
||||||
|
|
@ -68,8 +90,24 @@ class Base extends Controller{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断token是否过期
|
||||||
|
public function token_time_validate($token){
|
||||||
|
// cache($token,time());
|
||||||
|
$time = cache($token);
|
||||||
|
// dump($time);
|
||||||
|
if($time === false){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$diff_time = time() - $time;
|
||||||
|
if($diff_time > $this->token_time){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
cache($token, time());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// 计算天数
|
// 计算天数
|
||||||
function daysSince($pastDate,$now = false)
|
public function daysSince($pastDate,$now = false)
|
||||||
{
|
{
|
||||||
// 创建一个表示过去日期的 DateTime 对象
|
// 创建一个表示过去日期的 DateTime 对象
|
||||||
$past = new \DateTime($pastDate);
|
$past = new \DateTime($pastDate);
|
||||||
|
|
@ -86,7 +124,7 @@ class Base extends Controller{
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算月份
|
// 计算月份
|
||||||
function calculateAgeInMonthsWithPrecision($birthDateStr) {
|
public function calculateAgeInMonthsWithPrecision($birthDateStr) {
|
||||||
// 获取当前日期
|
// 获取当前日期
|
||||||
$now = new \DateTime();
|
$now = new \DateTime();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,93 +71,88 @@ class Card extends Base{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 获取卡片列表
|
// // 获取卡片列表
|
||||||
// $data = ['id'=>'2','time'=>'1991-04-20',content=>'15个']
|
// // $data = ['id'=>'2','time'=>'1991-04-20',content=>'15个']
|
||||||
public function get_card_list(){
|
// public function get_card_list($data = ['aud_id'=>'2','time'=>'1991-04-20','content'=>'15个']){
|
||||||
$data = input();
|
// $data = input();
|
||||||
if(!array_key_exists('ann_id', $data) || !array_key_exists('time', $data) || !array_key_exists('content', $data)){
|
// if(!array_key_exists('aud_id', $data) || !array_key_exists('time', $data) || !array_key_exists('content', $data)){
|
||||||
return $this->msg(10001,'数据格式错误');
|
// return $this->msg(10001,'数据格式错误');
|
||||||
}
|
// }
|
||||||
|
|
||||||
$result = Db::table('app_card_data_log')->insert(['aud_id'=>$data['id'],'log_time'=>$data['time'],'content'=>$data['content'],'create_time'=>date('Y-m-d H:i:s')]);
|
// $result = Db::table('app_card_data_log')->insert(['aud_id'=>$data['id'],'log_time'=>$data['time'],'content'=>$data['content'],'create_time'=>date('Y-m-d H:i:s')]);
|
||||||
if($result){
|
// if($result){
|
||||||
return $this->msg(0,'success');
|
// return $this->msg(0,'success');
|
||||||
}else{
|
// }else{
|
||||||
return $this->msg(10003,'添加失败');
|
// return $this->msg(10003,'添加失败');
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 获取基础卡片信息
|
// 获取基础卡片信息
|
||||||
// $data = ['id'=>'2']
|
// $data = ['id'=>'2']
|
||||||
public function card_data_base(){
|
// public function card_data_base($data = ['aud_id'=>'11']){
|
||||||
$data = input();
|
// if(count(input()) > 0){
|
||||||
if(!array_key_exists('id', $data)){
|
// $data = input();
|
||||||
return $this->msg(10001,'数据格式错误');
|
// }
|
||||||
}
|
// if(!array_key_exists('aud_id', $data)){
|
||||||
$result = Db::table('app_card_body_data')->where(['aud_id'=>$data['id']])->order('record_time desc')->field('record_time,height,weight,bmi')->find();
|
// return $this->msg(10001,'数据格式错误');
|
||||||
if(!$result){
|
// }
|
||||||
return $this->msg(10002,'未找到数据');
|
// $result = Db::table('app_card_body_data')->where(['aud_id'=>$data['aud_id']])->order('record_time desc')->field('record_time,height,weight,bmi')->find();
|
||||||
}else{
|
// if(!$result){
|
||||||
return $this->msg(0,'success',$result);
|
// return $this->msg(10002,'未找到数据');
|
||||||
}
|
// }else{
|
||||||
}
|
// return $this->msg(0,'success',$result);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// 详细卡片信息
|
// 详细卡片信息
|
||||||
// $data = ['id'=>'2']
|
// $data = ['id'=>'2']
|
||||||
public function card_data_detailed($data=['id'=>'7','acd_id'=>'2']){
|
public function card_data_detailed($data=['aud_id'=>'11','token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
||||||
// public function body_data_detailed($data=['id'=>'9','acd_id'=>'2']){
|
if(count(input()) > 0){
|
||||||
// $data = input();
|
$data = input();
|
||||||
|
}
|
||||||
if(!array_key_exists('id', $data) || !array_key_exists('acd_id', $data)){
|
if($this->token_time_validate($data['token']) === false){
|
||||||
|
return $this->msg(20001,'登录失效');
|
||||||
|
}
|
||||||
|
unset($data['token']);
|
||||||
|
if(!array_key_exists('aud_id', $data)){
|
||||||
return $this->msg(10001,'关键参数缺失');
|
return $this->msg(10001,'关键参数缺失');
|
||||||
}
|
}
|
||||||
if($data['acd_id'] == '2'){
|
|
||||||
// 基础身体信息卡片
|
|
||||||
|
|
||||||
return $this->get_user_body_data($data);
|
return $this->get_user_body_data($data);
|
||||||
}
|
// if($data['acd_id'] == '2'){
|
||||||
|
// // 基础身体信息卡片
|
||||||
|
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 手动记录
|
// 手动记录
|
||||||
// $data = ['id'=>'2','time'=>'1991-04-20 10:10:10','height'=>'15.1','weight'=>'75.1']
|
// $data = ['id'=>'2','time'=>'1991-04-20 10:10:10','height'=>'15.1','weight'=>'75.1']
|
||||||
public function card_manual_recording($data = ['acd_id'=>'2','aud_id'=>'11','time'=>'2024-04-11 10:10:10','data'=>['height'=>'175.1','weight'=>'77.1']]){
|
// public function card_manual_recording($data = ['acd_id'=>'2','aud_id'=>'11','time'=>'2024-04-11 10:10:10','data'=>['height'=>'175.1','weight'=>'77.1']]){
|
||||||
if(!array_key_exists('acd_id', $data) || !array_key_exists('aud_id', $data)){
|
public function card_manual_recording($data = ['aud_id'=>'11','time'=>'2024-04-11 10:10:10','height'=>'165.3','weight'=>'66.1','token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
||||||
|
if(count(input()) > 0){
|
||||||
|
$data = input();
|
||||||
|
}
|
||||||
|
if($this->token_time_validate($data['token']) === false){
|
||||||
|
return $this->msg(20001,'登录失效');
|
||||||
|
}
|
||||||
|
unset($data['token']);
|
||||||
|
if(!array_key_exists('aud_id', $data) || !array_key_exists('time', $data) || !array_key_exists('height', $data) || !array_key_exists('weight', $data)){
|
||||||
return $this->msg(10001,'关键参数缺失');
|
return $this->msg(10001,'关键参数缺失');
|
||||||
}
|
}
|
||||||
|
$data['acd_id'] = '2';
|
||||||
$afferent_data = [];
|
return $this->set_user_body_data($data);
|
||||||
|
|
||||||
foreach ($data as $key => $value) {
|
|
||||||
if(is_array($value)){
|
|
||||||
foreach ($value as $k => $v) {
|
|
||||||
$afferent_data[$k] = $v;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
$afferent_data[$key] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($data['acd_id'] == '2'){
|
|
||||||
return $this->set_user_body_data($data);
|
|
||||||
}else if($data['acd_id'] == '6'){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取记录信息列表
|
// 获取记录信息列表
|
||||||
function get_card_record_data($data = ['acd_id'=>'6','aud_id'=>'11','s_time'=>'2024-04-01 10:10:10','e_time'=>'2024-04-12 10:10:10']){
|
function get_card_record_data($data = ['aud_id'=>'11','s_time'=>'2024-04-01 10:10:10','e_time'=>'2024-04-12 10:10:10']){
|
||||||
if(!array_key_exists('acd_id', $data) || !array_key_exists('aud_id', $data) || !array_key_exists('s_time', $data) || !array_key_exists('e_time', $data)){
|
if(!array_key_exists('aud_id', $data) || !array_key_exists('s_time', $data) || !array_key_exists('e_time', $data)){
|
||||||
return $this->msg(10001,'关键参数缺失');
|
return $this->msg(10001,'关键参数缺失');
|
||||||
}
|
}
|
||||||
|
$data['acd_id'] = '2';
|
||||||
return $this->get_all_record_data($data);
|
return $this->get_all_record_data($data);
|
||||||
// if($data['acd_id'] == '2'){
|
|
||||||
|
|
||||||
// }else if($data['acd_id'] == '6'){
|
|
||||||
// $skip = new Skip();
|
|
||||||
// return $skip->get_skip_record_data($data);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 数据对比
|
// 数据对比
|
||||||
|
|
@ -165,7 +160,6 @@ class Card extends Base{
|
||||||
if(!array_key_exists('acd_id', $data) || !array_key_exists('aud_id', $data) || !array_key_exists('s_time', $data) || !array_key_exists('e_time', $data)){
|
if(!array_key_exists('acd_id', $data) || !array_key_exists('aud_id', $data) || !array_key_exists('s_time', $data) || !array_key_exists('e_time', $data)){
|
||||||
return $this->msg(10001,'关键参数缺失');
|
return $this->msg(10001,'关键参数缺失');
|
||||||
}
|
}
|
||||||
|
|
||||||
if($data['acd_id'] == '2'){
|
if($data['acd_id'] == '2'){
|
||||||
return $this->body_data_contrast($data);
|
return $this->body_data_contrast($data);
|
||||||
}else if($data['acd_id'] == '6'){
|
}else if($data['acd_id'] == '6'){
|
||||||
|
|
@ -244,8 +238,8 @@ class Card extends Base{
|
||||||
$return_result[$value['r_t']] = [['id'=>$value['id'],'v1'=>$value['v1'],'v2'=>$value['v2'],'v3'=>$value['v3']]];
|
$return_result[$value['r_t']] = [['id'=>$value['id'],'v1'=>$value['v1'],'v2'=>$value['v2'],'v3'=>$value['v3']]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dump(['original'=>$result,'optimization'=>$return_result]);
|
// dump(['original'=>$result,'optimization'=>$return_result]);
|
||||||
die;
|
// die;
|
||||||
return ['original'=>$result,'optimization'=>$return_result];
|
return ['original'=>$result,'optimization'=>$return_result];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -307,9 +301,10 @@ class Card extends Base{
|
||||||
################################################################身体数据卡片业务
|
################################################################身体数据卡片业务
|
||||||
// 用户身体数据卡片记录
|
// 用户身体数据卡片记录
|
||||||
function set_user_body_data($data){
|
function set_user_body_data($data){
|
||||||
if(!array_key_exists('time', $data) || !array_key_exists('height', $data) || !array_key_exists('weight', $data)){
|
// if(!array_key_exists('time', $data) || !array_key_exists('height', $data) || !array_key_exists('weight', $data)){
|
||||||
return $this->msg(10001,'数据格式错误');
|
// return $this->msg(10001,'数据格式错误');
|
||||||
}
|
// }
|
||||||
|
$data['type'] = 1;
|
||||||
$user_data = Db::table('app_user_data')->where(['id'=>$data['aud_id']])->field('birthday,gender')->find();
|
$user_data = Db::table('app_user_data')->where(['id'=>$data['aud_id']])->field('birthday,gender')->find();
|
||||||
$result_data['height'] = $data['height'];
|
$result_data['height'] = $data['height'];
|
||||||
$result_data['weight'] = $data['weight'];
|
$result_data['weight'] = $data['weight'];
|
||||||
|
|
@ -360,65 +355,58 @@ class Card extends Base{
|
||||||
$result = Db::table('app_card_body_data')
|
$result = Db::table('app_card_body_data')
|
||||||
->alias('acbd')
|
->alias('acbd')
|
||||||
->join('app_user_data aud','acbd.aud_id = aud.id','LEFT')
|
->join('app_user_data aud','acbd.aud_id = aud.id','LEFT')
|
||||||
->where(['acbd.id'=>$data['id']])
|
->where(['acbd.aud_id'=>$data['aud_id']])
|
||||||
|
->order('record_time desc')
|
||||||
->field('acbd.*,aud.birthday,aud.gender')
|
->field('acbd.*,aud.birthday,aud.gender')
|
||||||
->find();
|
->find();
|
||||||
|
|
||||||
|
// dump($data);
|
||||||
|
// dump($result['age']);
|
||||||
|
// $result['age'] = 14;
|
||||||
|
// die;
|
||||||
if(!$result){
|
if(!$result){
|
||||||
return $this->msg(10002,'未找到数据');
|
return $this->msg(10002,'未找到数据');
|
||||||
}else{
|
}else{
|
||||||
$result_end = $this->processing_return_data($result);
|
$result_end = $this->processing_return_data_new($result);
|
||||||
// dump($result_end);
|
// dump($result_end);
|
||||||
// die;
|
// die;
|
||||||
return $this->msg(0,'success',$result_end);
|
return $this->msg(0,'success',$result_end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 返回数据处理
|
// 返回数据处理
|
||||||
function processing_return_data($data){
|
function processing_return_data_new($data){
|
||||||
$result_end_data = [];
|
$result_end_data = [];
|
||||||
$month_num = $this->calculateAgeInMonthsWithPrecision($data['birthday'])*100;
|
$month_num = $this->calculateAgeInMonthsWithPrecision($data['birthday'])*100;
|
||||||
$gender_val = $data['gender'];
|
$gender_val = $data['gender'];
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
if($key != 'aud_id' && $key != 'id' && $key != 'create_time' && $key != 'last_update_time' && $key != 'acd_id' && $key != 'ROW_NUMBER' && $key != 'record_time' && $key != 'gender' && $key != 'birthday'){
|
if($key != 'aud_id' && $key != 'id' && $key != 'create_time' && $key != 'last_update_time' && $key != 'acd_id' && $key != 'ROW_NUMBER' && $key != 'record_time' && $key != 'gender' && $key != 'birthday'){
|
||||||
|
|
||||||
|
// 设置单个数据格式
|
||||||
|
$result_end_data[$key] = $this->result_end_data_mould;
|
||||||
|
if(array_key_exists($key, $this->unit_name)){
|
||||||
|
$result_end_data[$key]['name'] = $this->unit_name[$key];
|
||||||
|
}
|
||||||
|
if(array_key_exists($key, $this->unit_symbol)){
|
||||||
|
$result_end_data[$key]['unit'] = $this->unit_symbol[$key];
|
||||||
|
}
|
||||||
|
$result_end_data[$key]['value'] = explode(',',$value)[0];
|
||||||
|
if(strpos($value, ',')){
|
||||||
|
$result_end_data[$key]['standard'] = explode(',',$value)[1];
|
||||||
|
}
|
||||||
|
if(array_key_exists($key, $this->standard_color)){
|
||||||
|
$result_end_data[$key]['color'] = $this->standard_color[$key][$result_end_data[$key]['standard']];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 如果大于16岁(成人)
|
// 如果大于16岁(成人)
|
||||||
if($data['age'] >= $this->age_limit){
|
if($data['age'] < $this->age_limit){
|
||||||
$result_end_data[$key] = $this->result_end_data_mould;
|
|
||||||
if(array_key_exists($key, $this->unit_name)){
|
|
||||||
$result_end_data[$key]['name'] = $this->unit_name[$key];
|
|
||||||
}
|
|
||||||
if(array_key_exists($key, $this->unit_symbol)){
|
|
||||||
$result_end_data[$key]['unit'] = $this->unit_symbol[$key];
|
|
||||||
}
|
|
||||||
$result_end_data[$key]['value'] = explode(',',$value)[0];
|
|
||||||
if(strpos($value, ',')){
|
|
||||||
$result_end_data[$key]['standard'] = explode(',',$value)[1];
|
|
||||||
}
|
|
||||||
if(array_key_exists($key, $this->standard_color)){
|
|
||||||
$result_end_data[$key]['color'] = $this->standard_color[$key][$result_end_data[$key]['standard']];
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if(array_key_exists($key, $this->bhw_list)){
|
if(array_key_exists($key, $this->bhw_list)){
|
||||||
$result_end_data[$key] = $this->result_end_data_mould;
|
|
||||||
$result_end_data[$key]['list'] = $this->bhw_list[$key];
|
$result_end_data[$key]['list'] = $this->bhw_list[$key];
|
||||||
if(array_key_exists($key, $this->unit_name)){
|
|
||||||
$result_end_data[$key]['name'] = $this->unit_name[$key];
|
|
||||||
}
|
|
||||||
if(array_key_exists($key, $this->unit_symbol)){
|
|
||||||
$result_end_data[$key]['unit'] = $this->unit_symbol[$key];
|
|
||||||
}
|
|
||||||
$result_end_data[$key]['value'] = explode(',',$value)[0];
|
|
||||||
if(strpos($value, ',')){
|
|
||||||
$result_end_data[$key]['standard'] = explode(',',$value)[1];
|
|
||||||
}
|
|
||||||
if(array_key_exists($key, $this->standard_color)){
|
|
||||||
$result_end_data[$key]['color'] = $this->standard_color[$key][$result_end_data[$key]['standard']];
|
|
||||||
}
|
|
||||||
if($key == 'bmi'){
|
if($key == 'bmi'){
|
||||||
// dump($month_num);
|
// dump($month_num);
|
||||||
$bhw_date = Db::table('pc_bmistand2')->where("month >= $month_num and sex = '$gender_val'")->order('month')->limit(1)->select();
|
$bhw_date = Db::table('pc_bmistand2')->where("month >= $month_num and sex = '$gender_val'")->order('month')->limit(1)->select();
|
||||||
|
// dump($bhw_date);
|
||||||
if($bhw_date){
|
if($bhw_date){
|
||||||
$result_end_data[$key]['list'][0]['max_val'] = $bhw_date[0]['f1sd'];
|
$result_end_data[$key]['list'][0]['max_val'] = $bhw_date[0]['f1sd'];
|
||||||
$result_end_data[$key]['list'][1]['min_val'] = $bhw_date[0]['f1sd'];
|
$result_end_data[$key]['list'][1]['min_val'] = $bhw_date[0]['f1sd'];
|
||||||
|
|
@ -462,6 +450,92 @@ class Card extends Base{
|
||||||
}
|
}
|
||||||
return $result_end_data;
|
return $result_end_data;
|
||||||
}
|
}
|
||||||
|
// // 返回数据处理
|
||||||
|
// function processing_return_data($data){
|
||||||
|
// $result_end_data = [];
|
||||||
|
// $month_num = $this->calculateAgeInMonthsWithPrecision($data['birthday'])*100;
|
||||||
|
// $gender_val = $data['gender'];
|
||||||
|
// foreach ($data as $key => $value) {
|
||||||
|
// if($key != 'aud_id' && $key != 'id' && $key != 'create_time' && $key != 'last_update_time' && $key != 'acd_id' && $key != 'ROW_NUMBER' && $key != 'record_time' && $key != 'gender' && $key != 'birthday'){
|
||||||
|
// // 如果大于16岁(成人)
|
||||||
|
// if($data['age'] >= $this->age_limit){
|
||||||
|
// $result_end_data[$key] = $this->result_end_data_mould;
|
||||||
|
// if(array_key_exists($key, $this->unit_name)){
|
||||||
|
// $result_end_data[$key]['name'] = $this->unit_name[$key];
|
||||||
|
// }
|
||||||
|
// if(array_key_exists($key, $this->unit_symbol)){
|
||||||
|
// $result_end_data[$key]['unit'] = $this->unit_symbol[$key];
|
||||||
|
// }
|
||||||
|
// $result_end_data[$key]['value'] = explode(',',$value)[0];
|
||||||
|
// if(strpos($value, ',')){
|
||||||
|
// $result_end_data[$key]['standard'] = explode(',',$value)[1];
|
||||||
|
// }
|
||||||
|
// if(array_key_exists($key, $this->standard_color)){
|
||||||
|
// $result_end_data[$key]['color'] = $this->standard_color[$key][$result_end_data[$key]['standard']];
|
||||||
|
// }
|
||||||
|
// }else{
|
||||||
|
// if(array_key_exists($key, $this->bhw_list)){
|
||||||
|
// $result_end_data[$key] = $this->result_end_data_mould;
|
||||||
|
// $result_end_data[$key]['list'] = $this->bhw_list[$key];
|
||||||
|
// if(array_key_exists($key, $this->unit_name)){
|
||||||
|
// $result_end_data[$key]['name'] = $this->unit_name[$key];
|
||||||
|
// }
|
||||||
|
// if(array_key_exists($key, $this->unit_symbol)){
|
||||||
|
// $result_end_data[$key]['unit'] = $this->unit_symbol[$key];
|
||||||
|
// }
|
||||||
|
// $result_end_data[$key]['value'] = explode(',',$value)[0];
|
||||||
|
// if(strpos($value, ',')){
|
||||||
|
// $result_end_data[$key]['standard'] = explode(',',$value)[1];
|
||||||
|
// }
|
||||||
|
// if(array_key_exists($key, $this->standard_color)){
|
||||||
|
// $result_end_data[$key]['color'] = $this->standard_color[$key][$result_end_data[$key]['standard']];
|
||||||
|
// }
|
||||||
|
// if($key == 'bmi'){
|
||||||
|
// // dump($month_num);
|
||||||
|
// $bhw_date = Db::table('pc_bmistand2')->where("month >= $month_num and sex = '$gender_val'")->order('month')->limit(1)->select();
|
||||||
|
// if($bhw_date){
|
||||||
|
// $result_end_data[$key]['list'][0]['max_val'] = $bhw_date[0]['f1sd'];
|
||||||
|
// $result_end_data[$key]['list'][1]['min_val'] = $bhw_date[0]['f1sd'];
|
||||||
|
// $result_end_data[$key]['list'][1]['max_val'] = $bhw_date[0]['z1sd'];
|
||||||
|
// $result_end_data[$key]['list'][2]['min_val'] = $bhw_date[0]['z1sd'];
|
||||||
|
// $result_end_data[$key]['list'][2]['max_val'] = $bhw_date[0]['z2sd'];
|
||||||
|
// $result_end_data[$key]['list'][3]['min_val'] = $bhw_date[0]['z2sd'];
|
||||||
|
// }
|
||||||
|
// }else if($key == 'height'){
|
||||||
|
// $bhw_date = Db::table('pc_heightstand2')->where("month >= $month_num")->order('month')->limit(1)->select();
|
||||||
|
// if($bhw_date){
|
||||||
|
// $result_end_data[$key]['list'][0]['max_val'] = $bhw_date[0]['f2sd'];
|
||||||
|
// $result_end_data[$key]['list'][1]['min_val'] = $bhw_date[0]['f2sd'];
|
||||||
|
// $result_end_data[$key]['list'][1]['max_val'] = $bhw_date[0]['f1sd'];
|
||||||
|
// $result_end_data[$key]['list'][2]['min_val'] = $bhw_date[0]['f1sd'];
|
||||||
|
// $result_end_data[$key]['list'][2]['max_val'] = $bhw_date[0]['z1sd'];
|
||||||
|
// $result_end_data[$key]['list'][3]['min_val'] = $bhw_date[0]['z1sd'];
|
||||||
|
// $result_end_data[$key]['list'][3]['max_val'] = $bhw_date[0]['z2sd'];
|
||||||
|
// $result_end_data[$key]['list'][4]['min_val'] = $bhw_date[0]['z2sd'];
|
||||||
|
// $result_end_data[$key]['list'][4]['max_val'] = $bhw_date[0]['z3sd'];
|
||||||
|
// }
|
||||||
|
// }else if($key == 'weight'){
|
||||||
|
// $bhw_date = Db::table('pc_weightstand2')->where("month >= $month_num")->order('month')->limit(1)->select();
|
||||||
|
// // dump($value);
|
||||||
|
// // dump($bhw_date);/
|
||||||
|
// if($bhw_date){
|
||||||
|
// $result_end_data[$key]['list'][0]['max_val'] = $bhw_date[0]['f2sd'];
|
||||||
|
// $result_end_data[$key]['list'][1]['min_val'] = $bhw_date[0]['f2sd'];
|
||||||
|
// $result_end_data[$key]['list'][1]['max_val'] = $bhw_date[0]['f1sd'];
|
||||||
|
// $result_end_data[$key]['list'][2]['min_val'] = $bhw_date[0]['f1sd'];
|
||||||
|
// $result_end_data[$key]['list'][2]['max_val'] = $bhw_date[0]['z1sd'];
|
||||||
|
// $result_end_data[$key]['list'][3]['min_val'] = $bhw_date[0]['z1sd'];
|
||||||
|
// $result_end_data[$key]['list'][3]['max_val'] = $bhw_date[0]['z2sd'];
|
||||||
|
// $result_end_data[$key]['list'][4]['min_val'] = $bhw_date[0]['z2sd'];
|
||||||
|
// $result_end_data[$key]['list'][4]['max_val'] = $bhw_date[0]['z3sd'];
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return $result_end_data;
|
||||||
|
// }
|
||||||
|
|
||||||
################################################################跳绳数据卡片接口################################################################
|
################################################################跳绳数据卡片接口################################################################
|
||||||
################################################################跳绳数据卡片接口################################################################
|
################################################################跳绳数据卡片接口################################################################
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,14 @@ class Index extends Base{
|
||||||
// dump($result);
|
// dump($result);
|
||||||
// }
|
// }
|
||||||
// 创建用户
|
// 创建用户
|
||||||
public function create_user_data($data = ['aan_id'=>66,'nickname'=>'王小二','birthday'=>'2019-01-01','gender'=>1,'grade'=>'二年级']){
|
public function create_user_data($data = ['aan_id'=>66,'nickname'=>'王小二','birthday'=>'2019-01-01','gender'=>1,'grade'=>'二年级','token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
||||||
if(count(input()) > 0){
|
if(count(input()) > 0){
|
||||||
$data = input();
|
$data = input();
|
||||||
}
|
}
|
||||||
|
if($this->token_time_validate($data['token']) === false){
|
||||||
|
return $this->msg(20001,'登录失效');
|
||||||
|
}
|
||||||
|
unset($data['token']);
|
||||||
$verify_result = $this->verify_parameters($data,'register');
|
$verify_result = $this->verify_parameters($data,'register');
|
||||||
if(!is_array($verify_result)){
|
if(!is_array($verify_result)){
|
||||||
return $this->msg(10002,$verify_result);
|
return $this->msg(10002,$verify_result);
|
||||||
|
|
@ -47,10 +51,14 @@ class Index extends Base{
|
||||||
|
|
||||||
// 获取账号下用户列表
|
// 获取账号下用户列表
|
||||||
// $type 1获取列表,2获取详细信息
|
// $type 1获取列表,2获取详细信息
|
||||||
public function get_user_card_list($data = ['aan_id'=>66,'type'=>1]){
|
public function get_user_card_list($data = ['aan_id'=>66,'type'=>1,'token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
||||||
if(count(input()) > 0){
|
if(count(input()) > 0){
|
||||||
$data = input();
|
$data = input();
|
||||||
}
|
}
|
||||||
|
if($this->token_time_validate($data['token']) === false){
|
||||||
|
return $this->msg(20001,'登录失效');
|
||||||
|
}
|
||||||
|
unset($data['token']);
|
||||||
$result = Db::table('app_user_data')->where(['aan_id'=>$data['aan_id']])->select();
|
$result = Db::table('app_user_data')->where(['aan_id'=>$data['aan_id']])->select();
|
||||||
// $result = Db::table('app_user_data')->where(['aan_id'=>$aan_id])->field('id,nickname')->select();
|
// $result = Db::table('app_user_data')->where(['aan_id'=>$aan_id])->field('id,nickname')->select();
|
||||||
$temporary_data = [];
|
$temporary_data = [];
|
||||||
|
|
@ -65,10 +73,14 @@ class Index extends Base{
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取指定用户详细信息
|
// 获取指定用户详细信息
|
||||||
public function get_user_data_information($data = ['aud_id'=>11]){
|
public function get_user_data_information($data = ['aud_id'=>11,'token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
||||||
if(count(input()) > 0){
|
if(count(input()) > 0){
|
||||||
$data = input();
|
$data = input();
|
||||||
}
|
}
|
||||||
|
if($this->token_time_validate($data['token']) === false){
|
||||||
|
return $this->msg(20001,'登录失效');
|
||||||
|
}
|
||||||
|
unset($data['token']);
|
||||||
$result = Db::table('app_user_data')->where(['id'=>$data['aud_id']])->field('id,aan_id,nickname,birthday,gender,card_order')->find();
|
$result = Db::table('app_user_data')->where(['id'=>$data['aud_id']])->field('id,aan_id,nickname,birthday,gender,card_order')->find();
|
||||||
unset($result['ROW_NUMBER']);
|
unset($result['ROW_NUMBER']);
|
||||||
if($result['card_order'] === ''){
|
if($result['card_order'] === ''){
|
||||||
|
|
@ -79,14 +91,23 @@ class Index extends Base{
|
||||||
$result['card_order'] = explode(',',$result['card_order']);
|
$result['card_order'] = explode(',',$result['card_order']);
|
||||||
$result['card_data_list'] = $this->get_user_card_data_list($result['card_order'],$result['id']);
|
$result['card_data_list'] = $this->get_user_card_data_list($result['card_order'],$result['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$result['birthday'] = str_replace('-', '/', $result['birthday']);
|
||||||
|
foreach ($result['card_data_list'] as $key => $value) {
|
||||||
|
$result['card_data_list'][$key]['record_time'] = str_replace('-', '/', $result['card_data_list'][$key]['record_time']);
|
||||||
|
}
|
||||||
return $this->msg(0,'success',$result);
|
return $this->msg(0,'success',$result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取所有卡片列表信息
|
// 获取所有卡片列表信息
|
||||||
public function get_card_all_list($data = ['aud_id'=>11]){
|
public function get_card_all_list($data = ['aud_id'=>11,'token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
||||||
if(count(input()) > 0){
|
if(count(input()) > 0){
|
||||||
$data = input();
|
$data = input();
|
||||||
}
|
}
|
||||||
|
if($this->token_time_validate($data['token']) === false){
|
||||||
|
return $this->msg(20001,'登录失效');
|
||||||
|
}
|
||||||
|
unset($data['token']);
|
||||||
$user_card_list = Db::table('app_user_data')->where(['id'=>$data['aud_id']])->field('id,card_order')->find();
|
$user_card_list = Db::table('app_user_data')->where(['id'=>$data['aud_id']])->field('id,card_order')->find();
|
||||||
unset($user_card_list['ROW_NUMBER']);
|
unset($user_card_list['ROW_NUMBER']);
|
||||||
$user_card_list['card_order'] = explode(',',$user_card_list['card_order']);
|
$user_card_list['card_order'] = explode(',',$user_card_list['card_order']);
|
||||||
|
|
@ -106,23 +127,20 @@ class Index extends Base{
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存用户的卡片排序
|
// 保存用户的卡片排序
|
||||||
public function save_user_card_order($data=['aud_id'=>11,'card_order'=>'2,8']){
|
public function save_user_card_order($data=['aud_id'=>11,'card_order'=>'2,8','token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
||||||
if(count(input()) > 0){
|
if(count(input()) > 0){
|
||||||
$data = input();
|
$data = input();
|
||||||
}
|
}
|
||||||
|
if($this->token_time_validate($data['token']) === false){
|
||||||
|
return $this->msg(20001,'登录失效');
|
||||||
|
}
|
||||||
|
unset($data['token']);
|
||||||
if(!array_key_exists('aud_id', $data) || !array_key_exists('card_order', $data)){
|
if(!array_key_exists('aud_id', $data) || !array_key_exists('card_order', $data)){
|
||||||
return $this->msg(10001,'数据参数错误');
|
return $this->msg(10001,'数据参数错误');
|
||||||
}
|
}
|
||||||
// dump($data['card_order']);
|
|
||||||
// dump(explode(',',$data['card_order']));
|
|
||||||
// die;
|
|
||||||
dump($this->is_num_array(explode(',',$data['card_order'])));
|
|
||||||
die;
|
|
||||||
if(!$this->is_num_array(explode(',',$data['card_order']))){
|
if(!$this->is_num_array(explode(',',$data['card_order']))){
|
||||||
return $this->msg(10002,'数据内参数格式或值错误');
|
return $this->msg(10002,'数据内参数格式或值错误');
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['card_order'] = json_encode($data['card_order']);
|
|
||||||
$result = Db::table('app_user_data')->where(['id'=>$data['aud_id']])->update(['card_order'=>$data['card_order']]);
|
$result = Db::table('app_user_data')->where(['id'=>$data['aud_id']])->update(['card_order'=>$data['card_order']]);
|
||||||
if($result){
|
if($result){
|
||||||
return $this->msg(0,'success');
|
return $this->msg(0,'success');
|
||||||
|
|
|
||||||
|
|
@ -5,20 +5,18 @@ namespace app\app\controller;
|
||||||
use think\Controller;
|
use think\Controller;
|
||||||
use think\Db;
|
use think\Db;
|
||||||
use think\Cache;
|
use think\Cache;
|
||||||
use app\bj\controller\Common;
|
|
||||||
use think\Log;
|
use think\Log;
|
||||||
use \think\Validate;
|
use \think\Validate;
|
||||||
use PHPMailer\PHPMailer\PHPMailer;
|
use PHPMailer\PHPMailer\PHPMailer;
|
||||||
|
|
||||||
class Login extends Base{
|
class Login extends Base{
|
||||||
|
protected $code_time = 3600;
|
||||||
|
|
||||||
################################################################个人资料卡################################################################
|
################################################################个人资料卡################################################################
|
||||||
################################################################个人资料卡################################################################
|
################################################################个人资料卡################################################################
|
||||||
################################################################个人资料卡################################################################
|
################################################################个人资料卡################################################################
|
||||||
|
|
||||||
// 注册
|
// 注册
|
||||||
public function register_action($data = ['data'=>15588885555,'password'=>'ceshi','code'=>'123456']){
|
public function register_action($data = ['data'=>18530934717,'password'=>'ceshi','code'=>'746119']){
|
||||||
|
|
||||||
// dump('123');
|
// dump('123');
|
||||||
// phpinfo();
|
// phpinfo();
|
||||||
|
|
@ -33,16 +31,49 @@ class Login extends Base{
|
||||||
// dump($verify_result);
|
// dump($verify_result);
|
||||||
// die;
|
// die;
|
||||||
// 记录
|
// 记录
|
||||||
$result = Db::table('app_account_number')->insert($verify_result);
|
$result = Db::table('app_account_number')->insertGetId($verify_result);
|
||||||
if($result){
|
if($result){
|
||||||
return $this->msg(0,'success');
|
cache($verify_result['token'], time());
|
||||||
|
return $this->msg(0,'success',['token'=>$verify_result['token'],'aan_id'=>$result]);
|
||||||
}else{
|
}else{
|
||||||
return $this->msg(10003,'注册失败');
|
return $this->msg(10003,'注册失败');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 重置密码
|
||||||
|
public function reset_password($data = ['data'=>'18530934717','password'=>'ceshi1','c_password'=>'ceshi1','code'=>'491661']){
|
||||||
|
if(count(input()) > 0){
|
||||||
|
$data = input();
|
||||||
|
}
|
||||||
|
if(!array_key_exists('data', $data) || !array_key_exists('password', $data) || !array_key_exists('c_password', $data) || !array_key_exists('code', $data)){
|
||||||
|
return $this->msg(10001,'参数缺失');
|
||||||
|
}
|
||||||
|
|
||||||
|
if($data['password'] != $data['c_password']){
|
||||||
|
return $this->msg(10002,'两次密码不一致');
|
||||||
|
}
|
||||||
|
$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(10004,'账号格式错误');
|
||||||
|
}
|
||||||
|
$find_data = Db::table('app_account_number')->where([$t_y=>$data['data']])->field('id,token')->find();
|
||||||
|
if(!$find_data){
|
||||||
|
return $this->msg(10006,'未核实到账号信息');
|
||||||
|
}
|
||||||
|
$result = Db::table('app_account_number')->where([$t_y=>$data['data']])->update(['password'=>$data['password']]);
|
||||||
|
if($result){
|
||||||
|
cache($find_data['token'], time());
|
||||||
|
return $this->msg(0,'success',['token'=>$find_data['token'],'aan_id'=>$find_data['id']]);
|
||||||
|
}else{
|
||||||
|
return $this->msg(10005,'注册失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 登录
|
// 登录
|
||||||
public function login_action($data = ['data'=>'18530934717','validate_data'=>'734626','type'=>'login','validate_type'=>'code']){
|
public function login_action($data = ['data'=>'18530934717','validate_data'=>'746119','type'=>'login','validate_type'=>'code']){
|
||||||
|
|
||||||
if(count(input()) > 0){
|
if(count(input()) > 0){
|
||||||
$data = input();
|
$data = input();
|
||||||
|
|
@ -59,15 +90,20 @@ class Login extends Base{
|
||||||
$verify_result['email'] = $data['data'];
|
$verify_result['email'] = $data['data'];
|
||||||
$road = 'email';
|
$road = 'email';
|
||||||
}
|
}
|
||||||
|
// dump($verify_result);
|
||||||
|
// die;
|
||||||
|
// $find_token = Db::table('app_account_number')->where([$t_y=>$data['data']])->field('id,token')->find();
|
||||||
// 检测校验途径
|
// 检测校验途径
|
||||||
if($data['validate_type'] == 'code'){
|
if($data['validate_type'] == 'code'){
|
||||||
$code_name = $data['data'];
|
$code_name = $data['data'];
|
||||||
// dump(cache($code_name));
|
// dump(cache($code_name));
|
||||||
// die;
|
// die;
|
||||||
if(cache($code_name) == $data['validate_data']){
|
// if(cache($code_name) == $data['validate_data']){
|
||||||
$result = Db::table('app_account_number')->where(['tel'=>$verify_result['tel']])->find();
|
if($this->check_code($code_name,$data['validate_data']) === true){
|
||||||
|
$result = Db::table('app_account_number')->where($verify_result)->field('id,token')->find();
|
||||||
if($result){
|
if($result){
|
||||||
return $this->msg(0,'success',$result['id']);
|
cache($result['token'], time());
|
||||||
|
return $this->msg(0,'success',['token'=>$result['token'],'aan_id'=>$result['id']]);
|
||||||
}else{
|
}else{
|
||||||
return $this->msg(10002,'登录失败,无效账号');
|
return $this->msg(10002,'登录失败,无效账号');
|
||||||
}
|
}
|
||||||
|
|
@ -76,9 +112,10 @@ class Login extends Base{
|
||||||
}
|
}
|
||||||
}else if($data['validate_type'] == 'password'){
|
}else if($data['validate_type'] == 'password'){
|
||||||
$verify_result['password'] = $data['validate_data'];
|
$verify_result['password'] = $data['validate_data'];
|
||||||
$result = Db::table('app_account_number')->where($verify_result)->find();
|
$result = Db::table('app_account_number')->where($verify_result)->field('id,token')->find();
|
||||||
if($result){
|
if($result){
|
||||||
return $this->msg(0,'success',$result['id']);
|
cache($result['token'], time());
|
||||||
|
return $this->msg(0,'success',['token'=>$result['token'],'aan_id'=>$result['id']]);
|
||||||
}else{
|
}else{
|
||||||
return $this->msg(10001,'登录失败,账号/密码错误');
|
return $this->msg(10001,'登录失败,账号/密码错误');
|
||||||
}
|
}
|
||||||
|
|
@ -111,7 +148,7 @@ class Login extends Base{
|
||||||
$road = 'email';
|
$road = 'email';
|
||||||
}
|
}
|
||||||
if(is_array($result) && $result['code'] == 0){
|
if(is_array($result) && $result['code'] == 0){
|
||||||
cache($data['data'], $num, 60);
|
cache($data['data'], $num, $this->code_time);
|
||||||
// dump($data['data']."_".$data['road']."_".$data['type']);
|
// dump($data['data']."_".$data['road']."_".$data['type']);
|
||||||
return $this->msg(0,'success',$num);
|
return $this->msg(0,'success',$num);
|
||||||
// return true;
|
// return true;
|
||||||
|
|
@ -121,16 +158,6 @@ class Login extends Base{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function check_code($data = []){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
################################内部调用################################
|
################################内部调用################################
|
||||||
/* 接口说明(发邮件)
|
/* 接口说明(发邮件)
|
||||||
* $address(收件人的邮箱地址) 数组 格式: ['460834639@qq.com','460834639@qq.com'.......]
|
* $address(收件人的邮箱地址) 数组 格式: ['460834639@qq.com','460834639@qq.com'.......]
|
||||||
|
|
@ -219,6 +246,21 @@ class Login extends Base{
|
||||||
echo "未收到响应";
|
echo "未收到响应";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function check_code($data = 18530934717 , $code = 123456){
|
||||||
|
return true;
|
||||||
|
// dump($data);
|
||||||
|
// dump(cache($data));
|
||||||
|
// die;
|
||||||
|
if(cache($data) == false){
|
||||||
|
return '验证码过期';
|
||||||
|
}else{
|
||||||
|
if($code != cache($data)){
|
||||||
|
return '验证码错误';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
################################################################other################################################################
|
################################################################other################################################################
|
||||||
################################################################other################################################################
|
################################################################other################################################################
|
||||||
################################################################other################################################################
|
################################################################other################################################################
|
||||||
|
|
@ -265,13 +307,13 @@ class Login extends Base{
|
||||||
// dump($montage_data);
|
// dump($montage_data);
|
||||||
// dump( $parameter);
|
// dump( $parameter);
|
||||||
// 检验是否注册过
|
// 检验是否注册过
|
||||||
if($montage_data == 'tel'){
|
// if($montage_data == 'tel'){
|
||||||
$inspect_repeat = Db::table('app_account_number')->where(['tel'=>$parameter['tel']])->count();
|
// $inspect_repeat = Db::table('app_account_number')->where(['tel'=>$parameter['tel']])->count();
|
||||||
// $inspect_repeat = Db::query("select count(*) from app_account_number where tel='".$parameter['tel']."'and password='".$parameter['password']);
|
// // $inspect_repeat = Db::query("select count(*) from app_account_number where tel='".$parameter['tel']."'and password='".$parameter['password']);
|
||||||
}else{
|
// }else{
|
||||||
$inspect_repeat = Db::table('app_account_number')->where(['email'=>$parameter['email']])->count();
|
// $inspect_repeat = Db::table('app_account_number')->where(['email'=>$parameter['email']])->count();
|
||||||
}
|
// }
|
||||||
|
$inspect_repeat = Db::table('app_account_number')->where([$montage_data=>$data['data']])->count();
|
||||||
// dump( $inspect_repeat);
|
// dump( $inspect_repeat);
|
||||||
// die;
|
// die;
|
||||||
// dump($inspect_repeat);
|
// dump($inspect_repeat);
|
||||||
|
|
@ -283,19 +325,15 @@ class Login extends Base{
|
||||||
|
|
||||||
if($type == 'register'){
|
if($type == 'register'){
|
||||||
if(array_key_exists('code', $data)){
|
if(array_key_exists('code', $data)){
|
||||||
// dump($parameter[$montage_data]."_".$montage_data."_register".'='.cache($parameter[$montage_data]."_".$montage_data."_register"));
|
$code_result = $this->check_code($parameter[$montage_data],$data['code']);
|
||||||
if(cache($parameter[$montage_data]) == false){
|
if($code_result !== true){
|
||||||
return '验证码过期';
|
return $code_result;
|
||||||
}else{
|
|
||||||
if($data['code'] != cache($parameter[$montage_data])){
|
|
||||||
return '验证码错误';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
return '验证码必须';
|
return '验证码必须';
|
||||||
}
|
}
|
||||||
$parameter['create_time'] = date('Y-m-d H:i:s');
|
$parameter['create_time'] = date('Y-m-d H:i:s');
|
||||||
$parameter['token'] = md5($parameter['tel'].$this->create_random_string(12).time());
|
$parameter['token'] = md5($data['data'].$this->create_random_string(12).time());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $parameter;
|
return $parameter;
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,8 @@ Route::any('/admin/index', 'admin/index/index');
|
||||||
// ################################登录接口################################
|
// ################################登录接口################################
|
||||||
// 注册接口
|
// 注册接口
|
||||||
Route::any('/register_action', 'app/login/register_action');
|
Route::any('/register_action', 'app/login/register_action');
|
||||||
|
// 注册接口
|
||||||
|
Route::any('/reset_password', 'app/login/reset_password');
|
||||||
// 登录接口
|
// 登录接口
|
||||||
Route::any('/login_action', 'app/login/login_action');
|
Route::any('/login_action', 'app/login/login_action');
|
||||||
// 手机或者邮箱验证码接口接口
|
// 手机或者邮箱验证码接口接口
|
||||||
|
|
@ -54,17 +56,13 @@ Route::any('/get_user_data_information', 'app/index/get_user_data_information');
|
||||||
Route::any('/get_card_all_list', 'app/index/get_card_all_list');
|
Route::any('/get_card_all_list', 'app/index/get_card_all_list');
|
||||||
// 保存用户的卡片排序
|
// 保存用户的卡片排序
|
||||||
Route::any('/save_user_card_order', 'app/index/save_user_card_order');
|
Route::any('/save_user_card_order', 'app/index/save_user_card_order');
|
||||||
// ################################身体接口################################
|
// ################################身体数据卡片接口################################
|
||||||
// 查找设备
|
// 报告页详情
|
||||||
|
Route::any('/card_data_detailed', 'app/card/card_data_detailed');
|
||||||
|
// 手动记录接口
|
||||||
|
Route::any('/card_manual_recording', 'app/card/card_manual_recording');
|
||||||
|
// 获取所有记录接口
|
||||||
Route::any('/get_card_record_data', 'app/card/get_card_record_data');
|
Route::any('/get_card_record_data', 'app/card/get_card_record_data');
|
||||||
// // 今日数据
|
|
||||||
Route::any('/card_data_contrast', 'app/card/card_data_contrast');
|
|
||||||
// // 数据记录
|
|
||||||
// Route::any('/skip_record_data', 'app/skip/skip_record_data');
|
|
||||||
// // 运动曲线
|
|
||||||
Route::any('/skip_motion_curve', 'app/skip/skip_motion_curve');
|
|
||||||
Route::any('/body_curve_data', 'app/card/body_curve_data');
|
|
||||||
// Route::any('/generateRandomJumpData', 'app/skip/generateRandomJumpData');
|
|
||||||
// ################################跳绳接口################################
|
// ################################跳绳接口################################
|
||||||
// 查找设备
|
// 查找设备
|
||||||
Route::any('/skip_device_check', 'app/skip/skip_device_check');
|
Route::any('/skip_device_check', 'app/skip/skip_device_check');
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 11 KiB |
Loading…
Reference in New Issue