123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- use think\Db;
- /**
- * 基础配置接口
- */
- class Baseconfig extends Api
- {
- protected $noNeedLogin = ['*'];
- protected $noNeedRight = ['*'];
-
- public function index(){
- // $jewelMoneyConfig = config('site.jewel_money');
- // $jewelMoney = bcdiv(1,$jewelMoneyConfig,10);//转换为小数给前端,前端是乘以的方式计算的
- $config = [
- // 'domain_name' => config('site.domain_name'),
- // 'android_update_num' => config('site.android_update_num'),
- 'android_update_version' => config('site.android_update_version'),
- // 'ios_update_num' => config('site.ios_update_num'),
- 'ios_update_version' => config('site.ios_update_version'),
- // 'livebc_type' => Db::name('party_type')->where('room_type',2)->order('id asc')->select(),
- // 'taluopai' => config('site.taluopai'),
- // 'open_unlock_wechataccount' => config('site.open_unlock_wechataccount'),
- 'no_screenshot' => config('site.no_screenshot'),
- 'show_wechat_pay' => config('site.show_wechat_pay'),
- 'show_ali_pay' => config('site.show_ali_pay'),
- 'show_intimacy' => config('site.show_intimacy'),
- // 'jewel_money' => $jewelMoney,
- ];
- $this->success('success',$config);
- }
- //启动广告图
- public function start_advert(){
- //非首次注册男性用户每次打开app,系统自动推送女性(公会)打招呼消息3人次
- if($this->auth->isLogin()){
- if($this->auth->gender == 1 && $this->auth->gh_id == 0){
- $this->firstopen_send($this->auth->id);
- }
- }
- $info = Db::name('start_advert')->where('is_show',1)->order('id desc')->find();
- $info = info_domain_image($info,['image']);
- $this->success_find('success',$info);
- }
- //非首次注册男性用户每次打开app,系统自动推送女性(公会)打招呼消息3人次。
- private function firstopen_send($oneuser){
- //找出公会的人
- $map = [
- 'gh_id' => ['gt',0],
- 'gender' => 0,
- ];
- $ghuser = Db::name('user')->where($map)->orderRaw('rand()')->limit(3)->column('id');
- //dump($ghuser);
- //随机取出一句话
- $oneword = Db::name('plantask_accost')->orderRaw('rand()')->limit(3)->column('title');
- //dump($oneword);
- $tenim = new \app\common\library\Tenim;
- for($i = 0;$i < 3;$i++){
- $ghuser_one = isset($ghuser[$i]) ? $ghuser[$i] : $ghuser[array_rand($ghuser)];
- $oneword_one = isset($oneword[$i]) ? $oneword[$i] : $oneword[array_rand($oneword)];
- $tenim->sendMessageToUser($ghuser_one,$oneuser,$oneword_one);
- }
- }
- //个人资料的一下枚举
- public function userinfo_enum(){
- $enum_hobby_type = Db::name('enum_hobby_type')->field('id,name')->order('weight desc,id desc')->select();
- $mt_enum_hobby = Db::name('enum_hobby');
- foreach ($enum_hobby_type as &$v) {
- $v['list'] = $mt_enum_hobby->where(['type_id' => $v['id']])->field('id,name')->order('weight desc,id desc')->select();
- }
- // $enum_hobby = Db::name('enum_hobby')->field('id,name')->order('weight desc,id desc')->select();
- $enum_job = Db::name('enum_job')->field('id,name')->order('weight desc,id desc')->select();
- $enum_marital = Db::name('enum_marital')->field('id,name')->order('weight desc,id desc')->select();
- $enum_education = Db::name('enum_education')->field('id,name')->order('weight desc,id desc')->select();
- $enum_tag = Db::name('enum_tag')->field('id,name')->order('weight desc,id desc')->select();
- $enum_wages = Db::name('enum_wages')->field('id,name')->order('weight desc,id desc')->select();
- $enum_character = Db::name('enum_character')->field('id,name')->order('weight desc,id desc')->select();
- $enum_constellation = Db::name('enum_constellation')->field('id,name')->order('weight desc,id desc')->select();
- $enum_stature = Db::name('enum_stature')->field('id,name')->order('weight desc,id desc')->select();
- $enum_live = Db::name('enum_live')->field('id,name')->order('weight desc,id desc')->select();
- $enum_car = Db::name('enum_car')->field('id,name')->order('weight desc,id desc')->select();
- $enum_chest = Db::name('enum_chest')->field('id,name')->order('weight desc,id desc')->select();
- $data = [
- 'enum_hobby' => $enum_hobby_type,
- 'enum_job' => $enum_job,
- 'enum_marital' => $enum_marital,
- 'enum_education' => $enum_education,
- 'enum_tag' => $enum_tag,
- 'enum_wages' => $enum_wages,
- 'enum_character' => $enum_character,
- 'enum_constellation' => $enum_constellation,
- 'enum_stature' => $enum_stature,
- 'enum_live' => $enum_live,
- 'enum_car' => $enum_car,
- 'enum_chest' => $enum_chest,
- ];
- $this->success('success',$data);
- }
- //关键字过滤
- public function keyworld_config(){
- $config = config('keyworld');
- $this->success('success',$config);
- }
- }
|