小说网站源码带PHP全自动采集规则
小说网站源码是一个整合了小说自动采集、搜索、会员权限管理和自适H5手机版的在线小说阅读及下载管理系统。该源码采用PHP+Mysql+伪静态技术开发,集成了丰富的全自动采集插件和公众号对接功能,支持一键导入和下载小说资源。
PHP小说网站源码具有友好的用户UI界面,用户登录后功能丰富易于使用,支持智能收藏、转阅和下载小说,还可以生成离线TXT文档。站点采用极简代码编写,占用服务器资源线程少,源码运行速度快,基于Thinkphp的伪静态开发对搜索引擎很友好,便于SEO优化。丰富的版面设置满足各个渠道的用户需求:大气清新电脑版、手机自适版和H5小程序版。
小说网站源码主配置源码:
源码及演示:xsymz.icu
use think\Db;
use Aliyun\Core\Config;
use Aliyun\Core\Profile\DefaultProfile;
use Aliyun\Core\DefaultAcsClient;
use Aliyun\Api\Sms\Request\V20170525\SendSmsRequest;
function msubstr($str, $start = 0, $length, $charset = "utf-8", $suffix = true) {
if (function_exists("mb_substr"))
$slice = mb_substr($str, $start, $length, $charset);
elseif (function_exists('iconv_substr')) {
$slice = iconv_substr($str, $start, $length, $charset);
if (false === $slice) {
$slice = '';
}
} else {
$re['utf-8'] = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}/";
$re['gb2312'] = "/[\x01-\x7f]|[\xb0-\xf7][\xa0-\xfe]/";
$re['gbk'] = "/[\x01-\x7f]|[\x81-\xfe][\x40-\xfe]/";
$re['big5'] = "/[\x01-\x7f]|[\x81-\xfe]([\x40-\x7e]|\xa1-\xfe])/";
preg_match_all($re[$charset], $str, $match);
$slice = join("", array_slice($match[0], $start, $length));
}
return $suffix ? $slice . '...' : $slice;
}
function load_config(){
$list = Db::name('config')->select();
$config = [];
foreach ($list as $k => $v) {
$config[trim($v['name'])]=$v['value'];
}
return $config;
}
function load_config_child($memberid){
$list = Db::name('child_config')->where('memberid',$memberid)->select();
$config = [];
foreach ($list as $k => $v) {
$config[trim($v['name'])]=$v['value'];
}
return $config;
}
搜索结构代码:
namespace app\pay\controller;
use app\jingdian\model\OrderModel;
use app\jingdian\model\UserModel;
use think\Config;
use think\Loader;
use org\Lanpay;
use think\Db;
require ROOT_PATH.'/vendor/riverslei/payment/autoload.php';
use Payment\Common\PayException;
use Payment\Notify\PayNotifyInterface;
use Payment\Client\Notify;
use Payment\Configv;
class AlipayNotify implements PayNotifyInterface
{
public function notifyProcess(array $data)
{
$channel = $data['channel'];
if ($channel === Configv::ALI_CHARGE) {
} elseif ($channel === Configv::WX_CHARGE) {
} elseif ($channel === Configv::CMB_CHARGE) {
} elseif ($channel === Configv::CMB_BIND) {
} else {
}
return true;
}
}
class WxpayService
{
protected $mchid;
protected $appid;
protected $apiKey;
public function __construct($mchid, $appid, $key)
{
$this->mchid = $mchid;
$this->appid = $appid;
$this->apiKey = $key;
}
public function notify()
{
$config = array(
'mch_id' => $this->mchid,
'appid' => $this->appid,
'key' => $this->apiKey,
);
$postStr = file_get_contents('php://input');
//禁止引用外部xml实体
libxml_disable_entity_loader(true);
$postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
if ($postObj === false) {
die('parse xml error');
}
if ($postObj->return_code != 'SUCCESS') {
die($postObj->return_msg);
}
if ($postObj->result_code != 'SUCCESS') {
die($postObj->err_code);
}
$arr = (array)$postObj;
unset($arr['sign']);
if (self::getSign($arr, $config['key']) == $postObj->sign) {
echo '<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>';
return $arr;
}
}
public static function getSign($params, $key)
{
ksort($params, SORT_STRING);
$unSignParaString = self::formatQueryParaMap($params, false);
$signStr = strtoupper(md5($unSignParaString . "&key=" . $key));
return $signStr;
}
protected static function formatQueryParaMap($paraMap, $urlEncode = false)
{
$buff = "";
ksort($paraMap);
foreach ($paraMap as $k => $v) {
if (null != $v && "null" != $v) {
if ($urlEncode) {
$v = urlencode($v);
}
$buff .= $k . "=" . $v . "&";
}
}
$reqPar = '';
if (strlen($buff) > 0) {
$reqPar = substr($buff, 0, strlen($buff) - 1);
}
return $reqPar;
}
}
会员结构代码:
namespace app\pay\controller;
use app\jingdian\model\OrderModel;
use app\jingdian\model\GoodsListModel;
use think\Config;
use think\Loader;
use org\Lanpay;
use think\Db;
require ROOT_PATH.'/vendor/riverslei/payment/autoload.php';
use Payment\Common\PayException;
use Payment\Client\Charge;
use Payment\Configv;
class WxpayService
{
protected $mchid;
protected $appid;
protected $apiKey;
public function __construct($mchid, $appid, $key)
{
$this->mchid = $mchid;
$this->appid = $appid;
$this->apiKey = $key;
}
public function createJsBizPackage($totalFee, $outTradeNo, $orderName, $notifyUrl, $timestamp)
{
$config = array(
'mch_id' => $this->mchid,
'appid' => $this->appid,
'key' => $this->apiKey,
);
//$orderName = iconv('GBK','UTF-8',$orderName);
$unified = array(
'appid' => $config['appid'],
'attach' => 'pay',
'body' => $orderName,
'mch_id' => $config['mch_id'],
'nonce_str' => self::createNonceStr(),
'notify_url' => $notifyUrl,
'out_trade_no' => $outTradeNo,
'spbill_create_ip' => '127.0.0.1',
'total_fee' => intval($totalFee * 100),
'trade_type' => 'NATIVE',
);
$unified['sign'] = self::getSign($unified, $config['key']);
libxml_disable_entity_loader(true);
$unifiedOrder = simplexml_load_string($responseXml, 'SimpleXMLElement', LIBXML_NOCDATA);
if ($unifiedOrder === false) {
die('parse xml error');
}
if ($unifiedOrder->return_code != 'SUCCESS') {
die($unifiedOrder->return_msg);
}
if ($unifiedOrder->result_code != 'SUCCESS') {
die($unifiedOrder->err_code);
}
$codeUrl = (array)($unifiedOrder->code_url);
if(!$codeUrl[0]) exit('get code_url error');
$arr = array(
"appId" => $config['appid'],
"timeStamp" => $timestamp,
"nonceStr" => self::createNonceStr(),
"package" => "prepay_id=" . $unifiedOrder->prepay_id,
"signType" => 'MD5',
"code_url" => $codeUrl[0],
);
$arr['paySign'] = self::getSign($arr, $config['key']);
return $arr;
} 作者:想菍哭Thesky https://www.bilibili.com/read/cv12299390 出处:bilibili
- 点赞
- 收藏
- 关注作者
评论(0)