Exemplo n.º 1
0
 public function delDocument($Model, $ids)
 {
     //如果是文档  则自动删除积分
     if ($Model == 'Document') {
         $map['id'] = array('in', $ids);
         $map['usertype'] = 'user';
         $idlist = M('Document')->where($map)->field('id,title,uid,usertype')->select();
         foreach ($idlist as $key => $value) {
             $info = array();
             $info = api('Document/get_detail', array('id' => $value['id']));
             //管理员删除  扣除积分
             Credits::ag_cms_topics_delete($value['uid'], $info['category_id'], '管理员一条内容,ID:' . $value['id']);
         }
     }
     return true;
 }
Exemplo n.º 2
0
 public function ag_cms_credits($type, $cate_id, $id, $status)
 {
     switch ($type) {
         case 'top':
             if ($status) {
                 //加精置顶
                 $tzinfo = M('Document')->where(array('id' => $id))->field('uid,usertype')->find();
                 if ($tzinfo['usertype'] == 'user') {
                     Credits::ag_cms_topics_settop($tzinfo['uid'], $cate_id, '管理员置顶一条内容,ID:' . $id);
                 }
             }
             break;
         case 'dig':
             if ($status) {
                 //加精置顶
                 $tzinfo = M('Document')->where(array('id' => $id))->field('uid,usertype')->find();
                 if ($tzinfo['usertype'] == 'user') {
                     Credits::ag_cms_topics_settop($tzinfo['uid'], $cate_id, '管理员加精一条内容,ID:' . $id);
                 }
             }
             break;
     }
     return true;
 }