自定义按钮
{
field: 'buttons',
width: "120px",
title: __('按钮组'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'tongguo',
text: '通过',
title: '通过',
classname: 'btn btn-xs btn-success btn-magic btn-ajax',
icon: 'fa fa-magic',
url: 'agent_live_access/qiehuangongsi',
confirm: '确认通过?',
refresh:true,
success: function (data, ret) {
table.bootstrapTable('refresh');
return false;
},
error: function (data, ret) {
// Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
Layer.alert(ret.msg);
return false;
}
},
],
formatter: Table.api.formatter.buttons
},
public function qiehuangongsi($ids = null)
{
$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'));
}
}
// if ($row['type']==2){
// $this->error('该直播间不在线,无法修改');
// }
if ($row['isgongsi']==1){
Db::name('agent_live_access')->where(array('id'=>$ids))->setField('isgongsi',0);
}else{
Db::name('agent_live_access')->where(array('id'=>$ids))->setField('isgongsi',1);
}
$this->success($ids);
}
上传图片(需要取消这个接口的登录权限限制)
接口地址:
http://pb.com/index.php/api/common/upload
接口功能:
提交图片数据,返回地址数据