本文整理汇总了PHP中utils::getService方法的典型用法代码示例。如果您正苦于以下问题:PHP utils::getService方法的具体用法?PHP utils::getService怎么用?PHP utils::getService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils
的用法示例。
在下文中一共展示了utils::getService方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insertProduct
public function insertProduct($data, $productImg = array(), $productDescImg = array())
{
$oldData = $this->model->select(array('where' => 'tid = ?', 'param' => array($data['tid']), 'isRow' => true));
if ($oldData) {
return 'hasOld';
}
$nowTime = time();
$productData = array('tid' => $data['tid'], 'title' => $data['title'], 'price' => $data['price'], 'prop_price' => isset($data['prop_price']) ? $data['prop_price'] : 0, 'add_time' => $nowTime, 'url' => $data['url'], 'extra_price' => isset($data['extra_price']) ? $data['extra_price'] : 0, 'image' => '');
if (isset($productImg[0])) {
$productData['image'] = $productImg[0];
}
$id = $this->model->insert($productData);
if ($productImg) {
$productImgService = utils::getService('productImg');
foreach ($productImg as $img) {
if ($img) {
$imgData = array('product_id' => $id, 'image' => $img, 'add_time' => $nowTime);
$productImgService->model->insert($imgData);
unset($imgData);
}
}
}
if ($productDescImg) {
$productDescImgService = utils::getService('productDescImg');
foreach ($productDescImg as $img) {
if ($img) {
$imgDescData = array('product_id' => $id, 'image' => $img, 'add_time' => $nowTime);
$productDescImgService->model->insert($imgDescData);
unset($imgDescData);
}
}
}
return $id;
}
示例2: getCartProductFormat
public function getCartProductFormat($groupTimeListNum = 0)
{
$cartProductList = $this->getCartProductList();
$skuIdArr = $productIdArr = $newSkuList = $newProductList = array();
if ($cartProductList['rowNums']) {
foreach ($cartProductList['resultList'] as $cartProduct) {
$skuIdArr[] = $cartProduct['sku_id'];
$productIdArr[] = $cartProduct['product_id'];
}
if ($skuIdArr) {
$productSkuService = utils::getService('productSku');
$skuList = $productSkuService->getSkuByIds($skuIdArr);
foreach ($skuList as $skuInfo) {
$newSkuList[$skuInfo['id']] = $skuInfo;
}
}
if ($productIdArr) {
$productService = utils::getService('product');
$productList = $productService->getProductByIds($productIdArr);
foreach ($productList as $productInfo) {
$newProductList[$productInfo['id']] = $productInfo;
}
}
foreach ($cartProductList['resultList'] as &$cartProduct) {
$cartProduct['productInfo'] = $newProductList[$cartProduct['product_id']];
$productPrice = $newProductList[$cartProduct['product_id']]['default_price'];
if (isset($newSkuList[$cartProduct['sku_id']])) {
$cartProduct['skuInfo'] = $newSkuList[$cartProduct['sku_id']];
$productPrice = $newSkuList[$cartProduct['sku_id']]['price'];
}
$cartProduct['price'] = $productPrice;
$groupPriceArr = json_decode($cartProduct['productInfo']['group_price']);
foreach ($groupPriceArr as $groupKeyNum => $groupPrice) {
if ($cartProduct['group_num'] <= $groupKeyNum) {
$salePrice = $cartProduct['price'] * ($groupPrice->price / 10);
$cartProduct['salePrice'] = sprintf('%.2f', $salePrice);
break;
}
}
if (isset($cartProduct['salePrice'])) {
$cartProduct['countPrice'] = $cartProduct['salePrice'] * $cartProduct['product_num'] * $cartProduct['group_num'];
} else {
$cartProduct['countPrice'] = $cartProduct['price'] * $cartProduct['product_num'] * $cartProduct['group_num'];
}
$cartProduct['countPrice'] = sprintf('%.2f', $cartProduct['countPrice']);
$groupTimeList = array();
for ($i = 1; $i <= $cartProduct['group_num']; $i++) {
if ($groupTimeListNum > 0) {
if ($i > $groupTimeListNum) {
break;
}
}
$groupTimeList[] = array('time' => $cartProduct['start_time'] + $i * $cartProduct['group_day'] * 24 * 3600, 'price' => isset($cartProduct['salePrice']) ? $cartProduct['salePrice'] : $cartProduct['price']);
}
$cartProduct['groupTimeList'] = $groupTimeList;
}
}
return $cartProductList;
}
示例3: updateInfo
public function updateInfo()
{
$userData = request::postParam('user');
$userExtData = request::postParam('userExtData');
$userService = utils::getService('user');
$userExtService = utils::getService('userExt');
$userService->model->save($userData);
$userExtService->model->save($userExtData, 'user_id = ?', array($userData['id']));
}
示例4: addUser
public function addUser($data, $dataExt = '')
{
$userId = $this->model->insert($data);
$userExtService = utils::getService('userExt');
$userExtId = 0;
if ($dataExt) {
$userExtId = $userExtService->model->insert($dataExt);
}
if (!$userExtId) {
$userExtData = array('userid' => $userId);
$userExtService->model->insert($userExtData);
}
return $userId;
}
示例5: getHomeListByShopId
public function getHomeListByShopId($shopId)
{
$tableParam = array('where' => 'shop_id = ?', 'param' => array($shopId));
$shopHomeList = $this->model->select($tableParam);
$shopIdArr = array();
if ($shopHomeList) {
foreach ($shopHomeList['resultList'] as $shinfo) {
$shopIdArr[] = $shinfo['home_id'];
}
}
if ($shopIdArr) {
$homeService = utils::getService('home');
$homeList = $homeService->getHomeByIds($shopIdArr);
return $homeList['resultList'];
}
}
示例6: getUserAddressInfo
public function getUserAddressInfo($userId)
{
$tableParam = array('where' => 'user_id = ?', 'param' => array($userId));
$addressList = $this->model->select($tableParam);
if ($addressList) {
$addrssService = utils::getService('address');
$cacheAddressList = $addrssService->getCacheFileAddress();
foreach ($addressList['resultList'] as &$address) {
$proviceName = $cacheAddressList[$address['province_id']]['title'];
$cityName = $cacheAddressList[$address['city_id']]['title'];
$townName = $cacheAddressList[$address['town_id']]['title'];
$address['address'] = $proviceName . $cityName . $townName . $address['address'];
$address['provinceName'] = $proviceName;
$address['cityName'] = $cityName;
$address['townName'] = $townName;
}
return $addressList['resultList'];
}
}
示例7: grid
public function grid()
{
$page = request::getParam('page', 1);
$pageSize = request::getParam('pagesize', 20);
$pageObj = new page();
$whereParam = array('page' => $page, 'pageSize' => $pageSize, 'isCount' => true);
$applicationList = $this->userApplicationObj->select($whereParam);
if ($applicationList) {
$userObj = new userModel();
foreach ($applicationList['resultList'] as &$appUser) {
$userInfo = $userObj->find($appUser['user_id']);
$appUser['userInfo'] = $userInfo;
}
}
$pageStr = $pageObj->showpage($applicationList['count'], $page, $pageSize);
$businessAppService = utils::getService('businessApp');
$pstatusList = $businessAppService->status;
$data = array('pageStr' => $pageStr, 'applicationList' => $applicationList['resultList'], 'pstatusList' => $pstatusList);
$this->setView($data);
}
示例8: orderWapPay
public function orderWapPay($orderGlideId)
{
$orderPayGlideService = utils::getService('orderPayGlide');
$orderGlideInfo = $orderPayGlideService->find($orderGlideId);
$alipay_config = utils::c('aliwappay');
$format = "xml";
$v = "2.0";
$req_id = date('Ymdhis');
$notify_url = utils::c('siteUrl') . '/mobile/order/ali-pay-notify';
$call_back_url = utils::c('siteUrl') . '/mobile/order/ali-pay-back';
$merchant_url = utils::c('siteUrl') . '/mobile/order';
$out_trade_no = $orderGlideInfo['glide_nums'];
$subject = '宅配订单' . $orderGlideInfo['glide_nums'];
$total_fee = $orderGlideInfo['total'];
$req_data = '<direct_trade_create_req><notify_url>' . $notify_url . '</notify_url><call_back_url>' . $call_back_url . '</call_back_url><seller_account_name>' . trim($alipay_config['seller_email']) . '</seller_account_name><out_trade_no>' . $out_trade_no . '</out_trade_no><subject>' . $subject . '</subject><total_fee>' . $total_fee . '</total_fee><merchant_url>' . $merchant_url . '</merchant_url></direct_trade_create_req>';
$para_token = array("service" => "alipay.wap.trade.create.direct", "partner" => trim($alipay_config['partner']), "sec_id" => trim($alipay_config['sign_type']), "format" => $format, "v" => $v, "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
$alipaySubmit = new AlipaySubmit($alipay_config);
$html_text = $alipaySubmit->buildRequestHttp($para_token);
$html_text = urldecode($html_text);
$para_html_text = $alipaySubmit->parseResponse($html_text);
$request_token = $para_html_text['request_token'];
$req_data = '<auth_and_execute_req><request_token>' . $request_token . '</request_token></auth_and_execute_req>';
$parameter = array("service" => "alipay.wap.auth.authAndExecute", "partner" => trim($alipay_config['partner']), "sec_id" => trim($alipay_config['sign_type']), "format" => $format, "v" => $v, "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
$alipaySubmit = new AlipaySubmit($alipay_config);
$htmlText = $alipaySubmit->buildRequestForm($parameter, 'get', '支付宝支付');
return $htmlText;
}
示例9: getAllCategory
public function getAllCategory()
{
$categoryService = utils::getService('showCategory');
$this->coustomData['showCategory'] = $categoryService->model->getChildCategoryByIdCache(0);
}
示例10: __construct
public function __construct()
{
parent::__construct();
$this->homeService = utils::getService('home');
$this->homeModel = $this->homeService->model;
}
示例11: geturl
public function geturl()
{
$productService = utils::getService('product');
$whereParam = array('where' => 'link_short_url = \'\'', 'param' => array());
$result = $productService->model->select($whereParam);
if ($result) {
if ($result['rowNums'] > 0) {
foreach ($result['resultList'] as $product) {
$url = $this->getTuiGuangClick($product['tid']);
$saveData = array('link_short_url' => $url['shortUrl'], 'link_long_url' => $url['liteUrl']);
$productService->model->save($saveData, 'id=?', array($product['id']));
$saveData = array();
}
}
}
}
示例12: showOrderStatus
public static function showOrderStatus($orderInfo, $userType)
{
$orderService = utils::getService('order');
$orderStatus = $orderService->orderStatus;
$payStatus = $orderService->orderPayStatus;
$resultOrderStatus = array();
$nowTime = time();
$resultOrderStatus['pstatus'] = $orderStatus[$orderInfo['pstatus']];
$resultOrderStatus['payStatus'] = $payStatus[$orderInfo['pay_status']];
switch ($userType) {
case 1:
if ($orderInfo['pstatus'] == 1 && $orderInfo['paddtime'] + 1800 <= $nowTime) {
$resultOrderStatus['cancelOrder'] = '取消订单';
}
if (in_array($orderInfo['pstatus'], array(0, 5, 6)) && !$orderInfo['is_complain']) {
if ($orderInfo['update_time'] + 3 * 24 * 3600 >= $nowTime) {
$resultOrderStatus['complain'] = '投诉卖家';
}
}
if ($orderInfo['pstatus'] == 0 && !$orderInfo['is_assess']) {
if ($orderInfo['update_time'] + 3 * 24 * 3600 >= $nowTime) {
$resultOrderStatus['assess'] = '评价卖家';
}
}
break;
case 2:
if (in_array($orderInfo['pstatus'], array(1, 2, 3, 4))) {
$resultOrderStatus['cancelOrder'] = '取消订单';
}
if ($orderInfo['pstatus'] == 0) {
$resultOrderStatus['complain'] = '投诉买家';
$resultOrderStatus['assess'] = '评价买家';
}
if ($orderInfo['pay_type'] == 0 && $orderInfo['pstatus'] == 4) {
$resultOrderStatus['turePrice'] = '已收到货款';
}
break;
default:
break;
}
return $resultOrderStatus;
}
示例13: __construct
public function __construct()
{
parent::__construct();
$this->orderObj = utils::getService('order')->model;
}