当前位置: 首页>>代码示例>>PHP>>正文


PHP Common::returnData方法代码示例

本文整理汇总了PHP中Common::returnData方法的典型用法代码示例。如果您正苦于以下问题:PHP Common::returnData方法的具体用法?PHP Common::returnData怎么用?PHP Common::returnData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Common的用法示例。


在下文中一共展示了Common::returnData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($blackId)
 {
     $input = Input::all();
     $sessionId = Common::checkSessionLogin($input);
     BlackList::where('user_id', $input['user_id'])->where('black_id', $blackId)->delete();
     return Common::returnData(200, DELETE_SUCCESS, $input['user_id'], $sessionId);
 }
开发者ID:trantung,项目名称:online_market,代码行数:13,代码来源:ApiBlackListController.php

示例2: searchLogDestroy

 public function searchLogDestroy($id)
 {
     $input = Input::all();
     $sessionId = Common::checkSessionLogin($input);
     Search::find($id)->delete();
     return Common::returnData(200, DELETE_SUCCESS, $input['user_id'], $sessionId);
 }
开发者ID:trantung,项目名称:online_market,代码行数:7,代码来源:ApiSearchController.php

示例3: commonUploadImage

 public static function commonUploadImage($input, $path, $type = null)
 {
     $data = null;
     $sessionId = Common::checkSessionLogin($input);
     if (isset($input['image_url'])) {
         foreach ($input['image_url'] as $key => $value) {
             $filename[$key] = $value->getClientOriginalName();
             $filename[$key] = changeFileNameImage($filename[$key]);
             $filename[$key] = $key . $filename[$key];
             $pathUpload = public_path() . $path . '/' . $input['user_id'];
             $uploadSuccess = $value->move($pathUpload, $filename[$key]);
             if ($key == 0) {
                 if ($type == 1) {
                     $image = Image::make(sprintf('' . $pathUpload . '/%s', $filename[$key]))->save();
                 } else {
                     $image = Image::make(sprintf('' . $pathUpload . '/%s', $filename[$key]))->resize(USER_AVATAR_WIDTH, USER_AVATAR_HEIGHT)->save();
                 }
             } else {
                 $image = Image::make(sprintf('' . $pathUpload . '/%s', $filename[$key]))->save();
             }
             $data[$key] = ['image_url' => $filename[$key]];
         }
         return Common::returnData(200, SUCCESS, $input['user_id'], $sessionId, $data);
     }
     throw new Prototype\Exceptions\UploadErrorException();
 }
开发者ID:trantung,项目名称:online_market,代码行数:26,代码来源:CommonUpload.php

示例4: post

 /**
  *
  * Param: productId
  *
  * @return Response
  */
 public function post($id)
 {
     $input = Input::all();
     $sessionId = Common::checkSessionLogin($input);
     $inputFeedback = ['product_id' => $id, 'user_id' => $input['user_id'], 'message' => $input['message'], 'status' => ACTIVE];
     Feedback::create($inputFeedback)->id;
     return Common::returnData(200, SUCCESS, $input['user_id'], $sessionId);
 }
开发者ID:trantung,项目名称:online_market,代码行数:14,代码来源:ApiReportController.php

示例5: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $input = Input::all();
     $sessionId = Common::checkSessionLogin($input);
     $favorite = Favorite::where('model_name', 'Product')->where('model_id', $id)->where('follow_id', $input['user_id'])->where('type_favorite', TYPE_FAVORITE_SAVE)->first();
     if (isset($favorite)) {
         $favorite->delete();
     }
     return Common::returnData(200, DELETE_SUCCESS, $input['user_id'], $sessionId);
 }
开发者ID:trantung,项目名称:online_market,代码行数:16,代码来源:ApiProductLogController.php

