Ejemplo n.º 1
0
 public function getList($params)
 {
     $row = "cat_id,parent_id,cat_path,level,cat_name,child_count,cat_logo";
     if ($params['fields']) {
         $row = $params['fields'];
     }
     $row = str_append($row, 'level,cat_id,parent_id');
     $objMdlCat = app::get('syscategory')->model('cat');
     $catList = $objMdlCat->getList($row);
     foreach ($catList as $key => $value) {
         if ($value["cat_name"] != "其他") {
             if ($value['level'] == '1') {
                 $data[$value['cat_id']] = $value;
             } elseif ($value['level'] == '2') {
                 $lv2[$value['parent_id']][$value['cat_id']] = $value;
             } elseif ($value['level'] == '3') {
                 $lv3[$value['parent_id']][$value['cat_id']] = $value;
             }
         }
     }
     foreach ($data as $catId => $val) {
         foreach ($lv2[$catId] as $k => $v) {
             $lv2[$catId][$k]['lv3'] = $lv3[$k];
         }
         $data[$catId]['lv2'] = $lv2[$catId];
     }
     return $data;
 }
Ejemplo n.º 2
0
 public function getList($params)
 {
     $catIds = explode(',', $params['cat_id']);
     $row = "cat_id,parent_id,cat_path,level,cat_name,child_count";
     if ($params['fields']) {
         $row = $params['fields'];
         $row = str_append($row, 'level,parent_id');
     }
     $db = app::get('syscategory')->database();
     $data = array();
     foreach ($catIds as $catId) {
         $cat = $db->executeQuery('SELECT ' . $row . ' FROM syscategory_cat WHERE cat_id=' . $catId . ' or cat_path LIKE "%,' . $catId . ',%"');
         foreach ($cat as $value) {
             if ($value['level'] == '1') {
                 $data[$value['cat_id']] = $value;
             } elseif ($value['level'] == '2') {
                 $lv2[$value['parent_id']][$value['cat_id']] = $value;
             } elseif ($value['level'] == '3') {
                 $lv3[$value['parent_id']][$value['cat_id']] = $value;
             }
         }
     }
     if (!$data) {
         throw new \LogicException('参数cat_id必须为一级类目id');
     }
     foreach ($data as $catId => $val) {
         foreach ($lv2[$catId] as $k => $v) {
             $lv2[$catId][$k]['lv3'] = $lv3[$k];
         }
         $data[$catId]['lv2'] = $lv2[$catId];
     }
     return $data;
 }
Ejemplo n.º 3
0
 public function getList($params)
 {
     $objMdlCat = app::get('syscategory')->model('cat');
     $row = "cat_id,cat_name,level,parent_id";
     if ($params['fields']) {
         $row = $params['fields'];
         $row = str_append($row, 'cat_id');
     }
     if ($params['cat_id']) {
         $filter['cat_id'] = explode(',', $params['cat_id']);
     }
     if ($params['cat_path']) {
         $filter['cat_path|has'] = ',' . $params['cat_path'] . ',';
     }
     if (isset($params['parent_id']) && intval($params['parent_id']) >= 0) {
         $filter['parent_id'] = $params['parent_id'];
     } elseif (is_array($params['parent_id'])) {
         $filter['parent_id'] = explode(',', $params['parent_id']);
     }
     if ($params['cat_name'] && $params['level']) {
         $filter['cat_name'] = $params['cat_name'];
         $filter['level'] = $params['level'];
     }
     if ($params['level']) {
         $filter['level'] = $params['level'];
     }
     $catList = $objMdlCat->getList($row, $filter);
     return array_bind_key($catList, 'cat_id');
 }
