2024-03-06 16:58:11 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace app\app\controller;
|
|
|
|
|
|
|
|
|
|
|
|
use think\Controller;
|
|
|
|
|
|
use think\Db;
|
|
|
|
|
|
use app\bj\controller\Common;
|
|
|
|
|
|
use think\Log;
|
|
|
|
|
|
use \think\Validate;
|
|
|
|
|
|
|
2024-05-16 10:33:57 +08:00
|
|
|
|
class Index extends Base{
|
2024-03-06 16:58:11 +08:00
|
|
|
|
|
2024-05-16 10:33:57 +08:00
|
|
|
|
protected $db_name = ['2'=>'app_card_body_data','6'=>'app_card_skip_data','8'=>'app_card_vitalcapacity_data'];
|
|
|
|
|
|
// protected $card_key = ['2'=>'body','6'=>'skip','8'=>'vitalcapacity'];
|
|
|
|
|
|
protected $card_data = [
|
2024-05-21 18:43:56 +08:00
|
|
|
|
'2'=>['身体数据','body_data',['height'=>['身高','cm'],'weight'=>['体重','公斤'],'bmi'=>['BMI','无']]],
|
2024-05-16 10:33:57 +08:00
|
|
|
|
// 'skip'=>['跳绳数据',['height,weight,bmi,record_time']],
|
2024-05-21 18:43:56 +08:00
|
|
|
|
'8'=>['肺活量','vitalcapacity_data',['average'=>['本次数据','ml']]],
|
2024-05-16 10:33:57 +08:00
|
|
|
|
];
|
2024-05-21 18:43:56 +08:00
|
|
|
|
|
|
|
|
|
|
protected $data_name_unit = [
|
|
|
|
|
|
'height'=>['身高','cm','pc_heightstand2'],
|
|
|
|
|
|
'weight'=>['体重','公斤','pc_weightstand2'],
|
|
|
|
|
|
'bmi'=>['BMI','','pc_bmistand2'],
|
|
|
|
|
|
'average'=>['肺活量','ml','pc_vitalcapacity_standard']
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
protected $grade_list = [
|
|
|
|
|
|
['id'=>'nothing','name'=>'无'],
|
|
|
|
|
|
['id'=>'grade_s_1','name'=>'小学一年级'],
|
|
|
|
|
|
['id'=>'grade_s_2','name'=>'小学二年级'],
|
|
|
|
|
|
['id'=>'grade_s_3','name'=>'小学三年级'],
|
|
|
|
|
|
['id'=>'grade_s_4','name'=>'小学四年级'],
|
|
|
|
|
|
['id'=>'grade_s_5','name'=>'小学五年级'],
|
|
|
|
|
|
['id'=>'grade_s_6','name'=>'小学六年级'],
|
|
|
|
|
|
['id'=>'grade_m_1','name'=>'初中一年级'],
|
|
|
|
|
|
['id'=>'grade_m_2','name'=>'初中二年级'],
|
|
|
|
|
|
['id'=>'grade_m_3','name'=>'初中三年级'],
|
|
|
|
|
|
['id'=>'grade_h_1','name'=>'高中一年级'],
|
|
|
|
|
|
['id'=>'grade_h_2','name'=>'高中二年级'],
|
|
|
|
|
|
['id'=>'grade_h_3','name'=>'高中三年级'],
|
|
|
|
|
|
['id'=>'grade_u_12','name'=>'大学一、二年级'],
|
|
|
|
|
|
['id'=>'grade_u_34','name'=>'大学三、四年级']
|
|
|
|
|
|
];
|
|
|
|
|
|
|
2024-03-06 16:58:11 +08:00
|
|
|
|
################################################################个人资料卡################################################################
|
|
|
|
|
|
################################################################个人资料卡################################################################
|
|
|
|
|
|
################################################################个人资料卡################################################################
|
|
|
|
|
|
|
2024-05-16 10:33:57 +08:00
|
|
|
|
// // 个人信息
|
|
|
|
|
|
// public function personal_information(){
|
|
|
|
|
|
// // phpinfo();
|
|
|
|
|
|
// dump(123);
|
|
|
|
|
|
// $result = Db::table('admin_user')->select();
|
|
|
|
|
|
// dump($result);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// 创建用户
|
2024-05-20 18:49:27 +08:00
|
|
|
|
public function create_user_data($data = ['aan_id'=>66,'nickname'=>'王小二','birthday'=>'2019-01-01','gender'=>1,'grade'=>'二年级','token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
2024-05-20 13:56:50 +08:00
|
|
|
|
if(count(input()) > 0){
|
|
|
|
|
|
$data = input();
|
|
|
|
|
|
}
|
2024-05-21 18:43:56 +08:00
|
|
|
|
if(!array_key_exists('token', $data)){
|
|
|
|
|
|
return $this->msg(10001);
|
|
|
|
|
|
}
|
2024-05-20 18:49:27 +08:00
|
|
|
|
if($this->token_time_validate($data['token']) === false){
|
2024-05-21 18:43:56 +08:00
|
|
|
|
return $this->msg(20001);
|
2024-05-20 18:49:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
unset($data['token']);
|
2024-03-29 18:34:01 +08:00
|
|
|
|
$verify_result = $this->verify_parameters($data,'register');
|
2024-05-16 10:33:57 +08:00
|
|
|
|
if(!is_array($verify_result)){
|
2024-05-21 18:43:56 +08:00
|
|
|
|
return $this->msg(10001,$verify_result);
|
2024-03-15 18:15:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
$result = Db::table('app_user_data')->insert($verify_result);
|
2024-03-06 16:58:11 +08:00
|
|
|
|
if($result){
|
2024-05-21 18:43:56 +08:00
|
|
|
|
return $this->msg([]);
|
2024-03-06 16:58:11 +08:00
|
|
|
|
}else{
|
2024-05-21 18:43:56 +08:00
|
|
|
|
return $this->msg(10002);
|
2024-03-06 16:58:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-03-15 18:15:17 +08:00
|
|
|
|
|
|
|
|
|
|
// 获取账号下用户列表
|
2024-03-06 16:58:11 +08:00
|
|
|
|
// $type 1获取列表,2获取详细信息
|
2024-05-20 18:49:27 +08:00
|
|
|
|
public function get_user_card_list($data = ['aan_id'=>66,'type'=>1,'token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
2024-05-20 13:56:50 +08:00
|
|
|
|
if(count(input()) > 0){
|
|
|
|
|
|
$data = input();
|
|
|
|
|
|
}
|
2024-05-22 19:50:44 +08:00
|
|
|
|
if(!array_key_exists('token', $data) || !array_key_exists('aan_id', $data) || !array_key_exists('type', $data)){
|
2024-05-21 18:43:56 +08:00
|
|
|
|
return $this->msg(10001);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-05-20 18:49:27 +08:00
|
|
|
|
if($this->token_time_validate($data['token']) === false){
|
2024-05-21 18:43:56 +08:00
|
|
|
|
return $this->msg(20001);
|
2024-05-20 18:49:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
unset($data['token']);
|
2024-05-20 13:56:50 +08:00
|
|
|
|
$result = Db::table('app_user_data')->where(['aan_id'=>$data['aan_id']])->select();
|
2024-03-15 18:15:17 +08:00
|
|
|
|
// $result = Db::table('app_user_data')->where(['aan_id'=>$aan_id])->field('id,nickname')->select();
|
2024-05-20 13:56:50 +08:00
|
|
|
|
$temporary_data = [];
|
|
|
|
|
|
if($data['type'] == 1){
|
2024-03-06 16:58:11 +08:00
|
|
|
|
for ($i=0; $i < count($result); $i++) {
|
2024-05-20 13:56:50 +08:00
|
|
|
|
array_push($temporary_data,['id'=>$result[$i]['id'],'nickname'=>$result[$i]['nickname']]);
|
2024-03-06 16:58:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
}else{
|
2024-05-20 13:56:50 +08:00
|
|
|
|
$temporary_data = $result;
|
2024-03-06 16:58:11 +08:00
|
|
|
|
}
|
2024-05-21 18:43:56 +08:00
|
|
|
|
return $this->msg($temporary_data);
|
2024-03-06 16:58:11 +08:00
|
|
|
|
}
|
2024-03-15 18:15:17 +08:00
|
|
|
|
|
2024-05-16 10:33:57 +08:00
|
|
|
|
// 获取指定用户详细信息
|
2024-05-22 18:36:27 +08:00
|
|
|
|
public function get_user_data_information($data = ['aud_id'=>25,'token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
2024-05-20 13:56:50 +08:00
|
|
|
|
if(count(input()) > 0){
|
|
|
|
|
|
$data = input();
|
|
|
|
|
|
}
|
2024-05-22 19:50:44 +08:00
|
|
|
|
if(!array_key_exists('token', $data) || !array_key_exists('aud_id', $data)){
|
2024-05-21 18:43:56 +08:00
|
|
|
|
return $this->msg(10001);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-05-20 18:49:27 +08:00
|
|
|
|
if($this->token_time_validate($data['token']) === false){
|
2024-05-21 18:43:56 +08:00
|
|
|
|
return $this->msg(20001);
|
2024-05-20 18:49:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
unset($data['token']);
|
2024-05-21 18:43:56 +08:00
|
|
|
|
$result = Db::table('app_user_data')->where(['id'=>$data['aud_id']])->field('id,aan_id,nickname,head_pic,birthday,gender,card_order')->find();
|
2024-05-22 19:50:44 +08:00
|
|
|
|
|
2024-05-21 18:43:56 +08:00
|
|
|
|
if(!$result){
|
|
|
|
|
|
return $this->msg(10003);
|
|
|
|
|
|
}
|
2024-05-16 10:33:57 +08:00
|
|
|
|
unset($result['ROW_NUMBER']);
|
2024-05-21 18:43:56 +08:00
|
|
|
|
$result['age'] = $this->calculate_age($result['birthday']);
|
2024-05-16 10:33:57 +08:00
|
|
|
|
if($result['card_order'] === ''){
|
|
|
|
|
|
$result['card_order'] = [];
|
|
|
|
|
|
$result['card_data_list'] = [];
|
2024-03-06 16:58:11 +08:00
|
|
|
|
}else{
|
2024-05-16 10:33:57 +08:00
|
|
|
|
$result['card_order'] = explode(',',$result['card_order']);
|
|
|
|
|
|
$result['card_data_list'] = $this->get_user_card_data_list($result['card_order'],$result['id']);
|
2024-03-06 16:58:11 +08:00
|
|
|
|
}
|
2024-05-22 19:50:44 +08:00
|
|
|
|
// base_target_initial_cumulative_weight
|
2024-05-21 18:43:56 +08:00
|
|
|
|
// dump($result);
|
|
|
|
|
|
// die;
|
2024-05-20 18:49:27 +08:00
|
|
|
|
$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']);
|
|
|
|
|
|
}
|
2024-05-21 18:43:56 +08:00
|
|
|
|
return $this->msg($result);
|
2024-03-06 16:58:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-05-16 10:33:57 +08:00
|
|
|
|
// 获取所有卡片列表信息
|
2024-05-20 18:49:27 +08:00
|
|
|
|
public function get_card_all_list($data = ['aud_id'=>11,'token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
2024-05-20 13:56:50 +08:00
|
|
|
|
if(count(input()) > 0){
|
|
|
|
|
|
$data = input();
|
|
|
|
|
|
}
|
2024-05-21 18:43:56 +08:00
|
|
|
|
if(!array_key_exists('token', $data)){
|
|
|
|
|
|
return $this->msg(10001);
|
|
|
|
|
|
}
|
2024-05-20 18:49:27 +08:00
|
|
|
|
if($this->token_time_validate($data['token']) === false){
|
2024-05-21 18:43:56 +08:00
|
|
|
|
return $this->msg(20001);
|
2024-05-20 18:49:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
unset($data['token']);
|
2024-05-20 13:56:50 +08:00
|
|
|
|
$user_card_list = Db::table('app_user_data')->where(['id'=>$data['aud_id']])->field('id,card_order')->find();
|
2024-05-21 18:43:56 +08:00
|
|
|
|
if(!$user_card_list){
|
|
|
|
|
|
return $this->msg(10003);
|
|
|
|
|
|
}
|
2024-05-16 10:33:57 +08:00
|
|
|
|
unset($user_card_list['ROW_NUMBER']);
|
|
|
|
|
|
$user_card_list['card_order'] = explode(',',$user_card_list['card_order']);
|
|
|
|
|
|
$all_card_list = Db::table('app_card_data')->field('id,name')->select();
|
|
|
|
|
|
// dump($user_card_list);
|
|
|
|
|
|
// dump($all_card_list);
|
|
|
|
|
|
$result = ['user'=>[],'all'=>[]];
|
|
|
|
|
|
foreach ($all_card_list as $key => $value) {
|
|
|
|
|
|
if(in_array($value['id'],$user_card_list['card_order'])){
|
|
|
|
|
|
$result['user'][array_search($value['id'], $user_card_list['card_order'])] = ['id'=>$value['id'],'name'=>$value['name']];
|
|
|
|
|
|
}else{
|
|
|
|
|
|
array_push($result['all'],['id'=>$value['id'],'name'=>$value['name']]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
ksort($result['user']);
|
2024-05-21 18:43:56 +08:00
|
|
|
|
return $this->msg($result);
|
2024-05-16 10:33:57 +08:00
|
|
|
|
}
|
2024-03-15 18:15:17 +08:00
|
|
|
|
|
2024-05-16 10:33:57 +08:00
|
|
|
|
// 保存用户的卡片排序
|
2024-05-20 18:49:27 +08:00
|
|
|
|
public function save_user_card_order($data=['aud_id'=>11,'card_order'=>'2,8','token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
2024-05-20 13:56:50 +08:00
|
|
|
|
if(count(input()) > 0){
|
|
|
|
|
|
$data = input();
|
2024-03-06 16:58:11 +08:00
|
|
|
|
}
|
2024-05-21 18:43:56 +08:00
|
|
|
|
if(!array_key_exists('aud_id', $data) || !array_key_exists('card_order', $data) || !array_key_exists('token', $data)){
|
|
|
|
|
|
return $this->msg(10001);
|
|
|
|
|
|
}
|
2024-05-20 18:49:27 +08:00
|
|
|
|
if($this->token_time_validate($data['token']) === false){
|
2024-05-21 18:43:56 +08:00
|
|
|
|
return $this->msg(20001);
|
2024-05-20 18:49:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
unset($data['token']);
|
2024-05-20 13:56:50 +08:00
|
|
|
|
if(!$this->is_num_array(explode(',',$data['card_order']))){
|
2024-05-21 18:43:56 +08:00
|
|
|
|
return $this->msg(10001,'数据内参数格式或值错误');
|
2024-05-16 10:33:57 +08:00
|
|
|
|
}
|
2024-05-20 13:56:50 +08:00
|
|
|
|
$result = Db::table('app_user_data')->where(['id'=>$data['aud_id']])->update(['card_order'=>$data['card_order']]);
|
2024-03-06 16:58:11 +08:00
|
|
|
|
if($result){
|
2024-05-21 18:43:56 +08:00
|
|
|
|
return $this->msg([]);
|
2024-03-06 16:58:11 +08:00
|
|
|
|
}else{
|
2024-05-21 18:43:56 +08:00
|
|
|
|
return $this->msg(10002);
|
2024-03-06 16:58:11 +08:00
|
|
|
|
}
|
2024-05-20 13:56:50 +08:00
|
|
|
|
|
2024-03-06 16:58:11 +08:00
|
|
|
|
}
|
2024-05-21 18:43:56 +08:00
|
|
|
|
|
|
|
|
|
|
public function get_grade_list(){
|
|
|
|
|
|
$data = input();
|
|
|
|
|
|
if(!array_key_exists('token', $data)){
|
|
|
|
|
|
return $this->msg(10001);
|
|
|
|
|
|
}
|
|
|
|
|
|
if($this->token_time_validate($data['token']) === false){
|
|
|
|
|
|
return $this->msg(20001);
|
|
|
|
|
|
}
|
|
|
|
|
|
return $this->msg($this->grade_list);
|
|
|
|
|
|
}
|
2024-05-20 13:56:50 +08:00
|
|
|
|
|
2024-03-06 16:58:11 +08:00
|
|
|
|
|
2024-05-16 10:33:57 +08:00
|
|
|
|
################################获取账号下信息操作################################
|
2024-05-21 18:43:56 +08:00
|
|
|
|
|
2024-05-16 10:33:57 +08:00
|
|
|
|
// 获取账号下首页卡片的基础数据
|
|
|
|
|
|
public function get_user_card_data_list($data,$aud_id){
|
2024-05-21 18:43:56 +08:00
|
|
|
|
|
2024-05-16 10:33:57 +08:00
|
|
|
|
$result = [];
|
2024-05-21 18:43:56 +08:00
|
|
|
|
$db_arr = [];
|
2024-05-16 10:33:57 +08:00
|
|
|
|
foreach ($data as $key => $value) {
|
2024-05-21 18:43:56 +08:00
|
|
|
|
$db_arr[$value] = Db::table($this->db_name[$value])->where(['aud_id'=>$aud_id,'is_del'=>'0'])->order('id desc')->limit(1)->select();
|
2024-05-22 18:36:27 +08:00
|
|
|
|
// dump($db_arr[$value]);
|
|
|
|
|
|
|
|
|
|
|
|
if(count($db_arr[$value]) > 0){
|
|
|
|
|
|
$db_arr[$value] = $db_arr[$value][0];
|
|
|
|
|
|
}else{
|
|
|
|
|
|
unset($db_arr[$value]);
|
|
|
|
|
|
}
|
2024-05-16 10:33:57 +08:00
|
|
|
|
}
|
2024-05-21 18:43:56 +08:00
|
|
|
|
|
2024-05-22 18:36:27 +08:00
|
|
|
|
if(count($db_arr) <= 0){
|
|
|
|
|
|
// 没有数据,传递一个空的卡片
|
|
|
|
|
|
return [
|
|
|
|
|
|
[
|
|
|
|
|
|
'id'=>'',
|
|
|
|
|
|
'acd_id'=>'2',
|
|
|
|
|
|
'record_time'=>'',
|
|
|
|
|
|
'card_name'=>'身体数据',
|
|
|
|
|
|
'inside_data'=>[
|
|
|
|
|
|
[
|
|
|
|
|
|
'key'=>'',
|
|
|
|
|
|
'name'=>'身高',
|
|
|
|
|
|
'value'=>'',
|
|
|
|
|
|
'unit'=>'cm',
|
|
|
|
|
|
'standard'=>'',
|
|
|
|
|
|
'color'=>'',
|
|
|
|
|
|
],
|
|
|
|
|
|
[
|
|
|
|
|
|
'key'=>'',
|
|
|
|
|
|
'name'=>'体重',
|
|
|
|
|
|
'value'=>'',
|
|
|
|
|
|
'unit'=>'公斤',
|
|
|
|
|
|
'standard'=>'',
|
|
|
|
|
|
'color'=>'',
|
|
|
|
|
|
],
|
|
|
|
|
|
[
|
|
|
|
|
|
'key'=>'',
|
|
|
|
|
|
'name'=>'BMI',
|
|
|
|
|
|
'value'=>'',
|
|
|
|
|
|
'unit'=>'',
|
|
|
|
|
|
'standard'=>'',
|
|
|
|
|
|
'color'=>'',
|
|
|
|
|
|
],
|
|
|
|
|
|
]
|
|
|
|
|
|
]
|
|
|
|
|
|
];
|
|
|
|
|
|
}
|
|
|
|
|
|
// dump($db_arr);
|
|
|
|
|
|
// die;
|
2024-05-21 18:43:56 +08:00
|
|
|
|
foreach ($db_arr as $key => $value) {
|
|
|
|
|
|
$temporary_arr = [];
|
|
|
|
|
|
$temporary_arr['id'] = $value['id'];
|
|
|
|
|
|
$temporary_arr['acd_id'] = $value['acd_id'];
|
|
|
|
|
|
$temporary_arr['record_time'] = $value['record_time'];
|
|
|
|
|
|
// $temporary_arr['value'] = $value['record_time'];
|
|
|
|
|
|
$temporary_arr['card_name'] = $this->card_data[$value['acd_id']][0];
|
|
|
|
|
|
$temporary_arr['inside_data'] = [];
|
|
|
|
|
|
if(array_key_exists($value['acd_id'],$this->card_data)){
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($this->card_data[$value['acd_id']][2] as $k => $v) {
|
|
|
|
|
|
$tem_arr_2 = explode(',', $db_arr[$key][$k."_data"]);
|
|
|
|
|
|
array_push($temporary_arr['inside_data'],[
|
|
|
|
|
|
'key'=>$k,
|
|
|
|
|
|
'name'=>$v[0],
|
|
|
|
|
|
'value'=>$tem_arr_2[0],
|
|
|
|
|
|
'unit'=>$v[1]!='无'?$v[1]:'',
|
|
|
|
|
|
'standard'=>$tem_arr_2[1]!='无'?$tem_arr_2[1]:'',
|
|
|
|
|
|
'color'=>$tem_arr_2[2]!='无'?$tem_arr_2[2]:''
|
|
|
|
|
|
]);
|
2024-05-16 10:33:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-05-21 18:43:56 +08:00
|
|
|
|
array_push($result,$temporary_arr);
|
2024-05-16 10:33:57 +08:00
|
|
|
|
}
|
2024-05-22 18:36:27 +08:00
|
|
|
|
// dump($result);
|
|
|
|
|
|
// die;
|
2024-05-16 10:33:57 +08:00
|
|
|
|
return $result;
|
2024-05-21 18:43:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-06 16:58:11 +08:00
|
|
|
|
|
|
|
|
|
|
################################################################other################################################################
|
|
|
|
|
|
################################################################other################################################################
|
|
|
|
|
|
################################################################other################################################################
|
2024-05-16 10:33:57 +08:00
|
|
|
|
|
2024-03-06 16:58:11 +08:00
|
|
|
|
|
2024-03-15 18:15:17 +08:00
|
|
|
|
public function verify_parameters($data,$type){
|
|
|
|
|
|
// 设置验证
|
|
|
|
|
|
$rule = [
|
|
|
|
|
|
'aan_id' => 'require|number',
|
|
|
|
|
|
'nickname' => 'require|chsAlpha',
|
|
|
|
|
|
'birthday' => 'require|date',
|
|
|
|
|
|
'gender' => 'require|number|in:0,1,2',
|
2024-03-29 18:34:01 +08:00
|
|
|
|
'grade' => 'require',
|
2024-03-15 18:15:17 +08:00
|
|
|
|
];
|
|
|
|
|
|
$msg = [
|
|
|
|
|
|
'aan_id.require' => '账号信息缺失',
|
|
|
|
|
|
'nickname.require' => '昵称缺失',
|
|
|
|
|
|
'birthday.require' => '生日缺失',
|
|
|
|
|
|
'gender.require' => '性别缺失',
|
2024-03-29 18:34:01 +08:00
|
|
|
|
'grade.require' => '年级缺失',
|
2024-03-15 18:15:17 +08:00
|
|
|
|
|
|
|
|
|
|
'aan_id.number' => '账号信息格式错误',
|
|
|
|
|
|
'nickname.chsAlpha' => '昵称只能是只能是汉字、字母',
|
|
|
|
|
|
'birthday.date' => '生日信息格式错误',
|
|
|
|
|
|
'gender.number' => '性别格式错误',
|
|
|
|
|
|
'gender.in' => '性别信息错误',
|
|
|
|
|
|
];
|
|
|
|
|
|
$validate = new Validate($rule,$msg);
|
|
|
|
|
|
$result = $validate->check($data);
|
|
|
|
|
|
if(!$result){
|
|
|
|
|
|
return $validate->getError();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$parameter['aan_id'] = $data['aan_id'];
|
|
|
|
|
|
$parameter['nickname'] = $data['nickname'];
|
|
|
|
|
|
$parameter['birthday'] = $data['birthday'];
|
|
|
|
|
|
$parameter['gender'] = $data['gender'];
|
2024-03-29 18:34:01 +08:00
|
|
|
|
$parameter['grade'] = $data['grade'];
|
2024-05-21 18:43:56 +08:00
|
|
|
|
$parameter['card_order'] = '2,8';
|
2024-03-15 18:15:17 +08:00
|
|
|
|
$parameter['create_time'] = date('Y-m-d H:i:s');
|
|
|
|
|
|
$parameter['last_update_time'] = date('Y-m-d H:i:s');
|
2024-05-21 18:43:56 +08:00
|
|
|
|
$parameter_pd = Db::table('app_account_number')->where(['id'=>$parameter['aan_id']])->count();
|
|
|
|
|
|
if($parameter_pd <= 0){
|
|
|
|
|
|
return '该账户不存在';
|
|
|
|
|
|
}
|
2024-05-20 13:56:50 +08:00
|
|
|
|
$result = Db::table('app_user_data')->where(['nickname'=>$parameter['nickname'],'aan_id'=>$parameter['aan_id']])->count();
|
|
|
|
|
|
if($result>0){
|
|
|
|
|
|
return '该成员已存在';
|
|
|
|
|
|
}
|
2024-03-15 18:15:17 +08:00
|
|
|
|
|
|
|
|
|
|
return $parameter;
|
|
|
|
|
|
}
|
2024-03-29 18:34:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
2024-03-15 18:15:17 +08:00
|
|
|
|
|
2024-05-20 13:56:50 +08:00
|
|
|
|
|
2024-03-06 16:58:11 +08:00
|
|
|
|
|
|
|
|
|
|
}
|