云之道知识付费3.1.1【最新开源】全插件,独立版

云之道知识付费3.1.1【最新开源】全插件,独立版
全插件 前端+后端源码 独立版 亲测可用!!!
共7端 D音端 k手端 pc端 等…全部可上线

代码具体有复制性,一经售出,概不退款!
亲测可用,有小程序前端。
演示请私信

defined('IN_IA') or exit('Access Denied');
define("YZD_EDU_IMG","/static/public/img");
require "inc/common/common.php";
require "inc/common/init.php";
require 'inc/web/page.inc.php';
require 'inc/func/core.php';
include 'lib/php_poster/phpQrcode.class.php';
include 'lib/php_poster/poster.class.php';
require 'lib/ali/AopSdk.php';
use Qiniu\Auth;
use Qiniu\Storage\UploadManager;
use Qiniu\Storage\BucketManager; 
use OSS\OssClient;
use OSS\Core\OssException;
// class Yzd_eduModuleSite extends WeModuleSite {
class Yzd_eduModuleSite extends Core {

	public function doWebWeb(){
		echo "test";
	}
	// 七牛云获取上传Token
	public function doWebGetQiniuToken(){
		global $_W, $_GPC;
		$res = Common::attchmentSet($_W['uniacid']);
		require_once IA_ROOT . '/addons/yzd_edu/lib/qiniu/autoload.php';//引入加载文件 
		$accessKey = $res['qiniu']['qn_accesskey'];
		$secretKey = $res['qiniu']['qn_secretkey'];
		
		$auth = new Auth($accessKey, $secretKey);
		// $bucket = 'yunzhidaowx';
		// 生成上传Token
		$token = $auth->uploadToken($res['qiniu']['qn_bucket']);
		return $token;
	}

	// 删除文件
	public function doWebDeletefile(){
		global $_W, $_GPC;
		$res = Common::attchmentSet($_W['uniacid']);
		if($_GPC['type'] == 'qiniu'){
			// 配置
			$access_key = $res['qiniu']['qn_accesskey'];
			$secret_key = $res['qiniu']['qn_secretkey'];
			$bucket = $res['qiniu']['qn_bucket']; // 存储空间名称
			require_once IA_ROOT . '/addons/yzd_edu/lib/qiniu/autoload.php';//引入加载文件 
			$auth = new \Qiniu\Auth($access_key, $secret_key);
			$config = new \Qiniu\Config();
			// 管理资源
			$bucketManager = new \Qiniu\Storage\BucketManager($auth, $config);
			// 删除文件操作
			$res = $bucketManager->delete($bucket, $_GPC['path']);
			if (is_null($res)) {
				echo "成功";
			}else{
				echo "失败";
			}
		}
		if($_GPC['type'] == 'bendi'){
			if(file_exists(ATTACHMENT_ROOT.$_GPC['path'])){
				unlink(ATTACHMENT_ROOT.$_GPC['path']);
			}else{
				echo '不存在';
			}

		}
	}

	//远程附件设置
	public function doWebAttachmentSet(){
		global $_W, $_GPC;
		$res = Common::attchmentSet($_W['uniacid']);
		exit(json_encode(array('data' => $res)));
	}
	//保存文件
	public function doWebAddAttachment() {
		global $_W, $_GPC;
		$data['attachment_group_id'] = $_GPC['attachment_group_id'];
		$http_type = $this->is_https();
		$http_type = $http_type?'https://':'http://';
		$data['url'] = $_GPC['url'];
		$data['path'] = $_GPC['path'];
		$data['type'] = $_GPC['type'];
		$data['add_time'] = time();
		$data['uniacid'] = $_W['uniacid'];
		$data['title'] = $_GPC['title'];
		$data['size'] = $_GPC['size'];
		$data['lecturer_id'] = $_GPC['lecturer_id'];
		$data['oss_type'] = $res = Common::attchmentSet($_W['uniacid'])['type'];
		pdo_insert('yzd_edu_attachment',$data);
	}

	//判断当前是否为https
	function is_https() {
	    if ( !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') {
	        return true;
	    } elseif ( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) {
	        return true;
	    } elseif ( !empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') {
	        return true;
	    }
	    return false;
	}

	//获取附件分组
    public function doWebgetgroupItem() {
        global $_W, $_GPC;
        $list = pdo_getall('yzd_edu_attachment_group',array('uniacid'=>$_W['uniacid'],'type'=>$_GPC['type'],'lecturer_id'=>$_GPC['lecturer_id']));
        exit(json_encode(array('data' => $list)));
    }

