|
@@ -3,16 +3,16 @@
|
|
|
namespace app\admin\controller\user;
|
|
namespace app\admin\controller\user;
|
|
|
|
|
|
|
|
use app\common\controller\Backend;
|
|
use app\common\controller\Backend;
|
|
|
-use app\common\model\UserModel;
|
|
|
|
|
|
|
+use app\common\model\ProductLists;
|
|
|
use think\exception\DbException;
|
|
use think\exception\DbException;
|
|
|
use think\response\Json;
|
|
use think\response\Json;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 团队奖励发放统计
|
|
|
|
|
|
|
+ * 用户存储列表 TeamRewards
|
|
|
*
|
|
*
|
|
|
* @icon fa fa-circle-o
|
|
* @icon fa fa-circle-o
|
|
|
*/
|
|
*/
|
|
|
-class TeamRewards extends Backend
|
|
|
|
|
|
|
+class Userpledge extends Backend
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -24,20 +24,12 @@ class TeamRewards extends Backend
|
|
|
public function _initialize()
|
|
public function _initialize()
|
|
|
{
|
|
{
|
|
|
parent::_initialize();
|
|
parent::_initialize();
|
|
|
- $this->model = new \app\admin\model\TeamRewards;
|
|
|
|
|
|
|
+ $this->model = new \app\common\model\UserPledge;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
|
|
|
|
- * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
|
|
|
|
- * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
|
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 查看
|
|
* 查看
|
|
|
*
|
|
*
|
|
@@ -57,17 +49,35 @@ class TeamRewards extends Backend
|
|
|
return $this->selectpage();
|
|
return $this->selectpage();
|
|
|
}
|
|
}
|
|
|
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
|
|
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
|
|
|
- $list = $this->model->alias('r')
|
|
|
|
|
- ->join('user u','r.user_id=u.id','LEFT')
|
|
|
|
|
- ->where($where)
|
|
|
|
|
- ->field('r.*,u.address')
|
|
|
|
|
- ->order($sort, $order)
|
|
|
|
|
- ->paginate($limit);
|
|
|
|
|
- foreach ($list as $k => $v) {
|
|
|
|
|
- $list[$k]['address'] = (new UserModel())->getById($v['user_id'])['address'];
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $list = $this->model->with('users,pledges')
|
|
|
|
|
+ ->where($where)
|
|
|
|
|
+ ->order($sort, $order)
|
|
|
|
|
+ ->paginate($limit);
|
|
|
|
|
+
|
|
|
$result = ['total' => $list->total(), 'rows' => $list->items()];
|
|
$result = ['total' => $list->total(), 'rows' => $list->items()];
|
|
|
return json($result);
|
|
return json($result);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 详情
|
|
|
|
|
+ */
|
|
|
|
|
+ public function detail($ids)
|
|
|
|
|
+ {
|
|
|
|
|
+ $row = $this->model->get(['id' => $ids]);
|
|
|
|
|
+ if (!$row) {
|
|
|
|
|
+ $this->error(__('No Results were found'));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($this->request->isAjax()) {
|
|
|
|
|
+ $this->success("Ajax请求成功", null, ['id' => $ids]);
|
|
|
|
|
+ }
|
|
|
|
|
+ $product = new ProductLists();
|
|
|
|
|
+ $details = json_decode($row->details, true);
|
|
|
|
|
+ foreach ($details as &$detail) {
|
|
|
|
|
+ $detail['name'] = $product::where('id', $detail['id'])->value('zh_name');
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->view->assign("row", $details);
|
|
|
|
|
+ return $this->view->fetch();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|