首页
友人帐
留言板
关于
Search
1
IDE Eval Resetter:JetBrains 全家桶无限试用插件
635 阅读
2
影视资源采集站收录大全
598 阅读
3
linux安装或升级protoc
401 阅读
4
HEU KMS Activator v23.1.0 win10 office2019激活工具
320 阅读
5
Cloudflare国内自选IP节点整理收录
306 阅读
谈天说地
程序源码
技术教程
成品源码
登录
Search
标签搜索
PHP
linux
源码
go
windows
centos
原创
mysql
微信
激活
采集
宝塔
绿色版
API
解析
SDK
图片
破解
域名
html
云青
累计撰写
150
篇文章
累计收到
165
条评论
首页
栏目
谈天说地
程序源码
技术教程
成品源码
页面
友人帐
留言板
关于
搜索到
150
篇与
的结果
2022-06-10
golang使用宝塔API快速建站
由于某些原因,需要用一行命令来创建宝塔以及数据库,此函数基于官方的API注意:宝塔创建网站需要使用php 以下代码使用php80下面代码用到了第三方库github.com/spf13/vipermd5的计算就不贴了很简单BtServer主文件/* * @Author anderyly * @email admin@aaayun.cc * @link http://blog.aaayun.cc/ * @copyright Copyright (c) 2022 */ package ay import ( "encoding/json" "fmt" "io/ioutil" "net/http" "runtime" "strconv" "strings" "time" ) type BtServer struct { } // GetSign 获取签名 func (con BtServer) GetSign() map[string]string { res := make(map[string]string, 2) res["request_time"] = strconv.FormatInt(time.Now().Unix(), 10) res["request_token"] = MD5(res["request_time"] + MD5(Yaml.GetString("bt.code"))) return res } // GetSiteId 获取网站id func (con BtServer) GetSiteId() { type r struct { Where string `json:"where"` Page string `json:"page"` Data []struct { Id int `json:"id"` Name string `json:"name"` Path string `json:"path"` Status string `json:"status"` Ps string `json:"ps"` Addtime string `json:"addtime"` Edate string `json:"edate"` Type string `json:"type"` TypeVersion string `json:"type_version"` BackupCount int `json:"backup_count"` Domain int `json:"domain"` Ssl int `json:"ssl"` } `json:"data"` } url := Yaml.GetString("bt.panel") + "/data?action=getData&table=sites" data := con.GetSign() data["limit"] = "1" data["search"] = Yaml.GetString("bt.site") res := con.Http(url, data) var rj r json.Unmarshal([]byte(res), &rj) siteId := 0 if len(rj.Data) == 1 { for _, v := range rj.Data { siteId = v.Id } } Yaml.Set("bt.site_id", siteId) Yaml.WriteConfig() } func (con BtServer) Http(url string, data map[string]string) string { str := "" for k, v := range data { str += k + "=" + v + "&" } resp, err := http.Post(url, "application/x-www-form-urlencoded", strings.NewReader(strings.TrimRight(str, "&"))) if err != nil { fmt.Println(err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { // handle error } return string(body) } // Create 创建网站 func (con BtServer) Create() (bool, string) { type r struct { SiteStatus bool `json:"siteStatus"` SiteId int `json:"siteId"` FtpStatus bool `json:"ftpStatus"` DatabaseStatus bool `json:"databaseStatus"` Status bool `json:"status"` Msg string `json:"msg"` } url := Yaml.GetString("bt.panel") + "/site?action=AddSite" data := con.GetSign() pass := MD5(strconv.FormatInt(time.Time{}.Unix(), 10))[:10] Yaml.Set("mysql.user", "shop") Yaml.Set("mysql.database", "shop") Yaml.Set("mysql.password", pass) Yaml.Set("mysql.localhost", "127.0.0.1") Yaml.Set("mysql.port", "3306") if runtime.GOOS == "linux" { data["path"] = "/www/wwwroot/shop" } else { data["path"] = "D:/wwwroot/shop" } data["webname"] = `{"domain":"` + Yaml.GetString("bt.site") + `","domainlist":[],"count":0}` data["type_id"] = "0" data["type"] = "PHP" data["version"] = "80" data["port"] = "80" data["ps"] = "微营销" data["ftp"] = "false" data["sql"] = "true" data["codeing"] = "utf8mb4" data["datauser"] = "shop" data["datapassword"] = pass res := con.Http(url, data) var rj r json.Unmarshal([]byte(res), &rj) Yaml.Set("bt.site_id", rj.SiteId) if rj.SiteStatus && rj.DatabaseStatus { Yaml.WriteConfig() return true, "success" } else { return false, rj.Msg } } // GetDomain 获取域名 func (con BtServer) GetDomain() []map[string]string { type r struct { Id int `json:"id"` Pid int `json:"pid"` Name string `json:"name"` Port int `json:"port"` Addtime string `json:"addtime"` } url := Yaml.GetString("bt.panel") + "/data?action=getData&table=domain" data := con.GetSign() data["search"] = Yaml.GetString("bt.site_id") data["list"] = "true" res := con.Http(url, data) var rj []r json.Unmarshal([]byte(res), &rj) var s []map[string]string for _, v := range rj { s = append(s, map[string]string{ "id": strconv.Itoa(v.Id), "name": v.Name, "port": strconv.Itoa(v.Port), }) } return s } // DelDomain 删除域名 func (con BtServer) DelDomain(domain, port string) (bool, string) { type r struct { Status bool `json:"status"` Msg string `json:"msg"` } url := Yaml.GetString("bt.panel") + "/site?action=DelDomain" data := con.GetSign() data["id"] = Yaml.GetString("bt.site_id") data["webname"] = Yaml.GetString("bt.site") data["domain"] = domain data["port"] = port res := con.Http(url, data) var rj r json.Unmarshal([]byte(res), &rj) return rj.Status, rj.Msg } // SetDomain 设置域名 func (con BtServer) SetDomain(domain string) (bool, string) { type r struct { Status bool `json:"status"` Msg string `json:"msg"` } url := Yaml.GetString("bt.panel") + "/site?action=AddDomain" data := con.GetSign() data["id"] = Yaml.GetString("bt.site_id") data["webname"] = Yaml.GetString("bt.site") data["domain"] = domain res := con.Http(url, data) var rj r json.Unmarshal([]byte(res), &rj) return rj.Status, rj.Msg } // UpdateDomain 更新网站域名 func (con BtServer) UpdateDomain(str string) (bool, string) { domainArr := strings.Split(str, "=") btDomain := con.GetDomain() for _, v := range domainArr { domainS := 0 for _, v1 := range btDomain { if v == v1["name"] { domainS = 1 break } } if domainS != 1 { con.SetDomain(v) } } return true, "success" }yaml文件bt: code: QGg5Ct3BlSKlvZmvVk537vuVToJ8j8ci panel: http://127.0.0.1:8888 site: baidu1.com site_id: 1 domain: http://127.0.0.1:8082 mysql: database: shop localhost: 127.0.0.1 password: root port: 3306 user: root
2022年06月10日
35 阅读
0 评论
0 点赞
2022-05-23
Centos7一键安装pptp脚本
废话不多说直接上脚本wget https://uss.aaayun.cc/typecho/uploads/2022/05/3296326676.txt -O CentOS7-pptp-host1plus.sh chmod +x ./CentOS7-pptp-host1plus.sh ./CentOS7-pptp-host1plus.sh -u your_username -p your_password 可在-u、-p后随意更改自己的登录用户名和密码。但密码长度必须大于8个 ASCII字符,否则为了安全,脚本将会随机生成密码。脚本命令及配置设置账号vim /etc/ppp/chap-secrets修改dns(ms_dns)vim /etc/ppp/options.pptpd 重启服务/bin/systemctl restart pptpd.service连不上VPN检查是否开放了 1723 端口,一般是因为这个原因吧打不开网页vim /etc/ppp/ip-up在 exit 0 前写入 : ifconfig $1 mtu 1500
2022年05月23日
87 阅读
0 评论
0 点赞
2022-05-21
人生
{dplayer src="https://uss.aaayun.cc/typecho/uploads/2022/05/1024311815.mp4"/}
2022年05月21日
44 阅读
0 评论
0 点赞
2022-03-05
最新idea激活2021版
找了很多版本都是2020.1激活的,比如像phpstorm2020版就没有php8提示,废话不多说下面开始此激活方式支持jb公司的 2021 后所有产品1.下载激活文件,并解压到一个路径下ja-netfilter.zip2.使用激活码进入idekey.txt3.进入配置文件4.修改并保存 重启ide-javaagent:第一步解压文件后的路径\ja-netfilter.jar5.成功
2022年03月05日
60 阅读
3 评论
0 点赞
2022-02-14
基于PHP实现微信小程序客服消息功能
开启客服消息开启消息推送 地址消息加密方式:可以根据自己需要选择,本例选择”兼容模式“。数据格式:json相对于xml来说,从压缩效率及传输效率更具优势,这里我们选json。示例代码<?php /** * @author anderyly * @email admin@aaayun.cc * @link http://blog.aaayun.cc * @copyright Copyright (c) 2022 */ use ay\lib\Curl; class WeChat { public static $token = 'xxx'; // Token(令牌) public static $key = 'xxx'; // EncodingAESKey(消息加密密钥) public static $appid = 'xxx'; public static $secret = 'xxx'; public function index() { // $this->checkSignature(self::$token); // 验证 $data = file_get_contents('php://input'); $this->send($data, self::$appid, self::$secret); } public function checkSignature($token) { $signature = $_GET["signature"]; $timestamp = $_GET["timestamp"]; $nonce = $_GET["nonce"]; $token = $token; $tmpArr = array($token, $timestamp, $nonce); sort($tmpArr, SORT_STRING); $tmpStr = implode( $tmpArr ); $tmpStr = sha1( $tmpStr ); if ($tmpStr == $signature ) { exit($_GET['echostr']); } } public function getAccessToken($appid, $secret) { $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $appid . "&secret=" . $secret; $row = Curl::url($url)->get(); $row = json_decode($row, true); return $row['access_token'] ?? false; } public function send($data, $appid, $secret) { $data = json_decode($data, true); $accessToken = $this->getAccessToken($appid, $secret); $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" . $accessToken; $r = [ "touser" => $data['FromUserName'] ]; $r['msgtype'] = "link"; $r['link'] = [ "title" => "轻风云", "description" => "云淡风轻,于事安然", "url" => "http://blog.aaayun.cc", "thumb_url" => "http://blog.aaayun.cc/avatar.png" ]; $json = json_encode($r, JSON_UNESCAPED_UNICODE); Curl::url($url)->param($json)->post('json'); } }
2022年02月14日
49 阅读
0 评论
0 点赞
1
...
3
4
5
...
30