| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 | <?phpnamespace app\api\controller;use app\common\controller\Api;use think\Db;/** * 基础配置接口 */class Baseconfig extends Api{    protected $noNeedLogin = ['*'];    protected $noNeedRight = ['*'];       public function index(){        $config = [            'domain_name' => config('site.domain_name'),            'domain_cdnurl' => config('site.domain_cdnurl'),            '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'),        ];        $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],        ];        $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 = 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();        $data = [            'enum_hobby' => $enum_hobby,            'enum_job' => $enum_job,            'enum_marital' => $enum_marital,            'enum_education' => $enum_education,            'enum_tag' => $enum_tag,            'enum_wages' => $enum_wages,        ];        $this->success('success',$data);    }    //关键字过滤    public function keyworld_config(){        $config = config('keyworld');        $this->success('success',$config);    }}
 |