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