Ejemplo n.º 4
0
 public function tradeList($params)
 {
     if ($params['oauth']['account_id'] && $params['oauth']['auth_type'] == "member") {
         $params['user_id'] = $params['oauth']['account_id'];
     } elseif ($params['oauth']['account_id'] && $params['oauth']['auth_type'] == "shop") {
         $sellerId = $params['oauth']['account_id'];
         $params['shop_id'] = app::get('systrade')->rpcCall('shop.get.loginId', array('seller_id' => $sellerId), 'seller');
     }
     $tradeRow = $params['fields']['rows'];
     $orderRow = $params['fields']['extends']['order'];
     $activityRow = $params['fields']['extends']['activity'];
     //分页使用
     $pageSize = $params['page_size'] ? $params['page_size'] : 40;
     $pageNo = $params['page_no'] ? $params['page_no'] : 1;
     $max = 1000000;
     if ($pageSize >= 1 && $pageSize < 500 && $pageNo >= 1 && $pageNo < 200 && $pageSize * $pageNo < $max) {
         $limit = $pageSize;
         $page = ($pageNo - 1) * $limit;
     }
     $orderBy = $params['orderBy'];
     if (!$params['orderBy']) {
         $orderBy = "created_time desc";
     }
     unset($params['fields'], $params['page_no'], $params['page_size'], $params['order_by'], $params['oauth']);
     foreach ($params as $k => $val) {
         if (!$val) {
             unset($params[$k]);
             continue;
         }
         if ($k == "status" || $k == "tid") {
             $params[$k] = explode(',', $val);
         }
     }
     $objMdlTrade = app::get('systrade')->model('trade');
     $count = $objMdlTrade->count($params);
     $tradeLists = $objMdlTrade->getList($tradeRow, $params, $page, $limit, $orderBy);
     $tradeLists = array_bind_key($tradeLists, 'tid');
     if ($orderRow && $tradeLists) {
         $orderRow = str_append($orderRow, 'tid');
         $objMdlOrder = app::get('systrade')->model('order');
         $tids = array_column($tradeLists, 'tid');
         $orderLists = $objMdlOrder->getList($orderRow, array('tid' => $tids));
         //是否需要显示标签促销tag
         if ($activityRow && $orderLists) {
             $oids = array_column($orderLists, 'oid');
             $promotionActivityData = app::get('systrade')->model('promotion_detail')->getList('promotion_tag,oid', ['promotion_type' => 'activity', 'oid' => $oids]);
             //一个子订单只可参加一次标签促销活动
             $promotionActivityData = array_bind_key($promotionActivityData, 'oid');
         }
         foreach ($orderLists as $key => $value) {
             if ($promotionActivityData[$value['oid']]['promotion_tag']) {
                 $value['promotion_tag'] = $promotionActivityData[$value['oid']]['promotion_tag'];
             }
             $tradeLists[$value['tid']]['order'][] = $value;
         }
     }
     $trade['list'] = $tradeLists;
     $trade['count'] = $count;
     return $trade;
 }
Ejemplo n.º 5
0
 public function tradeList($params, $oauth)
 {
     if (isset($oauth['shop_id'])) {
         $params['shop_id'] = $oauth['shop_id'];
     } else {
         if ($params['oauth']['account_id'] && $params['oauth']['auth_type'] == "member") {
             $params['user_id'] = $params['oauth']['account_id'];
         } elseif ($params['oauth']['account_id'] && $params['oauth']['auth_type'] == "shop") {
             $sellerId = $params['oauth']['account_id'];
             $params['shop_id'] = app::get('systrade')->rpcCall('shop.get.loginId', array('seller_id' => $sellerId), 'seller');
         }
     }
     $tradeRow = $params['fields']['rows'];
     $orderRow = $params['fields']['extends']['order'];
     //lastmodify的范围划分
     if ($params['update_time_start'] > 0 && $params['update_time_end'] > 0) {
         $params['modified_time|between'] = array($params['update_time_start'], $params['update_time_end']);
     }
     unset($params['update_time_start']);
     unset($params['update_time_end']);
     //分页使用
     $pageSize = $params['page_size'] ? $params['page_size'] : 40;
     $pageNo = $params['page_no'] ? $params['page_no'] : 1;
     $max = 1000000;
     if ($pageSize >= 1 && $pageSize < 500 && $pageNo >= 1 && $pageNo < 200 && $pageSize * $pageNo < $max) {
         $limit = $pageSize;
         $page = ($pageNo - 1) * $limit;
     }
     $orderBy = $params['orderBy'];
     if (!$params['orderBy']) {
         $orderBy = "created_time desc";
     }
     unset($params['fields'], $params['page_no'], $params['page_size'], $params['order_by'], $params['oauth']);
     foreach ($params as $k => $val) {
         if (!$val) {
             unset($params[$k]);
             continue;
         }
         if ($k == "status" || $k == "tid") {
             $params[$k] = explode(',', $val);
         }
     }
     $objMdlTrade = app::get('systrade')->model('trade');
     $count = $objMdlTrade->count($params);
     $tradeLists = $objMdlTrade->getList($tradeRow, $params, $page, $limit, $orderBy);
     $tradeLists = array_bind_key($tradeLists, 'tid');
     if ($orderRow && $tradeLists) {
         $orderRow = str_append($orderRow, 'tid');
         $objMdlOrder = app::get('systrade')->model('order');
         $tids = array_column($tradeLists, 'tid');
         $orderLists = $objMdlOrder->getList($orderRow, array('tid' => $tids));
         foreach ($orderLists as $key => $value) {
             $tradeLists[$value['tid']]['order'][] = $value;
         }
     }
     $trade['list'] = $tradeLists;
     $trade['count'] = $count;
     return $trade;
 }
