|
@@ -729,16 +729,37 @@ class DreamController extends Controller
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * @api {get} /api/dream/share 分享
|
|
|
|
+ * @apiDescription 分享
|
|
|
|
+ * @apiParam {int} id 梦想id
|
|
|
|
+ * @apiGroup Dream
|
|
|
|
+ * @apiPermission Passport
|
|
|
|
+ * @apiVersion 0.1.0
|
|
|
|
+ * @apiSuccessExample {json} Success-Response:
|
|
|
|
+ * HTTP/1.1 200 OK
|
|
|
|
+ * @apiErrorExample {json} Error-Response:
|
|
|
|
+ */
|
|
// 分享梦想
|
|
// 分享梦想
|
|
public function share(Request $request)
|
|
public function share(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);
|
|
$url = env('APP_URL').'/api/dream/show?id='.$request->id;
|
|
$url = env('APP_URL').'/api/dream/show?id='.$request->id;
|
|
$dream = DreamInfoModel::with('img')->find($request->id);
|
|
$dream = DreamInfoModel::with('img')->find($request->id);
|
|
|
|
+ $img = !empty($dream->img) ? $dream->img->pic : '';
|
|
$html =
|
|
$html =
|
|
"<div style='text-align: center'>
|
|
"<div style='text-align: center'>
|
|
<a href='$url'>
|
|
<a href='$url'>
|
|
<h1>$dream->name</h1>
|
|
<h1>$dream->name</h1>
|
|
- <img src='$dream->img->pic' style='width: 20px;height: 20px;' alt=''>
|
|
|
|
|
|
+ <img src=\"$img\" style='width: 20px;height: 20px;' alt=''>
|
|
</a>
|
|
</a>
|
|
</div>";
|
|
</div>";
|
|
return $html;
|
|
return $html;
|