	//获取附件列表
    public function doWebgetAttachment_List() {
		global $_W, $_GPC;
		$pageindex = max(1, intval($_GPC['page']));
		$pagesize=10;
		$where=' WHERE uniacid=:uniacid';
		if($_GPC['type_id']==0) {
			
		}else{
			$where .= " and attachment_group_id =".$_GPC['type_id'];
		}
		if($_GPC['title']){
			$where.=" and title LIKE  concat('%', :title,'%') ";	
			$data[':title']=$_GPC['title'];
		}
		if($_GPC['type']){
			$where .= " and type =".$_GPC['type'];
		}
		$data[':uniacid']=$_W['uniacid'];
		$where .= " and lecturer_id =".$_GPC['lecturer_id'];
		$sql="SELECT * FROM ".tablename('yzd_edu_attachment') .$where." ORDER BY id DESC";
		$total=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('yzd_edu_attachment').$where,$data);
		$select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
		$list=pdo_fetchall($select_sql,$data);
		if($list) {
			foreach($list as &$v) {
				if(strlen($v['title']) >15){
					$v['sort_title'] = $this->esub($v['title'],10)."...";
				}else{
					$v['sort_title'] = $v['title'];
				}
			}
		}
        exit(json_encode(array('data' => $list,'total'=>intval($total))));
	}
	
	//新增附件分组
	public function doWebaddNewAttType() {
		global $_W, $_GPC;
		$result = pdo_insert('yzd_edu_attachment_group',array('title'=>$_GPC['title'],'type'=>$_GPC['type'],'uniacid'=>$_W['uniacid'],'lecturer_id'=>$_GPC['lecturer_id']));
		exit(json_encode(array('data' => $result, 'message' => '添加成功')));
	}
	public function doWebdeleteAttType() {
		global $_W, $_GPC;
		$result = pdo_delete('yzd_edu_attachment_group',array('id'=>$_GPC['id']));
		exit(json_encode(array('data' => $result, 'message' => '删除成功')));
	}
	//删除图片
	public function doWebdeleteAttItem() {
		global $_W, $_GPC;
		$result = pdo_delete('yzd_edu_attachment',array('id'=>$_GPC['id']));
		exit(json_encode(array('data' => $result, 'message' => '删除成功')));
	}
	public function doWebgetArticleType() {
		global $_W, $_GPC;
		$result = Common::articleTypeList($_W['uniacid']);
		exit(json_encode(array('data' => $result)));
	}
	// 获取DIY页面
	public function doWebgetDiyList(){
		global $_W, $_GPC;
		$result = pdo_getall('yzd_edu_diy',array('uniacid'=>$_W['uniacid']));
		if($result){
			foreach($result as &$v){
				$v['page_data'] = json_decode($v['page_data'],true);
			}
		}
		exit(json_encode(array('data' => $result)));
	}
	// 获取哪个是首页id和个人中心id
	public function doWebgetNavPage(){
		global $_W, $_GPC;
		$index = pdo_get('yzd_edu_setting',array('uniacid'=>$_W['uniacid']));
		$indexUrl = json_decode($index['nav_set'],true)['bottom']['data'][0]['url'];
		$user = pdo_get('yzd_edu_diy',array('uniacid'=>$_W['uniacid'],'type' => 2));
		$userUrl = '/u_pages/diy/index?id='.$user['id'];
		exit(json_encode(array('indexUrl' => substr($indexUrl,1),'userUrl'=>substr($userUrl,1),'index_scene' => explode("?",$indexUrl)[1],'user_scene' => 'id='.$user['id'])));
	}
	public function doWebUploadFile(){
		global $_W, $_GPC;
		$destination_folder = "../attachment/yzd_edu/" . date('Y') . "/" . date('m') . "/" . date('d') . "/"; //上传文件路径
		$file = $_FILES["upfile"];
		if (!file_exists($destination_folder)) {
			mkdir($destination_folder, 0777, true);
		}
		$filename = $file["tmp_name"];
		$image_size = getimagesize($filename);
		$pinfo = pathinfo($file["name"]);
		$ftype = $pinfo['extension'];
		$destination = $destination_folder . str_shuffle(time() . rand(111111, 999999)) . "." . $ftype;
		if (file_exists($destination) && $overwrite != true) {
            print_r('同名文件已经存在了');
		}
		if (!move_uploaded_file($filename, $destination)) {

在这里插入图片描述

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值