Commit fb01b094 authored by sugar's avatar sugar

guquan

parent e5377a32
......@@ -7,6 +7,7 @@ use app\admin\model\device\Chargedevice;
use app\admin\model\order\Order;
use app\common\controller\Backend;
use think\Db;
/**
* 用户管理
......@@ -36,6 +37,60 @@ class Users extends Backend
/**
* 编辑
*
* @param $ids
* @return string
* @throws DbException
* @throws \think\Exception
*/
public function edit($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;
if(!$params['signtime']){
$params['signtime'] = 0;
}
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();
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
......
......@@ -29,6 +29,9 @@ return [
'User_type' => '类型',
'User_type wechat' => '小程序登录',
'User_type app' => 'APP登录',
'Equity' => '股权数量',
'Equity_code' => '股权代码',
'Signtime' => '股权签发时间',
'Status' => '状态',
'Status 1' => '正常',
'Status 2' => '冻结'
......
......@@ -18,7 +18,7 @@
<input id="c-realname" data-rule="required" class="form-control" name="row[realname]" type="text" value="{$row.realname|htmlentities}">
</div>
</div>
<div class="form-group">
<!--<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Avatar')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
......@@ -151,6 +151,24 @@
</div>
</div>
</div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Equity')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-equity" class="form-control" name="row[equity]" type="number" value="{$row.equity|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Equity_code')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-equity_code" class="form-control" name="row[equity_code]" type="text" value="{$row.equity_code|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Signtime')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-signtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[signtime]" type="text" value="{:$row.signtime?datetime($row.signtime):''}">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
......
......@@ -33,25 +33,28 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{ field: 'mobile', title: __('Mobile'), operate: 'LIKE' },
{ field: 'nickname', title: __('Nickname'), operate: 'LIKE' },
{ field: 'realname', title: __('Realname'), operate: 'LIKE' },
{ field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image },
{ field: 'avatar', title: __('Avatar'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image },
{ field: 'total_money', title: __('Money'), operate: false },
{ field: 'shopping_money', title: __('购物金'), operate: false },
{ field: 'province', title: __('Province'), operate: 'LIKE' },
{ field: 'city', title: __('City'), operate: 'LIKE' },
{ field: 'token', title: __('Token'), operate: 'LIKE', visible: false },
{ field: 'sex', title: __('Sex'), searchList: { "0": __('Sex 0'), "1": __('Sex 1'), "2": __('Sex 2') }, formatter: Table.api.formatter.normal },
{ field: 'prevtime', title: __('Prevtime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime },
{ field: 'logintime', title: __('Logintime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime },
{ field: 'loginip', title: __('Loginip'), operate: 'LIKE' },
{ field: 'jointime', title: __('Jointime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime },
{ field: 'province', title: __('Province'), operate: false ,visible: false},
{ field: 'city', title: __('City'), operate: false ,visible: false},
{ field: 'token', title: __('Token'), operate: false, visible: false },
{ field: 'sex', title: __('Sex'), operate: false, searchList: { "0": __('Sex 0'), "1": __('Sex 1'), "2": __('Sex 2') }, formatter: Table.api.formatter.normal,visible: false},
{ field: 'prevtime', title: __('Prevtime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime , operate: false,visible: false},
{ field: 'logintime', title: __('Logintime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime , operate: false,visible: false},
{ field: 'loginip', title: __('Loginip'), operate: false ,visible: false},
{ field: 'jointime', title: __('Jointime'), operate: false, addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime },
{ field: 'type', title: __('Type'), searchList: { "1": __('Type 1'), "2": __('Type 2') }, formatter: Table.api.formatter.normal },
{ field: 'wx_openid', title: __('Wx_openid'), operate: 'LIKE', visible: false },
{ field: 'app_openid', title: __('App_openid'), operate: 'LIKE', visible: false },
{ field: 'unionid', title: __('Unionid'), operate: 'LIKE', visible: false },
{ field: 'session_key', title: __('Session_key'), operate: 'LIKE', visible: false },
{ field: 'brand', title: __('Brand'), operate: 'LIKE' },
{ field: 'wx_openid', title: __('Wx_openid'), operate: false, visible: false },
{ field: 'app_openid', title: __('App_openid'), operate: false, visible: false },
{ field: 'unionid', title: __('Unionid'), operate: false, visible: false },
{ field: 'session_key', title: __('Session_key'), operate: false, visible: false },
{ field: 'brand', title: __('Brand'), operate: false, visible: false},
{ field: 'equity', title: __('Equity'), operate: false,sortable:true},
{ field: 'equity_code', title: __('Equity_code'), operate: 'LIKE' },
{ field: 'signtime', title: __('Signtime')},
{ field: 'user_type', title: __('User_type'), searchList: { "wechat": __('User_type wechat'), "app": __('User_type app') }, formatter: Table.api.formatter.normal },
{ field: 'status', title: __('Status'), searchList: { "1": __('Status 1'), "2": __('Status 2') }, formatter: Table.api.formatter.status },
{ field: 'status', title: __('Status'),visible: false, searchList: { "1": __('Status 1'), "2": __('Status 2') }, formatter: Table.api.formatter.status},
{
field: 'operate', title: __('Operate'), table: table, buttons: [
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment