Baseconfig.php 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. 'domain_name' => config('site.domain_name'),
  15. 'domain_cdnurl' => config('site.domain_cdnurl'),
  16. 'android_update_num' => config('site.android_update_num'),
  17. 'android_update_version' => config('site.android_update_version'),
  18. 'ios_update_num' => config('site.ios_update_num'),
  19. 'ios_update_version' => config('site.ios_update_version'),
  20. 'livebc_type' => Db::name('party_type')->where('room_type',2)->order('id asc')->select(),
  21. 'taluopai' => config('site.taluopai'),
  22. ];
  23. $this->success('success',$config);
  24. }
  25. //启动广告图
  26. public function start_advert(){
  27. //非首次注册男性用户每次打开app,系统自动推送女性(公会)打招呼消息3人次
  28. if($this->auth->isLogin()){
  29. if($this->auth->gender == 1 && $this->auth->gh_id == 0){
  30. $this->firstopen_send($this->auth->id);
  31. }
  32. }
  33. $info = Db::name('start_advert')->where('is_show',1)->order('id desc')->find();
  34. $info = info_domain_image($info,['image']);
  35. $this->success_find('success',$info);
  36. }
  37. //非首次注册男性用户每次打开app,系统自动推送女性(公会)打招呼消息3人次。
  38. private function firstopen_send($oneuser){
  39. //找出公会的人
  40. $map = [
  41. 'gh_id' => ['gt',0],
  42. ];
  43. $ghuser = Db::name('user')->where($map)->orderRaw('rand()')->limit(3)->column('id');
  44. //dump($ghuser);
  45. //随机取出一句话
  46. $oneword = Db::name('plantask_accost')->orderRaw('rand()')->limit(3)->column('title');
  47. //dump($oneword);
  48. $tenim = new \app\common\library\Tenim;
  49. for($i = 0;$i < 3;$i++){
  50. $ghuser_one = isset($ghuser[$i]) ? $ghuser[$i] : $ghuser[array_rand($ghuser)];
  51. $oneword_one = isset($oneword[$i]) ? $oneword[$i] : $oneword[array_rand($oneword)];
  52. $tenim->sendMessageToUser($ghuser_one,$oneuser,$oneword_one);
  53. }
  54. }
  55. //个人资料的一下枚举
  56. public function userinfo_enum(){
  57. $enum_hobby = Db::name('enum_hobby')->field('id,name')->order('weight desc,id desc')->select();
  58. $enum_job = Db::name('enum_job')->field('id,name')->order('weight desc,id desc')->select();
  59. $enum_marital = Db::name('enum_marital')->field('id,name')->order('weight desc,id desc')->select();
  60. $enum_education = Db::name('enum_education')->field('id,name')->order('weight desc,id desc')->select();
  61. $enum_tag = Db::name('enum_tag')->field('id,name')->order('weight desc,id desc')->select();
  62. $enum_wages = Db::name('enum_wages')->field('id,name')->order('weight desc,id desc')->select();
  63. $data = [
  64. 'enum_hobby' => $enum_hobby,
  65. 'enum_job' => $enum_job,
  66. 'enum_marital' => $enum_marital,
  67. 'enum_education' => $enum_education,
  68. 'enum_tag' => $enum_tag,
  69. 'enum_wages' => $enum_wages,
  70. ];
  71. $this->success('success',$data);
  72. }
  73. //关键字过滤
  74. public function keyworld_config(){
  75. $config = config('keyworld');
  76. $this->success('success',$config);
  77. }
  78. }