123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- <?php
- namespace app\api\controller;
- use think\cache\driver\Redis;
- use think\Db;
- use think\facade\Validate;
- use think\Request;
- use OSS\OssClient;
- use OSS\Core\OssException;
- use Zxing\Qrcode\Decoder\DataBlock;
- class Publics extends Base
- {
-
- public function uploadLocality(){
- $file = request()->file('file');
- $dir = dirname(realpath(dirname($_SERVER['SCRIPT_FILENAME']))) . '/public/upload';
- if(!file_exists($dir)){
-
- mkdir($dir, 0700,true);
- }
- $info = $file->move($dir);
- $newName = $info->getSaveName();
- $data['url'] = 'http://'.$_SERVER['SERVER_NAME']."/upload/{$newName}";
- $this->success('上传成功',$data);
- }
-
- public function config_info(){
- $nameArray = [
- 'agreement',
- 'privacy',
- 'platform_agreement',
- 'newbie_guide',
- 'invite_rules',
- 'service',
- 'about_us',
- 'registration_agreement',
- 'terms_service',
- 'chain_on_query',
- 'examples_illustrate',
- 'android_version',
- 'android_package',
- 'ios_package',
- 'free_lucky_number',
- 'lucky_recharge_price',
- 'service_fee',
- 'royalties',
- 'advance_minutes',
- 'share_poster',
- 'secondary_sell_switch',
- 'withdraw_switch',
- 'turnover_switch',
- ];
- $array = getConfig($nameArray);
- $this->success('成功',$array);
- }
-
- public function getWechatSign(){
- $urls = input('url');
- $appid = 'wx8e47a12d0a1c007f';
- $secret = 'f19bfac2108af3aee75df0a31a1fee1c';
- $redis = new Redis();
- $access_token = $redis->get('access_token');
- if (!$access_token){
- $access_token = '';
- $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=$appid&secret=$secret";
- $res=curlRequest($url);
- $res = json_decode($res,true);
- if (isset($res['access_token'])){
- $redis->set('access_token',$res['access_token'],'7000');
- $access_token = $res['access_token'];
- }
- }
- $url2 ="https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=".$access_token."&type=jsapi";
- $res2=curlRequest($url2);
- $res2 = json_decode($res2,true);
- if (!isset($res2) || $res2['errcode']!=0){
- $this->error('获取ticket失败');
- }
- $timestamp = time();
- $noncestr = get32Str(15);
- $string = "jsapi_ticket=".$res2['ticket']."&noncestr=$noncestr×tamp=$timestamp&url=".$urls;
- $sign = sha1($string);
- $return = [
- 'appid'=>$appid,
- 'noncestr'=>$noncestr,
- 'timestamp'=>$timestamp,
- 'url'=>$urls,
- 'sign'=>$sign,
- 'ticket'=>$res2['ticket']
- ];
- $this->success('成功',$return);
- }
-
- public function getWithdrawConfig()
- {
- $nameArray = [
- 'withdraw_switch',
- 'withdraw_min_price',
- 'withdraw_max_price',
- 'poundage_proportion',
- ];
- $array = getConfig($nameArray);
- $this->success('成功',$array);
- }
-
- public function getCloudWalletConfig()
- {
- $this->success('成功',['cloud_min'=>5,'cloud_max'=>1000,'cloud_fee'=>2]);
- }
- }
|