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


PHP CUtil::getUserId方法代码示例

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


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

示例1: buildShopQuery

 public function buildShopQuery()
 {
     $this->qry = ShopDetails::leftJoin('users', 'users.id', '=', 'shop_details.user_id')->leftJoin('product', function ($join) {
         $join->on('users.id', '=', 'product.product_user_id');
     })->Select("shop_details.*", "users.created_at", "users.first_name", "users.last_name", "users.email", "users.activated", "users.id", \DB::raw('count(product.id) as script_cnt'));
     $this->qry->groupBy('users.id');
     $this->qry->Where('users.id', '<>', 0);
     //form the search query
     if ($this->getSrchVal('user_code')) {
         $this->qry->whereRaw("( users.id = ?  OR users.id =  ? )", array(CUtil::getUserId($this->getSrchVal('user_code')), $this->getSrchVal('user_code')));
     }
     if ($this->getSrchVal('user_name')) {
         $name_arr = explode(" ", $this->getSrchVal('user_name'));
         if (count($name_arr) > 0) {
             foreach ($name_arr as $names) {
                 $this->qry->whereRaw("( users.first_name LIKE '%" . addslashes($names) . "%' OR users.last_name LIKE '%" . addslashes($names) . "%'  )");
             }
         }
     }
     if ($this->getSrchVal('shop_name')) {
         $name_arr = explode(" ", $this->getSrchVal('shop_name'));
         if (count($name_arr) > 0) {
             foreach ($name_arr as $names) {
                 $this->qry->whereRaw("( shop_details.shop_name LIKE '%" . addslashes($names) . "%')");
             }
         }
     }
     if ($this->getSrchVal('user_email')) {
         $this->qry->Where('users.email', $this->getSrchVal('user_email'));
     }
     if ($this->getSrchVal('shop_featured')) {
         if ($this->getSrchVal('shop_featured') == 'Yes') {
             $this->qry->Where('shop_details.is_featured_shop', 'Yes');
         } else {
             $this->qry->Where('shop_details.is_featured_shop', 'No');
         }
     }
     $this->qry->orderBy('users.created_at', 'desc');
     return $this->qry;
 }
开发者ID:agriya,项目名称:webshoppack,代码行数:40,代码来源:AdminManageShopService.php

示例2: postProductActions


