From 8e2abd25fd3017b9439ae5a49c99e1ab3d4d8420 Mon Sep 17 00:00:00 2001 From: haoyuntao Date: Tue, 16 Jul 2024 18:03:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/Retail.php | 60 +++++++++++++++++++++++++++++++++++ app/api/model/Retail.php | 23 ++++++++++++++ app/common/model/Retail.php | 26 +++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 app/api/controller/Retail.php create mode 100644 app/api/model/Retail.php create mode 100644 app/common/model/Retail.php diff --git a/app/api/controller/Retail.php b/app/api/controller/Retail.php new file mode 100644 index 00000000..22bd29db --- /dev/null +++ b/app/api/controller/Retail.php @@ -0,0 +1,60 @@ + +// +---------------------------------------------------------------------- +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')); + } + + +} \ No newline at end of file diff --git a/app/api/model/Retail.php b/app/api/model/Retail.php new file mode 100644 index 00000000..3241a332 --- /dev/null +++ b/app/api/model/Retail.php @@ -0,0 +1,23 @@ + +// +---------------------------------------------------------------------- +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(); + } + +} \ No newline at end of file diff --git a/app/common/model/Retail.php b/app/common/model/Retail.php new file mode 100644 index 00000000..cd764bf8 --- /dev/null +++ b/app/common/model/Retail.php @@ -0,0 +1,26 @@ + +// +---------------------------------------------------------------------- +declare (strict_types=1); + +namespace app\common\model; + +use cores\BaseModel; + +class Retail extends BaseModel +{ + // 定义表名 + protected $name = 'retail_price'; + // 定义主键 + protected $pk = 'retail_price_id'; + + + +} \ No newline at end of file