diff --git a/application/admin/controller/Card.php b/application/admin/controller/Card.php index 90ec5bf..f5bb5a6 100644 --- a/application/admin/controller/Card.php +++ b/application/admin/controller/Card.php @@ -8,8 +8,202 @@ use app\bj\controller\Common; use think\Log; use \think\Validate; -class Card extends Controller{ - public function demo(){ - echo '你好'; +class Card extends Base{ + protected $page_num = 10; + protected $file_max = 1024*1024*5;//xxxMB + public function index($page = 1){ + $data = input(); + $pd = true; + $parameter = []; + // $parameter['is_del'] = 0; + if(array_key_exists('tt', $data)){ + $page = $data['page_num']; + unset($data['page_num']); + unset($data['tt']); + $pd = false; + // if($data['status_num'] === "0" || $data['status_num'] === "1"){ + // $parameter['is_del'] = $data['status_num']; + // } + + // if($data['tel']){ + // $parameter['tel'] = $data['tel']; + // } + // if($data['email']){ + // $parameter['email'] = $data['email']; + // } + // if($data['s_time']){ + // $parameter['create_time'] = ['>=',$data['s_time']]; + // } + // if($data['e_time']){ + // $parameter['create_time'] = ['<=',$data['e_time']]; + // } + } + $num = Db::table('app_card_data')->where($parameter)->count(); + $result = Db::table('app_card_data')->where($parameter)->order('is_del,id desc')->page($page,$this->page_num)->select(); + if(!$pd){ + $result['num'] = $num; + $result['data'] = $result; + return $this->msg(0,'success',$result); + } + $this->assign([ + 'result' => $result, + 'num' => $num, + ]); + return $this->fetch(); + } + public function card_add(){ + return $this->fetch(); + } + public function card_add_action(){ + $file = request()->file('upload_file_app'); + $data = request()->param(); + $num = Db::table('app_card_data')->where(['name'=>$data['card_name']])->count(); + + if($num > 0){ + return $this->msg(10001,'卡片已存在'); + } + if($file){ + // 移动到框架应用根目录/public/uploads/ 目录下 + $file_name_new = $data['card_name'].'_'.time().'.'.$data['file_extension']; + $info = $file->validate(['size'=>$this->file_max,'ext'=>'jpg,png,gif'])->move(ROOT_PATH . 'public' . DS . 'card',$file_name_new); + if($info){ + $result = Db::table('app_card_data')->insert([ + 'name'=>$data['card_name'], + 'content'=>$data['content'], + 'create_time'=>date('Y-m-d H:i:s'), + 'pic'=>'http://tc.pcxbc.com/card/'.$file_name_new, + 'page_url_record'=>$data['page_url_record'], + 'page_url_report'=>$data['page_url_report'], + 'page_url_bluetooth'=>$data['page_url_bluetooth'], + + ]); + if($result){ + return $this->msg([]); + }else{ + return $this->msg(10002); + } + // 成功上传后 获取上传信息 + // 输出 jpg + // echo $info->getExtension(); + // // 输出 20160820/42a79759f284b767dfcb2a0197904287.jpg + // echo $info->getSaveName(); + // // 输出 42a79759f284b767dfcb2a0197904287.jpg + // echo $info->getFilename(); + }else{ + // 上传失败获取错误信息 + return $this->msg(10001, $file->getError()); + // echo $file->getError(); + } + }else{ + return $this->msg(10001, '文件缺失'); + } + + } + public function card_edit(){ + $data = input(); + + $result = Db::table('app_card_data')->where(['id'=>$data['id']])->find(); + // dump($result); + // die; + $this->assign([ + 'result' => $result + ]); + return $this->fetch(); + } + public function card_edit_action(){ + $file = request()->file('upload_file_app'); + $data = request()->param(); + $check_data = Db::table('app_card_data')->where(['id'=>$data['id']])->find(); + // dump($check_data); + // dump($data); + // die; + if(!$check_data){ + return $this->msg(10001,'修改数据不存在'); + } + if($file){ + // 移动到框架应用根目录/public/uploads/ 目录下 + $file_name_new = $data['card_name'].'_'.time().'.'.$data['file_extension']; + $info = $file->validate(['size'=>$this->file_max,'ext'=>'jpg,png,gif'])->move(ROOT_PATH . 'public' . DS . 'card',$file_name_new); + if($info){ + $result = Db::table('app_card_data')->where(['id'=>$data['id']])->update([ + 'name'=>$data['card_name'], + 'content'=>$data['content'], + 'pic'=>'http://tc.pcxbc.com/card/'.$file_name_new, + 'page_url_record'=>$data['page_url_record'], + 'page_url_report'=>$data['page_url_report'], + 'page_url_bluetooth'=>$data['page_url_bluetooth'], + + ]); + + if($result){ + $file_name = basename($check_data['pic']); + $filePath = ROOT_PATH . 'public' . DS . 'card' . DS . $file_name; // ROOT_PATH 是框架定义的根目录路径常量 + if (file_exists($filePath)) { + if (unlink($filePath)) { + // 删除成功 + // echo '文件删除成功!'; + } else { + // 删除失败 + // echo '文件删除失败!'; + } + } else { + // 文件不存在 + // echo '文件不存在!'; + } + return $this->msg([]); + }else{ + return $this->msg(10002); + } + // 成功上传后 获取上传信息 + // 输出 jpg + // echo $info->getExtension(); + // // 输出 20160820/42a79759f284b767dfcb2a0197904287.jpg + // echo $info->getSaveName(); + // // 输出 42a79759f284b767dfcb2a0197904287.jpg + // echo $info->getFilename(); + }else{ + // 上传失败获取错误信息 + return $this->msg(10001, $file->getError()); + // echo $file->getError(); + } + }else{ + $result = Db::table('app_card_data')->where(['id'=>$data['id']])->update([ + 'name'=>$data['card_name'], + 'content'=>$data['content'], + 'page_url_record'=>$data['page_url_record'], + 'page_url_report'=>$data['page_url_report'], + 'page_url_bluetooth'=>$data['page_url_bluetooth'], + ]); + + if($result){ + return $this->msg([]); + }else{ + return $this->msg(10002); + } + } + + } + + public function card_del(){ + $data = input(); + if(is_array($data['id'])){ + $data['id'] = implode(',',$data['id']); + $result = Db::table('app_card_data')->where("id in (".$data['id'].")")->update(['is_del'=>$data['is_del']]); + }else{ + $result = Db::table('app_card_data')->where(['id'=>$data['id']])->update(['is_del'=>$data['is_del']]); + } + + if($result){ + return $this->msg(0,'success'); + }else{ + return $this->msg(10001,'success'); + } + + // $num = Db::table('app_version_log')->where(['id'=>$data['id']])->update(['is_del'=>1]); + // if($num){ + // return $this->msg([]); + // }else{ + // return $this->msg(10002); + // } } } \ No newline at end of file diff --git a/application/admin/controller/Device.php b/application/admin/controller/Device.php new file mode 100644 index 0000000..54afd02 --- /dev/null +++ b/application/admin/controller/Device.php @@ -0,0 +1,207 @@ +=',$data['s_time']]; + // } + // if($data['e_time']){ + // $parameter['create_time'] = ['<=',$data['e_time']]; + // } + } + $num = Db::table('app_device_data')->where($parameter)->count(); + $result = Db::table('app_device_data')->where($parameter)->order('is_del,id desc')->page($page,$this->page_num)->select(); + if(!$pd){ + $result['num'] = $num; + $result['data'] = $result; + return $this->msg(0,'success',$result); + } + $this->assign([ + 'result' => $result, + 'num' => $num, + ]); + return $this->fetch(); + } + public function device_add(){ + return $this->fetch(); + } + public function device_add_action(){ + $file = request()->file('upload_file_app'); + $data = request()->param(); + $num = Db::table('app_device_data')->where(['name'=>$data['device_name'],'bluetooth_type'=>$data['bluetooth_type'],'device_model'=>$data['device_model']])->count(); + if($num > 0){ + return $this->msg(10001,'设备已存在'); + } + if($file){ + // 移动到框架应用根目录/public/uploads/ 目录下 + $file_name_new = $data['device_model'].$data['bluetooth_type'].'_'.time().'.'.$data['file_extension']; + $info = $file->validate(['size'=>$this->file_max,'ext'=>'jpg,png,gif'])->move(ROOT_PATH . 'public' . DS . 'device',$file_name_new); + if($info){ + $result = Db::table('app_device_data')->insert([ + 'name'=>$data['device_name'], + 'content'=>$data['content'], + 'create_time'=>date('Y-m-d H:i:s'), + 'pic'=>'http://tc.pcxbc.com/device/'.$file_name_new, + 'bluetooth_type'=>$data['bluetooth_type'], + 'device_model'=>$data['device_model'], + 'page_measure'=>$data['page_measure'], + + ]); + if($result){ + return $this->msg([]); + }else{ + return $this->msg(10002); + } + // 成功上传后 获取上传信息 + // 输出 jpg + // echo $info->getExtension(); + // // 输出 20160820/42a79759f284b767dfcb2a0197904287.jpg + // echo $info->getSaveName(); + // // 输出 42a79759f284b767dfcb2a0197904287.jpg + // echo $info->getFilename(); + }else{ + // 上传失败获取错误信息 + return $this->msg(10001, $file->getError()); + // echo $file->getError(); + } + }else{ + return $this->msg(10001, '文件缺失'); + } + + } + public function device_edit(){ + $data = input(); + + $result = Db::table('app_device_data')->where(['id'=>$data['id']])->find(); + // dump($result); + // die; + $this->assign([ + 'result' => $result + ]); + return $this->fetch(); + } + public function device_edit_action(){ + $file = request()->file('upload_file_app'); + $data = request()->param(); + $check_data = Db::table('app_device_data')->where(['id'=>$data['id']])->find(); + // dump($check_data); + // dump($data); + // die; + if(!$check_data){ + return $this->msg(10001,'修改数据不存在'); + } + if($file){ + // 移动到框架应用根目录/public/uploads/ 目录下 + $file_name_new = $data['device_model'].$data['bluetooth_type'].'_'.time().'.'.$data['file_extension']; + $info = $file->validate(['size'=>$this->file_max,'ext'=>'jpg,png,gif'])->move(ROOT_PATH . 'public' . DS . 'device',$file_name_new); + if($info){ + $result = Db::table('app_device_data')->where(['id'=>$data['id']])->update([ + 'name'=>$data['device_name'], + 'content'=>$data['content'], + 'pic'=>'http://tc.pcxbc.com/device/'.$file_name_new, + 'bluetooth_type'=>$data['bluetooth_type'], + 'device_model'=>$data['device_model'], + 'page_measure'=>$data['page_measure'], + ]); + + if($result){ + $file_name = basename($check_data['pic']); + $filePath = ROOT_PATH . 'public' . DS . 'device' . DS . $file_name; // ROOT_PATH 是框架定义的根目录路径常量 + if (file_exists($filePath)) { + if (unlink($filePath)) { + // 删除成功 + // echo '文件删除成功!'; + } else { + // 删除失败 + // echo '文件删除失败!'; + } + } else { + // 文件不存在 + // echo '文件不存在!'; + } + return $this->msg([]); + }else{ + return $this->msg(10002); + } + // 成功上传后 获取上传信息 + // 输出 jpg + // echo $info->getExtension(); + // // 输出 20160820/42a79759f284b767dfcb2a0197904287.jpg + // echo $info->getSaveName(); + // // 输出 42a79759f284b767dfcb2a0197904287.jpg + // echo $info->getFilename(); + }else{ + // 上传失败获取错误信息 + return $this->msg(10001, $file->getError()); + // echo $file->getError(); + } + }else{ + $result = Db::table('app_device_data')->where(['id'=>$data['id']])->update([ + 'name'=>$data['device_name'], + 'content'=>$data['content'], + 'bluetooth_type'=>$data['bluetooth_type'], + 'device_model'=>$data['device_model'], + 'page_measure'=>$data['page_measure'], + ]); + + if($result){ + return $this->msg([]); + }else{ + return $this->msg(10002); + } + } + + } + + public function device_del(){ + $data = input(); + if(is_array($data['id'])){ + $data['id'] = implode(',',$data['id']); + $result = Db::table('app_device_data')->where("id in (".$data['id'].")")->update(['is_del'=>$data['is_del']]); + }else{ + $result = Db::table('app_device_data')->where(['id'=>$data['id']])->update(['is_del'=>$data['is_del']]); + } + + if($result){ + return $this->msg(0,'success'); + }else{ + return $this->msg(10001,'success'); + } + + // $num = Db::table('app_version_log')->where(['id'=>$data['id']])->update(['is_del'=>1]); + // if($num){ + // return $this->msg([]); + // }else{ + // return $this->msg(10002); + // } + } +} \ No newline at end of file diff --git a/application/admin/controller/Login.php b/application/admin/controller/Login.php index dcadaa4..c10ed9d 100644 --- a/application/admin/controller/Login.php +++ b/application/admin/controller/Login.php @@ -19,15 +19,23 @@ class Login extends Controller{ public function login_action(){ $data = input(); - $key_word1='教育'; - $key_word2='体测'; + // $key_word1='教育'; + // $key_word2='体测'; // $data['name'] = md5($key_word1.$data['name'].$key_word2) + // dump($data); + // die; + $result = Db::table('admin_user')->where(['user_name'=>$data['username'],'pass_word'=>$data['password']])->count(); - if($data['name'] == 'a' && md5($key_word1.$data['password'].$key_word2) == '871365cc2db43a8f2c7544798b36ed78'){ - return $this->msg(10000,'success'); + if($result>0){ + return $this->msg(0,'success'); }else{ return $this->msg(10001,'error'); } + // if($data['name'] == 'a' && md5($key_word1.$data['password'].$key_word2) == '871365cc2db43a8f2c7544798b36ed78'){ + // return $this->msg(10000,'success'); + // }else{ + // return $this->msg(10001,'error'); + // } } diff --git a/application/admin/view/appversion/app_add.html b/application/admin/view/appversion/app_add.html index 2356295..6316f1f 100644 --- a/application/admin/view/appversion/app_add.html +++ b/application/admin/view/appversion/app_add.html @@ -56,9 +56,9 @@
-
增加
- + + +
@@ -105,54 +105,54 @@ } }); - $('#add').click(function(){ + function add_data(){ + if(pd === false){ + return + } var formdata = new FormData(); formdata.append('apk',$('#upload_file_app')[0].files[0]) formdata.append('file_name',$('#file_name').val()) formdata.append('version_num','V'+$('#version_num').val()) formdata.append('version_num_original',$('#version_num').val()) formdata.append('content',$('#content').val()) - // return - if(pd){ - load() - pd = false - console.log('进来了') - $.ajax({ - url:"/appversion/app_add_action", //请求的url地址 - contentType:false, - processData:false, - async:true,//请求是否异步,默认为异步,这也是ajax重要特性 - data:formdata, //参数值 - type:"POST", //请求方式 - success:function(req){ - c_load() - pd = true - if(req.code == 0){ - layer.alert("增加成功", {icon: 6},function() { - //关闭当前frame - xadmin.close(); - // 可以对父窗口进行刷新 - xadmin.father_reload(); - }); - }else{ - layer.alert("增加失败", {icon: 6},function() { - //关闭当前frame - xadmin.close(); - // 可以对父窗口进行刷新 - xadmin.father_reload(); - }); - } - //请求成功时处理 - - console.log(req) - }, - error:function(){ - //请求出错处理 - pd = true + load() + pd = false + console.log('进来了') + $.ajax({ + url:"/appversion/app_add_action", //请求的url地址 + contentType:false, + processData:false, + async:true,//请求是否异步,默认为异步,这也是ajax重要特性 + data:formdata, //参数值 + type:"POST", //请求方式 + success:function(req){ + c_load() + pd = true + if(req.code == 0){ + layer.alert("增加成功", {icon: 6},function() { + //关闭当前frame + xadmin.close(); + // 可以对父窗口进行刷新 + xadmin.father_reload(); + }); + }else{ + layer.alert("增加失败"+req.msg, {icon: 6},function() { + //关闭当前frame + xadmin.close(); + // 可以对父窗口进行刷新 + xadmin.father_reload(); + }); } - }); - } - }) + //请求成功时处理 + + console.log(req) + }, + error:function(){ + //请求出错处理 + pd = true + } + }); + } layui.use(['form', 'layer','jquery'],function() { @@ -185,6 +185,8 @@ //监听提交 form.on('submit(add)',function(data) { //发异步,把数据提交给php + console.log(5689); + add_data() return false; }); diff --git a/application/admin/view/card/card_add.html b/application/admin/view/card/card_add.html new file mode 100644 index 0000000..7de2f3d --- /dev/null +++ b/application/admin/view/card/card_add.html @@ -0,0 +1,218 @@ + + + + + + app版本管理 + + + + + + + + + + + + +
+
+
+
+ + +
+ + +
+ +
+
+ +
+ +
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+ + + +
+
+
+
+ + + + + \ No newline at end of file diff --git a/application/admin/view/card/card_edit.html b/application/admin/view/card/card_edit.html new file mode 100644 index 0000000..d448a5c --- /dev/null +++ b/application/admin/view/card/card_edit.html @@ -0,0 +1,232 @@ + + + + + + app版本管理 + + + + + + + + + + + + +
+
+
+
+ + +
+ + +
+ +
+
+ +
+ +
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+ + + +
+
+
+
+ + + + + + \ No newline at end of file diff --git a/application/admin/view/card/index.html b/application/admin/view/card/index.html new file mode 100644 index 0000000..a50c68b --- /dev/null +++ b/application/admin/view/card/index.html @@ -0,0 +1,360 @@ + + + + + 所有卡片管理 + + + + + + + + + + +
+ + 首页 + 演示 + + 导航元素 + + + +
+
+
+
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + {volist name="result" id="vo"} + + + + + + + + + + + {/volist} + +
ID卡片名称卡片图标卡片描述创建时间状态操作
{$vo.id}{$vo.name}{$vo.content}{$vo.create_time} + {if condition="$vo.is_del == 1"} + 已停用 + {else /} + 已启用 + {/if} + + + +
+
+
+
+
+
+ +
+
+
+
+ + + \ No newline at end of file diff --git a/application/admin/view/device/device_add.html b/application/admin/view/device/device_add.html new file mode 100644 index 0000000..05dbb72 --- /dev/null +++ b/application/admin/view/device/device_add.html @@ -0,0 +1,223 @@ + + + + + + 设备管理_add + + + + + + + + + + + + +
+
+
+
+ + +
+ + +
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+
+
+
+ +
+
+
+
+ + + +
+
+
+
+ + + + + \ No newline at end of file diff --git a/application/admin/view/device/device_edit.html b/application/admin/view/device/device_edit.html new file mode 100644 index 0000000..d80b175 --- /dev/null +++ b/application/admin/view/device/device_edit.html @@ -0,0 +1,238 @@ + + + + + + 设备管理_edit + + + + + + + + + + + + +
+
+
+
+ + +
+ + +
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+ + + +
+
+
+
+ + + + + + \ No newline at end of file diff --git a/application/admin/view/device/index.html b/application/admin/view/device/index.html new file mode 100644 index 0000000..9f20b3c --- /dev/null +++ b/application/admin/view/device/index.html @@ -0,0 +1,360 @@ + + + + + 所有设备管理 + + + + + + + + + + +
+ + 首页 + 演示 + + 导航元素 + + + +
+
+
+
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + {volist name="result" id="vo"} + + + + + + + + + + + {/volist} + +
ID设备名称设备图标设备描述创建时间状态操作
{$vo.id}{$vo.name}{$vo.content}{$vo.create_time} + {if condition="$vo.is_del == 1"} + 已停用 + {else /} + 已启用 + {/if} + + + +
+
+
+
+
+
+ +
+
+
+
+ + + \ No newline at end of file diff --git a/application/admin/view/index/index.html b/application/admin/view/index/index.html index 8362e03..affc984 100644 --- a/application/admin/view/index/index.html +++ b/application/admin/view/index/index.html @@ -52,14 +52,12 @@ -
  • + + + + + + diff --git a/application/admin/view/login/login.html b/application/admin/view/login/login.html index b3f98cf..330faa7 100644 --- a/application/admin/view/login/login.html +++ b/application/admin/view/login/login.html @@ -46,15 +46,15 @@ url:"/admin/login_action", //请求的url地址 dataType:"json", //返回格式为json async:true,//请求是否异步,默认为异步,这也是ajax重要特性 - data:{"name":data.field.username,"password":data.field.password}, //参数值 + data:{"username":data.field.username,"password":data.field.password}, //参数值 type:"POST", //请求方式 success:function(req){ //请求成功时处理 - if(req.code == 10000){ + if(req.code == 0){ layer.msg('登录成功,准备跳转',function(){ location.href='/admin/index' - }); + },500); }else{ layer.msg('登录失败',function(){ pd = true diff --git a/application/admin/view/member/member_list.html b/application/admin/view/member/member_list.html index 6dd9d20..f4a9eba 100644 --- a/application/admin/view/member/member_list.html +++ b/application/admin/view/member/member_list.html @@ -66,7 +66,7 @@ - ID + 账号ID 唯一token 手机 邮箱 diff --git a/application/admin/view/member/user_list.html b/application/admin/view/member/user_list.html index 4532186..6689ebb 100644 --- a/application/admin/view/member/user_list.html +++ b/application/admin/view/member/user_list.html @@ -40,7 +40,7 @@ -->
    - +
    @@ -74,8 +74,8 @@ - ID - Aan_ID + 角色ID + 账号ID 昵称 生日 性别 diff --git a/application/app/controller/Card.php b/application/app/controller/Card.php index 6989e33..f810b6b 100644 --- a/application/app/controller/Card.php +++ b/application/app/controller/Card.php @@ -14,48 +14,44 @@ use app\app\controller\Skip; class Card extends Base{ protected $color = ['#FF5656','#FFAB00','#5AD06D','#6492F6','#3967D6']; - // protected $db_name = ['2'=>'app_card_body_data','6'=>'app_card_skip_data']; - // protected $db_content = [ - // '2'=>'height as v1,weight as v2,bmi as v3', - // '6'=>'jump_num as v1,jump_time as v2,jump_kcal as v3' - // ]; + protected $age_limit = 16; protected $unit_symbol = ['score'=>'分','height'=>'CM','weight'=>'公斤','bmi'=>'','fat_r'=>'%','fat_w'=>'kg','muscle'=>'%','muscleval'=>'kg','water'=>'kg','bone'=>'kg','protein'=>'%','proteinval'=>'kg','kcal'=>'kcal','visceral'=>'','sfr'=>'%',]; protected $unit_name = ['score'=>'身体得分','height'=>'身高','weight'=>'体重','bmi'=>'BMI','fat_r'=>'脂肪率','fat_w'=>'脂肪量','muscle'=>'肌肉率','muscleval'=>'肌肉量','water'=>'水分','bone'=>'骨重','protein'=>'蛋白率','proteinval'=>'蛋白量','kcal'=>'基础代谢','visceral'=>'内脏指数','sfr'=>'皮下脂肪','body_level'=>'肥胖等级','body_type'=>'身体类型']; protected $bhw_list = [ 'bmi'=>[ - ['min_val'=>'0','max_val'=>'','text'=>'消瘦','color'=>'#ffda69'], - ['min_val'=>'','max_val'=>'','text'=>'正常','color'=>'#5ad06d'], - ['min_val'=>'','max_val'=>'','text'=>'偏重','color'=>'#ffab00'], - ['min_val'=>'','max_val'=>'50','text'=>'肥胖','color'=>'#ff5656'], + ['min_val'=>'0','max_val'=>'','text'=>'消瘦','color'=>'#FF5656'], + ['min_val'=>'','max_val'=>'','text'=>'正常','color'=>'#FFAB00'], + ['min_val'=>'','max_val'=>'','text'=>'偏重','color'=>'#5AD06D'], + ['min_val'=>'','max_val'=>'50','text'=>'肥胖','color'=>'#6492F6'], ], 'height'=>[ ['min_val'=>'0','max_val'=>'','text'=>'矮','color'=>'#ff5656'], ['min_val'=>'','max_val'=>'','text'=>'偏矮','color'=>'#ffab00'], - ['min_val'=>'','max_val'=>'','text'=>'标准','color'=>'#5ad06d'], + ['min_val'=>'','max_val'=>'','text'=>'标准','color'=>'#5AD06D'], ['min_val'=>'','max_val'=>'','text'=>'偏高','color'=>'#6492f6'], ['min_val'=>'','max_val'=>'','text'=>'高','color'=>'#3967d6'], ], 'weight'=>[ ['min_val'=>'0','max_val'=>'','text'=>'低','color'=>'#ff5656'], ['min_val'=>'','max_val'=>'','text'=>'偏低','color'=>'#ffab00'], - ['min_val'=>'','max_val'=>'','text'=>'标准','color'=>'#5ad06d'], - ['min_val'=>'','max_val'=>'','text'=>'偏高','color'=>'#ffab00'], - ['min_val'=>'','max_val'=>'','text'=>'高','color'=>'#ff5656'], + ['min_val'=>'','max_val'=>'','text'=>'标准','color'=>'#5AD06D'], + ['min_val'=>'','max_val'=>'','text'=>'偏高','color'=>'#6492F6'], + ['min_val'=>'','max_val'=>'','text'=>'高','color'=>'#3967D6'], ] ]; protected $standard_color = [ - 'fat_r'=>['偏低'=>'#FFAB00','标准'=>'#5AD06D','偏高'=>'#6492F6','高'=>'#3967D6'], - 'fat_w'=>['偏低'=>'#FFAB00','标准'=>'#5AD06D','偏高'=>'#6492F6','高'=>'#3967D6'], - 'muscle'=>['不足'=>'#FF5656','标准'=>'#5AD06D','优'=>'#3967D6'], - 'muscleval'=>['不足'=>'#FF5656','标准'=>'#5AD06D','优'=>'#3967D6'], - 'water'=>['不足'=>'#FF5656','标准'=>'#5AD06D','优'=>'#3967D6'], - 'proteinval'=>['不足'=>'#FF5656','标准'=>'#5AD06D','优'=>'#3967D6'], - 'bone'=>['不足'=>'#FF5656','标准'=>'#5AD06D','优'=>'#3967D6'], - 'protein'=>['不足'=>'#FF5656','标准'=>'#5AD06D','优'=>'#3967D6'], - 'kcal'=>['偏低'=>'#FF5656','优'=>'#3967D6'], - 'visceral'=>['标准'=>'#5AD06D','警惕'=>'#FFAB00','危险'=>'#FF5656'], - 'sfr'=>['不足'=>'#FF5656','标准'=>'#5AD06D','偏高'=>'#6492F6'], + 'fat_r'=>['偏低'=>'#FF5656','标准'=>'#FFAB00','偏高'=>'#5AD06D','高'=>'#6492F6'], + 'fat_w'=>['偏低'=>'#FF5656','标准'=>'#FFAB00','偏高'=>'#5AD06D','高'=>'#6492F6'], + 'muscle'=>['不足'=>'#FF5656','标准'=>'#FFAB00','优'=>'#5AD06D'], + 'muscleval'=>['不足'=>'#FF5656','标准'=>'#FFAB00','优'=>'#5AD06D'], + 'water'=>['不足'=>'#FF5656','标准'=>'#FFAB00','优'=>'#5AD06D'], + 'proteinval'=>['不足'=>'#FF5656','标准'=>'#FFAB00','优'=>'#5AD06D'], + 'bone'=>['不足'=>'#FF5656','标准'=>'#FFAB00','优'=>'#5AD06D'], + 'protein'=>['不足'=>'#FF5656','标准'=>'#FFAB00','优'=>'#5AD06D'], + 'kcal'=>['偏低'=>'#FF5656','优'=>'#5ad06d'], + 'visceral'=>['标准'=>'#5AD06D','警惕'=>'#6492F6','危险'=>'#3967D6'], + 'sfr'=>['不足'=>'#FF5656','标准'=>'#FFAB00','偏高'=>'#5AD06D'], ]; protected $result_end_data_mould = [ 'name'=>'', @@ -79,7 +75,7 @@ class Card extends Base{ // 详细卡片信息 // $data = ['id'=>'2'] - public function card_data_detailed($data=['aud_id'=>'26','token'=>'0dafb98a10995c98b5a33b7d59d986ca']){ + public function card_data_detailed($data=['aud_id'=>'58','token'=>'0dafb98a10995c98b5a33b7d59d986ca']){ if(count(input('post.')) > 0){ $data = input('post.'); } @@ -87,6 +83,7 @@ class Card extends Base{ if(!array_key_exists('aud_id', $data) || !array_key_exists('token', $data)){ return $this->msg(10001); } + // cache($data['token'], time()); if($this->token_time_validate($data['token']) === false){ return $this->msg(20001); } @@ -116,7 +113,7 @@ class Card extends Base{ // 手动记录 // $data = ['id'=>'2','time'=>'1991-04-20 10:10:10','height'=>'15.1','weight'=>'75.1'] - public function card_manual_recording($data = ['aud_id'=>'61','time'=>'2024-06-06 10:10:15','height'=>'175','weight'=>'68','token'=>'0dafb98a10995c98b5a33b7d59d986ca']){ + public function card_manual_recording($data = ['aud_id'=>'58','time'=>'2024-06-06 10:10:15','height'=>'175','weight'=>'68','token'=>'0dafb98a10995c98b5a33b7d59d986ca']){ if(count(input('post.')) > 0){ $data = input('post.'); }else{ @@ -431,10 +428,11 @@ class Card extends Base{ $result_data['adc'] = array_key_exists('impedance', $data)?$data['impedance']:550; $calculate_body_formula = new Calculatebody(); $get_body_value = $calculate_body_formula->calculate_body_data_result($result_data); + // dump($get_body_value); $get_body_value['gender'] = $user_data['gender']; $get_body_value['birthday'] = $user_data['birthday']; $get_body_value = $this->hwb_standard($get_body_value); - // dump($get_body_value); + // dump($get_body_value['脂肪率']); // dump(implode(',',$get_body_value['脂肪率'])); // die; @@ -489,6 +487,7 @@ class Card extends Base{ $linshi_data = []; $month_num = $this->calculateAgeInMonthsWithPrecision($data['birthday'])*100; + // dump($month_num); $gender_val = $data['gender']; if($data['age'] < $this->age_limit){ foreach ($data as $key => $value) { @@ -559,6 +558,7 @@ class Card extends Base{ $data['BMI2'] = $data['身高'].',无,无'; } // dump($data); + // die; return $data; // dump($data); } diff --git a/application/app/controller/Cardparts.php b/application/app/controller/Cardparts.php index d402970..ab9703f 100644 --- a/application/app/controller/Cardparts.php +++ b/application/app/controller/Cardparts.php @@ -12,7 +12,7 @@ use app\app\controller\Skip; class Cardparts extends Base{ - protected $color = ['#FF5656','#FF5656','#5AD06D','#6492F6','#3967D6']; + protected $color = ['#FF5656','#FFAB00','#5AD06D','#6492F6','#3967D6']; protected $parameter_aggregate_top = [ 'weight'=>'反映和衡量一个人健康状况的重要标志之一', 'height'=>'人体纵向部分的长度,源于人体的纵向生长,受遗传因素的影响较大', @@ -149,14 +149,14 @@ class Cardparts extends Base{ // 内脏指数 protected $visceral = [ 'man'=>[ - ['min_val'=>'0','max_val'=>'9','text'=>'标准','color'=>'#ff5656'], - ['min_val'=>'9','max_val'=>'14','text'=>'警惕','color'=>'#ffab00'], - ['min_val'=>'14','max_val'=>'50','text'=>'危险','color'=>'#5ad06d'], + ['min_val'=>'0','max_val'=>'9','text'=>'标准','color'=>'#5AD06D'], + ['min_val'=>'9','max_val'=>'14','text'=>'警惕','color'=>'#6492F6'], + ['min_val'=>'14','max_val'=>'50','text'=>'危险','color'=>'#3967D6'], ], 'woman'=>[ - ['min_val'=>'0','max_val'=>'9','text'=>'标准','color'=>'#ff5656'], - ['min_val'=>'9','max_val'=>'14','text'=>'警惕','color'=>'#ffab00'], - ['min_val'=>'14','max_val'=>'50','text'=>'危险','color'=>'#5ad06d'], + ['min_val'=>'0','max_val'=>'9','text'=>'标准','color'=>'#5AD06D'], + ['min_val'=>'9','max_val'=>'14','text'=>'警惕','color'=>'#6492F6'], + ['min_val'=>'14','max_val'=>'50','text'=>'危险','color'=>'#3967D6'], ] ]; // 皮下脂肪 @@ -181,7 +181,8 @@ class Cardparts extends Base{ // 除 bcdiv(,,20) // 计算部分内容的横线标准以及说明文字 public function conversion_interval($data){ - + // dump($data); + // die; // $data['gender'] = $data['gender']==2?'woman':'man'; $gender = $data['gender']==2?'woman':'man'; $age = $data['age']['value']; @@ -203,6 +204,7 @@ class Cardparts extends Base{ $temporary_arr['record_time'] = $date_temporary->format('Y年m月d日 H:i:s'); // dump($data); // dump($temporary_arr); + // die; // 处理格式(顶部) foreach ($this->parameter_aggregate_top as $key => $value) { $data[$key]['key_name'] = $key; @@ -220,6 +222,8 @@ class Cardparts extends Base{ array_push($temporary_arr['bottom_list'],$data[$key]); } + // dump($temporary_arr); + // die; // 处理顶部list foreach ($temporary_arr['top_list'] as $key => $value) { if(count($temporary_arr['top_list'][$key]['list']) > 0){ diff --git a/application/app/controller/Index.php b/application/app/controller/Index.php index 985dc3b..c3cd070 100644 --- a/application/app/controller/Index.php +++ b/application/app/controller/Index.php @@ -90,9 +90,9 @@ class Index extends Base{ if(!is_array($verify_result)){ return $this->msg(10001,$verify_result); } - $result = Db::table('app_user_data')->insert($verify_result); + $result = Db::table('app_user_data')->insertGetId($verify_result); if($result){ - return $this->msg([]); + return $this->msg(['aud_id'=>$result]); }else{ return $this->msg(10002); } @@ -176,7 +176,7 @@ class Index extends Base{ } // 获取指定用户详细信息 - public function get_user_data_information($data = ['aud_id'=>26,'token'=>'0dafb98a10995c98b5a33b7d59d986ca']){ + public function get_user_data_information($data = ['aud_id'=>58,'token'=>'0dafb98a10995c98b5a33b7d59d986ca']){ if(count(input('post.')) > 0){ $data = input('post.'); } @@ -247,15 +247,15 @@ class Index extends Base{ } 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(); + $all_card_list = Db::table('app_card_data')->field('id,name,pic')->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']]; + $result['user'][array_search($value['id'], $user_card_list['card_order'])] = ['id'=>$value['id'],'name'=>$value['name'],'pic'=>$value['pic']]; }else{ - array_push($result['all'],['id'=>$value['id'],'name'=>$value['name']]); + array_push($result['all'],['id'=>$value['id'],'name'=>$value['name'],'pic'=>$value['pic']]); } } ksort($result['user']); @@ -315,6 +315,18 @@ class Index extends Base{ } } + // 获取卡片路径及卡片数组处理start + $card_all_data = Db::table('app_card_data')->field('id,page_url_record,page_url_report,page_url_bluetooth')->select(); + $card_all_data_result = []; + foreach ($card_all_data as $key => $value) { + $card_all_data_result[$value['id']] = [ + 'page_url_record'=>$value['page_url_record'], + 'page_url_report'=>$value['page_url_report'], + 'page_url_bluetooth'=>$value['page_url_bluetooth'] + ]; + } + // 获取卡片路径及卡片数组处理end + // dump($db_arr); // die; // 添加目标体重于当前体重差数据 @@ -342,6 +354,9 @@ class Index extends Base{ $temporary_arr['record_time'] = ''; $temporary_arr['card_name'] = $this->card_data[$value][0]; $temporary_arr['card_key'] = $this->card_data[$value][1]; + $temporary_arr['page_url_record'] = $card_all_data_result[$value]['page_url_record']; + $temporary_arr['page_url_report'] = $card_all_data_result[$value]['page_url_report']; + $temporary_arr['page_url_bluetooth'] = $card_all_data_result[$value]['page_url_bluetooth']; $temporary_arr['inside_data'] = []; foreach ($this->card_data[$value][2] as $k => $v) { array_push($temporary_arr['inside_data'],[ @@ -363,6 +378,9 @@ class Index extends Base{ $temporary_arr['acd_id'] = $value; $temporary_arr['card_name'] = $this->card_data[$value][0]; $temporary_arr['card_key'] = $this->card_data[$value][1]; + $temporary_arr['page_url_record'] = $card_all_data_result[$value]['page_url_record']; + $temporary_arr['page_url_report'] = $card_all_data_result[$value]['page_url_report']; + $temporary_arr['page_url_bluetooth'] = $card_all_data_result[$value]['page_url_bluetooth']; $temporary_arr['inside_data'] = []; if(array_key_exists($value,$db_arr)){ $temporary_arr['id'] = $db_arr[$value]['id']; @@ -403,27 +421,6 @@ class Index extends Base{ } array_push($result,$temporary_arr); - - // $temporary_arr['acd_id'] = $value['acd_id']; - // $temporary_arr['record_time'] = $value['record_time']; - // $temporary_arr['card_name'] = $this->card_data[$value['acd_id']][0]; - // $temporary_arr['card_key'] = $this->card_data[$value['acd_id']][1]; - // $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]:'' - // ]); - // } - // } - // array_push($result,$temporary_arr); } } return [$result,$target_current]; diff --git a/application/app/controller/Login.php b/application/app/controller/Login.php index 75ac8f3..9d3fd44 100644 --- a/application/app/controller/Login.php +++ b/application/app/controller/Login.php @@ -304,7 +304,7 @@ class Login extends Base{ public function check_code($data = 18530934717 , $code = 123456){ // 默认验证码正确 - // return true; + return true; // dump($data); // dump(cache($data)); // die; diff --git a/application/route.php b/application/route.php index c52e4c2..8f1c9b3 100644 --- a/application/route.php +++ b/application/route.php @@ -28,6 +28,25 @@ Route::post('/admin/login_action', 'admin/login/login_action'); Route::any('/admin/index', 'admin/index/index'); Route::any('/admin/welcome', 'admin/index/welcome'); +// APP账号角色管理 +Route::any('/member/member_list', 'admin/member/member_list'); +Route::any('/member/user_list', 'admin/member/user_list'); + +// 卡片管理 +Route::any('/card/index', 'admin/card/index'); +Route::any('/card/card_add', 'admin/card/card_add'); +Route::any('/card/card_add_action', 'admin/card/card_add_action'); +Route::any('/card/card_edit', 'admin/card/card_edit'); +Route::any('/card/card_edit_action', 'admin/card/card_edit_action'); +Route::any('/card/card_del', 'admin/card/card_del'); +// Route::any('/appversion/app_add_action', 'admin/appversion/app_add_action'); +// 设备管理 +Route::any('/device/index', 'admin/device/index'); +Route::any('/device/device_add', 'admin/device/device_add'); +Route::any('/device/device_add_action', 'admin/device/device_add_action'); +Route::any('/device/device_edit', 'admin/device/device_edit'); +Route::any('/device/device_edit_action', 'admin/device/device_edit_action'); +Route::any('/device/device_del', 'admin/device/device_del'); // APP版本管理 Route::any('/appversion/index', 'admin/appversion/index'); Route::any('/appversion/app_add', 'admin/appversion/app_add'); diff --git a/public/card/1_1718264230.jpg b/public/card/1_1718264230.jpg new file mode 100644 index 0000000..cac00d1 Binary files /dev/null and b/public/card/1_1718264230.jpg differ diff --git a/public/device/TYP999ASDFGTR56_1718357969.jpg b/public/device/TYP999ASDFGTR56_1718357969.jpg new file mode 100644 index 0000000..a272b65 Binary files /dev/null and b/public/device/TYP999ASDFGTR56_1718357969.jpg differ