示例6: block

 public function block($id)
 {
     $input = Input::all();
     $sessionId = Common::checkSessionLogin($input);
     $checkInput = BlackList::where('user_id', $input['user_id'])->where('black_id', $id)->get();
     if (!empty($checkInput)) {
         BlackList::create(['user_id' => $input['user_id'], 'black_id' => $id, 'kind' => 1]);
     }
     return Common::returnData(200, SUCCESS, $input['user_id'], $sessionId);
 }
开发者ID:trantung,项目名称:online_market,代码行数:10,代码来源:ApiProfileController.php

示例7: action

 public function action($id)
 {
     $input = Input::all();
     $sessionId = Common::checkSessionLogin($input);
     $check = CommonFavorite::checkFavoriteLike('Category', $id, TYPE_FAVORITE_CATE, $input['user_id']);
     if ($check) {
         Favorite::where('model_name', 'Category')->where('model_id', $id)->where('follow_id', $input['user_id'])->where('type_favorite', TYPE_FAVORITE_CATE)->delete();
     } else {
         Favorite::create(['model_name' => 'Category', 'model_id' => $id, 'follow_id' => $input['user_id'], 'type_favorite' => TYPE_FAVORITE_CATE]);
     }
     return Common::returnData(200, SUCCESS, $input['user_id'], $sessionId);
 }
开发者ID:trantung,项目名称:online_market,代码行数:12,代码来源:ApiCategoryController.php

示例8: loginSocial

 public function loginSocial()
 {
     $input = Input::all();
     $user = User::where('facebook_id', $input['facebook_id'])->where('google_id', $input['google_id'])->first();
     if (!$user) {
         $sessionId = generateRandomString();
         $userId = User::create(['username' => $input['username'], 'facebook_id' => $input['facebook_id'], 'google_id' => $input['google_id'], 'status' => INACTIVE])->id;
         Device::create(['user_id' => $userId, 'session_id' => $sessionId, 'device_id' => $input['device_id']]);
     } else {
         $userId = $user->id;
         $sessionId = Common::getSessionId($input, $userId);
     }
     return Common::returnData(200, SUCCESS, $userId, $sessionId);
 }
开发者ID:trantung,项目名称:online_market,代码行数:14,代码来源:LoginController.php

示例9: index

 public function index()
 {
     $input = Input::all();
     $sessionId = Common::checkSessionLogin($input);
     $user = User::find($input['user_id']);
     //tao code phone
     $codePhone = generateRandomString(CODEPHONE);
     //luu code phone -> db
     $user->update(['code_phone' => $codePhone]);
     //gui code cho dau so
     //active user
     $user->update(['status' => ACTIVE]);
     return Common::returnData(200, SUCCESS, $input['user_id'], $sessionId);
 }
开发者ID:trantung,项目名称:online_market,代码行数:14,代码来源:ApiVerifyAccountController.php

示例10: logout

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function logout()
 {
     $input = Input::all();
     $device = Device::where('device_id', $input['device_id'])->where('user_id', $input['user_id'])->first();
     if ($device) {
         if ($device->session_id == $input['session_id']) {
             Device::find($device->id)->update(['session_id' => null]);
             return Common::returnData(200, SUCCESS, $input['user_id'], '');
         } else {
             throw new Prototype\Exceptions\UserSessionErrorException();
         }
     }
     throw new Prototype\Exceptions\DeviceErrorException();
 }
开发者ID:trantung,项目名称:online_market,代码行数:19,代码来源:LogoutController.php

示例11: saved

 public function saved($id)
 {
     $input = Input::all();
     $sessionId = Common::checkSessionLogin($input);
     $check = CommonFavorite::checkFavoriteLike('Product', $id, TYPE_FAVORITE_SAVE, $input['user_id']);
     if (!$check) {
         Favorite::create(['model_name' => 'Product', 'model_id' => $id, 'follow_id' => $input['user_id'], 'type_favorite' => TYPE_FAVORITE_SAVE]);
     }
     // else {
     // 	Favorite::where('model_name', 'Product')
     // 		->where('model_id', $id)
     // 		->where('follow_id', $input['user_id'])
     // 		->where('type_favorite', TYPE_FAVORITE_SAVE)
     // 		->delete();
     // }
     return Common::returnData(200, SUCCESS, $input['user_id'], $input['session_id']);
 }
