/**
  * 审核 加入群组的请求
  * @see <*****@*****.**>
  * http://jira.chuangyejia.com:8090/pages/viewpage.action?pageId=3413045
  * @param int $request_id 请求记录ID
  * @param int $request_status 请求记录状态
  * @param int $uid 操作人ID
  * 
  * @return json
  */
 public function actionExaminemen()
 {
     $params = Yii::$app->getRequest()->post();
     $request_id = isset($params['request_id']) ? intval($params['request_id']) : '';
     $request_status = isset($params['request_status']) ? intval($params['request_id']) : '';
     $uid = isset($params['uid']) ? intval($params['uid']) : '';
     //操作人uid
     if (empty($request_id) || empty($request_status) || empty($uid)) {
         return Yii::$app->util->responseArray('1101', 'params_error', '参数有误!');
     }
     //请求记录日志
     $mFriendRequest = new FriendRequestGroup();
     $fqobj = $mFriendRequest->getRow($params['request_id']);
     if (!$fqobj) {
         return Yii::$app->util->responseArray('1102', 'params_request_id_error', '参数有误!');
     }
     //$fqobj = $fqobj[0];
     if ($fqobj['request_status'] != FriendRequestGroup::STATUS_VIEW) {
         return Yii::$app->util->responseArray('1103', 'params_request_status_error', '参数有误!');
     }
     //要加入的群组是否存在, 是否允许加入
     $mGroup = new GroupGroup();
     $groupinfo = $mGroup->getRow($fqobj['accept_id']);
     if (!$groupinfo) {
         return Yii::$app->util->responseArray('1104', 'group_deled_error', '该群组已不存在!');
     }
     if ($groupinfo['group_check'] != GroupGroup::CHECK_HALF_CLOSED) {
         return Yii::$app->util->responseArray('1105', 'group_check_error', '参数有误!');
     }
     //查询操作用户 是否是管理员
     $mGroupMember = new GroupMemberGroup();
     $powstatus = $mGroupMember->IsPowers($params['uid'], $fqobj['accept_id']);
     if (!$powstatus) {
         return Yii::$app->util->responseArray('5101', 'user_no_power_error', '该操作用户非法!');
     }
     //更新日志状态
     $qscont = ['request_id' => $params['request_id'], 'request_status' => $params['request_status']];
     $qsta = $mFriendRequest->addRequest($qscont);
     if (!$qsta) {
         return Yii::$app->util->responseArray('4101', 'update_request_error', '操作失败!');
     }
     //同意加入
     if ($params['request_status'] == FriendRequestGroup::STATUS_AGREE) {
         //添加人员到群成员表中
         $membercont = ['uid' => $fqobj['launch_id'], 'group_id' => $fqobj['accept_id'], 'gm_role' => GroupMemberGroup::ROLE_PUBLIC, 'gm_status' => GroupMemberGroup::MEMBER_DEFAULT];
         $joinmem = $mGroupMember->JoinMember($membercont);
         if ($joinmem) {
             return Yii::$app->util->responseArray('0', 'success', '操作成功!');
         } else {
             return Yii::$app->util->responseArray('4102', 'join_member_error', '操作失败!');
         }
     } else {
         return Yii::$app->util->responseArray('0', 'success', '操作成功,您已拒绝该用户!');
     }
 }
 /**
  * 获取某位用户,所有 好友申请记录的接口
  * @param int $uid  用户ID
  * @param int $page 当前第几页
  * @param int $size 每页多少条
  * @return json
  * @see  http://jira.chuangyejia.com:8090/pages/viewpage.action?pageId=3413203
  */
 public function actionApplicationRecord()
 {
     $params = Yii::$app->getRequest()->post();
     $uid = isset($params['uid']) ? intval($params['uid']) : '';
     //用户ID
     $page = isset($params['page']) ? intval($params['page']) : '1';
     //第几页
     $size = isset($params['size']) ? intval($params['size']) : '6';
     //每页多少条
     $offset = ($page - 1) * $size;
     if ($uid) {
         $mRequest = new FriendRequestGroup();
         $list = $mRequest->friendRecordlist($uid, $offset, $size);
         $return = Yii::$app->util->responseArray(0, 'success', '成功', ['list' => $list, 'page' => $page]);
     } else {
         $return = Yii::$app->util->responseArray(1101, 'params_uid_missing', '用户ID参数缺失');
     }
     return $return;
 }