Baseconfig.php 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use think\Db;
  5. use Redis;
  6. /**
  7. * 基础配置接口
  8. */
  9. class Baseconfig extends Api
  10. {
  11. protected $noNeedLogin = ['*'];
  12. protected $noNeedRight = ['*'];
  13. public function apiurl(){
  14. // $this->success('success','https://jiankangyijia.huxiukeji.cn');
  15. }
  16. public function index(){
  17. $config = [
  18. 'kefu_phone' => config('site.kefuphoneno'),//客服电话号
  19. 'kefu_email' => config('site.kefuemail'),//客服邮箱
  20. 'index_jiuyipeizhen' => localpath_to_netpath(config('site.index_jiuyipeizhen')),//首页就医陪诊
  21. 'index_hulipeihu' => localpath_to_netpath(config('site.index_hulipeihu')),//首页护理陪护
  22. 'app_imgroup_switch' => config('site.app_imgroup_switch'),//APP群聊功能开关
  23. ];
  24. $this->success('success',$config);
  25. }
  26. //用户端版本
  27. public function user_app_version(){
  28. $config = [
  29. 'android_update_num' => config('site.user_android_update_num'), //android版本迭代号
  30. 'android_update_version' => config('site.user_android_update_version'), //android展示版本号
  31. 'android_download_url' => config('site.user_android_download_url'), //android下载链接
  32. 'android_update_force' => config('site.user_android_update_force'), //android是否强制更新
  33. 'android_update_title' => config('site.user_android_update_title'), //android更新标题
  34. 'android_update_info' => config('site.user_android_update_info'), //android更新描述
  35. 'ios_update_num' => config('site.user_ios_update_num'), //ios版本迭代号
  36. 'ios_update_version' => config('site.user_ios_update_version'), //ios展示版本号
  37. 'ios_download_url' => config('site.user_ios_download_url'), //ios下载链接
  38. 'ios_update_force' => config('site.user_ios_update_force'), //ios是否强制更新
  39. 'ios_update_title' => config('site.user_ios_update_title'), //ios更新标题
  40. 'ios_update_info' => config('site.user_ios_update_info'), //ios更新描述
  41. ];
  42. $this->success('success',$config);
  43. }
  44. //医生端版本
  45. public function doctor_app_version(){
  46. $config = [
  47. 'android_update_num' => config('site.doctor_android_update_num'), //android版本迭代号
  48. 'android_update_version' => config('site.doctor_android_update_version'), //android展示版本号
  49. 'android_download_url' => config('site.doctor_android_download_url'), //android下载链接
  50. 'android_update_force' => config('site.doctor_android_update_force'), //android是否强制更新
  51. 'android_update_title' => config('site.doctor_android_update_title'), //android更新标题
  52. 'android_update_info' => config('site.doctor_android_update_info'), //android更新描述
  53. 'ios_update_num' => config('site.doctor_ios_update_num'), //ios版本迭代号
  54. 'ios_update_version' => config('site.doctor_ios_update_version'), //ios展示版本号
  55. 'ios_download_url' => config('site.doctor_ios_download_url'), //ios下载链接
  56. 'ios_update_force' => config('site.doctor_ios_update_force'), //ios是否强制更新
  57. 'ios_update_title' => config('site.doctor_ios_update_title'), //ios更新标题
  58. 'ios_update_info' => config('site.doctor_ios_update_info'), //ios更新描述
  59. ];
  60. $this->success('success',$config);
  61. }
  62. //启动广告图
  63. public function start_advert(){
  64. $info = Db::name('start_advert')->where('is_show',1)->order('id desc')->find();
  65. $info = info_domain_image($info,['images','video_file']);
  66. $this->success('success',$info);
  67. }
  68. //个人资料的一下枚举
  69. public function userinfo_enum(){
  70. // $enum_hobby = Db::name('enum_hobby')->field('id,name')->order('weight desc,id desc')->select();
  71. // $enum_job = Db::name('enum_job')->field('id,name')->order('weight desc,id desc')->select();
  72. // $enum_marital = Db::name('enum_marital')->field('id,name')->order('weight desc,id desc')->select();
  73. // $enum_education = Db::name('enum_education')->field('id,name')->order('weight desc,id desc')->select();
  74. $enum_tag = Db::name('enum_tag')->field('id,name,color')->order('weight desc,id desc')->select();
  75. // $enum_wages = Db::name('enum_wages')->field('id,name')->order('weight desc,id desc')->select();
  76. $data = [
  77. // 'enum_hobby' => $enum_hobby,
  78. // 'enum_job' => $enum_job,
  79. // 'enum_marital' => $enum_marital,
  80. // 'enum_education' => $enum_education,
  81. 'enum_tag' => $enum_tag,
  82. 'enumtag_max' => config('site.enumtag_max'),//最多可选个数
  83. // 'enum_wages' => $enum_wages,
  84. ];
  85. $this->success('success',$data);
  86. }
  87. //关键字过滤
  88. public function keyworld_config(){
  89. $config = config('keyworld');
  90. $this->success('success',$config);
  91. }
  92. public function keyworld_config_redis(){
  93. //redis
  94. $redis = new Redis();
  95. $redisconfig = config("redis");
  96. $redis->connect($redisconfig["host"], $redisconfig["port"]);
  97. if ($redisconfig['redis_pwd']) {
  98. $redis->auth($redisconfig['redis_pwd']);
  99. }
  100. if($redisconfig['redis_selectdb'] > 0){
  101. $redis->select($redisconfig['redis_selectdb']);
  102. }
  103. $redis_key = 'keyworld';
  104. $cache_data = $redis->get($redis_key);
  105. if($cache_data){
  106. $cache_data = json_decode($cache_data,true);
  107. $this->success('success',$cache_data);
  108. }else{
  109. $cache_data = config('keyworld');
  110. $redis->set($redis_key,json_encode($cache_data));
  111. $this->success('success',$cache_data);
  112. }
  113. }
  114. ///////////////////////本项目用不到的//////////////////////////////
  115. /**
  116. * 获取安卓版本更新信息
  117. */
  118. public function getandroidEdition() {
  119. // 获取二维码
  120. $is_force = config("site.android_is_force");
  121. $apkUrl = config("site.android_apkUrl");
  122. $apkName = config("site.android_apkName");
  123. $desc = config("site.android_desc");
  124. $versionCode = config("site.android_versionCode");
  125. $this->success("获取成功!",["versionCode"=>$versionCode,"isForceUpdate"=>$is_force,"apkUrl"=>$apkUrl,"apkName"=>$apkName,"desc"=>$desc]);
  126. }
  127. /**
  128. * 获取ios版本更新信息
  129. */
  130. public function getiosEdition() {
  131. // 获取二维码
  132. $is_force = config("site.iso_is_force");
  133. $apkUrl = config("site.ios_downurl");
  134. $apkName = config("site.iso_appname");
  135. $desc = config("site.iso_desc");
  136. $versionCode = config("site.iso_versioncode");
  137. $this->success("获取成功!",["versionCode"=>$versionCode,"isForceUpdate"=>$is_force,"apkUrl"=>$apkUrl,"apkName"=>$apkName,"desc"=>$desc]);
  138. }
  139. }