Baseconfig.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. // $jewelMoneyConfig = config('site.jewel_money');
  14. // $jewelMoney = bcdiv(1,$jewelMoneyConfig,10);//转换为小数给前端,前端是乘以的方式计算的
  15. $config = [
  16. // 'domain_name' => config('site.domain_name'),
  17. // 'android_update_num' => config('site.android_update_num'),
  18. 'android_update_version' => config('site.android_update_version'),
  19. // 'ios_update_num' => config('site.ios_update_num'),
  20. 'ios_update_version' => config('site.ios_update_version'),
  21. // 'livebc_type' => Db::name('party_type')->where('room_type',2)->order('id asc')->select(),
  22. // 'taluopai' => config('site.taluopai'),
  23. // 'open_unlock_wechataccount' => config('site.open_unlock_wechataccount'),
  24. 'no_screenshot' => config('site.no_screenshot'),
  25. 'show_wechat_pay' => config('site.show_wechat_pay'),
  26. 'show_ali_pay' => config('site.show_ali_pay'),
  27. 'show_intimacy' => config('site.show_intimacy'),
  28. // 'jewel_money' => $jewelMoney,
  29. ];
  30. $this->success('success',$config);
  31. }
  32. //启动广告图
  33. public function start_advert(){
  34. //非首次注册男性用户每次打开app,系统自动推送女性(公会)打招呼消息3人次
  35. if($this->auth->isLogin()){
  36. if($this->auth->gender == 1 && $this->auth->gh_id == 0){
  37. $this->firstopen_send($this->auth->id);
  38. }
  39. }
  40. $info = Db::name('start_advert')->where('is_show',1)->order('id desc')->find();
  41. $info = info_domain_image($info,['image']);
  42. $this->success_find('success',$info);
  43. }
  44. //非首次注册男性用户每次打开app,系统自动推送女性(公会)打招呼消息3人次。
  45. private function firstopen_send($oneuser){
  46. //找出公会的人
  47. $map = [
  48. 'gh_id' => ['gt',0],
  49. 'gender' => 0,
  50. ];
  51. $ghuser = Db::name('user')->where($map)->orderRaw('rand()')->limit(3)->column('id');
  52. //dump($ghuser);
  53. //随机取出一句话
  54. $oneword = Db::name('plantask_accost')->orderRaw('rand()')->limit(3)->column('title');
  55. //dump($oneword);
  56. $tenim = new \app\common\library\Tenim;
  57. for($i = 0;$i < 3;$i++){
  58. $ghuser_one = isset($ghuser[$i]) ? $ghuser[$i] : $ghuser[array_rand($ghuser)];
  59. $oneword_one = isset($oneword[$i]) ? $oneword[$i] : $oneword[array_rand($oneword)];
  60. $tenim->sendMessageToUser($ghuser_one,$oneuser,$oneword_one);
  61. }
  62. }
  63. //个人资料的一下枚举
  64. public function userinfo_enum(){
  65. $enum_hobby_type = Db::name('enum_hobby_type')->field('id,name')->order('weight desc,id desc')->select();
  66. $mt_enum_hobby = Db::name('enum_hobby');
  67. foreach ($enum_hobby_type as &$v) {
  68. $v['list'] = $mt_enum_hobby->where(['type_id' => $v['id']])->field('id,name')->order('weight desc,id desc')->select();
  69. }
  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')->order('weight desc,id desc')->select();
  75. $enum_wages = Db::name('enum_wages')->field('id,name')->order('weight desc,id desc')->select();
  76. $enum_character = Db::name('enum_character')->field('id,name')->order('weight desc,id desc')->select();
  77. $enum_constellation = Db::name('enum_constellation')->field('id,name')->order('weight desc,id desc')->select();
  78. $enum_stature = Db::name('enum_stature')->field('id,name')->order('weight desc,id desc')->select();
  79. $enum_live = Db::name('enum_live')->field('id,name')->order('weight desc,id desc')->select();
  80. $enum_car = Db::name('enum_car')->field('id,name')->order('weight desc,id desc')->select();
  81. $enum_chest = Db::name('enum_chest')->field('id,name')->order('weight desc,id desc')->select();
  82. $data = [
  83. 'enum_hobby' => $enum_hobby_type,
  84. 'enum_job' => $enum_job,
  85. 'enum_marital' => $enum_marital,
  86. 'enum_education' => $enum_education,
  87. 'enum_tag' => $enum_tag,
  88. 'enum_wages' => $enum_wages,
  89. 'enum_character' => $enum_character,
  90. 'enum_constellation' => $enum_constellation,
  91. 'enum_stature' => $enum_stature,
  92. 'enum_live' => $enum_live,
  93. 'enum_car' => $enum_car,
  94. 'enum_chest' => $enum_chest,
  95. ];
  96. $this->success('success',$data);
  97. }
  98. //关键字过滤
  99. public function keyworld_config(){
  100. $config = config('keyworld');
  101. $this->success('success',$config);
  102. }
  103. }