Ejemplo n.º 6
0
 public function get($params)
 {
     if (!$params['brand_id'] && !$params['brand_name']) {
         throw new \LogicException(app::get('sysspfb')->_('id 和name 至少一项必填'));
     }
     if ($params['brand_id']) {
         $filter['brand_id'] = explode(',', $params['brand_id']);
     }
     if ($params['brand_name']) {
         $filter['brand_name'] = explode(',', $params['brand_name']);
     }
     $rows = "brand_name,brand_id,brand_alias,order_sort,brand_logo,brand_desc";
     if ($params['fields']) {
         $rows = $params['fields'];
         $rows = str_append($rows, 'brand_id');
     }
     $objMdlBrand = app::get('sysspfb')->model('brand');
     $brandList = $objMdlBrand->getList($rows, $filter);
     return array_bind_key($brandList, 'brand_id');
 }
Ejemplo n.º 7
0
 /**
  * @brief 根据条件查询店铺信息
  *
  * @param string $row 需要获取的字段
  * @param array  $filter 查询条件
  * @param bool  $isRow  是否为查询单条数据
  *
  * @return array
  */
 public function getShopInfo($row, $filter, $isRow = true)
 {
     $row = str_append($row, 'shop_name,shop_type');
     $objMdlShop = app::get('sysshop')->model('shop');
     $objMdlShopType = app::get('sysshop')->model('shop_type');
     $shopData = $objMdlShop->getList($row, $filter);
     $shopTypeData = $objMdlShopType->getList('suffix,name,shop_type');
     $type = array_bind_key($shopTypeData, 'shop_type');
     foreach ($shopData as $k => &$rowData) {
         //为店铺名称填充后缀
         if ($rowData['shop_name'] && $rowData['shop_type']) {
             $rowData['shopname'] = $rowData['shop_name'] . $type[$rowData['shop_type']]['suffix'];
             $rowData['shoptype'] = $type[$rowData['shop_type']]['name'];
         }
         if ($isRow) {
             break;
         }
     }
     return $isRow ? $shopData[0] : $shopData;
 }
Ejemplo n.º 8
0
} else {
    if ($opt == 'uf' || $opt == 'df') {
        // Prepocessing form
        $r = dbSFA("*", $dbtable, "W/replid='{$cid}'");
    } else {
        $r = app_form_gpost('departemen', 'pelajaran');
        $r['bobot'] = '1.0';
        $r['kkm'] = 70;
    }
    $fform->dimension(300, 250);
    $fform->ptop = 20;
    $fform->head();
    if ($opt == 'af' || $opt == 'uf') {
        require_once MODDIR . 'control.php';
        // Add or Edit form
        echo '<tr><td colspan="2"><div style="background:#fafafa;border:1px solid #d2d2d2;padding:5px;margin-bottom:10px;text-align:justify;line-height:130%"><p><b>Tips:</b></p><p>Untuk memperoleh nilai akhir sama dengan nilai rata-rata set semua penilaian dengan bobot yang sama.</p><p>Set bobot penilaian menjadi 0 jika penilaian tersebut tidak masuk dalam perhitungan nilai rapor.</p></div></td></tr>';
        $allid = '';
        $t1 = dbSel("*", "aka_penilaian", "W/guru='{$gid}' AND pelajaran='{$pel}' AND kelas='{$kls}'");
        while ($r1 = dbFA($t1)) {
            $fform->fi($r1['nama'] . ' (' . $r1['kode'] . ')', iText('bobot_' . $r1['replid'], $r1['bobot'], 'width:50px;text-align:center'));
            str_append($allid, $r1['replid']);
        }
        hiddenval('allid', $allid);
    } else {
        if ($opt == 'df') {
            // Delete form
            $fform->dlg_del($r['nama']);
        }
    }
    $fform->foot();
}
Ejemplo n.º 9
0
 /**
  * 根据条件获取货品信息
  *
  * @param $skuIds 货品ID的数组
  * @param $row    SKU表中需要获取的字段
  * @param $store  是否需要获取库存信息
  *
  * @return array $skuList
  */
 private function __searchSkuList($filter, $rows = '*', $isStore = true)
 {
     $rows = str_append($rows, 'sku_id');
     $objMdlItem = app::get('sysitem')->model('sku');
     $list = $objMdlItem->getList($rows, $filter);
     if (empty($list)) {
         return array();
     }
     $skuList = array_bind_key($list, 'sku_id');
     if ($isStore) {
         foreach ($skuList as $row) {
             $skuIds[] = $row['sku_id'];
         }
         $objMdlSkuStore = app::get('sysitem')->model('sku_store');
         $storeInfo = $objMdlSkuStore->getList('store,freez,sku_id', array('sku_id' => $skuIds));
         foreach ($storeInfo as $row) {
             $skuList[$row['sku_id']]['store'] = intval($row['store']);
             $skuList[$row['sku_id']]['freez'] = intval($row['freez']);
             $skuList[$row['sku_id']]['realStore'] = $row['store'] - $row['freez'];
             $skuList[$row['sku_id']]['realStore'] = intval($skuList[$row['sku_id']]['realStore']);
         }
     }
     return $skuList;
 }