init: 项目初始代码

This commit is contained in:
2026-10-14 14:00:29 +08:00
commit cc434cf89f
464 changed files with 66984 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
<?php
namespace app\api\controller\v1;
use app\api\model\GoodsCoupon as GoodsCouponModel;
use app\api\validate\GoodsCoupon as GoodsCouponValidate;
/**
* 优惠券口令类
* Class GoodsCoupon
* @package app\api\controller
*/
class GoodsCoupon extends Base
{
public function initialize()
{
parent::initialize(); // TODO: Change the autogenerated stub
$this->model = new GoodsCouponModel();
$this->validate = new GoodsCouponValidate();
}
/**
* 列表
* @return \think\response\Json
*/
public function index()
{
$inputData = $this->request->param();
// //语言包
// if (isset($inputData['language_id']) && $inputData['language_id'] != '' && $inputData['language_id'] != 0) {
// $this->focus['language_id'] = $inputData['language_id'];
// } else {
// return $this->msg(504,'语言包ID不正确,请检查!');
// }
$data = [
// 'language_id'=>$inputData['language_id'],
'platform_id'=>$this->platformId
];
$result = $this->model->getLatest($data);
$result = ['old_code'=>$result['new_code']];
return $this->msg(200,'获取列表成功',$result);
}
/**
* 新增
* @return \think\response\Json
*/
public function create()
{
$inputData = $this->request->param();
$inputData['platform_id'] = $this->platformId;
$inputData['new_code'] = htmlspecialchars_decode($inputData['new_code']);
if (!$this->commonValidate(__FUNCTION__,$inputData)) {
return $this->msg(-1,$this->validate->getError());
}
$inputData['new_code'] = htmlspecialchars($inputData['new_code']);
$result = $this->model->addData($inputData);
if ($result) {
return $this->msg(200,'新增成功');
} else {
return $this->msg(504,'新增失败');
}
}
}