Baseconfig.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. 'kefu_url' => config('site.kefu_url'), //客服超链接
  18. 'sixin_oneday_user_times' => config('site.sixin_oneday_user_times'), //每人每天私信免费次数
  19. 'app_find_show' => config('site.app_find_show'), //发现页是否展示
  20. //问答
  21. 'question_icon' => localpath_to_netpath(config('site.question_icon')), //问号图标
  22. 'question_title' => config('site.question_title'), //问答标题
  23. 'question_basedatakey' => config('site.question_basedatakey'), //问答文章key
  24. ];
  25. $this->success('success',$config);
  26. }
  27. /**
  28. * 获取安卓版本更新信息
  29. */
  30. public function getandroidEdition() {
  31. // 获取二维码
  32. $is_force = config("site.android_is_force");
  33. $apkUrl = config("site.android_apkUrl");
  34. $apkName = config("site.android_apkName");
  35. $desc = config("site.android_desc");
  36. $versionCode = config("site.android_versionCode");
  37. $this->success("获取成功!",["versionCode"=>$versionCode,"isForceUpdate"=>$is_force,"apkUrl"=>$apkUrl,"apkName"=>$apkName,"desc"=>$desc]);
  38. }
  39. /**
  40. * 获取ios版本更新信息
  41. */
  42. public function getiosEdition() {
  43. // 获取二维码
  44. $is_force = config("site.iso_is_force");
  45. $apkUrl = config("site.ios_downurl");
  46. $apkName = config("site.iso_appname");
  47. $desc = config("site.iso_desc");
  48. $versionCode = config("site.iso_versioncode");
  49. $this->success("获取成功!",["versionCode"=>$versionCode,"isForceUpdate"=>$is_force,"apkUrl"=>$apkUrl,"apkName"=>$apkName,"desc"=>$desc]);
  50. }
  51. //启动广告图
  52. public function start_advert(){
  53. $info = Db::name('start_advert')->where('is_show',1)->order('id desc')->find();
  54. $info = info_domain_image($info,['images','video_file']);
  55. $this->success_find('success',$info);
  56. }
  57. //非首次注册男性用户每次打开app,系统自动推送女性(公会)打招呼消息3人次。
  58. private function firstopen_send($oneuser){
  59. //找出公会的人
  60. $map = [
  61. 'gh_id' => ['gt',0],
  62. 'gender' => 0,
  63. ];
  64. $ghuser = Db::name('user')->where($map)->orderRaw('rand()')->limit(3)->column('id');
  65. //dump($ghuser);
  66. //随机取出一句话
  67. $oneword = Db::name('plantask_accost')->orderRaw('rand()')->limit(3)->column('title');
  68. //dump($oneword);
  69. $tenim = new \app\common\library\Tenim;
  70. for($i = 0;$i < 3;$i++){
  71. $ghuser_one = isset($ghuser[$i]) ? $ghuser[$i] : $ghuser[array_rand($ghuser)];
  72. $oneword_one = isset($oneword[$i]) ? $oneword[$i] : $oneword[array_rand($oneword)];
  73. $tenim->sendMessageToUser($ghuser_one,$oneuser,$oneword_one);
  74. }
  75. }
  76. //个人资料的一下枚举
  77. public function userinfo_enum(){
  78. // $enum_hobby = Db::name('enum_hobby')->field('id,name')->order('weight desc,id desc')->select();
  79. // $enum_job = Db::name('enum_job')->field('id,name')->order('weight desc,id desc')->select();
  80. // $enum_marital = Db::name('enum_marital')->field('id,name')->order('weight desc,id desc')->select();
  81. // $enum_education = Db::name('enum_education')->field('id,name')->order('weight desc,id desc')->select();
  82. $enum_tag = Db::name('enum_tag')->field('id,name,color')->order('weight desc,id desc')->select();
  83. // $enum_wages = Db::name('enum_wages')->field('id,name')->order('weight desc,id desc')->select();
  84. $data = [
  85. // 'enum_hobby' => $enum_hobby,
  86. // 'enum_job' => $enum_job,
  87. // 'enum_marital' => $enum_marital,
  88. // 'enum_education' => $enum_education,
  89. 'enum_tag' => $enum_tag,
  90. 'enumtag_max' => config('site.enumtag_max'),//最多可选个数
  91. // 'enum_wages' => $enum_wages,
  92. ];
  93. $this->success('success',$data);
  94. }
  95. //关键字过滤
  96. public function keyworld_config(){
  97. $config = config('keyworld');
  98. $this->success('success',$config);
  99. }
  100. //好评有礼
  101. public function app_comment(){
  102. $images = input('images','');
  103. $platform = input('platform','android');
  104. $check = Db::name('app_comment')->where('user_id',$this->auth->id)->order('id desc')->find();
  105. if($check){
  106. if($check['status'] == 1){
  107. $this->error('您已经提交并审核通过,无需重复提交');
  108. }
  109. if($check['status'] == 0){
  110. $this->error('您已经提交过了,请等待审核');
  111. }
  112. }
  113. $data = [
  114. 'user_id' => $this->auth->id,
  115. 'images' => $images,
  116. 'status' => 0,
  117. 'platform' => $platform,
  118. 'createtime' => time(),
  119. 'updatetime' => time(),
  120. ];
  121. Db::name('app_comment')->insertGetId($data);
  122. $this->success('提交成功,请等待审核');
  123. }
  124. }