开发者ID:trantung,项目名称:online_market,代码行数:17,代码来源:ApiProductController.php

示例12: resetpassword

 public function resetpassword()
 {
     $input = Input::all();
     $user = User::where('email', $input['email'])->first();
     if (is_null($user)) {
         throw new Prototype\Exceptions\EmailErrorException();
     }
     $user->update(['password' => Hash::make(DEFAULT_PASSWORD)]);
     $mailData = [];
     Mail::send('emails.changepass', $mailData, function ($message) use($user, $input) {
         $message->to($input['email'], 'Hello' . $user->name)->subject('Authorize password');
     });
     if (Mail::failures()) {
         throw new Prototype\Exceptions\EmailErrorException();
     }
     return Common::returnData(200, SUCCESS);
 }
开发者ID:trantung,项目名称:online_market,代码行数:17,代码来源:ApiPasswordController.php

示例13: action

 public function action($id)
 {
     $input = Input::all();
     $sessionId = Common::checkSessionLogin($input);
     $favorite = Favorite::where('model_name', 'User')->where('model_id', $id)->where('follow_id', $input['user_id'])->where('type_favorite', TYPE_FAVORITE_LIKE)->first();
     if (!isset($favorite)) {
         Favorite::create(['model_name' => 'User', 'model_id' => $id, 'follow_id' => $input['user_id'], 'type_favorite' => TYPE_FAVORITE_LIKE]);
     }
     // else {
     // 	Favorite::where('model_name', 'User')
     // 		->where('model_id', $id)
     // 		->where('follow_id', $input['user_id'])
     // 		->where('type_favorite', TYPE_FAVORITE_LIKE)
     // 		->delete();
     // }
     return Common::returnData(200, SUCCESS, $input['user_id'], $sessionId);
 }
开发者ID:trantung,项目名称:online_market,代码行数:17,代码来源:ApiFavoriteController.php

示例14: post

 public function post()
 {
     $input = Input::all();
     $sessionId = Common::checkSessionLogin($input);
     //check user active
     $checkUser = User::find($input['user_id'])->status;
     if (isset($checkUser) && $checkUser == INACTIVE) {
         throw new Prototype\Exceptions\UserStatusErrorException();
     }
     // create product
     $inputSubmit = ['name' => $input['name'], 'user_id' => $input['user_id'], 'category_id' => $input['category_id'], 'type_id' => $input['type_id'], 'price_id' => CommonProduct::getPriceId($input['price']), 'price' => $input['price'], 'lat' => $input['lat'], 'long' => $input['long'], 'description' => $input['description'], 'avatar' => $input['avatar'], 'address' => $input['address'], 'city_id' => $input['city_id'], 'city' => Common::getModelField($input['city_id'], 'City', 'name'), 'position' => 1, 'status' => INACTIVE, 'start_time' => Carbon\Carbon::now()];
     $id = Product::create($inputSubmit)->id;
     // images product
     if (isset($input['image_url']) && count($input['image_url']) > 0) {
         foreach ($input['image_url'] as $key => $value) {
             $inputImage = array('product_id' => $id, 'image_url' => $value);
             ProductImage::create($inputImage);
         }
     }
     return Common::returnData(200, SUCCESS, $input['user_id'], $sessionId);
 }
开发者ID:trantung,项目名称:online_market,代码行数:21,代码来源:ApiPostController.php

示例15: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($id)
 {
     $input = Input::all();
     $data = Text::where('id', $id)->select(['title', 'description'])->get();
     return Common::returnData(200, SUCCESS, $input['user_id'], $input['session_id'], $data);
 }
开发者ID:trantung,项目名称:online_market,代码行数:11,代码来源:ApiTextController.php


注:本文中的Common::returnData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。