From 6ed285e231a87805ff10de4f39c73d91888113c6 Mon Sep 17 00:00:00 2001 From: "home.fengxinyhyl" Date: Sun, 14 Apr 2024 12:04:21 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E5=AD=98=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/dao/store/DepositDao.php | 25 ++ app/common/dao/store/LotteryDao.php | 25 ++ app/common/model/store/Deposit.php | 30 ++ app/common/model/store/Lottery.php | 30 ++ .../repositories/store/DepositRepository.php | 109 ++++++ .../repositories/store/LotteryRepository.php | 74 ++++ app/controller/admin/system/Deposit.php | 152 +++++++++ app/controller/admin/system/Lottery.php | 106 ++++++ app/validate/admin/DepositValidate.php | 30 ++ route/admin/system.php | 28 ++ view/admin/src/api/user.js | 42 ++- view/admin/src/router/modules/user.js | 22 +- view/admin/src/views/user/assets/index.vue | 323 ++++++++++++++++++ view/admin/src/views/user/deposit/index.vue | 166 +++++++++ view/admin/src/views/user/stock/index.vue | 112 ++++++ 15 files changed, 1269 insertions(+), 5 deletions(-) create mode 100644 app/common/dao/store/DepositDao.php create mode 100644 app/common/dao/store/LotteryDao.php create mode 100644 app/common/model/store/Deposit.php create mode 100644 app/common/model/store/Lottery.php create mode 100644 app/common/repositories/store/DepositRepository.php create mode 100644 app/common/repositories/store/LotteryRepository.php create mode 100644 app/controller/admin/system/Deposit.php create mode 100644 app/controller/admin/system/Lottery.php create mode 100644 app/validate/admin/DepositValidate.php create mode 100644 view/admin/src/views/user/assets/index.vue create mode 100644 view/admin/src/views/user/deposit/index.vue create mode 100644 view/admin/src/views/user/stock/index.vue diff --git a/app/common/dao/store/DepositDao.php b/app/common/dao/store/DepositDao.php new file mode 100644 index 0000000..f9c08fa --- /dev/null +++ b/app/common/dao/store/DepositDao.php @@ -0,0 +1,25 @@ + +// +---------------------------------------------------------------------- +namespace app\common\dao\store; + +use app\common\dao\BaseDao; +use app\common\model\store\Deposit; + +class DepositDao extends BaseDao +{ + + + protected function getModel(): string + { + return Deposit::class; + } + +} diff --git a/app/common/dao/store/LotteryDao.php b/app/common/dao/store/LotteryDao.php new file mode 100644 index 0000000..762ff1b --- /dev/null +++ b/app/common/dao/store/LotteryDao.php @@ -0,0 +1,25 @@ + +// +---------------------------------------------------------------------- +namespace app\common\dao\store; + +use app\common\dao\BaseDao; +use app\common\model\store\Lottery; + +class LotteryDao extends BaseDao +{ + + + protected function getModel(): string + { + return Lottery::class; + } + +} diff --git a/app/common/model/store/Deposit.php b/app/common/model/store/Deposit.php new file mode 100644 index 0000000..d768d09 --- /dev/null +++ b/app/common/model/store/Deposit.php @@ -0,0 +1,30 @@ + +// +---------------------------------------------------------------------- +namespace app\common\model\store; + +use app\common\model\BaseModel; + + +class Deposit extends BaseModel +{ + + public static function tablePk(): string + { + return 'id'; + } + + public static function tableName(): string + { + return 'deposit'; + } + + +} diff --git a/app/common/model/store/Lottery.php b/app/common/model/store/Lottery.php new file mode 100644 index 0000000..1a576d6 --- /dev/null +++ b/app/common/model/store/Lottery.php @@ -0,0 +1,30 @@ + +// +---------------------------------------------------------------------- +namespace app\common\model\store; + +use app\common\model\BaseModel; + + +class Lottery extends BaseModel +{ + + public static function tablePk(): string + { + return 'id'; + } + + public static function tableName(): string + { + return 'lottery'; + } + + +} diff --git a/app/common/repositories/store/DepositRepository.php b/app/common/repositories/store/DepositRepository.php new file mode 100644 index 0000000..736bbf4 --- /dev/null +++ b/app/common/repositories/store/DepositRepository.php @@ -0,0 +1,109 @@ + +// +---------------------------------------------------------------------- +namespace app\common\repositories\store; + +use app\common\dao\store\DepositDao; +use app\common\dao\store\GuaranteeDao; +use app\common\repositories\BaseRepository; +use app\common\repositories\store\product\ProductRepository; +use FormBuilder\Factory\Elm; +use think\facade\Route; + +class DepositRepository extends BaseRepository +{ + /** + * @var GuaranteeDao + */ + protected $dao; + + + /** + * GuaranteeRepository constructor. + * @param DepositDao $dao + */ + public function __construct(DepositDao $dao) + { + $this->dao = $dao; + } + + /** + * TODO 平台列表 + * @param $where + * @param $page + * @param $limit + * @return array + * @author Qinii + * @day 5/17/21 + */ + public function getList($where,$page, $limit) + { + $query = $this->dao->getSearch($where)->order('id DESC'); + $count = $query->count(); + $list = $query->page($page,$limit)->select(); + return compact('count','list'); + } + + public function select(array $where) + { + $list = $this->dao->getSearch($where)->field('guarantee_id,guarantee_name,guarantee_info,image')->order('sort DESC')->select(); + return $list; + } + /** + * TODO 添加form + * @param int|null $id + * @param array $formData + * @return \FormBuilder\Form + * @author Qinii + * @day 5/17/21 + */ + public function form($id = null,array $formData = []) + { + $isCreate = is_null($id); + $action = Route::buildUrl($isCreate ? 'systemDepositCreate' : 'systemDepositUpdate', $isCreate ? [] : compact('id'))->build(); + return Elm::createForm($action, [ + Elm::number('money', '预存金额:')->placeholder('请输入等级名称')->min(0)->required(), + Elm::number('cycle', '周期:')->placeholder('请输入周期')->min(0)->required(), + Elm::number('diamond', '赠送钻石/天:')->placeholder('请输入赠送钻石数')->min(0)->required(), + Elm::number('diamond_max', '赠送最大钻石:')->placeholder('请输入赠送最大钻石数')->min(0)->required(), + Elm::number('count', '名额:')->placeholder('请输入名额')->min(0)->required(), + ])->setTitle($isCreate ? '添加预存' : '编辑预存')->formData($formData); + } + + /** + * TODO 编辑form + * @param $id + * @return \FormBuilder\Form + * @author Qinii + * @day 5/17/21 + */ + public function updateForm($id) + { + $ret = $this->dao->get($id); + return $this->form($id,$ret->toArray()); + } + + /** + * TODO 获取详情 + * @param $id + * @return array|\think\Model|null + * @author Qinii + * @day 5/17/21 + */ + public function get($id) + { + $where = [ + $this->dao->getPk() => $id, + 'is_del' => 0, + ]; + $ret = $this->dao->getWhere($where); + return $ret; + } +} diff --git a/app/common/repositories/store/LotteryRepository.php b/app/common/repositories/store/LotteryRepository.php new file mode 100644 index 0000000..2ba8254 --- /dev/null +++ b/app/common/repositories/store/LotteryRepository.php @@ -0,0 +1,74 @@ + +// +---------------------------------------------------------------------- +namespace app\common\repositories\store; + +use app\common\dao\store\GuaranteeDao; +use app\common\dao\store\LotteryDao; +use app\common\repositories\BaseRepository; + +class LotteryRepository extends BaseRepository +{ + /** + * @var GuaranteeDao + */ + protected $dao; + + + /** + * GuaranteeRepository constructor. + * @param LotteryDao $dao + */ + public function __construct(LotteryDao $dao) + { + $this->dao = $dao; + } + + /** + * TODO 平台列表 + * @param $where + * @param $page + * @param $limit + * @return array + * @author Qinii + * @day 5/17/21 + */ + public function getList($where,$page, $limit) + { + $query = $this->dao->getSearch($where)->order('sort DESC'); + $count = $query->count(); + $list = $query->page($page,$limit)->select(); + return compact('count','list'); + } + + public function select(array $where) + { + $list = $this->dao->getSearch($where)->field('guarantee_id,guarantee_name,guarantee_info,image')->order('sort DESC')->select(); + return $list; + } + + + /** + * TODO 获取详情 + * @param $id + * @return array|\think\Model|null + * @author Qinii + * @day 5/17/21 + */ + public function get($id) + { + $where = [ + $this->dao->getPk() => $id, + 'is_del' => 0, + ]; + $ret = $this->dao->getWhere($where); + return $ret; + } +} diff --git a/app/controller/admin/system/Deposit.php b/app/controller/admin/system/Deposit.php new file mode 100644 index 0000000..7891685 --- /dev/null +++ b/app/controller/admin/system/Deposit.php @@ -0,0 +1,152 @@ + +// +---------------------------------------------------------------------- + + +namespace app\controller\admin\system; + + +use app\common\repositories\store\DepositRepository; +use app\validate\admin\DepositValidate; +use crmeb\basic\BaseController; +use FormBuilder\Exception\FormBuilderException; +use think\App; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; + +/** + * Class UserGroup + * @package app\controller\admin\user + * @author xaboy + * @day 2020-05-07 + */ +class Deposit extends BaseController +{ + /** + * @var DepositRepository + */ + protected $repository; + + /** + * UserGroup constructor. + * @param App $app + * @param DepositRepository $repository + */ + public function __construct(App $app, DepositRepository $repository) + { + parent::__construct($app); + $this->repository = $repository; + } + + /** + * @return mixed + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException + * @author xaboy + * @day 2020-05-07 + */ + public function lst() + { + [$page, $limit] = $this->getPage(); + return app('json')->success($this->repository->getList(['status' => 1], $page, $limit)); + } + + /** + * @return mixed + * @throws FormBuilderException + * @author xaboy + * @day 2020-05-07 + */ + public function createForm() + { + return app('json')->success(formToData($this->repository->form())); + } + + /** + * @param DepositValidate $validate + * @return mixed + * @author xaboy + * @day 2020-05-07 + */ + public function create(DepositValidate $validate) + { + $data = $this->checkParams($validate); + $this->repository->create($data); + + return app('json')->success('添加成功'); + } + + /** + * @param $id + * @return mixed + * @throws DbException + * @throws FormBuilderException + * @throws DataNotFoundException + * @throws ModelNotFoundException + * @author xaboy + * @day 2020-05-07 + */ + public function updateForm($id) + { + if (!$this->repository->exists($id)) + return app('json')->fail('数据不存在'); + return app('json')->success(formToData($this->repository->updateForm($id))); + } + + /** + * @param $id + * @param DepositValidate $validate + * @return mixed + * @throws DbException + * @author xaboy + * @day 2020-05-07 + */ + public function update($id, DepositValidate $validate) + { + $data = $this->checkParams($validate); + if (!$this->repository->exists($id)) + return app('json')->fail('数据不存在'); + $this->repository->update($id, $data); + + return app('json')->success('编辑成功'); + } + + /** + * @param $id + * @return mixed + * @throws DbException + * @author xaboy + * @day 2020-05-07 + */ + public function delete($id) + { + if (!$this->repository->exists($id)) + return app('json')->fail('数据不存在'); + $this->repository->update($id, array('status' => 0)); + + return app('json')->success('删除成功'); + } + + /** + * @param DepositValidate $validate + * @return array + * @author xaboy + * @day 2020-05-07 + */ + protected function checkParams(DepositValidate $validate) + { + $data = $this->request->params(['count','cycle', 'diamond', 'diamond_max', 'money']); + $validate->check($data); + return $data; + } +} diff --git a/app/controller/admin/system/Lottery.php b/app/controller/admin/system/Lottery.php new file mode 100644 index 0000000..8f536bc --- /dev/null +++ b/app/controller/admin/system/Lottery.php @@ -0,0 +1,106 @@ + +// +---------------------------------------------------------------------- +namespace app\controller\admin\system; + +use app\common\repositories\system\CacheRepository; +use app\common\repositories\system\config\ConfigValueRepository; +use crmeb\basic\BaseController; +use crmeb\services\RedisCacheService; +use think\App; +use think\facade\Cache as BaseCache; + +class Lottery extends BaseController +{ + /** + * @var CacheRepository + */ + protected $repository; + + /** + * CacheRepository constructor. + * @param App $app + */ + public function __construct(App $app, CacheRepository $repository) + { + parent::__construct($app); + $this->repository = $repository; + } + + + public function getKeyLst() + { + $type = $this->request->param('type', 0); + $data = $this->repository->getAgreeList($type); + return app('json')->success($data); + } + + + /** + * @Author:Qinii + * @Date: 2020/9/15 + * @return mixed + */ + public function getAgree($key) + { + $allow = $this->repository->getAgreeKey(); + if (!in_array($key, $allow)) return app('json')->fail('数据不存在'); + $data = $this->repository->getResult($key); + return app('json')->success($data); + } + + + /** + * @Author:Qinii + * @Date: 2020/9/15 + * @return mixed + */ + public function saveAgree($key) + { + $allow = $this->repository->getAgreeKey(); + if (!in_array($key, $allow)) return app('json')->fail('KEY不存在'); + + $value = $this->request->param('agree'); + $this->repository->save($key, $value); + + if ($key == CacheRepository::USER_PRIVACY) + $this->repository->setUserAgreement($value); + if ($key == CacheRepository::USER_AGREE) + $this->repository->setUserRegister($value); + + return app('json')->success('保存成功'); + } + + /** + * TODO 清除缓存 + * @return \think\response\Json + * @author Qinii + * @day 12/9/21 + */ + public function clearCache() + { + $type = $this->request->param('type', 1); + switch ($type) { + case 2: + BaseCache::tag('get_product')->clear(); + break; + case 3: + BaseCache::delete('get_api_config'); + break; + default: + BaseCache::clear(); + break; + } + $configValueRepository = app()->make(ConfigValueRepository::class); + $configValueRepository->syncConfig(); + $configValueRepository->special(); + return app('json')->success('清除缓存成功'); + } +} diff --git a/app/validate/admin/DepositValidate.php b/app/validate/admin/DepositValidate.php new file mode 100644 index 0000000..9ae1155 --- /dev/null +++ b/app/validate/admin/DepositValidate.php @@ -0,0 +1,30 @@ + +// +---------------------------------------------------------------------- + + +namespace app\validate\admin; + + +use think\Validate; + +class DepositValidate extends Validate +{ + protected $failException = true; + + protected $rule = [ + 'money|金额' => 'require', + 'cycle|周期' => 'require', + 'diamond|分组名称' => 'require', + 'diamond_max|分组名称' => 'require', + 'count|名额' => 'require', + ]; +} diff --git a/route/admin/system.php b/route/admin/system.php index 25697eb..ce23325 100755 --- a/route/admin/system.php +++ b/route/admin/system.php @@ -33,6 +33,34 @@ Route::group(function () { '_auth' => false, ]); + Route::group('deposit', function () { + Route::get('lst', '/lst')->name('systemDepositLst')->option([ + '_alias' => '预存管理', + ]); + Route::post('create/deposit', '/create')->name('systemDepositCreate')->option([ + '_alias' => '预存添加', + ]); + Route::get('form', '/createForm')->name('systemDepositCreateForm')->option([ + '_alias' => '预存添加表单', + '_auth' => false, + '_form' => 'systemDepositCreate', + ]); + Route::delete(':id', '/delete')->name('systemDepositDelete')->option([ + '_alias' => '预存删除', + ]); + Route::post(':id', '/update')->name('systemDepositUpdate')->option([ + '_alias' => '预存编辑', + ]); + Route::get('form/:id', '/updateForm')->name('systemDepositUpdateForm')->option([ + '_alias' => '预存编辑表单', + '_auth' => false, + '_form' => 'systemDepositUpdate', + ]); + })->prefix('admin.system.Deposit')->option([ + '_path' => '/dashboard', + '_auth' => true, + ]); + Route::group('statistics', function () { diff --git a/view/admin/src/api/user.js b/view/admin/src/api/user.js index 9f57cab..f75cde2 100644 --- a/view/admin/src/api/user.js +++ b/view/admin/src/api/user.js @@ -87,6 +87,32 @@ export function groupLstApi(data) { export function groupDeleteApi(id) { return request.delete(`user/group/${id}`) } + +/** + * @description 预存管理 -- 编辑表单 + * @param {Object} param params {Object} 传值参数 + */ +export function depositEditApi(id) { + return request.get('deposit/form/' + id) +} +/** + * @description 预存管理 -- 添加表单 + */ +export function depositFormApi() { + return request.get('deposit/form') +} +/** + * @description 预存管理 -- 列表 + */ +export function depositLstApi(data) { + return request.get('deposit/lst', data) +} +/** + * @description 预存管理 -- 删除 + */ +export function depositDeleteApi(id) { + return request.delete(`deposit/${id}`) +} /** * @description 用户标签 -- 编辑表单 * @param {Object} param params {Object} 传值参数 @@ -337,7 +363,7 @@ export function recordListImportApi(data) { } /** * 获取版权信息 - * @returns + * @returns */ export function getVersion() { return request.get('../api/version') @@ -474,4 +500,16 @@ export function memberRecordCard(data) { */ export function memberGrowthLog(data) { return request.get(`user/member_log`, data) -} \ No newline at end of file +} + +/** + * @description 资产明细 -- 列表数据 + */ +export function assetsLogList(data) { + return request.get(`user/assets_list`,data) +} + +// 惠通宝转让记录 +export function getHuitongbao(data) { + return request.get('user/huitong_list', data) +} diff --git a/view/admin/src/router/modules/user.js b/view/admin/src/router/modules/user.js index 278e3f4..43f40e6 100644 --- a/view/admin/src/router/modules/user.js +++ b/view/admin/src/router/modules/user.js @@ -25,6 +25,24 @@ const userRouter = name: 'UserGroup', meta: { title: '用户分组', noCache: true } }, + { + path: 'assets', + component: () => import('@/views/user/assets'), + name: 'assets', + meta: { title: '转让记录', noCache: true } + }, + { + path: 'stock', + component: () => import('@/views/user/stock'), + name: 'stock', + meta: { title: '本票统计', noCache: true } + }, + { + path: 'deposit', + component: () => import('@/views/user/deposit'), + name: 'deposit', + meta: { title: '预存管理', noCache: true } + }, { path: 'label', component: () => import('@/views/user/group'), @@ -105,7 +123,6 @@ const userRouter = component: () => import('@/views/user/member/equity') }, { - path: 'description', name: 'memberDescription', meta: { title: '用户等级说明', @@ -115,7 +132,6 @@ const userRouter = component: () => import('@/views/user/member/description') }, { - path: 'vipAgreement', name: 'vipAgreement', meta: { title: '会员协议', @@ -142,7 +158,7 @@ const userRouter = }, component: () => import('@/views/user/member/record') }, - + ] }, ] diff --git a/view/admin/src/views/user/assets/index.vue b/view/admin/src/views/user/assets/index.vue new file mode 100644 index 0000000..28c6669 --- /dev/null +++ b/view/admin/src/views/user/assets/index.vue @@ -0,0 +1,323 @@ + + + + + diff --git a/view/admin/src/views/user/deposit/index.vue b/view/admin/src/views/user/deposit/index.vue new file mode 100644 index 0000000..e3da8d1 --- /dev/null +++ b/view/admin/src/views/user/deposit/index.vue @@ -0,0 +1,166 @@ + + + + + diff --git a/view/admin/src/views/user/stock/index.vue b/view/admin/src/views/user/stock/index.vue new file mode 100644 index 0000000..7511650 --- /dev/null +++ b/view/admin/src/views/user/stock/index.vue @@ -0,0 +1,112 @@ + + + + +