本文整理汇总了PHP中action_log函数的典型用法代码示例。如果您正苦于以下问题:PHP action_log函数的具体用法?PHP action_log怎么用?PHP action_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了action_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* 新增或更新一个文档
* @param array $data 手动传入的数据
* @return boolean fasle 失败 , int 成功 返回完整的数据
* @author huajie <banhuajie@163.com>
*/
public function update($data = null)
{
/* 获取数据对象 */
$data = $this->token(false)->create($data);
if (empty($data)) {
return false;
}
/* 添加或新增基础内容 */
if (empty($data['id'])) {
//新增数据
$id = $this->add($_POST);
//添加基础内容
if (!$id) {
$this->error = '新增基础内容出错!';
return false;
}
} else {
//更新数据
$status = $this->save();
//更新基础内容
if (false === $status) {
$this->error = '更新基础内容出错!';
return false;
}
}
hook('documentSaveComplete', array('model_id' => $data['model_id']));
//行为记录
if ($id) {
action_log('add_document', 'document', $id, UID);
}
//内容添加或更新完成
return $data;
}
示例2: addLZLReply
public function addLZLReply($post_id, $to_f_reply_id, $to_reply_id, $to_uid, $content, $p, $send_message = true)
{
//新增一条回复
$data = array('uid' => is_login(), 'post_id' => $post_id, 'to_f_reply_id' => $to_f_reply_id, 'to_reply_id' => $to_reply_id, 'to_uid' => $to_uid, 'content' => $content);
$data = $this->create($data);
if (!$data) {
return false;
}
$result = $this->add($data);
action_log('add_post_reply', 'ForumLzlReply', $result, is_login());
S('post_replylist_' . $post_id, null);
S('post_replylzllist_' . $to_f_reply_id, null);
$postModel = D('ForumPost');
//增加帖子的回复数
$postModel->where(array('id' => $post_id))->setInc('reply_count');
//更新最后回复时间
$postModel->where(array('id' => $post_id))->setField('last_reply_time', time());
$post = $postModel->find($post_id);
D('Forum')->where(array('id' => $post['forum_id']))->setField('last_reply_time', time());
if ($send_message) {
$this->sendReplyMessage(is_login(), $post_id, $content, $to_uid, $to_f_reply_id, $result, $p);
}
$this->handleAt($post_id, $to_f_reply_id, $content, $p, $map);
//返回结果
return $result;
}
示例3: save
function save()
{
$Brand = D('Brand');
$data = $Brand->create();
if ($data) {
$id = $Brand->add();
if ($id) {
// S('DB_CONFIG_DATA',null);
//记录行为
action_log('update_menu', 'Menu', $id, UID);
$this->success('新增成功', Cookie('__forward__'));
} else {
$this->error('新增失败');
}
} else {
$this->error($Brand->getError());
}
// if(IS_POST){
//
// } else {
// $this->assign('info',array('pid'=>I('pid')));
// $menus = M('Menu')->field(true)->select();
// $menus = D('Common/Tree')->toFormatTree($menus);
// $menus = array_merge(array(0=>array('id'=>0,'title_show'=>'顶级菜单')), $menus);
// $this->assign('Menus', $menus);
// $this->meta_title = '新增菜单';
// $this->display('edit');
// }
}
示例4: logout
public function logout()
{
get_user() && action_log('系统', '退出');
D('User')->logout();
session('[destroy]');
$this->success('退出成功!', U('login'));
}
示例5: edit
/**
* 编辑
* @author 烟消云散 <1010422715@qq.com>
*/
public function edit($id = 0)
{
if (IS_POST) {
$Form = D('records');
if ($_POST["id"]) {
$id = $_POST["id"];
/*更新时间*/
$Form->time = NOW_TIME;
/* 编辑后新增系统反馈信息*/
$Form->info = $_POST["info"];
$result = $Form->where("id='{$id}'")->save();
if ($result) {
//记录行为
action_log('update_backlist', 'backlist', $data['id'], UID);
$this->success('更新成功', Cookie('__forward__'));
} else {
$this->error('更新失败' . $id);
}
} else {
$this->error($Config->getError());
}
} else {
$info = array();
/* 获取数据 */
$info = M('records')->find($id);
$list = M('records')->where("id='{$id}'")->select();
if (false === $info) {
$this->error('获取订单信息错误');
}
$this->assign('list', $list);
$this->assign('info', $info);
$this->meta_title = '编辑订单';
$this->display();
}
}
示例6: editData
public function editData($data)
{
$contentHandler = new ContentHandlerModel();
if (isset($data['content'])) {
$data['content'] = $contentHandler->filterHtmlContent($data['content']);
}
if ($data['id']) {
$data['update_time'] = time();
$res = $this->save($data);
if ($res) {
action_log('edit_answer', 'question_answer', $data['id'], get_uid());
}
} else {
$data['support'] = $data['oppose'] = 0;
$data['status'] = 1;
$data['uid'] = get_uid();
$data['create_time'] = $data['update_time'] = time();
$res = $this->add($data);
if ($res) {
D('Question/Question')->where(array('id' => $data['question_id']))->setInc('answer_num');
action_log('add_answer', 'question_answer', $res, get_uid());
}
}
return $res;
}
示例7: update
/**
* 新增或更新一个文档
* @return boolean fasle 失败 , int 成功 返回完整的数据
* @author Rocks
*/
public function update()
{
/* 获取数据对象 */
$data = $this->create();
if (empty($data)) {
return false;
}
/* 添加或新增基础内容 */
if (empty($data['id'])) {
//新增数据
$id = $this->add();
//添加基础内容
if (!$id) {
$this->error = '新增模型出错!';
return false;
}
} else {
//更新数据
$status = $this->save();
//更新基础内容
if (false === $status) {
$this->error = '更新模型出错!';
return false;
}
}
// 清除模型缓存数据
S('DOCUMENT_MODEL_LIST', null);
//记录行为
action_log('update_model', 'model', $data['id'] ? $data['id'] : $id, UID);
//内容添加或更新完成
return $data;
}
示例8: update
/**
* 新增或更新一个文档
* @param array $data 手动传入的数据
* @return boolean fasle 失败 , int 成功 返回完整的数据
* @author huajie <banhuajie@163.com>
*/
public function update($data = null)
{
/* 获取数据对象 */
$data = $this->create($data);
if (empty($data)) {
return false;
}
/* 添加或新增基础内容 */
if (empty($data['id'])) {
//新增数据
$id = $this->add();
//添加基础内容
if (!$id) {
$this->error = '新增基础内容出错!';
return false;
}
} else {
//更新数据
$status = $this->save();
//更新基础内容
if (false === $status) {
$this->error = '更新基础内容出错!';
return false;
}
}
//行为记录
if ($id) {
action_log('update_shipping', 'shipping', $id, UID);
}
//内容添加或更新完成
return $data;
}
示例9: edit
/**
* 编辑订单
* @author 烟消云散 <1010422715@qq.com>
*/
public function edit($id = 0)
{
if (IS_POST) {
$Form = D('change');
if ($_POST["id"]) {
$id = $_POST["id"];
$Form->create();
$result = $Form->where("id='{$id}'")->save();
if ($result) {
//记录行为
action_log('update_change', 'change', $data['id'], UID);
$this->success('更新成功', Cookie('__forward__'));
} else {
$this->error('更新失败,换货单' . $id);
}
} else {
$this->error($Config->getError());
}
} else {
$info = array();
/* 获取数据 */
$info = M('change')->find($id);
$list = M('change')->where("shopid='{$id}'")->select();
if (false === $info) {
$this->error('获取订单信息错误');
}
$this->assign('list', $list);
$this->assign('info', $info);
$this->meta_title = '编辑订单';
$this->display();
}
}
示例10: doSendInfo
public function doSendInfo()
{
$this->checkAuth('Cat/Center/doSendInfo', -1, '你没有发送消息的权限!');
$this->checkActionLimit('cat_center_send_info', 'cat_center');
$send = D('cat_send')->create();
$recStr = I('post.receiver', 'op_t');
$array = explode(' ', str_replace('@', '', $recStr));
$array = array_unique($array);
$send['send_uid'] = is_login();
$send['create_time'] = time();
$send['content'] = I('post.content', '', 'op_t');
$rs = 1;
foreach ($array as $v) {
if ($array != '') {
$v = trim($v);
$v = str_replace("\r", '', $v);
$user = D('member')->where(array('nickname' => $v))->find();
if ($user) {
$t_send = $send;
$t_send['rec_uid'] = $user['uid'];
$rs = $rs && D('cat_send')->add($t_send);
}
}
}
if ($rs) {
action_log('cat_center_send_info', 'cat_center');
$this->success('发送成功。');
} else {
$this->error('发送失败。');
}
}
示例11: login
public function login()
{
if (IS_POST) {
$code = I('post.code');
$code_check = $this->check_verify($code);
if ($code_check != 1) {
$this->error('验证码不正确');
}
$username = I('post.username');
$password = I('post.password');
$password = md5(md5($password));
$info = get_info(D('Common/MemberView'), array('username' => $username, 'password' => $password));
if ($info['is_admin'] != 1) {
$this->error("管理员帐号不存在");
}
if ($info['member_status'] != 1) {
$this->error("管理员帐号已被禁用或删除");
}
if ($info) {
if ($info['member_rules']) {
$info['rules'] .= ',' . $info['member_rules'];
}
$info['rules'] = implode(',', array_unique(explode(',', $info['rules'])));
session('rules', $info['rules']);
session('username', $info['username']);
session('member_id', $info['member_id']);
action_log('member', $info['member_id'], 'id,username as title');
$this->success('登录成功', __ROOT__ . "/Backend");
} else {
$this->error('用户名或密码错误');
}
} else {
header("location:" . __ROOT__ . "/Backend");
}
}
示例12: login
/**
* 登录指定用户
* @param integer $uid 用户ID
* @return boolean ture-登录成功,false-登录失败
*/
public function login($uid)
{
/* 检测是否在当前应用注册 */
$user = $this->field(true)->find($uid);
if (!$user) {
//未注册
/* 在当前应用中注册用户 */
$Api = new UserApi();
$info = $Api->info($uid);
$user = $this->create(array("nickname" => $info[1], "status" => 1));
$user["uid"] = $uid;
if (!$this->add($user)) {
$this->error = "前台用户信息注册失败,请重试!";
return false;
}
} elseif (1 != $user["status"]) {
$this->error = "用户未激活或已禁用!";
//应用级别禁用
return false;
}
/* 登录用户 */
$this->autoLogin($user);
/* 登录历史 */
history($uid);
/* 登录购物车处理函数 */
addintocart($uid);
//记录行为
action_log("user_login", "member", $uid, $uid);
return true;
}
示例13: login
/**
* 登录指定用户
* @param integer $uid 用户ID
* @return boolean ture-登录成功,false-登录失败
*/
public function login($uid)
{
/* 检测是否在当前应用注册 */
$user = $this->field(true)->find($uid);
if (!$user) {
//未注册
/* 在当前应用中注册用户 */
$Api = new UserApi();
$info = $Api->info($uid);
$user = $this->create(array('nickname' => $info[1], 'status' => 1));
$user['uid'] = $uid;
if (!$this->add($user)) {
$this->error = '前台用户信息注册失败,请重试!';
return false;
}
} elseif (1 != $user['status']) {
$this->error = '用户未激活或已禁用!';
//应用级别禁用
return false;
}
/* 登录用户 */
$this->autoLogin($user);
//记录行为
action_log('user_login', 'member', $uid, $uid);
return true;
}
示例14: editData
public function editData($data)
{
if ($data['id']) {
$res = $this->save($data);
} else {
$data['addtime'] = time();
$res = $this->add($data);
action_log('add_atlas_collection', 'Atlas', $res, is_login());
}
return $res;
}
示例15: update
/**
* 新增或更新一个文档
* @return boolean fasle 失败 , int 成功 返回完整的数据
* @author huajie <banhuajie@163.com>
*/
public function update()
{
/* 获取数据对象 */
$data = $this->create();
if (empty($data)) {
return false;
}
/* 添加或新增基础内容 */
if (empty($data['id'])) {
//新增数据
$id = $this->add();
//添加基础内容
if (!$id) {
$this->error = '新增模型出错!';
return false;
}
} else {
//更新数据
$model = $this->find($data['id']);
//先取旧的模型名
$status = $this->save($data);
//更新基础内容
if (false === $status) {
$this->error = '更新模型出错!';
return false;
} elseif ($model['name'] != $data['name']) {
// 同时更新模型对应的数据表,先判断数据表是否存在
if ($model['extend'] == 0) {
// 独立模型表名
$table_name = C('DB_PREFIX') . strtolower($model['name']);
$new_table_name = C('DB_PREFIX') . strtolower($data['name']);
} else {
// 继承模型表名
$extend_model = $this->where(array('id' => $model['extend']))->field('name,extend')->find();
$table_name = C('DB_PREFIX') . strtolower($extend_model['name']) . '_' . strtolower($model['name']);
$new_table_name = C('DB_PREFIX') . strtolower($extend_model['name']) . '_' . strtolower($data['name']);
}
$sql = "SHOW TABLES LIKE '{$table_name}'";
$res = M()->query($sql);
if (count($res)) {
$sql = "ALTER TABLE `{$table_name}` RENAME TO `{$new_table_name}`";
$this->execute($sql);
}
}
}
// 清除模型缓存数据
S('DOCUMENT_MODEL_LIST', null);
//记录行为
action_log('update_model', 'model', $data['id'] ? $data['id'] : $id, UID);
//内容添加或更新完成
return $data;
}