當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tools::reTrue方法代碼示例

本文整理匯總了PHP中Tools::reTrue方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tools::reTrue方法的具體用法?PHP Tools::reTrue怎麽用?PHP Tools::reTrue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tools的用法示例。


在下文中一共展示了Tools::reTrue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getRelatedRelpies

 public function getRelatedRelpies()
 {
     $cate = Input::get('cate', '');
     $id = Input::get('id', 0);
     $last_id = Input::get('last_id', 0);
     $per_page = Input::get('per_page', 30);
     $mapping = Reply::getRepliableCate();
     try {
         if (array_key_exists($cate, $mapping)) {
             $cate = $mapping[$cate];
         } else {
             throw new Exception("需要傳入有效的評論分類", 2001);
         }
         $query = Reply::with(['user'])->select('replies.*')->where('replies.status', '=', 1);
         if ($last_id) {
             $query = $query->where('replies.id', '<', $last_id);
         }
         $query = $query->join('repliables', function ($q) use($cate, $id) {
             $q->on('repliables.reply_id', '=', 'replies.id')->where('repliables.repliable_type', '=', $cate)->where('repliables.repliable_id', '=', $id);
         });
         $list = $query->orderBy('replies.id', 'DESC')->paginate($per_page);
         $data = [];
         foreach ($list as $key => $reply) {
             $data[] = $reply->showInList();
         }
         $re = Tools::reTrue('獲取評論成功', $data);
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '獲取評論失敗:' . $e->getMessage());
     }
     return Response::json($re);
 }
開發者ID:qnck,項目名稱:qingnianchuangke,代碼行數:31,代碼來源:ReplyController.php

示例2: listIndexTop

 public function listIndexTop()
 {
     $base = Config::get('app.url');
     $data = [['url' => $base . 'banner/1', 'img' => 'http://qnck001.oss-cn-hangzhou.aliyuncs.com/banner/1.png', 'title' => '青年創'], ['url' => $base . 'banner/2', 'img' => 'http://qnck001.oss-cn-hangzhou.aliyuncs.com/banner/2.png', 'title' => '青年創']];
     $re = Tools::reTrue('獲取首頁廣告成功', $data);
     return Response::json($re);
 }
開發者ID:qnck,項目名稱:qingnianchuangke,代碼行數:7,代碼來源:AdController.php

示例3: sendOrders

 public function sendOrders()
 {
     set_time_limit(60000);
     try {
         $user = User::find(5);
         if ($user->u_priase_count == 0) {
             throw new Exception("已經執行過了", 30001);
         } else {
             $user->u_priase_count = 0;
             $user->save();
         }
         $str_text = '恭喜“雙11不怕剁手”眾籌活動已成功,您被眾籌發起者選中,請於12日18時前憑此信息到零棟鋪子領取眾籌回報。4006680550';
         $str_push = '恭喜“雙11不怕剁手”眾籌活動已成功,您被眾籌發起者選中,請於12日18時前憑此信息到零棟鋪子領取眾籌回報。4006680550';
         $orders = Order::selectRaw('right(`t_orders`.`o_number`, 4) AS seed, `t_orders`.*')->join('carts', function ($q) {
             $q->on('orders.o_id', '=', 'carts.o_id');
         })->where('carts.c_type', '=', 2)->where('carts.p_id', '=', 4)->orderBy('seed', 'DESC')->limit(111)->get();
         foreach ($orders as $key => $order) {
             if (empty($order)) {
                 continue;
             }
             $phones = $order->o_shipping_phone;
             $pushObj = new PushMessage($order->u_id);
             $pushObj->pushMessage($str_push);
             echo 'pushed to ' . $order->u_id . ' </br>';
             $phoneObj = new Phone($order->o_shipping_phone);
             $phoneObj->sendText($str_text);
             echo 'texted to ' . $order->o_shipping_phone . ' </br>';
         }
         File::put('/var/www/qingnianchuangke/phones', implode(',', $phones));
         $re = Tools::reTrue('發送中獎信息成功');
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '發送中獎信息失敗:' . $e->getMessage());
     }
     return Response::json($re);
 }
開發者ID:qnck,項目名稱:qingnianchuangke,代碼行數:35,代碼來源:EmergencyController.php

示例4: postFavorite

 public function postFavorite($id)
 {
     $token = Input::get('token', '');
     $u_id = Input::get('u_id', 0);
     $type = Input::get('type', 0);
     try {
         $user = User::chkUserByToken($token, $u_id);
         $booth = Booth::find($id);
         if (empty($booth)) {
             throw new Exception("請求的店鋪不存在", 2001);
         }
         $chk = $booth->favorites()->where('favorites.u_id', '=', $u_id)->first();
         if ($type == 1) {
             if (empty($chk)) {
                 $data = ['u_id' => $u_id, 'created_at' => Tools::getNow(), 'u_name' => $user->u_nickname];
                 $favorite = new Favorite($data);
                 $booth->favorites()->save($favorite);
             }
         } else {
             if (!empty($chk)) {
                 $booth->favorites()->detach($chk->id);
                 $chk->delete();
             }
         }
         $re = Tools::reTrue('操作成功');
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '操作失敗:' . $e->getMessage());
     }
     return Response::json($re);
 }
