|
@@ -255,12 +255,13 @@ class MyController extends Controller
|
|
public function reply()
|
|
public function reply()
|
|
{
|
|
{
|
|
$user = $this->getUser();
|
|
$user = $this->getUser();
|
|
|
|
+// $user = UserInfoModel::find(4);
|
|
$data = CommentInfoModel::where('to_user_id',$user->id)->orderBy('id','desc')->get(); //user_id
|
|
$data = CommentInfoModel::where('to_user_id',$user->id)->orderBy('id','desc')->get(); //user_id
|
|
foreach ($data as $item){ //访问接口 标记已读
|
|
foreach ($data as $item){ //访问接口 标记已读
|
|
$item->update(['is_read'=>0]);
|
|
$item->update(['is_read'=>0]);
|
|
$info = InteractionInfo::find($item->interaction_id);
|
|
$info = InteractionInfo::find($item->interaction_id);
|
|
$dream_id =empty($info) ? 0 : $info->dream_id;
|
|
$dream_id =empty($info) ? 0 : $info->dream_id;
|
|
- $item->dream_id = $dream_id;
|
|
|
|
|
|
+ $item->dreamid = $dream_id;
|
|
}
|
|
}
|
|
return $this->api($data);
|
|
return $this->api($data);
|
|
}
|
|
}
|
|
@@ -287,12 +288,13 @@ class MyController extends Controller
|
|
public function letter()
|
|
public function letter()
|
|
{
|
|
{
|
|
$user = $this->getUser();
|
|
$user = $this->getUser();
|
|
- $data = SystemInfoModel::where('user_id',$user->id)->whereNotNull('to_user_id')->orderBy('id','desc')->get();
|
|
|
|
|
|
+ $data = SystemInfoModel::with('touser')->where('user_id',$user->id)->whereNotNull('to_user_id')->orderBy('id','desc')->get();
|
|
foreach ($data as $item){ //访问接口 标记已读
|
|
foreach ($data as $item){ //访问接口 标记已读
|
|
$item->update(['is_read'=>1]);
|
|
$item->update(['is_read'=>1]);
|
|
}
|
|
}
|
|
return $this->api($data);
|
|
return $this->api($data);
|
|
- } /**
|
|
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
* @api {get} /api/my/system_info 系统消息
|
|
* @api {get} /api/my/system_info 系统消息
|
|
* @apiDescription 系统消息
|
|
* @apiDescription 系统消息
|
|
* @apiGroup My
|
|
* @apiGroup My
|
|
@@ -860,6 +862,57 @@ class MyController extends Controller
|
|
$users =$user->UserCareUser;
|
|
$users =$user->UserCareUser;
|
|
return $this->api($users);
|
|
return $this->api($users);
|
|
|
|
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * @api {get} /api/my/careme 关注我的用户
|
|
|
|
+ * @apiDescription 关注我的用户
|
|
|
|
+ * @apiGroup My
|
|
|
|
+ * @apiPermission Passport
|
|
|
|
+ * @apiVersion 0.1.0
|
|
|
|
+ * @apiSuccessExample {json} Success-Response:
|
|
|
|
+ * HTTP/1.1 200 OK
|
|
|
|
+ *{
|
|
|
|
+ * "status": true,
|
|
|
|
+ * "status_code": 0,
|
|
|
|
+ * "message": "",
|
|
|
|
+ * "data":[] or
|
|
|
|
+ * "data": [
|
|
|
|
+ * {
|
|
|
|
+ * "id": 2,
|
|
|
|
+ * "phone": "13880642881",
|
|
|
|
+ * "nickname": "name2",
|
|
|
|
+ * "avatar": "http://www.miao.com/upload/user/20170630/08e235d7211944e9b6482965b4d7c42e.jpg",
|
|
|
|
+ * "birthday": "2000-06-21",
|
|
|
|
+ * "sign": 0,
|
|
|
|
+ * "money": 0,
|
|
|
|
+ * "coin": 800,
|
|
|
|
+ * "sex": 1,
|
|
|
|
+ * "signture": "我的个性签名2",
|
|
|
|
+ * "height": 200,
|
|
|
|
+ * "work": "兼职",
|
|
|
|
+ * "emotion": 2,
|
|
|
|
+ * "address": "370105",
|
|
|
|
+ * "city": "成都",
|
|
|
|
+ * "detail_address": "",
|
|
|
|
+ * "status": 1,
|
|
|
|
+ * "wechat": "",
|
|
|
|
+ * "weibo": "",
|
|
|
|
+ * "remember_token": "",
|
|
|
|
+ * "created_at": "2017-06-25 10:42:06",
|
|
|
|
+ * "updated_at": "2017-06-30 09:15:04",
|
|
|
|
+ * "deleted_at": null,
|
|
|
|
+ * }
|
|
|
|
+ * ]
|
|
|
|
+ *}
|
|
|
|
+ * @apiErrorExample {json} Error-Response:
|
|
|
|
+ * HTTP/1.1 400 Bad Request
|
|
|
|
+ */
|
|
|
|
+ public function careMe()
|
|
|
|
+ {
|
|
|
|
+ $user = $this->getUser();
|
|
|
|
+ $users =$user->UserCareMe;
|
|
|
|
+ return $this->api($users);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
public function insertSearchTable($id,$keyword)
|
|
public function insertSearchTable($id,$keyword)
|
|
@@ -1095,5 +1148,105 @@ class MyController extends Controller
|
|
return $this->error(ErrorCode::OPERATION_FAILED);
|
|
return $this->error(ErrorCode::OPERATION_FAILED);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+// 发私信
|
|
|
|
+ /**
|
|
|
|
+ * @api {post} /api/my/letter/store 发送私信
|
|
|
|
+ * @apiDescription 发送私信
|
|
|
|
+ * @apiGroup My
|
|
|
|
+ * @apiParam {string} content 私信内容
|
|
|
|
+ * @apiParam {int} to_user_id 私信对象
|
|
|
|
+ * @apiPermission Passport
|
|
|
|
+ * @apiVersion 0.1.0
|
|
|
|
+ * @apiSuccessExample {json} Success-Response:
|
|
|
|
+ * HTTP/1.1 200 OK
|
|
|
|
+ *{
|
|
|
|
+ * "status": true,
|
|
|
|
+ * "status_code": 0,
|
|
|
|
+ * "message": "",
|
|
|
|
+ * "data": ""
|
|
|
|
+ *}
|
|
|
|
+ * @apiErrorExample {json} Error-Response:
|
|
|
|
+ *{
|
|
|
|
+ * "status": false,
|
|
|
|
+ * "status_code": 700,
|
|
|
|
+ * "message": "操作失败",
|
|
|
|
+ * "data": null
|
|
|
|
+ *}
|
|
|
|
+ */
|
|
|
|
+ public function letterStore(Request $request)
|
|
|
|
+ {
|
|
|
|
+ $validator = \Validator::make($request->all(),
|
|
|
|
+ [
|
|
|
|
+ 'content' => 'required',
|
|
|
|
+ 'to_user_id' => 'required',
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'content.required' => '私信内容不存在',
|
|
|
|
+ 'to_user_id.required' => '私信对象不存在',
|
|
|
|
+ ]
|
|
|
|
+ );
|
|
|
|
+ if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
|
|
|
|
+ $user = $this->getUser();
|
|
|
|
+ $user_id = $user->id;
|
|
|
|
+ $message = $request->input('content');
|
|
|
|
+ $to_user_id = $request->input('to_user_id');
|
|
|
|
+// 链接到最近的一个梦想
|
|
|
|
+ $dream = DreamInfoModel::where('user_id',$user_id)->orderBy('id','desc')->first();
|
|
|
|
+ $dream_id = empty($dream) ? 0 : $dream->id;
|
|
|
|
+ $arr = [
|
|
|
|
+ 'user_id'=>$to_user_id,
|
|
|
|
+ 'message'=>$message,
|
|
|
|
+ 'to_user_id'=>$user_id,
|
|
|
|
+ 'dream_id'=>$dream_id,
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ $ok =SystemInfoModel::create($arr);
|
|
|
|
+ if ($ok) {
|
|
|
|
+ $this->jPush($user->nickname.'给你发了个私信哦~点击看看!','',$to_user_id);
|
|
|
|
+ return $this->api('');
|
|
|
|
+ }else{
|
|
|
|
+ return $this->error(ErrorCode::OPERATION_FAILED);
|
|
|
|
+ }
|
|
|
|
+ } /**
|
|
|
|
+ * @api {get} /api/my/letter/show 查看私信
|
|
|
|
+ * @apiDescription 查看私信
|
|
|
|
+ * @apiGroup My
|
|
|
|
+ * @apiParam {int} id 私信主键id
|
|
|
|
+ * @apiPermission Passport
|
|
|
|
+ * @apiVersion 0.1.0
|
|
|
|
+ * @apiSuccessExample {json} Success-Response:
|
|
|
|
+ * HTTP/1.1 200 OK
|
|
|
|
+ *{
|
|
|
|
+ * "status": true,
|
|
|
|
+ * "status_code": 0,
|
|
|
|
+ * "message": "",
|
|
|
|
+ * "data": ""
|
|
|
|
+ *}
|
|
|
|
+ * @apiErrorExample {json} Error-Response:
|
|
|
|
+ *{
|
|
|
|
+ * "status": false,
|
|
|
|
+ * "status_code": 700,
|
|
|
|
+ * "message": "操作失败",
|
|
|
|
+ * "data": null
|
|
|
|
+ *}
|
|
|
|
+ */
|
|
|
|
+ public function letterShow(Request $request)
|
|
|
|
+ {
|
|
|
|
+ $validator = \Validator::make($request->all(),
|
|
|
|
+ [
|
|
|
|
+ 'id' => 'required',
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'id.required' => '私信id不存在',
|
|
|
|
+ ]
|
|
|
|
+ );
|
|
|
|
+ if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
|
|
|
|
+ $user = $this->getUser();
|
|
|
|
+ $user_id = $user->id;
|
|
|
|
+ $id = $request->input('id');
|
|
|
|
+
|
|
|
|
+ $data = SystemInfoModel::find($id);
|
|
|
|
+ return $this->api($data);
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|