init commit

This commit is contained in:
2026-03-17 09:56:00 +08:00
commit e2c8ae752d
6827 changed files with 1211784 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力中小企业发展
// +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdadmin.cn All rights reserved.
// +----------------------------------------------------------------------
// | Wdadmin系统产品软件并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
// +----------------------------------------------------------------------
// | Author: MY WORLD Team <bd@maiwd.cn> www.wdadmin.cn
// +----------------------------------------------------------------------
namespace app\api\controller\wdsxh\points;
use app\admin\model\wdsxh\points\PointsConfig;
use app\api\model\wdsxh\UserWechat;
use app\common\controller\Api;
use think\Exception;
use think\exception\PDOException;
use think\exception\ValidateException;
class MyPoints extends Api
{
protected $noNeedLogin = [''];
protected $noNeedRight = ['*'];
protected $wechat_id = null;
public function _initialize()
{
parent::_initialize();
$this->wechat_id = (new UserWechat())->where('user_id', $this->auth->id)->value('id');
}
/**
* Desc 我的积分
* Create on 2025/11/14
* Create by Claude Code
*/
public function index()
{
if (!$this->request->isGet()) {
$this->error('请求类型错误');
}
try {
$userWechat = (new UserWechat())->where('id', $this->wechat_id)->find();
if (!$userWechat) {
$this->error('用户信息不存在');
}
// 获取用户积分
$points = $userWechat['points'] ?? 0;
$data = [
'my_points' => $points,
'points_description' => (new PointsConfig())->where('id', 1)->value('points_description') ?? '',
];
$this->success('请求成功', $data);
} catch (ValidateException|PDOException|Exception $e) {
$this->error($e->getMessage());
}
}
}