init: 从宝塔同步到 Gitea

This commit is contained in:
root
2026-02-25 01:50:31 +08:00
commit e633c8e27d
2444 changed files with 399341 additions and 0 deletions
@@ -0,0 +1,61 @@
<?php
namespace app\agent\controller;
use \think\Controller;
use \think\Session;
use \think\Request;
use \think\Db;
class Marketing Extends Common{
public function index(){
// 登录用户信息
$user_info = Session::get('user_info');
$account_type = $user_info['account_type'];
$user_info = Db::name('user')->where('id',$user_info['id'])->find();
$referral_code = $user_info['referral_code'];
$user_info['account_type'] = $account_type;
if(!$user_info['referral_code']){//没有推荐码则补充
$referral_code = getRandCode();
Db::name('user')->where(['id'=>$user_info['id']])->update(['referral_code'=>$referral_code]);
}
$user_info['referral_code'] = $referral_code;
$serverName = ONLINE_CHIP;
$marketingUrl = $serverName.'#/pages/register?invitedCode='.$referral_code;
// if(!$user_info['marketing_url']){
// // 推广链接
// $serverName = ONLINE_CHIP;
// $marketingUrl = $serverName.'login/register?agent='.$referral_code;
// $ask = array();
// $ask['appid'] = 139663876;
// $ask['appkey'] = 'f6d0f6090f7652bf509e96c51189298f';
// $ask['type'] = 'add';
// $ask['url'] = $marketingUrl;
// $ask['visit_type'] = 'frame';
// $url = 'https://wechaturl.us/api/SingleShortUrl.json';
// $postdata = @http_build_query($ask);
// $options = array(
// 'http' => array(
// 'method' => 'POST',
// 'header' => 'Content-type:application/x-www-form-urlencoded',
// 'content' => $postdata,
// 'timeout' => 15 * 60 // 超时时间(单位:s
// )
// );
// $context = stream_context_create($options);
// $result = file_get_contents($url, false, $context);
// $result = json_decode($result);
// $result = ((array)$result);
// if(isset($result['code']) && $result['code'] == 1){
// $resultdata = ((array)$result['data']);
// $marketingUrl = $resultdata['weibo_shorturl'];
// DB::name('user')->where('id',$user_info['id'])->update(['marketing_url' => $marketingUrl]);
// }else{
// return '生成推广码失败,请稍后再试';
// }
// }else{
// $marketingUrl = $user_info['marketing_url'];
// }
// 渲染
$this->assign('user_info',$user_info);
$this->assign('marketingUrl',$marketingUrl);
return $this->fetch();
}
}