Baseconfig.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use think\Db;
  5. use getusersig\getusersig;
  6. /**
  7. * 基础配置接口
  8. */
  9. class Baseconfig extends Api
  10. {
  11. protected $noNeedLogin = ['*'];
  12. protected $noNeedRight = ['*'];
  13. public function index(){
  14. $config = [
  15. 'nowtime' => time(),
  16. 'nowdate' => date('Y-m-d H:i:s'),
  17. 'nowdate1' => date('Y-m-d H:i:s',time()+3600),
  18. 'nowdate2' => '2024-08-20 09:55:23',
  19. 'nowdate3' => '2024-08-20 19:55:23',
  20. ];
  21. $this->success('success',$config);
  22. }
  23. //给小程序端用的usersig
  24. //user_用户端小程序,master_师傅,kefu_客服
  25. public function tenim_usersig(){
  26. $user_id = "user_".$this->auth->id;
  27. // 获取配置信息
  28. $config = config("tencent_im");
  29. $usersigObj = new getusersig($config["sdkappid"],$config["key"]);
  30. $usersig = $usersigObj->genUserSig($user_id);
  31. $rs = [
  32. 'usersig' => $usersig,
  33. 'sdkappid' => $config['sdkappid'],
  34. ];
  35. $this->success(1,$rs);
  36. }
  37. /**
  38. * 获取安卓版本更新信息
  39. */
  40. public function getandroidEdition() {
  41. // 获取二维码
  42. $is_force = config("site.android_is_force");
  43. $apkUrl = config("site.android_apkUrl");
  44. $apkName = config("site.android_apkName");
  45. $desc = config("site.android_desc");
  46. $versionCode = config("site.android_versionCode");
  47. $this->success("获取成功!",["versionCode"=>$versionCode,"isForceUpdate"=>$is_force,"apkUrl"=>$apkUrl,"apkName"=>$apkName,"desc"=>$desc]);
  48. }
  49. /**
  50. * 获取ios版本更新信息
  51. */
  52. public function getiosEdition() {
  53. // 获取二维码
  54. $is_force = config("site.iso_is_force");
  55. $apkUrl = config("site.ios_downurl");
  56. $apkName = config("site.iso_appname");
  57. $desc = config("site.iso_desc");
  58. $versionCode = config("site.iso_versioncode");
  59. $this->success("获取成功!",["versionCode"=>$versionCode,"isForceUpdate"=>$is_force,"apkUrl"=>$apkUrl,"apkName"=>$apkName,"desc"=>$desc]);
  60. }
  61. //启动广告图
  62. public function start_advert(){
  63. $info = Db::name('start_advert')->where('is_show',1)->order('id desc')->find();
  64. $info = info_domain_image($info,['images','video_file']);
  65. $this->success_find('success',$info);
  66. }
  67. //个人资料的一下枚举
  68. public function userinfo_enum(){
  69. $enum_hobby = Db::name('enum_hobby')->field('id,name')->order('weight desc,id desc')->select();
  70. $enum_job = Db::name('enum_job')->field('id,name')->order('weight desc,id desc')->select();
  71. $enum_marital = Db::name('enum_marital')->field('id,name')->order('weight desc,id desc')->select();
  72. $enum_suqiu = Db::name('enum_suqiu')->field('id,name')->order('weight desc,id desc')->select();
  73. $enum_tag = Db::name('enum_tag')->field('id,name')->order('weight desc,id desc')->select();
  74. $enum_wages = Db::name('enum_wages')->field('id,name')->order('weight desc,id desc')->select();
  75. $data = [
  76. 'enum_hobby' => $enum_hobby,
  77. 'enum_job' => $enum_job,
  78. 'enum_marital' => $enum_marital,
  79. 'enum_suqiu' => $enum_suqiu,
  80. 'enum_tag' => $enum_tag,
  81. 'enum_wages' => $enum_wages,
  82. ];
  83. $this->success('success',$data);
  84. }
  85. //关键字过滤
  86. public function keyworld_config(){
  87. $config = config('keyworld');
  88. $this->success('success',$config);
  89. }
  90. }