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,98 @@
<?php
namespace app\admin\controller\wdsxh\points;
use app\admin\model\wdsxh\points\PointsConfig;
use app\common\controller\Backend;
use think\Db;
use Exception;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 积分配置
*
* @icon fa fa-circle-o
*/
class Config extends Backend
{
/**
* Config模型对象
* @var \app\admin\model\wdsxh\points\PointsConfig
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new PointsConfig();
}
/**
* 积分配置
*/
public function index(){
$row = $this->model->get(1);
if (!$row) {
$this->error(__('No Results were found'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
if (false === $this->request->isPost()) {
$this->view->assign('row', $row);
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException()->validate($validate);
}
$result = $row->allowField(true)->save($params);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if (false === $result) {
$this->error(__('No rows were updated'));
}
$this->success();
}
public function del($ids = null)
{
return;
}
public function edit($ids = null)
{
return;
}
public function add()
{
return;
}
public function multi($ids = null)
{
return;
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace app\admin\controller\wdsxh\points;
use app\common\controller\Backend;
/**
* 积分商城快递公司
*
* @icon fa fa-circle-o
*/
class Express extends Backend
{
/**
* Express模型对象
* @var \app\admin\model\wdsxh\points\Express
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\wdsxh\points\Express;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function multi($ids = null)
{
return;
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace app\admin\controller\wdsxh\points;
use app\common\controller\Backend;
/**
* 积分商品管理
*
* @icon fa fa-circle-o
*/
class Goods extends Backend
{
/**
* Goods模型对象
* @var \app\admin\model\wdsxh\points\Goods
*/
protected $model = null;
protected $modelValidate = true;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\wdsxh\points\Goods;
$this->view->assign("statusList", $this->model->getStatusList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@@ -0,0 +1,142 @@
<?php
namespace app\admin\controller\wdsxh\points;
use app\admin\model\wdsxh\points\Express;
use app\admin\model\wdsxh\points\Logistics;
use app\common\controller\Backend;
use think\Db;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 兑换订单
*
* @icon fa fa-circle-o
*/
class Order extends Backend
{
/**
* Order模型对象
* @var \app\admin\model\wdsxh\points\Order
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\wdsxh\points\Order;
$this->view->assign("stateList", $this->model->getStateList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function delivery($ids = null){
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
if (false === $this->request->isPost()) {
$this->view->assign('row', $row);
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
$result = false;
$send_time = time();
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException()->validate($validate);
}
$params = [
'order_id' => $row['id'],
'delivery_id' => $params['delivery_id'],
'delivery_no' => $params['delivery_no'],
'send_time' => $send_time
];
(new Logistics())->insert($params);
$order_data['state'] = 3;
$result = $row->allowField(true)->save($order_data);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if (false === $result) {
$this->error(__('No rows were updated'));
}
$this->success();
}
public function details($ids = null){
$orderObj = $this->model->get($ids);
$userObj = (new \app\admin\model\wdsxh\user\Wechat())->where('id',$orderObj['wechat_id'])->find();
$logisticsObj = (new \app\admin\model\wdsxh\points\Logistics())->where('order_id',$orderObj['id'])->find();
$this->view->assign("userObj", $userObj);
$this->view->assign("orderObj", $orderObj);
$this->view->assign("logisticsObj", $logisticsObj);
$expressObj = (new Express())->select();
$this->view->assign('expressObj',$expressObj);
return $this->view->fetch();
}
public function multi($ids = null)
{
return;
}
public function del($ids = null)
{
return;
}
public function edit($ids = null)
{
return;
}
public function add()
{
return;
}
public function recyclebin($ids = null)
{
return;
}
public function restore($ids = null)
{
return;
}
public function destroy($ids = null)
{
return;
}
}

View File

@@ -0,0 +1,133 @@
<?php
namespace app\admin\controller\wdsxh\points;
use app\admin\model\wdsxh\member\Member;
use app\admin\model\wdsxh\user\UserWechat;
use app\common\controller\Backend;
use app\common\model\wdsxh\points\UserWechatPointsLog;
use think\exception\DbException;
use think\exception\PDOException;
use think\exception\ValidateException;
use think\response\Json;
/**
* 微信用户积分变动管理
*
* @icon fa fa-circle-o
*/
class Ranking extends Backend
{
/**
* Ranking模型对象
* @var \app\admin\model\wdsxh\points\Ranking
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\wdsxh\points\Ranking;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*
* @return string|Json
* @throws \think\Exception
* @throws DbException
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
$wechatIdArray = (new UserWechatPointsLog())->distinct(true)->column('wechat_id');
$wechatIdArray = (new UserWechat())->where('id','in',$wechatIdArray)->where('points','>',0)->column('id');
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = (new Member())
->with(['level','wechat'])
->where('wechat_id','in',$wechatIdArray)
->order('points desc')
->paginate($limit);
foreach ($list as &$v) {
$v->id = $v->wechat_id;
}
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
/**
* Desc 一键清零
* Create on 2025/3/12 11:13
* Create by wangyafang
*/
public function one_click_reset($ids=null){
if(!$this->request->isPost()) {
$this->error('请求类型错误');
}
try {
$userWechatObj = (new UserWechat())->get($ids);
$pointsLogData = array(
'wechat_id'=>$ids,
'points'=>$userWechatObj['points'],
'before'=>$userWechatObj['points'],
'after'=>0,
'memo'=>'积分清零',
'change'=>2,
);
$pointsLogModel = new UserWechatPointsLog();
$pointsLogModel->data($pointsLogData);
$pointsLogModel->allowField(true)->save();
$userWechatObj->points = 0;
$userWechatObj->save();
$this->success('操作成功');
} catch (ValidateException|PDOException|Exception $e) {
$this->error($e->getMessage());
}
}
public function multi($ids = NULL)
{
return;
}
public function del($ids = null)
{
return;
}
public function edit($ids = null)
{
return;
}
public function add()
{
return;
}
}

View File

@@ -0,0 +1,86 @@
<?php
namespace app\admin\controller\wdsxh\points;
use app\common\controller\Backend;
use think\exception\DbException;
use think\response\Json;
/**
* 微信用户积分变动管理
*
* @icon fa fa-circle-o
*/
class UserWechatPointsLog extends Backend
{
/**
* UserWechatPointsLog模型对象
* @var \app\admin\model\wdsxh\points\UserWechatPointsLog
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\wdsxh\points\UserWechatPointsLog;
$this->view->assign("changeList", $this->model->getChangeList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*
* @return string|Json
* @throws \think\Exception
* @throws DbException
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$wechat_id = $this->request->param('wechat_id');
$list = $this->model
->where('wechat_id',$wechat_id)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
public function del($ids = null)
{
return;
}
public function edit($ids = null)
{
return;
}
public function add()
{
return;
}
public function multi($ids = NULL)
{
return;
}
}