示例#1
0
 /**
  * 修改状态
  */
 public function status()
 {
     if (IS_POST) {
         $id = PUT('id');
         $value = PUT('value');
         if ($value == 2) {
             $row = $this->__find($id);
             $msg = array();
             $msg['url'] = URI_ROUTE('message' . $row['id'], true, true);
             $msg['remark'] = $row['remark'];
             $msg['content'] = $row['title'];
             if ($row['msg_cat'] == 0) {
                 Jpush::pushAll($msg);
             } else {
                 $audience = array('cat' . $row['msg_cat']);
                 $res['android'] = Jpush::tag($msg, $audience, 0, 'android');
                 $res['ios'] = Jpush::tag($msg, $audience, 1, 'ios');
                 //wlog('res', $res);//wlog('$row[msg_cat]',$audience );
             }
         }
         if ($this->__status(PUT('id'), PUT('value'), PUT('field'))) {
             if ($value == 2) {
                 $this->success('推送成功!');
             } else {
                 $this->success('状态修改成功');
             }
         } else {
             $this->error('状态修改失败');
         }
     }
 }
示例#2
0
 /**
  * 通知
  */
 public function notify()
 {
     if (IS_POST) {
         $id = PUT('id');
         //必读消息id
         $where['msg_id'] = $id;
         $read_user = M('MsgRead')->where($where)->field('user_id')->select();
         $read_user_id = array();
         foreach ($read_user as $value) {
             $read_user_id[] = $value['user_id'];
             //已读人员列表
         }
         $message = $this->__find($id);
         $map['status'] = array('in', '1,3,5,7,9,11,13,15');
         if ($message['msg_cat'] == 0) {
             $user = D('user')->field('id')->where($map)->select();
             foreach ($user as &$value) {
                 if (!in_array($value['id'], $read_user_id)) {
                     $unread_user_id[] = $value['id'];
                 }
             }
         } else {
             $map['cat_id'] = $message['msg_cat'];
             $user = M('UserInfo')->field('user_id')->where($map)->select();
             foreach ($user as $value) {
                 if (!in_array($value['user_id'], $read_user_id)) {
                     $unread_user_id[] = $value['user_id'];
                 }
             }
         }
         //wlog('id', $id);
         //wlog('$read_user_id', $read_user_id);
         //wlog('$unread_user_id', $unread_user_id);
         $msg = array();
         $msg['url'] = URI_ROUTE('message' . $message['id'], true, true);
         $msg['remark'] = $message['remark'];
         $msg['content'] = $message['title'];
         $result = Jpush::tag($msg, $unread_user_id);
         if ($result['success']) {
             $this->success('推送成功!');
         } else {
             $this->success('推送失败!');
         }
     }
 }
示例#3
0
 public function reject()
 {
     if (IS_POST) {
         $id = PUT('id');
         //wlog('cert_name', $id);
         $audience = array($id);
         $map = array();
         $map['user_id'] = $id;
         $result = M('UserInfo')->where($map)->setField('name_cert', 2);
         if ($result) {
             $msg = array();
             $msg['url'] = '';
             $msg['content'] = '实名认证失败!';
             $msg['remark'] = '抱歉,您未能通过实名认证!请核对您提交的信息!';
             Jpush::tag($msg, $audience);
             $this->success('认证失败!');
         } else {
             $msg = array();
             $msg['url'] = '';
             $msg['content'] = '实名认证失败!';
             $msg['remark'] = '抱歉,您未能通过实名认证!请核对您提交的信息!';
             Jpush::tag($msg, $audience);
             $this->error('认证失败!');
         }
     }
 }