初始化代码

This commit is contained in:
2025-08-11 10:22:05 +08:00
commit ebd8d85201
4206 changed files with 753018 additions and 0 deletions

View File

@@ -0,0 +1,94 @@
<?php
namespace app\api\wxapi\post;
use app\api\wxapi\Base;
/* 生成带参数的二维码
* $QrcodeCreatePost=new QrcodeCreatePost();
* $QrcodeCreatePost->setAccessToken($AccessTokenRequest->access_token);
* $QrcodeCreatePost->setActionName(QrcodeCreatePost::ACTION_NAME_QR_SCENE);
* $QrcodeCreatePost->setExpireSeconds(60*60); //临时时间戳
* $QrcodeCreatePost->setSceneVal('123');
* $QrcodeCreatePost->run();
* $WxClient->setTypeCurl(WxClient::TYPE_CURL_POST);
* $QrcodeInfo=$WxClient->execute($QrcodeCreatePost);
* */
class QrcodeCreatePost extends Base
{
const ACTION_NAME_QR_SCENE='QR_SCENE'; //临时32位非0整型
const ACTION_NAME_QR_LIMIT_SCENE='QR_LIMIT_SCENE'; //永久最大值为1--100000
const ACTION_NAME_QR_LIMIT_STR_SCENE='QR_LIMIT_STR_SCENE'; //永久字符串长度限制为1到64
private $PostParas = array(); //post参数
private $GetParas = array(); //请求地址参数
private $access_token;
private $expire_seconds; //该二维码有效时间,以秒为单位。 最大不超过2592000即30天此字段如果不填则默认有效期为30秒。临时二维码参数
private $action_name; //ACTION_NAME_QR_SCENE(临时) ACTION_NAME_QR_LIMIT_SCENE(永久) ACTION_NAME_QR_LIMIT_STR_SCENE(永久字符串)
private $scene_val; //场景值
public function init(){
}
public function run(){
switch ($this->action_name) {
case self::ACTION_NAME_QR_LIMIT_STR_SCENE;
$this->PostParas["action_info"]['scene']['scene_str'] = $this->getSceneVal();
break;
default :
$this->PostParas["action_info"]['scene']['scene_id'] = $this->getSceneVal();
}
}
public function getApiMethodName(){
return "cgi-bin/qrcode/create";
}
public function getApiParas(){
return json_encode($this->PostParas);
}
public function getGetParas(){
return $this->GetParas;
}
public function putOtherTextParam($key, $value){
$this->PostParas[$key] = $value;
$this->$key = $value;
}
public function setExpireSeconds($expire_seconds){
$this->expire_seconds = $expire_seconds;
$this->PostParas["expire_seconds"] = $expire_seconds;
}
public function getExpireSeconds(){
return $this->expire_seconds;
}
public function setActionName($action_name){
$this->action_name = $action_name;
$this->PostParas["action_name"] = $action_name;
}
public function getActionName(){
return $this->action_name;
}
public function setSceneVal($scene_val){
$this->scene_val = $scene_val;
}
public function getSceneVal(){
return $this->scene_val;
}
public function setAccessToken($access_token){
$this->access_token = $access_token;
$this->GetParas["access_token"] = $access_token;
}
public function getAccessToken(){
return $this->access_token;
}
}