lszyh
haoyuntao 5 months ago
parent 7a252aec0a
commit 8e2abd25fd
  1. 60
      app/api/controller/Retail.php
  2. 23
      app/api/model/Retail.php
  3. 26
      app/common/model/Retail.php

@ -0,0 +1,60 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\api\controller;
use think\response\Json;
use app\api\model\Retail as RetailModel;
use app\api\model\Agreement as AgreementModel;
class Retail extends Controller
{
/**
* 获取零售批发会员列表
* @param int $retailType
* @return Json
*/
public function list(int $retailType): Json
{
$list = RetailModel::withoutGlobalScope()->where('retail_type',$retailType)->select();
return $this->renderSuccess(compact('list'));
}
/**
* 获取软件付费协议
* @return Json
*/
public function getSoftAgreement(): Json
{
$params = $this->request->param();
if (empty($params['type'])) {
return $this->renderSuccess("参数错误");
}
$detail = AgreementModel::detail(['type' => $params['type']]);
if (!empty($detail->content)) {
$detail->content = str_ireplace('nowrap', 'inherit', $detail->content);
}
return $this->renderSuccess(compact('detail'));
}
/**
* 购买会员
* @return Json
*/
public function purchase(): Json
{
return $this->renderSuccess(compact('detail'));
}
}

@ -0,0 +1,23 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\api\model;
use app\common\model\Retail as RetailModel;
class Retail extends RetailModel
{
public static function getRetailList()
{
return self::select();
}
}

@ -0,0 +1,26 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\common\model;
use cores\BaseModel;
class Retail extends BaseModel
{
// 定义表名
protected $name = 'retail_price';
// 定义主键
protected $pk = 'retail_price_id';
}
Loading…
Cancel
Save