source/index/open_wxapp.ctrl.php

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
class open_wxappControl extends skymvc{
	public $wx; 
	public function __construct(){
		parent::__construct();
		
	}
	public function upload_oss($files){
			$this->loadClass("image");
			$this->loadClass("upload");
	
			$this->upload->uploaddir="attach/".$this->sitedir; 
			set_time_limit(100);
			include_once(ROOT_PATH."api/ossapi/ossapi.php");
			if(!UPLOAD_OSS) return false;
			if(empty($files)) return false;
			$arr=array("",".100x100.jpg",".small.jpg",".middle.jpg");
			foreach($arr as $a){		
				if(file_exists(ROOT_PATH.$files.$a)){
					$to=str_replace("//","/",$files.$a);
					$from=ROOT_PATH.$files.$a;
					$response = oss_upload_file(array("bucket"=>OSS_BUCKET,"to"=>$to,"from"=>$from));
					if(defined("UPLOAD_DEL") && UPLOAD_DEL){
						@unlink($from);
					}
				}
			}
		}
	public function onDefault(){
		
	}
	public function getWeixin(){
			$wid=get_post('wid','i');
			if($wid){
			$where=" id=".$wid;
			}else{
			$where="";
			}
			$this->wx=$wx=M("open_wxapp")->selectRow(array("where"=>$where,"order"=>"id DESC"));
			return $wx;
	}
	public function onCode2Session(){
		$wx=$this->getWeiXin();
		$code=get("code","h");
		$res=curl_get_contents("https://api.weixin.qq.com/sns/jscode2session?appid=".$wx['appid']."&secret=".$wx['appkey']."&js_code=".$code."&grant_type=authorization_code");
		 
		$data=json_decode($res,true);
		if(isset($data['openid'])){
			$this->goAll("success",0,array(
				"openid"=>$data['openid']
			));
		}else{
			$this->goAll("error",1);
		}
	}
	
	public function onLogin(){
		$code=get_post('code','h');
		$nickname=get_post('nickname','h');
		$user_wxhead=get_post('user_head','h');
后面还有 168 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。