//.........这里部分代码省略.........
             // images on the image tab
             $resource_type = \Input::get('resource_type');
             $this->productAddService->setProductPreviewType($p_id);
             $this->productAddService->setAllowedUploadFormats('preview');
             $this->productAddService->setMaxUploadSize('preview');
             $resource_count = ProductResource::whereRaw('product_id = ? AND resource_type = ? ', array($p_id, $this->productAddService->product_media_type))->count();
             if ($resource_count < \Config::get('webshoppack::preview_max')) {
                 $file_info = array();
                 $file = \Input::file('uploadfile');
                 $upload_file_name = $file->getClientOriginalName();
                 $upload_status = $this->productAddService->uploadMediaFile('uploadfile', $this->productAddService->product_media_type, $file_info);
                 if ($upload_status['status'] == 'success') {
                     $resource_arr = array('product_id' => $p_id, 'resource_type' => $resource_type, 'filename' => $file_info['filename_no_ext'], 'ext' => $file_info['ext'], 'title' => $file_info['title'], 'width' => $file_info['width'], 'height' => $file_info['height'], 't_width' => $file_info['t_width'], 't_height' => $file_info['t_height'], 'l_width' => $file_info['l_width'], 'l_height' => $file_info['l_height'], 'server_url' => $file_info['server_url'], 'is_downloadable' => $file_info['is_downloadable']);
                     $resource_id = $this->productService->insertResource($resource_arr);
                     $image_dim = CUtil::DISP_IMAGE(74, 74, $file_info['t_width'], $file_info['t_height'], true);
                     $this->productService->updateProductStatus($p_id, 'Draft');
                     echo json_encode(array('status' => 'success', 'resource_type' => ucwords($resource_type), 'server_url' => $file_info['server_url'], 'filename' => $file_info['file_thumb'], 't_width' => $image_dim['width'], 't_height' => $image_dim['height'], 'title' => $file_info['title'], 'resource_id' => $resource_id));
                 } else {
                     echo json_encode(array('status' => 'error', 'error_message' => $upload_status['error_message'], 'filename' => $upload_file_name));
                 }
             } else {
                 echo json_encode(array('status' => 'error', 'error_message' => trans('webshoppack::products_max_file'), 'filename' => ''));
             }
             exit;
             break;
         case 'save_resource_title':
             $row_id = \Input::get('row_id');
             $resource_title = \Input::get('resource_title');
             echo $this->productService->updateProductResourceImageTitle($row_id, $resource_title) ? 'success' : 'error';
             $this->productService->updateProductStatus($p_id, 'Draft');
             exit;
             break;
         case 'delete_resource':
             $row_id = \Input::get('row_id');
             if ($this->productService->deleteProductResource($row_id)) {
                 $this->productService->updateProductStatus($p_id, 'Draft');
                 echo json_encode(array('result' => 'success', 'row_id' => $row_id));
             } else {
                 echo json_encode(array('result' => 'failed', 'row_id' => $row_id));
             }
             exit;
             break;
         case 'order_resource':
             $resourcednd_arr = \Input::get('resourcednd');
             $this->productService->updateProductResourceImageDisplayOrder($resourcednd_arr);
             // set status is not called since only re-ordering
             exit;
             break;
         case 'upload_resource_file':
             // the download file in zip format
             $resource_type = 'Archive';
             $this->productAddService->product_media_type = 'archive';
             $this->productAddService->setAllowedUploadFormats('archive');
             $this->productAddService->setMaxUploadSize('archive');
             $resource_count = ProductResource::whereRaw('product_id = ? AND resource_type = ? ', array($p_id, $this->productAddService->product_media_type))->count();
             if ($resource_count == 0) {
                 $file_info = array();
                 $file = \Input::file('uploadfile');
                 $upload_file_name = $file->getClientOriginalName();
                 $upload_status = $this->productAddService->uploadMediaFile('uploadfile', $this->productAddService->product_media_type, $file_info, true);
                 if ($upload_status['status'] == 'success') {
                     $resource_arr = array('product_id' => $p_id, 'resource_type' => $resource_type, 'server_url' => $file_info['server_url'], 'filename' => $file_info['filename_no_ext'], 'ext' => $file_info['ext'], 'title' => $file_info['title'], 'width' => $file_info['width'], 'height' => $file_info['height'], 't_width' => $file_info['t_width'], 't_height' => $file_info['t_height'], 'l_width' => $file_info['l_width'], 'l_height' => $file_info['l_height'], 'is_downloadable' => $file_info['is_downloadable']);
                     $resource_id = $this->productService->insertResource($resource_arr);
                     if ($file_info['title'] != '') {
                         $download_filename = preg_replace('/[^0-9a-z\\.\\_\\-)]/i', '', $file_info['title']) . '.' . $file_info['ext'];
                     } else {
                         $download_filename = md5($p_id) . '.' . $file_info['ext'];
                     }
                     echo json_encode(array('status' => 'success', 'server_url' => $file_info['server_url'], 'download_url' => \URL::action('Agriya\\Webshoppack\\AdminProductAddController@getProductActions') . '?action=download_file&product_id=' . $p_id, 'filename' => $download_filename, 't_width' => $file_info['t_width'], 't_height' => $file_info['t_height'], 'title' => $file_info['title'], 'resource_id' => $resource_id, 'is_downloadable' => $file_info['is_downloadable']));
                     $this->productService->updateProductStatus($p_id, 'Draft');
                 } else {
                     echo json_encode(array('status' => 'error', 'error_message' => $upload_status['error_message'], 'filename' => $upload_file_name));
                 }
             } else {
                 echo json_encode(array('status' => 'error', 'error_message' => trans('webshoppack::product.products_max_file'), 'filename' => ''));
             }
             exit;
             break;
         case 'check_user':
             $user_code = \Input::get('user_code');
             $user_id = CUtil::getUserId($user_code);
             if ($user_id != "") {
                 $user_details = CUtil::getUserDetails($user_id);
                 if (count($user_details) > 0) {
                     if (!$this->productAddService->checkIsShopOwner($user_id)) {
                         echo json_encode(array('status' => 'error', 'message' => trans('webshoppack::product.invalid_seller_usercode')));
                     } else {
                         $section_options = $this->productAddService->getProductUserSections($user_id);
                         echo json_encode(array('status' => 'success', 'section_options' => $section_options));
                     }
                 } else {
                     echo json_encode(array('status' => 'error', 'message' => trans('webshoppack::product.invalid_user_code')));
                 }
             } else {
                 echo json_encode(array('status' => 'error', 'message' => trans('webshoppack::product.invalid_user_code')));
             }
             exit;
             break;
     }
 }
开发者ID:agriya,项目名称:webshoppack,代码行数:101,代码来源:AdminProductAddController.php

示例3: addProduct

 public function addProduct($input_arr)
 {
     $p_id = 0;
     if (count($input_arr) > 0) {
         $user_id = CUtil::getUserId($input_arr['user_code']);
         $product_code = CUtil::generateRandomUniqueCode('P', 'product', 'product_code');
         $url_slug = \Str::slug($input_arr['product_name']);
         $data_arr = array('product_code' => $product_code, 'product_name' => $input_arr['product_name'], 'product_description' => $input_arr['product_description'], 'meta_title' => '', 'meta_keyword' => '', 'meta_description' => '', 'product_highlight_text' => $input_arr['product_highlight_text'], 'demo_url' => $input_arr['demo_url'], 'demo_details' => $input_arr['demo_details'], 'product_tags' => $input_arr['product_tags'], 'user_section_id' => $input_arr['user_section_id'], 'product_preview_type' => $input_arr['product_preview_type'], 'product_status' => 'Draft', 'product_price_currency' => \Config::get('webshoppack::site_default_currency'), 'product_category_id' => $input_arr['my_category_id'], 'url_slug' => isset($input_arr['url_slug']) ? $input_arr['url_slug'] : $url_slug, 'product_added_date' => \DB::raw('NOW()'), 'last_updated_date' => \DB::raw('NOW()'), 'product_user_id' => $user_id);
         $p_id = Product::insertGetId($data_arr);
         //To add dumb data for product image
         $p_img_arr = array('product_id' => $p_id);
         $p_img_id = ProductImage::insertGetId($p_img_arr);
     }
     return $p_id;
 }
开发者ID:agriya,项目名称:webshoppack,代码行数:15,代码来源:AdminProductAddService.php


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