jh-admin/addon/saas/shop/controller/Saas.php

113 lines
3.9 KiB
PHP

<?php
/**
* SAAS应用系统 --- 十年开发经验汇集巨献!
* ==========================================================
* Copy right 2020-2050 成都众联思索科技有限公司,保留所有权利。
* ----------------------------------------------------------
* 官方网址: https://www.zoomtk.com
* 这不是自由软件!未经允许不得用于商业目或程序代码摘取及修改。
* 任何企业和个人未经允许对程序代码以任何形式任何目的再发布传播。
* 唯一发布渠道www.zoomtk.com;非官方渠道统一视为侵权行为。
* ==========================================================
*/
namespace addon\saas\shop\controller;
use addon\saas\model\CloudOrder;
use addon\saas\model\OrderCreate;
use addon\cashier\model\order\CashierOrderCreate as CashierOrderCreateModel;
use app\model\system\Pay as PayModel;
use app\model\web\WebSite as WebsiteModel;
use think\facade\Cache;
class Saas extends SaasBase
{
public function index()
{
$condition = [
['agent_id', '=', $this->site_id]
];
$info = model('site')->getList($condition, 'expire_time,is_try');
$total = [
'expire_count' => 0, //到期
'effective_count' => 0, //有效时间
'experience_count' => 0,//体验
];
foreach ($info as $item) {
if ($item['is_try'] == 1) {
$total['experience_count'] += 1;
}
if ($item['expire_time'] < time()) {
$total['expire_count'] += 1;
} else {
$total['effective_count'] += 1;
}
}
$this->assign('total', count($info));
$this->assign('tInfo', $total);
$this->assign('agentInfo', $this->AgentInfo);
return $this->fetch('saas/index');
}
/***
* 云市场订单
* @return array|mixed
*/
public function cloudorder()
{
if (request()->isAjax()) {
$cloud = new CloudOrder();
$page = input('page', 1);
$page_size = input('page_size', PAGE_LIST_ROWS);
$search_text = input('search_text', '');
$condition[] = ['ag_site_id', '=', $this->site_id];
//下单时间
$start_time = input('start_time', '');
$end_time = input('end_time', '');
if ($start_time && $end_time) {
$condition[] = ['create_time', 'between', [date_to_time($start_time), date_to_time($end_time)]];
} elseif (!$start_time && $end_time) {
$condition[] = ['create_time', '<=', date_to_time($end_time)];
} elseif ($start_time && !$end_time) {
$condition[] = ['create_time', '>=', date_to_time($start_time)];
}
if ($search_text) {
$condition[] = ['third_order_id|goods_name|cloud_account', 'like', '%' . $search_text . '%'];
}
$res = $cloud->getPageList($condition, $page, $page_size);
return $res;
}
$this->forthMenu();
return $this->fetch('order/order');
}
public function config()
{
$this->forthMenu();
return $this->fetch('order/config');
}
/***
* 代理充值
* @return mixed
*/
public function recharge()
{
if (request()->isAjax()) {
$money = input('money');
$pay = new OrderCreate();
$return = $pay->rechargeOrderCreate($money, $this->uid, $this->site_id);
$qrcode = qrcode($return['data']['data']['qrcode'], 'upload/qrcode/pay/', $return['data']['out_trade_no'], 16);
$return = [
'qrcode' => 'data:image/png;base64,' . base64_encode(file_get_contents($qrcode)),
'out_trade_no' => $return['data']['out_trade_no'],
];
return $return;
}
return $this->fetch('saas/recharge');
}
public function shop()
{
}
}