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); } /** * @title 获取系统配置 * @desc 获取系统配置 * @url /api/Publics/config_info * @method POST * @tag 基础 * * @return name:agreement type:string desc:使用条款 * @return name:privacy type:string desc:隐私协议 * @return name:platform_agreement type:string desc:违规处罚 * @return name:about_us type:string desc:关于我们 * @return name:registration_agreement type:string desc:用户注册协议 * @return name:terms_service type:string desc:联通统一认证服务条款 * @return name:chain_on_query type:string desc:链上查询 * @return name:examples_illustrate type:string desc:转赠说明 * @return name:android_version type:string desc:安卓当前版本号 * @return name:android_package type:string desc:安卓包地址 * @return name:ios_package type:string desc:ios地址 * @return name:newbie_guide type:string desc:新手指南 * @return name:invite_rules type:string desc:邀请规则 * @return name:service type:string desc:客服 * @return name:advance_minutes type:string desc:提前抢购时间(分钟) * @return name:share_poster type:string desc:分享海报 * @return name:secondary_sell_switch type:int desc:二级市场商品出售开关(1开启,0关闭) * @return name:withdraw_switch type:int desc:提现开关(1开启,0关闭) **/ 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); } /** * @title 获取分享的签名 * @desc 获取分享的签名 * @url /api/Publics/getWechatSign * @method POST * @tag 基础 * **/ 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); // $urls = 'http://jybl.hdlkeji.com/web/h5/'; $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); } /** * @title 获取余额提现配置 * @desc 获取余额提现配置 * @url /api/Publics/getWithdrawConfig * @method POST * @tag 基础 * @return name:withdraw_switch type:int desc:提现开关(1开启,0关闭) * @return name:withdraw_min_price type:float desc:最小提现金额 * @return name:withdraw_max_price type:float desc:最大提现金额 * @return name:poundage_proportion type:int desc:提现手续费(计算时需要除以100) **/ public function getWithdrawConfig() { $nameArray = [ 'withdraw_switch', 'withdraw_min_price', 'withdraw_max_price', 'poundage_proportion', ]; $array = getConfig($nameArray); $this->success('成功',$array); } /** * @title 云钱包提现设置 * @desc 云钱包提现设置 * @url /api/Publics/getCloudWalletConfig * @method POST * @tag 基础 * @return name:cloud_min type:float desc:最小提现金额 * @return name:cloud_max type:float desc:最大提现金额 * @return name:cloud_fee type:int desc:提现手续费【固定金额】 **/ public function getCloudWalletConfig() { $this->success('成功',['cloud_min'=>5,'cloud_max'=>1000,'cloud_fee'=>2]); } }