Baseconfig.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use think\Db;
  5. /**
  6. * 基础配置接口
  7. */
  8. class Baseconfig extends Api
  9. {
  10. protected $noNeedLogin = ['*'];
  11. protected $noNeedRight = ['*'];
  12. public function index(){
  13. $config = [
  14. 'kefu_user_ids' => config('site.kefu_user_ids'),//在线客服人员
  15. 'teenage_rule' => config('site.teenage_rule'),//青少年模式规则描述
  16. 'fangzhapian' => config('site.fangzhapian'),//防诈骗提示
  17. 'changyongyu' => config('site.changyongyu'),//常用语温馨提示
  18. 'zhanghaozhuxiao' => config('site.zhanghaozhuxiao'),//账号注销
  19. ];
  20. $this->success('success',$config);
  21. }
  22. /**
  23. * 获取安卓版本更新信息
  24. */
  25. public function getandroidEdition() {
  26. // 获取二维码
  27. $is_force = config("site.android_is_force");
  28. $apkUrl = config("site.android_apkUrl");
  29. $apkName = config("site.android_apkName");
  30. $desc = config("site.android_desc");
  31. $versionCode = config("site.android_versionCode");
  32. $this->success("获取成功!",["versionCode"=>$versionCode,"isForceUpdate"=>$is_force,"apkUrl"=>$apkUrl,"apkName"=>$apkName,"desc"=>$desc]);
  33. }
  34. /**
  35. * 获取ios版本更新信息
  36. */
  37. public function getiosEdition() {
  38. // 获取二维码
  39. $is_force = config("site.iso_is_force");
  40. $apkUrl = config("site.ios_downurl");
  41. $apkName = config("site.iso_appname");
  42. $desc = config("site.iso_desc");
  43. $versionCode = config("site.iso_versioncode");
  44. $this->success("获取成功!",["versionCode"=>$versionCode,"isForceUpdate"=>$is_force,"apkUrl"=>$apkUrl,"apkName"=>$apkName,"desc"=>$desc]);
  45. }
  46. //启动广告图
  47. public function start_advert(){
  48. $info = Db::name('start_advert')->where('is_show',1)->order('id desc')->find();
  49. $info = info_domain_image($info,['images','video_file']);
  50. $this->success_find('success',$info);
  51. }
  52. //非首次注册男性用户每次打开app,系统自动推送女性(公会)打招呼消息3人次。
  53. private function firstopen_send($oneuser){
  54. //找出公会的人
  55. $map = [
  56. 'gh_id' => ['gt',0],
  57. 'gender' => 0,
  58. ];
  59. $ghuser = Db::name('user')->where($map)->orderRaw('rand()')->limit(3)->column('id');
  60. //dump($ghuser);
  61. //随机取出一句话
  62. $oneword = Db::name('plantask_accost')->orderRaw('rand()')->limit(3)->column('title');
  63. //dump($oneword);
  64. $tenim = new \app\common\library\Tenim;
  65. for($i = 0;$i < 3;$i++){
  66. $ghuser_one = isset($ghuser[$i]) ? $ghuser[$i] : $ghuser[array_rand($ghuser)];
  67. $oneword_one = isset($oneword[$i]) ? $oneword[$i] : $oneword[array_rand($oneword)];
  68. $tenim->sendMessageToUser($ghuser_one,$oneuser,$oneword_one);
  69. }
  70. }
  71. //个人资料的一下枚举
  72. public function userinfo_enum(){
  73. $enum_hobby = Db::name('enum_hobby')->field('id,name')->order('weight desc,id desc')->select();
  74. $enum_job = Db::name('enum_job')->field('id,name')->order('weight desc,id desc')->select();
  75. $enum_marital = Db::name('enum_marital')->field('id,name')->order('weight desc,id desc')->select();
  76. $enum_suqiu = Db::name('enum_suqiu')->field('id,name')->order('weight desc,id desc')->select();
  77. $enum_tag = Db::name('enum_tag')->field('id,name')->order('weight desc,id desc')->select();
  78. $enum_wages = Db::name('enum_wages')->field('id,name')->order('weight desc,id desc')->select();
  79. $data = [
  80. 'enum_hobby' => $enum_hobby,
  81. 'enum_job' => $enum_job,
  82. 'enum_marital' => $enum_marital,
  83. 'enum_suqiu' => $enum_suqiu,
  84. 'enum_tag' => $enum_tag,
  85. 'enum_wages' => $enum_wages,
  86. ];
  87. $this->success('success',$data);
  88. }
  89. //关键字过滤
  90. public function keyworld_config(){
  91. $config = config('keyworld');
  92. $this->success('success',$config);
  93. }
  94. //帮助中心
  95. public function questions(){
  96. $list = Db::name('questions')->order('weigh desc')->select();
  97. $this->success(1,$list);
  98. }
  99. }