開發者ID:qnck,項目名稱:qingnianchuangke,代碼行數:30,代碼來源:BoothController.php

示例5: postImg

 public function postImg()
 {
     $cate = Input::get('cate', '');
     $token = Input::get('img_token', '');
     try {
         $oss = new AliyunOss($cate, $token);
         $data = $oss->upload();
         $re = Tools::reTrue('上傳圖片成功', $data);
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '上傳圖片失敗:' . $e->getMessage());
     }
     return Response::json($re);
 }
開發者ID:qnck,項目名稱:qingnianchuangke,代碼行數:13,代碼來源:ImgController.php

示例6: getSign

 public function getSign()
 {
     $noncestr = Input::get('noncestr', '');
     $timestamp = Input::get('timestamp', '');
     $url = Input::get('url', '');
     try {
         $curl = new CurlRequest();
         $request_url = 'http://qnckwx.54qnck.com/GetjsapiInfo.ashx?noncestr=' . $noncestr . '&timestamp=' . $timestamp . '&url=' . urlencode($url);
         $data = $curl->get($request_url);
         $data = $data['content'];
         $re = Tools::reTrue('獲取簽名成功', $data);
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getMessage(), '獲取簽名失敗:' . $e->getMessage());
     }
     return Response::json($re);
 }
開發者ID:qnck,項目名稱:qingnianchuangke,代碼行數:16,代碼來源:WechatController.php

示例7: postFeedback

 public function postFeedback()
 {
     $u_id = Input::get('u_id', 0);
     $comment = Input::get('comment', '');
     $app_ver = Input::get('app_ver', '');
     try {
         $feedback = new AppFeedback();
         $feedback->u_id = $u_id;
         $feedback->comment = $comment;
         $feedback->app_ver = $app_ver;
         $feedback->addFeedback();
         $re = Tools::reTrue('提交成功');
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '提交失敗:' . $e->getMessage());
     }
     return Response::json($re);
 }
開發者ID:qnck,項目名稱:qingnianchuangke,代碼行數:17,代碼來源:AppController.php

示例8: getBooth

 public function getBooth($id)
 {
     $token = Input::get('token', '');
     $u_id = Input::get('u_id', 0);
     try {
         $user = User::chkUserByToken($token, $u_id);
         $booth = Booth::find($id);
         if (empty($booth) || $booth->u_id != $u_id) {
             throw new Exception("無法獲取請求的店鋪", 7001);
         }
         $data = $booth->showDetail();
         $re = Tools::reTrue('獲取店鋪信息成功', $data);
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '獲取店鋪信息失敗:' . $e->getMessage());
     }
     return Response::json($re);
 }
開發者ID:qnck,項目名稱:qingnianchuangke,代碼行數:17,代碼來源:MeBoothController.php

示例9: listClubs

 public function listClubs()
 {
     $per_page = Input::get('per_page', 100000);
     try {
         $list = Club::with(['user'])->paginate($per_page);
         $data = [];
         $data['rows'] = [];
         foreach ($list as $key => $club) {
             $data['rows'][] = $club->showInList();
         }
         $data['total'] = $list->getTotal();
         $re = Tools::reTrue('獲取社團成功', $data);
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '獲取社團失敗:' . $e->getMessage());
     }
     return Responce::json($re);
 }
開發者ID:qnck,項目名稱:qingnianchuangke,代碼行數:17,代碼來源:OfficeClubController.php

示例10: countNots

 public function countNots()
 {
     $u_id = Input::get('u_id', 0);
     $token = Input::get('token', '');
     try {
         $user = User::chkUserByToken($token, $u_id);
         $list = Notification::join('notification_receivers', function ($q) {
             $q->on('notifications.n_id', '=', 'notification_receivers.n_id');
         })->leftJoin('notification_reads', function ($q) {
             $q->on('notification_reads.n_id', '=', 'notifications.n_id');
         })->where('notification_reads.u_id', '=', $u_id)->where('notifications.n_status', '=', 1)->where('notification_receivers.to_type', '=', '2')->where('notification_receivers.to_id', '=', 0)->orWhere('notification_receivers.to_id', '=', $u_id)->havingRaw('(`t_notification_reads`.`is_read` <> 1 AND `t_notification_reads`.`is_del` <> 1) OR (`t_notification_reads`.`is_read` IS NULL AND `t_notification_reads`.`is_del` IS NULL )')->get();
         $count = count($list);
         $data = ['count' => $count];
         $re = Tools::reTrue('獲取消息成功', $data);
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '獲取消息失敗:' . $e->getMessage());
     }
     return Response::json($re);
 }
