本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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 . '×tamp=' . $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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}
}
示例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);
}
示例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);
}
示例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);
}