first commit

This commit is contained in:
2020-08-06 15:26:41 +08:00
commit 8c0aa3edc1
1416 changed files with 238374 additions and 0 deletions

View File

@@ -0,0 +1,100 @@
<?php
// +------------------------------------------------+
// |http://www.cjango.com |
// +------------------------------------------------+
// | 修复BUG不是一朝一夕的事情等我喝醉了再说吧 |
// +------------------------------------------------+
// | Author: 小陈叔叔 <Jason.Chen> |
// +------------------------------------------------+
namespace app\openapi\controller;
use app\common\model\MemberInfo;
use app\common\model\VipOrder;
use app\common\service\Account as AccountService;
use app\common\service\Wechat as WechatService;
use cjango\Wechat;
class Pay
{
public function vip()
{
WechatService::instance();
$res = Wechat\Pay::parsePayRequest();
if ($res) {
$order = VipOrder::where('orderid', $res['out_trade_no'])->find();
if ($order->status != 0) {
Wechat\Pay::returnNotify();
return;
}
$order->save(['status' => 20, 'model' => 'weixin']);
$MemberInfo = MemberInfo::get($order->uid);
if ($MemberInfo->is_vip == 1) {
if ($MemberInfo->vip_end_time > time()) {
$time = strtotime("+1 year", $MemberInfo->vip_end_time);
} else {
$time = strtotime("+1 year");
}
} else {
$time = strtotime("+1 year");
}
//赠送一年代理商
if ($MemberInfo->is_agent == 1) {
if ($MemberInfo->agent_end_time > time()) {
$agenttime = strtotime("+1 year", $MemberInfo->agent_end_time);
} else {
$agenttime = strtotime("+1 year");
}
} else {
$agenttime = strtotime("+1 year");
}
MemberInfo::update(['is_vip' => 1, 'is_fee' => 1, 'vip_time' => $time, 'is_agent' => 1, 'agent_time' => $agenttime], ['uid' => $order->uid]);
AccountService::commission($order->orderid);
Wechat\Pay::returnNotify();
} else {
Wechat\Pay::returnNotify('处理失败');
}
}
public function agent()
{
WechatService::instance();
$res = Wechat\Pay::parsePayRequest();
if ($res) {
$order = VipOrder::where('orderid', $res['out_trade_no'])->find();
if ($order->status != 0) {
Wechat\Pay::returnNotify();
return;
}
$order->save(['status' => 20, 'model' => 'weixin']);
$MemberInfo = MemberInfo::get($order->uid);
if ($MemberInfo->is_agent == 1) {
if ($MemberInfo->agent_end_time > time()) {
$agenttime = strtotime("+1 year", $MemberInfo->agent_end_time);
} else {
$agenttime = strtotime("+1 year");
}
} else {
$agenttime = strtotime("+1 year");
}
//赠送一年推广先锋
if ($MemberInfo->is_vip == 1) {
if ($MemberInfo->vip_end_time > time()) {
$time = strtotime("+1 year", $MemberInfo->vip_end_time);
} else {
$time = strtotime("+1 year");
}
} else {
$time = strtotime("+1 year");
}
MemberInfo::update(['is_agent' => 1, 'agent_time' => $agenttime, 'is_vip' => 1, 'is_fee' => 1, 'vip_time' => $time], ['uid' => $order->uid]);
AccountService::commission($order->orderid);
Wechat\Pay::returnNotify();
} else {
Wechat\Pay::returnNotify('处理失败');
}
}
}

View File

@@ -0,0 +1,28 @@
<?php
// +------------------------------------------------+
// |http://www.cjango.com |
// +------------------------------------------------+
// | 修复BUG不是一朝一夕的事情等我喝醉了再说吧 |
// +------------------------------------------------+
// | Author: 小陈叔叔 <Jason.Chen> |
// +------------------------------------------------+
namespace app\openapi\controller;
class Wechat
{
private $request;
public function __construct()
{
// $config = Config::get('wechat');
// Wx::instance($config);
// Wx::valid();
// $this->request = Wx\Reply::request();
}
public function index()
{
// Wx\Reply::response($this->request['content']);
}
}