Baseconfig.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. 'comment_for_gold_switch' => config('site.comment_for_gold_switch'),//好评有礼开关
  15. 'kefu_user_ids' => config('site.kefu_user_ids'),//在线客服人员
  16. 'index_pipei_switch' => config('site.index_pipei_switch'), //首页匹配功能开关
  17. ];
  18. $this->success('success',$config);
  19. }
  20. /**
  21. * 获取版本更新信息
  22. */
  23. public function getEdition() {
  24. // 获取二维码
  25. $is_force = config("site.is_force");
  26. $apkUrl = config("site.apkUrl");
  27. $apkName = config("site.apkName");
  28. $desc = config("site.desc");
  29. $versionCode = config("site.versionCode");
  30. $this->success("获取成功!",["versionCode"=>$versionCode,"isForceUpdate"=>$is_force,"apkUrl"=>$apkUrl,"apkName"=>$apkName,"desc"=>$desc]);
  31. }
  32. //启动广告图
  33. public function start_advert(){
  34. $info = Db::name('start_advert')->where('is_show',1)->order('id desc')->find();
  35. $info = info_domain_image($info,['images','video_file']);
  36. $this->success_find('success',$info);
  37. }
  38. //非首次注册男性用户每次打开app,系统自动推送女性(公会)打招呼消息3人次。
  39. private function firstopen_send($oneuser){
  40. //找出公会的人
  41. $map = [
  42. 'gh_id' => ['gt',0],
  43. 'gender' => 0,
  44. ];
  45. $ghuser = Db::name('user')->where($map)->orderRaw('rand()')->limit(3)->column('id');
  46. //dump($ghuser);
  47. //随机取出一句话
  48. $oneword = Db::name('plantask_accost')->orderRaw('rand()')->limit(3)->column('title');
  49. //dump($oneword);
  50. $tenim = new \app\common\library\Tenim;
  51. for($i = 0;$i < 3;$i++){
  52. $ghuser_one = isset($ghuser[$i]) ? $ghuser[$i] : $ghuser[array_rand($ghuser)];
  53. $oneword_one = isset($oneword[$i]) ? $oneword[$i] : $oneword[array_rand($oneword)];
  54. $tenim->sendMessageToUser($ghuser_one,$oneuser,$oneword_one);
  55. }
  56. }
  57. //个人资料的一下枚举
  58. public function userinfo_enum(){
  59. // $enum_hobby = Db::name('enum_hobby')->field('id,name')->order('weight desc,id desc')->select();
  60. // $enum_job = Db::name('enum_job')->field('id,name')->order('weight desc,id desc')->select();
  61. // $enum_marital = Db::name('enum_marital')->field('id,name')->order('weight desc,id desc')->select();
  62. // $enum_education = Db::name('enum_education')->field('id,name')->order('weight desc,id desc')->select();
  63. $enum_tag = Db::name('enum_tag')->field('id,name')->order('weight desc,id desc')->select();
  64. // $enum_wages = Db::name('enum_wages')->field('id,name')->order('weight desc,id desc')->select();
  65. $data = [
  66. // 'enum_hobby' => $enum_hobby,
  67. // 'enum_job' => $enum_job,
  68. // 'enum_marital' => $enum_marital,
  69. // 'enum_education' => $enum_education,
  70. 'enum_tag' => $enum_tag,
  71. // 'enum_wages' => $enum_wages,
  72. ];
  73. $this->success('success',$data);
  74. }
  75. //关键字过滤
  76. public function keyworld_config(){
  77. $config = config('keyworld');
  78. $this->success('success',$config);
  79. }
  80. //好评有礼
  81. public function app_comment(){
  82. $images = input('images','');
  83. $platform = input('platform','android');
  84. $data = [
  85. 'user_id' => $this->auth->id,
  86. 'images' => $images,
  87. 'status' => 0,
  88. 'platform' => $platform,
  89. 'createtime' => time(),
  90. 'updatetime' => time(),
  91. ];
  92. Db::name('app_comment')->insertGetId($data);
  93. $this->success();
  94. }
  95. }