開發者ID:qnck,項目名稱:qingnianchuangke,代碼行數:19,代碼來源:MeNotificationController.php

示例11: listUser

 public function listUser()
 {
     $token = Input::get('token', '');
     $ids = Input::get('ids', '');
     $ids = explode(',', $ids);
     try {
         $user = User::chkUserByToken($token);
         $friends = User::whereIn('u_id', $ids)->get();
         // return all users without any restriction case IM will use all users
         $data = [];
         foreach ($friends as $key => $friend) {
             $data[] = $friend->showInImList();
         }
         $re = Tools::reTrue('獲取信息成功', $data);
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '獲取信息失敗:' . $e->getMessage());
     }
     return Response::json($re);
 }
開發者ID:qnck,項目名稱:qingnianchuangke,代碼行數:19,代碼來源:ImController.php

示例12: updateBooth

 public function updateBooth($id)
 {
     $token = Input::get('token', '');
     $u_id = Input::get('u_id', 0);
     $lat = Input::get('lat', 0);
     $lng = Input::get('lng', 0);
     try {
         $user = User::chkUserByToken($token, $u_id);
         $booth = Booth::find($id);
         if ($booth->u_id != $user->u_id) {
             throw new Exception("您無法操作該店鋪", 7001);
         }
         $booth->latitude = $lat;
         $booth->longitude = $lng;
         $booth->save();
         $re = Tools::reTrue('更新店鋪地址成功');
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '更新店鋪地址:' . $e->getMessage());
     }
 }
開發者ID:qnck,項目名稱:qingnianchuangke,代碼行數:20,代碼來源:LocationController.php

示例13: confirmDraw

 public function confirmDraw($id)
 {
     $confirm = Input::get('confirm', 0);
     $comment = Input::get('comment', '');
     $img_token = Input::get('img_token', '');
     DB::beginTransaction();
     try {
         $draw = UsersDraw::find($id);
         if (empty($draw)) {
             throw new Exception("請求的數據不存在", 10001);
         }
         $balance = UsersWalletBalances::find($draw->u_id);
         if (empty($balance)) {
             $balance = new UsersWalletBalances();
             $balance->u_id = $draw->u_id;
         }
         if ($confirm == 1) {
             $balance->deFreez($draw->d_amount);
             $draw->d_status = 1;
             $balance->getOut($draw->d_amount);
         } elseif ($confirm == 0) {
             $draw->d_status = 2;
         } else {
             throw new Exception("隻有確認提現/不確認提現", 10001);
         }
         $draw->confirm($comment);
         if ($img_token) {
             $imgObj = new Img('draw', $img_token);
             $imgs = $imgObj->getSavedImg($draw->d_id);
             $draw->imgs = $imgs;
             $draw->save();
         }
         $re = Tools::reTrue('確認提現成功');
         DB::commit();
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '確認提現失敗:' . $e->getMessage());
         DB::rollback();
     }
     return Response::json($re);
 }
開發者ID:qnck,項目名稱:qingnianchuangke,代碼行數:40,代碼來源:OfficeDrawContoller.php

示例14: enable

 public function enable($id)
 {
     $status = Input::get('status', 0);
     $remark = Input::get('remark', '');
     try {
         $product = Product::find($id);
         if (empty($product)) {
             throw new Exception("沒有找到可用的產品", 10001);
         }
         if ($status == 1) {
             $product->p_status = 1;
         } else {
             $product->p_status = -1;
         }
         $product->p_remark = $remark;
         $product->save();
         $re = Tools::reTrue('修改產品狀態成功');
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '修改產品狀態失敗:' . $e->getMessage());
     }
     return Response::json($re);
 }
開發者ID:qnck,項目名稱:qingnianchuangke,代碼行數:22,代碼來源:OfficeProductController.php

示例15: postRoleUser

 public function postRoleUser($id)
 {
     $users = Input::get('users', '');
     try {
         SysUserRole::clearRoleUser($id);
         if (!empty($users)) {
             if (!is_array($users)) {
                 $role = SysRole::find($id);
                 if (empty($role)) {
                     throw new Exception("沒有找到請求的角色", 1);
                 }
                 $users = explode(',', $users);
                 foreach ($users as $key => $user) {
                     if (!$user) {
                         continue;
                     }
                     $role->addUser($user);
                 }
             }
         }
         $re = Tools::reTrue('設置用戶成功');
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '設置用戶失敗:' . $e->getMessage());
     }
     return Response::json($re);
 }
開發者ID:qnck,項目名稱:qingnianchuangke,代碼行數:26,代碼來源:OfficeMenuController.php


注:本文中的Tools::reTrue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。