作者 何书鹏
1 个管道 的构建 通过 耗费 1 秒

充值积分每分需多少元

... ... @@ -66,7 +66,7 @@ class Company extends Backend
foreach ($list as $row) {
$row->visible(['id','user_id','name','address','license','legal_person','invite_code','status']);
$row->visible(['user']);
$row->getRelation('user')->visible(['nickname']);
$row->getRelation('user')->visible(['group_id','nickname']);
}
$list = collection($list)->toArray();
$result = array("total" => $total, "rows" => $list);
... ... @@ -143,4 +143,53 @@ class Company extends Backend
$this->success($msg);
}
}
/**
* 设置角色
*/
public function setgroup($ids = null)
{
if($ids) {
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
if (!in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
}
$params = $this->request->param();
if ($params['group_id'] == 1) {
if ($row->user->group_id == 1) {
$this->error('该用户已经是企业管理员了');
}
}
if ($params['group_id'] == 0) {
if ($row->user->group_id == 0) {
$this->error('该企业管理员已经是普通用户了');
}
}
$row->user->group_id = $params['group_id'];
Db::startTrans();
try {
$result = $row->user->save();
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (\think\Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if(!$result) {
$this->error('操作失败');
}
$this->success('操作成功');
}
}
}
... ...
... ... @@ -117,7 +117,7 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">每积分可抵多少元:</label>
<label class="control-label col-xs-12 col-sm-2">每积分可抵多少元:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-score_price" class="form-control" name="row[score_price]" type="number" value="{$row.score_price}">
</div>
... ...
... ... @@ -14,6 +14,11 @@
<!--<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>-->
<!--</ul>-->
<!--</div>-->
<a href="javascript:;" class="btn btn-default" style="font-size:14px;color:dodgerblue;">
<span class="extend">
用户数量:<span id="total">0</span>
</span>
</a>
</div>
<table id="table" class="table table-striped table-bordered table-hover"
data-operate-edit="{:$auth->check('user/user/edit')}"
... ...
... ... @@ -416,6 +416,24 @@ class Course extends Api
}
/**
* @ApiTitle (每积分可抵扣多少元)
* @ApiSummary (每积分可抵扣多少元)
* @ApiMethod (POST)
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1599046220",
"data": 0.01 //每积分可抵扣多少元
})
*/
public function scorePrice()
{
$content = Db::name('mobile_config')->where('id',1)->value('score_price');
$this->success('成功', $content);
}
/**
* @ApiTitle (购买预览)
* @ApiSummary (购买预览)
* @ApiMethod (POST)
... ...
... ... @@ -1175,6 +1175,25 @@ class User extends Api
}
/**
* @ApiWeigh (56)
* @ApiTitle (充值积分每分需多少元)
* @ApiSummary (充值积分每分需多少元)
* @ApiMethod (POST)
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1599046220",
"data": 0.01 //充值积分每分需多少元
})
*/
public function scorePrice()
{
$content = Db::name('mobile_config')->where('id',1)->value('score_recharge_price');
$this->success('成功', $content);
}
/**
* @ApiWeigh (55)
* @ApiTitle (积分充值预览)
* @ApiSummary (积分充值预览)
... ...
... ... @@ -99,6 +99,40 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
return true;
}
},
},
{
name: 'setuser',
text: '设为普通用户',
title: '设为普通用户',
classname: 'btn btn-xs btn-primary btn-ajax',
icon: '',
url: 'mobile/company/setgroup?group_id=0',
confirm: '是否确认拒绝审核?',
visible:function (row) {
if(row.user.group_id == 1){
return true;
}
},
success: function (data) {
table.bootstrapTable('refresh');
}
},
{
name: 'setuser',
text: '设为企业管理员',
title: '设为企业管理员',
classname: 'btn btn-xs btn-primary btn-ajax',
icon: '',
url: 'mobile/company/setgroup?group_id=1',
confirm: '是否确认拒绝审核?',
visible:function (row) {
if(row.user.group_id == 0){
return true;
}
},
success: function (data) {
table.bootstrapTable('refresh');
}
}
], formatter: Table.api.formatter.operate,
}
... ...
... ... @@ -16,6 +16,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
var table = $("#table");
//当表格数据加载完成时
table.on('load-success.bs.table', function (e, data) {
//这里可以获取从服务端获取的JSON数据
console.log(data);
//这里我们手动设置底部的值
$("#total").text(data.total);
});
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
... ...
此 diff 太大无法显示。