2024 11 29
This commit is contained in:
parent
81a856850b
commit
9e961ac019
|
|
@ -191,16 +191,18 @@ class Base extends Controller{
|
||||||
return is_numeric($value) && $value >= 0;
|
return is_numeric($value) && $value >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function msg($data,$str='',$result = []){
|
||||||
|
|
||||||
public function msg($data,$str=''){
|
|
||||||
if(is_array($data)){
|
if(is_array($data)){
|
||||||
return json(['code'=>0,'msg'=>'操作成功','data'=>$data]);
|
if($str != ''){
|
||||||
|
return json(['code'=>0,'msg'=>$str,'data'=>$data]);
|
||||||
|
}else{
|
||||||
|
return json(['code'=>0,'msg'=>'操作成功','data'=>$data]);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
if($str != ''){
|
if($str != ''){
|
||||||
return json(['code'=>$data,'msg'=>$str]);
|
return json(['code'=>$data,'msg'=>$str,'data'=>$result]);
|
||||||
}
|
}
|
||||||
return json(['code'=>$data,'msg'=>$this->return_data_all[$data]]);
|
return json(['code'=>$data,'msg'=>$this->return_data_all[$data],'data'=>$result]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use app\bj\controller\Common;
|
||||||
use think\Log;
|
use think\Log;
|
||||||
use \think\Validate;
|
use \think\Validate;
|
||||||
|
|
||||||
class Editortext extends Controller{
|
class Editortext extends Base{
|
||||||
protected $page_num = 10;
|
protected $page_num = 10;
|
||||||
protected $file_max_pic = 1024*1024*5;//xxxMB
|
protected $file_max_pic = 1024*1024*5;//xxxMB
|
||||||
public function index($page = 1){
|
public function index($page = 1){
|
||||||
|
|
@ -78,25 +78,54 @@ class Editortext extends Controller{
|
||||||
if(!array_key_exists('id', $data)){
|
if(!array_key_exists('id', $data)){
|
||||||
return $this->msg(10001);
|
return $this->msg(10001);
|
||||||
}
|
}
|
||||||
$result = Db::table('admin_editor_text_content')->where(['id'=>$data['id']])->setInc('reading');
|
// 查看文章是否存在
|
||||||
$result = Db::table('admin_editor_text_content')->where(['id'=>$data['id']])->find();
|
$article_data = Db::table('admin_editor_text_content')->where(['id'=>$data['id']])->find();
|
||||||
|
if(!$article_data){
|
||||||
|
return $this->msg(10004);
|
||||||
|
}
|
||||||
|
$result = $article_data;
|
||||||
|
// 处理是否有过点赞
|
||||||
if(array_key_exists('token', $data)){
|
if(array_key_exists('token', $data)){
|
||||||
$result['token'] = $data['token'];
|
$result['token'] = $data['token'];
|
||||||
$is_like = Db::table('admin_editor_text_like_up_log')->where(['aetc_id'=>$data['id'],'token'=>$data['token']])->find();
|
// 启动事务处理用户已读记录&文章阅读数
|
||||||
|
Db::startTrans();
|
||||||
|
try{
|
||||||
|
Db::table('admin_editor_text_content')->where(['id'=>$data['id']])->setInc('reading');
|
||||||
|
// 查看文章是否有被观看过
|
||||||
|
$is_like = Db::table('admin_editor_text_like_up_log')->where(['aetc_id'=>$data['id'],'token'=>$data['token']])->find();
|
||||||
|
if (!$is_like) {
|
||||||
|
// 如果不存在,则插入新记录
|
||||||
|
$save_data = ['token'=>$result['token'],'aetc_id'=>$data['id'],'create_time'=>date('Y-m-d H:i:s')];
|
||||||
|
Db::name('admin_editor_text_like_up_log')->insert($save_data);
|
||||||
|
}else{
|
||||||
|
Db::table('admin_editor_text_like_up_log')->where(['id'=>$is_like['id']])->setInc('reading');
|
||||||
|
}
|
||||||
|
// 提交事务
|
||||||
|
Db::commit();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// 回滚事务
|
||||||
|
Db::rollback();
|
||||||
|
}
|
||||||
if($is_like){
|
if($is_like){
|
||||||
if($is_like['is_del'] == 0){
|
if($is_like['is_like'] == 0){
|
||||||
|
// 用户没点赞
|
||||||
$result['user_like'] = 0;
|
$result['user_like'] = 0;
|
||||||
}else{
|
}else{
|
||||||
|
// 用户点过点赞
|
||||||
$result['user_like'] = 1;
|
$result['user_like'] = 1;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
// 用户没点过赞
|
||||||
$result['user_like'] = 2;
|
$result['user_like'] = 2;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
// 没有用户信息提示要登录
|
||||||
|
Db::table('admin_editor_text_content')->where(['id'=>$data['id']])->setInc('reading');
|
||||||
$result['user_like'] = 3;
|
$result['user_like'] = 3;
|
||||||
$result['token'] = '';
|
$result['token'] = '';
|
||||||
}
|
}
|
||||||
|
// dump($result);
|
||||||
|
// die;
|
||||||
$this->assign([
|
$this->assign([
|
||||||
'result' => $result
|
'result' => $result
|
||||||
]);
|
]);
|
||||||
|
|
@ -286,8 +315,5 @@ class Editortext extends Controller{
|
||||||
################################################################other################################################################
|
################################################################other################################################################
|
||||||
################################################################other################################################################
|
################################################################other################################################################
|
||||||
|
|
||||||
public function msg($code,$msg='',$data=[]){
|
|
||||||
return json(['code'=>$code,'msg'=>$msg,'data'=>$data]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -92,6 +92,7 @@
|
||||||
<input name="id[]" lay-skin="primary" type="checkbox" value="3" title="肺活训练" lay-filter="type_child">
|
<input name="id[]" lay-skin="primary" type="checkbox" value="3" title="肺活训练" lay-filter="type_child">
|
||||||
<input name="id[]" lay-skin="primary" type="checkbox" value="4" title="跳绳训练" lay-filter="type_child">
|
<input name="id[]" lay-skin="primary" type="checkbox" value="4" title="跳绳训练" lay-filter="type_child">
|
||||||
<input name="id[]" lay-skin="primary" type="checkbox" value="5" title="中考体测" lay-filter="type_child">
|
<input name="id[]" lay-skin="primary" type="checkbox" value="5" title="中考体测" lay-filter="type_child">
|
||||||
|
<input name="id[]" lay-skin="primary" type="checkbox" value="6" title="公告" lay-filter="type_child">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@
|
||||||
var i_like_num = parseInt("{$result.i_like}");
|
var i_like_num = parseInt("{$result.i_like}");
|
||||||
// 根据 user_like 的值设置初始类
|
// 根据 user_like 的值设置初始类
|
||||||
var isLikeElement = document.getElementById('is_like_a');
|
var isLikeElement = document.getElementById('is_like_a');
|
||||||
if (user_like == 0) {
|
if (user_like == 1) {
|
||||||
isLikeElement.classList.add('heart_full');
|
isLikeElement.classList.add('heart_full');
|
||||||
} else {
|
} else {
|
||||||
isLikeElement.classList.add('heart_empty');
|
isLikeElement.classList.add('heart_empty');
|
||||||
|
|
@ -193,12 +193,12 @@
|
||||||
c_load()
|
c_load()
|
||||||
//请求成功时处理
|
//请求成功时处理
|
||||||
if(req.code == 0){
|
if(req.code == 0){
|
||||||
if(req.data.user_like == 0){
|
if(req.data.user_like == 1){
|
||||||
i_like_num = i_like_num + 1;
|
i_like_num = i_like_num + 1;
|
||||||
isLikeElement.classList.remove('heart_empty');
|
isLikeElement.classList.remove('heart_empty');
|
||||||
isLikeElement.classList.add('heart_full');
|
isLikeElement.classList.add('heart_full');
|
||||||
document.querySelector('.is_like_num').innerHTML = i_like_num;
|
document.querySelector('.is_like_num').innerHTML = i_like_num;
|
||||||
}else if(req.data.user_like == 1){
|
}else if(req.data.user_like == 0){
|
||||||
i_like_num = i_like_num - 1;
|
i_like_num = i_like_num - 1;
|
||||||
isLikeElement.classList.remove('heart_full');
|
isLikeElement.classList.remove('heart_full');
|
||||||
isLikeElement.classList.add('heart_empty');
|
isLikeElement.classList.add('heart_empty');
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ class Msginformation extends Base{
|
||||||
".$this->page_num." ROWS ONLY
|
".$this->page_num." ROWS ONLY
|
||||||
");
|
");
|
||||||
$return_result['content_data'] = $content_result;
|
$return_result['content_data'] = $content_result;
|
||||||
$user_like = Db::table($this->msginformation_use_db_name['2'])->where(['token'=>$data['token'],'is_del'=>0])->column('aetc_id');
|
$user_like = Db::table($this->msginformation_use_db_name['2'])->where(['token'=>$data['token'],'is_like'=>0])->column('aetc_id');
|
||||||
|
|
||||||
foreach ($return_result['content_data'] as $key => $value) {
|
foreach ($return_result['content_data'] as $key => $value) {
|
||||||
if(array_key_exists($value['id'], $user_like)){
|
if(array_key_exists($value['id'], $user_like)){
|
||||||
|
|
|
||||||
|
|
@ -179,12 +179,12 @@
|
||||||
$(this).hide()
|
$(this).hide()
|
||||||
})
|
})
|
||||||
|
|
||||||
if(isWeixin() && !isIOS()){
|
// if(isWeixin() && !isIOS()){
|
||||||
$('.ts').show()
|
// $('.ts').show()
|
||||||
}else{
|
// }else{
|
||||||
// console.log('当前不在微信环境中');
|
// // console.log('当前不在微信环境中');
|
||||||
// $('.download').addClass('bouncing-button-container')
|
// // $('.download').addClass('bouncing-button-container')
|
||||||
}
|
// }
|
||||||
|
|
||||||
function download(){
|
function download(){
|
||||||
if (isIOS()) {
|
if (isIOS()) {
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,13 @@ Route::any('/testedition/download', 'testapp/download/demo');
|
||||||
Route::any('/ceshi', 'app/download/ceshi');
|
Route::any('/ceshi', 'app/download/ceshi');
|
||||||
Route::any('/get_class', 'admin/demo/get_class_xuesheng');
|
Route::any('/get_class', 'admin/demo/get_class_xuesheng');
|
||||||
|
|
||||||
|
// // ################################################################二维码入口################################################################
|
||||||
|
// // ################################################################二维码入口################################################################
|
||||||
|
// 配合小白快乐成长&宠物小白使用
|
||||||
|
Route::any('/ordinary_code', 'code/qrcode/ordinary_code');
|
||||||
|
// 配合reedaw&宠物小白使用
|
||||||
|
Route::any('/bluetooth_code', 'code/qrcode/bluetooth_code');
|
||||||
|
|
||||||
|
|
||||||
// Route::any('/CityList.js', 'tsf/CityList.js');
|
// Route::any('/CityList.js', 'tsf/CityList.js');
|
||||||
|
|
||||||
|
|
@ -331,6 +338,10 @@ Route::any('/testedition/get_sector_content_msg', 'testapp/Msginformation/get_se
|
||||||
// 点赞
|
// 点赞
|
||||||
Route::any('/user_like_it', 'app/Msginformation/user_like_it');
|
Route::any('/user_like_it', 'app/Msginformation/user_like_it');
|
||||||
Route::any('/testedition/user_like_it', 'testapp/Msginformation/user_like_it');
|
Route::any('/testedition/user_like_it', 'testapp/Msginformation/user_like_it');
|
||||||
|
// 获取公告文章信息列表
|
||||||
|
Route::any('/get_recommend_information', 'app/Msginformation/get_recommend_information');
|
||||||
|
Route::any('/testedition/get_recommend_information', 'testapp/Msginformation/get_recommend_information');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,10 +98,6 @@ class Index extends Base{
|
||||||
$this->record_api_log($data, $logContent, null);
|
$this->record_api_log($data, $logContent, null);
|
||||||
return $this->msg(99999);
|
return $this->msg(99999);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// 创建用户
|
// 创建用户
|
||||||
public function create_user_data($data = ['aan_id'=>1,'height'=>'152.3','weight'=>'35.4','nickname'=>'钮祜禄测试1','birthday'=>'2019-04-20','gender'=>1,'grade'=>'grade_s_3','identity_id'=>'P3','identity_name'=>'大宝','address'=>'河南,郑州','token'=>'57bd45e3a963b372ea2d873e4bd8d1f8']){
|
public function create_user_data($data = ['aan_id'=>1,'height'=>'152.3','weight'=>'35.4','nickname'=>'钮祜禄测试1','birthday'=>'2019-04-20','gender'=>1,'grade'=>'grade_s_3','identity_id'=>'P3','identity_name'=>'大宝','address'=>'河南,郑州','token'=>'57bd45e3a963b372ea2d873e4bd8d1f8']){
|
||||||
|
|
@ -574,6 +570,7 @@ class Index extends Base{
|
||||||
return $this->msg(99999);
|
return $this->msg(99999);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
################################获取账号下信息操作################################
|
################################获取账号下信息操作################################
|
||||||
|
|
||||||
// 获取账号下首页卡片的基础数据
|
// 获取账号下首页卡片的基础数据
|
||||||
|
|
@ -722,6 +719,7 @@ class Index extends Base{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
################################################################other################################################################
|
################################################################other################################################################
|
||||||
################################################################other################################################################
|
################################################################other################################################################
|
||||||
################################################################other################################################################
|
################################################################other################################################################
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,36 @@ class Msginformation extends Base{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// 获取公告文章信息列表
|
||||||
|
public function get_recommend_information($data=['token'=>'6441bf7dabea7b3360a30240d3b19fc5']){
|
||||||
|
try {
|
||||||
|
if(count(input('post.')) > 0){
|
||||||
|
$data = input('post.');
|
||||||
|
}
|
||||||
|
if(!array_key_exists('token', $data)){
|
||||||
|
$this->record_api_log($data, null, ['code'=>10001,'msg'=>'',[]]);
|
||||||
|
return $this->msg(10001);
|
||||||
|
}
|
||||||
|
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||||
|
return $this->msg(10005);
|
||||||
|
}
|
||||||
|
$return_result = $this->get_recommend_information_action($data);
|
||||||
|
$this->record_api_log($data, null, $return_result);
|
||||||
|
return $return_result;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// 捕获异常
|
||||||
|
$logContent["flie"] = $e->getFile();
|
||||||
|
$logContent["line"] = $e->getLine();
|
||||||
|
$logContent['all_content'] = "异常信息:\n";
|
||||||
|
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||||
|
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||||
|
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||||
|
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||||
|
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||||
|
$this->record_api_log($data, $logContent, null);
|
||||||
|
return $this->msg(99999);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
################################################################业务################################################################
|
################################################################业务################################################################
|
||||||
################################################################get_sector_label_msg
|
################################################################get_sector_label_msg
|
||||||
|
|
@ -223,16 +253,16 @@ class Msginformation extends Base{
|
||||||
|
|
||||||
if($user_like_data){
|
if($user_like_data){
|
||||||
// 如果找到有点赞记录
|
// 如果找到有点赞记录
|
||||||
if($user_like_data['is_del'] == 0){
|
if($user_like_data['is_like'] == 1){
|
||||||
// 如果已经点了
|
// 如果已经点了
|
||||||
// 启动事务
|
// 启动事务
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try{
|
try{
|
||||||
Db::table($this->msginformation_use_db_name['1'])->where(['id'=>$data['id']])->setDec('i_like');
|
Db::table($this->msginformation_use_db_name['1'])->where(['id'=>$data['id']])->setDec('i_like');
|
||||||
Db::table($this->msginformation_use_db_name['2'])->where(['aetc_id'=>$data['id'],'token'=>$data['token']])->update(['is_del'=>1,'update_time'=>date('Y-m-d H:i:s')]);
|
Db::table($this->msginformation_use_db_name['2'])->where(['aetc_id'=>$data['id'],'token'=>$data['token']])->update(['is_like'=>0,'update_time'=>date('Y-m-d H:i:s')]);
|
||||||
// 提交事务
|
// 提交事务
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return $this->msg(['user_like'=>1]);
|
return $this->msg(['user_like'=>0]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// 回滚事务
|
// 回滚事务
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
|
|
@ -244,10 +274,10 @@ class Msginformation extends Base{
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try{
|
try{
|
||||||
Db::table($this->msginformation_use_db_name['1'])->where(['id'=>$data['id']])->setInc('i_like');
|
Db::table($this->msginformation_use_db_name['1'])->where(['id'=>$data['id']])->setInc('i_like');
|
||||||
Db::table($this->msginformation_use_db_name['2'])->where(['aetc_id'=>$data['id'],'token'=>$data['token']])->update(['is_del'=>0,'update_time'=>date('Y-m-d H:i:s')]);
|
Db::table($this->msginformation_use_db_name['2'])->where(['aetc_id'=>$data['id'],'token'=>$data['token']])->update(['is_like'=>1,'update_time'=>date('Y-m-d H:i:s')]);
|
||||||
// 提交事务
|
// 提交事务
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return $this->msg(['user_like'=>0]);
|
return $this->msg(['user_like'=>1]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// 回滚事务
|
// 回滚事务
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
|
|
@ -263,12 +293,13 @@ class Msginformation extends Base{
|
||||||
Db::table($this->msginformation_use_db_name['2'])->insert([
|
Db::table($this->msginformation_use_db_name['2'])->insert([
|
||||||
'aetc_id'=>$data['id'],
|
'aetc_id'=>$data['id'],
|
||||||
'token'=>$data['token'],
|
'token'=>$data['token'],
|
||||||
|
'is_like'=>1,
|
||||||
'create_time'=>date('Y-m-d H:i:s'),
|
'create_time'=>date('Y-m-d H:i:s'),
|
||||||
'update_time'=>date('Y-m-d H:i:s')
|
'update_time'=>date('Y-m-d H:i:s')
|
||||||
]);
|
]);
|
||||||
// 提交事务
|
// 提交事务
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return $this->msg(['user_like'=>0]);
|
return $this->msg(['user_like'=>1]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// 回滚事务
|
// 回滚事务
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
|
|
@ -277,6 +308,44 @@ class Msginformation extends Base{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
################################################################get_recommend_information
|
||||||
|
public function get_recommend_information_action($data){
|
||||||
|
$pop_arr = [];
|
||||||
|
$list_arr = [];
|
||||||
|
$recommend_data = Db::table($this->msginformation_use_db_name['1'])->where(['type'=>'6','is_del'=>0])->field('id,title,cover_image,pop_image')->select();
|
||||||
|
$recommend_data2 = [];
|
||||||
|
foreach ($recommend_data as $key => $value) {
|
||||||
|
$recommend_data2[$value['id']] = $value;
|
||||||
|
}
|
||||||
|
$user_read_data = Db::table($this->msginformation_use_db_name['2'])->where(['token'=>$data['token']])->field('id,aetc_id,create_time')->select();
|
||||||
|
foreach ($user_read_data as $key => $value) {
|
||||||
|
if(array_key_exists($value['aetc_id'],$recommend_data2)){
|
||||||
|
unset($recommend_data2[$value['aetc_id']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(count($recommend_data2) > 0){
|
||||||
|
foreach ($recommend_data2 as $key => $value) {
|
||||||
|
if($value['pop_image'] != null){
|
||||||
|
array_push($pop_arr,['title'=>$value['title'],'jump_url'=>"https://tc.pcxbc.com/editortext/model_content?id=".$value['id'].'&token='.$data['token'],'pop_image'=>"https://tc.pcxbc.com/".$value['pop_image']]);
|
||||||
|
}else{
|
||||||
|
array_push($list_arr,['title'=>$value['title'],'jump_url'=>"https://tc.pcxbc.com/editortext/model_content?id=".$value['id'].'&token='.$data['token']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// dump($pop_arr);
|
||||||
|
// dump($list_arr);
|
||||||
|
return $this->msg([
|
||||||
|
'pop_list'=>count($pop_arr) > 0 ? $pop_arr[0] : [],
|
||||||
|
'roll_list'=>count($list_arr) > 0 ? $list_arr : []
|
||||||
|
]);
|
||||||
|
}else{
|
||||||
|
return $this->msg([
|
||||||
|
'pop_list'=>[],
|
||||||
|
'roll_list'=>[]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ class Sportstesting extends Base{
|
||||||
|
|
||||||
}
|
}
|
||||||
// 获取地区类型列表
|
// 获取地区类型列表
|
||||||
public function sportstesting_get_region_list($data = ['parameter_data'=>'河北,石家庄市','gender'=>'0']){
|
public function sportstesting_get_region_list($data = ['parameter_data'=>'辽宁,沈阳市','gender'=>'1']){
|
||||||
try {
|
try {
|
||||||
// 你的业务逻辑
|
// 你的业务逻辑
|
||||||
if(count(input('post.')) > 0){
|
if(count(input('post.')) > 0){
|
||||||
|
|
@ -368,7 +368,8 @@ class Sportstesting extends Base{
|
||||||
$result['list'] = [];
|
$result['list'] = [];
|
||||||
$result['total_score'] = 0;
|
$result['total_score'] = 0;
|
||||||
$data = Db::table($this->sportstesting_use_db_name['1'])->where($db_condition)->select();
|
$data = Db::table($this->sportstesting_use_db_name['1'])->where($db_condition)->select();
|
||||||
|
// dump($data);
|
||||||
|
// die;
|
||||||
if(count($data) > 0){
|
if(count($data) > 0){
|
||||||
if(count($data) > 1){
|
if(count($data) > 1){
|
||||||
// 查到不止一条规则
|
// 查到不止一条规则
|
||||||
|
|
@ -377,7 +378,7 @@ class Sportstesting extends Base{
|
||||||
|
|
||||||
$data = json_decode($data[0]['content'],true);
|
$data = json_decode($data[0]['content'],true);
|
||||||
$result = $this->handle_default_rule_list($data,$gender);
|
$result = $this->handle_default_rule_list($data,$gender);
|
||||||
|
// dump($result);
|
||||||
// die;
|
// die;
|
||||||
return $this->msg($result);
|
return $this->msg($result);
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -630,14 +631,17 @@ class Sportstesting extends Base{
|
||||||
}else{
|
}else{
|
||||||
$temporary_arr = $data[2];
|
$temporary_arr = $data[2];
|
||||||
}
|
}
|
||||||
|
// dump($temporary_arr);
|
||||||
|
// return $temporary_arr;
|
||||||
// die;
|
// die;
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach ($temporary_arr as $key => $value) {
|
foreach ($temporary_arr as $key => $value) {
|
||||||
|
|
||||||
$num = array_push($result,['name'=>$key,'key'=>$key,'list'=>[]]);
|
$num = array_push($result,['name'=>$key,'key'=>$key,'list'=>[]]);
|
||||||
|
// dump($value);
|
||||||
foreach ($value as $s_c_k => $s_c_v) {
|
foreach ($value as $s_c_k => $s_c_v) {
|
||||||
if($s_c_v['choose_num'] == 0){
|
if($s_c_v['choose_num'] == 0){
|
||||||
|
// 如果是必选项
|
||||||
$num2 = array_push($result[$num-1]['list'],[
|
$num2 = array_push($result[$num-1]['list'],[
|
||||||
'name'=>$s_c_k,
|
'name'=>$s_c_k,
|
||||||
'key'=>$s_c_k,
|
'key'=>$s_c_k,
|
||||||
|
|
@ -657,7 +661,28 @@ class Sportstesting extends Base{
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$num2 = array_push($result[$num-1]['list'],['name'=>$s_c_k,'key'=>$s_c_k,'is_choice'=>$s_c_v['choose_num'],'list'=>[]]);
|
// 如果不是必选项
|
||||||
|
$num2 = array_push($result[$num-1]['list'],[
|
||||||
|
'name'=>$s_c_k."(".count($s_c_v['list'])."选".$s_c_v['choose_num'].")",
|
||||||
|
'key'=>$s_c_k,
|
||||||
|
'is_choice'=>$s_c_v['choose_num'],
|
||||||
|
'list'=>[]
|
||||||
|
]);
|
||||||
|
$choice_state_num = $s_c_v['choose_num'];
|
||||||
|
foreach ($s_c_v['list'] as $x_m_k => $x_m_v) {
|
||||||
|
array_push($result[$num-1]['list'][$num2-1]['list'],[
|
||||||
|
'name'=>$x_m_k,
|
||||||
|
'proportion'=>$x_m_v['proportion'],
|
||||||
|
'value'=>$x_m_v['value'],
|
||||||
|
'proportion_value'=>null,
|
||||||
|
'unit'=>$x_m_v['unit_data'],
|
||||||
|
'type'=>$x_m_v['type'],
|
||||||
|
'describe'=>$x_m_v['describe'],
|
||||||
|
'total_score'=>$x_m_v['score'],
|
||||||
|
'choice_state'=>$choice_state_num > 0?1:0,
|
||||||
|
]);
|
||||||
|
$choice_state_num = $choice_state_num-1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue