示例#1
0
 /**
  * 模板统一保存的方法
  * @params array - 需要保存的支付信息
  * @params boolean - 是否需要强制保存
  * @return boolean - 保存的成功与否的进程
  */
 public function save(&$data, $mustUpdate = NULL, $mustInsert = false)
 {
     // 异常处理
     if (!isset($data) || !$data || !is_array($data)) {
         trigger_error(app::get('ectools')->_("支付单信息不能为空!"), E_USER_ERROR);
         exit;
     }
     $sdf = array();
     // 支付数据列表
     $background = true;
     //后台 todo
     $payment_data = $data;
     $sdf_payment = parent::dump($data['refund_id'], '*');
     if ($sdf_payment) {
         if ($sdf_payment['status'] == $data['status'] || $sdf_payment['status'] != 'progress' && $sdf_payment['status'] != 'ready') {
             return true;
         }
         if ($data['currency'] && $sdf_payment['currency'] != $data['currency']) {
             return false;
         }
     }
     if ($sdf_payment) {
         $sdf = array_merge($sdf_payment, $data);
     } else {
         $sdf = $data;
         //$sdf['status'] = 'ready';
     }
     // 保存支付信息(可能是退款信息)
     $is_succ = parent::save($sdf);
     return $is_succ;
 }
示例#2
0
 /**
  * 模板统一保存的方法
  * @params array - 需要保存的支付信息
  * @params boolean - 是否需要强制保存
  * @return boolean - 保存的成功与否的进程
  */
 public function save($data, $mustUpdate = null)
 {
     // 异常处理
     if (!isset($data) || !$data || !is_array($data)) {
         trigger_error("支付单信息不能为空!", E_USER_ERROR);
         exit;
     }
     $sdf = array();
     // 支付数据列表
     $background = true;
     //后台 todo
     $payment_data = $data;
     $sdf_payment = parent::dump($data['payment_id'], '*');
     if ($sdf_payment) {
         if ($sdf_payment['status'] == $data['status'] || $sdf_payment['status'] != 'progress' && $sdf_payment['status'] != 'ready') {
             return true;
         }
         if ($data['currency'] && $sdf_payment['currency'] != $data['currency']) {
             $msg = __('#支付货币和订单货币不一致');
             return false;
         }
     }
     if ($sdf_payment) {
         $sdf = array_merge($sdf_payment, $data);
     } else {
         $sdf = $data;
         $sdf['status'] = $sdf['status'] ? $sdf['status'] : 'ready';
     }
     // 保存支付信息(可能是退款信息)
     $is_succ = parent::save($sdf);
     return $is_succ;
 }
示例#3
0
 /**
  * 模板统一保存的方法
  * @params array - 需要保存的支付信息
  * @params boolean - 是否需要强制保存
  * @return boolean - 保存的成功与否的进程
  */
 public function save(&$data, $mustUpdate = null, $mustInsert = false)
 {
     // 异常处理
     if (!isset($data) || !$data || !is_array($data)) {
         trigger_error(app::get('ectools')->_("支付单信息不能为空!"), E_USER_ERROR);
         exit;
     }
     $sdf = array();
     // 支付数据列表
     $background = true;
     //后台 todo
     $payment_data = $data;
     $sdf_payment = parent::dump($data['payment_id'], '*', 'default');
     if ($sdf_payment) {
         if ($data['orders'][0]['rel_id'] && key($sdf_payment['orders']) != $data['orders'][0]['rel_id']) {
             return false;
         }
         if ($sdf_payment['status'] == $data['status'] || $sdf_payment['status'] != 'progress' && $sdf_payment['status'] != 'ready') {
             return true;
         }
         if ($data['currency'] && $sdf_payment['currency'] != $data['currency']) {
             return false;
         }
     }
     $sdf = $data;
     $sdf['status'] = $sdf['status'] ? $sdf['status'] : 'ready';
     // 保存支付信息(可能是退款信息)
     $is_succ = parent::save($sdf, $mustUpdate, $mustInsert);
     return $is_succ;
 }
示例#4
0
文件: cat.php 项目: noikiy/snk
 /**
  * 保存的方法
  * @param mixed 保存的数据内容
  * @return boolean
  */
 public function save(&$aData, $mustUpdate = null, $mustInsert = false)
 {
     $path = array();
     $parent_id = $aData['parent_id'];
     while ($parent_id) {
         if ($aData['cat_id'] && $aData['cat_id'] == $parent_id) {
             return false;
             break;
         }
         array_unshift($path, $parent_id);
         $row = $this->dump(array('cat_id' => $parent_id), 'parent_id, cat_path, p_order');
         $parent_id = $row['parent_id'];
     }
     $olddata = $this->getList('*', array('cat_id' => $aData['cat_id']));
     if ($olddata[0]['parent_id'] && $olddata[0]['parent_id'] != $aData['parent_id']) {
         $row = $this->getList('*', array('cat_id' => $olddata[0]['parent_id']));
         $oldSave['cat_id'] = $row[0]['cat_id'];
         $oldSave['child_count'] = $row[0]['child_count'] - 1;
         parent::save($oldSave);
     }
     $aData['cat_path'] = $this->getCatPath($aData['parent_id']);
     if ($aData['parent_id'] != 0) {
         $row = parent::dump($aData['parent_id']);
         $data['child_count'] = $row['child_count'] + 1;
         $data['cat_id'] = $aData['parent_id'];
         parent::save($data);
     }
     parent::save($aData);
     return $this->cat2json();
 }
示例#5
0
 function dump($filter, $field = '*', $subSdf = null)
 {
     $dumpData = parent::dump($filter, $field, $subSdf);
     //剔除非商品图片
     if (isset($dumpData['images']) && $dumpData['images']) {
         foreach ($dumpData['images'] as $key => $value) {
             if ($value['target_type'] != "goods") {
                 unset($dumpData['images'][$key]);
             }
         }
     }
     $oSpec = $this->app->model('specification');
     if ($dumpData['spec_desc'] && is_array($dumpData['spec_desc'])) {
         foreach ($dumpData['spec_desc'] as $specId => $spec) {
             $dumpData['spec'][$specId] = $oSpec->dump($specId, '*');
             foreach ($spec as $pSpecId => $specValue) {
                 $dumpData['spec'][$specId]['option'][$pSpecId] = array_merge(array('private_spec_value_id' => $pSpecId), $specValue);
             }
         }
     }
     unset($dumpData['spec_desc']);
     if ($dumpData['product']) {
         $aProduct = current($dumpData['product']);
         if (isset($aProduct['price']['price']['current_price'])) {
             $dumpData['current_price'] = $aProduct['price']['price']['current_price'];
         }
     } else {
         if ($dumpData['price']) {
             $dumpData['current_price'] = $dumpData['price'];
         }
     }
     return $dumpData;
 }
示例#6
0
 /**
  * 获得商店详情
  * 
  * @param   array   $param          参数
  * @param   number  $update_visit   是否更新访问,1->更新(默认), 其它 -> 不更新
  * @return  array
  */
 function getDetail($param = array(), $update_visit = 1)
 {
     $info = array();
     $shop_id = $param['shop_id'] ? $param['shop_id'] : 0;
     $member_id = $param['member_id'] ? $param['member_id'] : 0;
     if ($shop_id > 0 || $member_id > 0) {
         if ($shop_id) {
             $filter['shop_id'] = $param['shop_id'];
         }
         if ($member_id) {
             $filter['member_id'] = $param['member_id'];
         }
         $info = parent::dump($filter);
         // 添加商品访问
         if ($info['is_open'] == 1) {
             if ($update_visit == 1) {
                 $_info = array('see_num' => $info['see_num'] + 1);
                 parent::update($_info, array('shop_id' => $info['shop_id']));
             }
             $_param = array('app' => 'microshop', 'ctl' => 'site_index', 'full' => 1, 'act' => 'detail', 'arg0' => $info['shop_id']);
             $info['shop_link'] = app::get('site')->router()->gen_url($_param);
             $m_mdl = app::get('b2c')->model('members');
             $m_info = $m_mdl->dump($info['member_id']);
             $info['follow_num'] = $m_info['follow_num'];
             $info['fans_num'] = $m_info['follow_num'];
             $info['cover'] = $m_info['cover'] ? kernel::single('base_storager')->image_path($m_info['cover']) : $this->app->res_url . '/images/top-bg.png';
             $info['avatar'] = $m_info['avatar'] ? kernel::single('base_storager')->image_path($m_info['avatar']) : $this->app->res_url . '/images/top-bg.png';
             $info['info'] = $m_info['info'];
         }
     }
     return $info;
 }
示例#7
0
文件: goods.php 项目: syjzwjj/quyeba
 function dump($filter, $field = '*', $subSdf = null)
 {
     $dumpData =& parent::dump($filter, $field, $subSdf);
     $oSpec =& $this->app->model('specification');
     if ($dumpData['spec_desc'] && is_array($dumpData['spec_desc'])) {
         foreach ($dumpData['spec_desc'] as $specId => $spec) {
             $dumpData['spec'][$specId] = $oSpec->dump($specId, '*');
             foreach ($spec as $pSpecId => $specValue) {
                 $dumpData['spec'][$specId]['option'][$pSpecId] = array_merge(array('private_spec_value_id' => $pSpecId), $specValue);
             }
         }
     }
     unset($dumpData['spec_desc']);
     if ($dumpData['product']) {
         $aProduct = current($dumpData['product']);
         if (isset($aProduct['price']['price']['current_price'])) {
             $dumpData['current_price'] = $aProduct['price']['price']['current_price'];
         }
     } else {
         if ($dumpData['price']) {
             $dumpData['current_price'] = $dumpData['price'];
         }
     }
     return $dumpData;
 }
示例#8
0
 function dump($filter, $field = '*', $subSdf = null)
 {
     if ($ret = parent::dump($filter, $field, $subSdf)) {
         $ret['profile']['birthday'] = $ret['b_year'] . '-' . $ret['b_month'] . '-' . $ret['b_day'];
         $ret['profile']['gender'] = $ret['profile']['gender'] == 1 ? 'male' : 'female';
     }
     return $ret;
 }
示例#9
0
文件: tmpl.php 项目: 453111208/bbc
 function dump($filter, $field = '*', $subSdf = null)
 {
     $dumpData =& parent::dump($filter, $field, $subSdf);
     $obj_themes_file = app::get('site')->model('themes_file');
     if ($dumpData['rel_file_id']) {
         $themes_file_content = $obj_themes_file->getList('content', array('id' => $dumpData['rel_file_id']));
         $dumpData['content'] = $themes_file_content['0']['content'];
     }
     return $dumpData;
 }
示例#10
0
 function save($aData)
 {
     $aData['cat_path'] = $this->getCatPath($aData['parent_id']);
     if ($aData['parent_id'] != 0) {
         $row = parent::dump($aData['parent_id']);
         $data['child_count'] = $row['child_count'] + 1;
         $data['cat_id'] = $aData['parent_id'];
         parent::save($data);
     }
     return parent::save($aData);
 }
示例#11
0
 function dump($filter, $field = '*', $subSdf = null)
 {
     $rs = parent::dump($filter, $field, $subSdf);
     $oMlv = $this->app->model('member_lv');
     $memLv = $oMlv->dump($filter['level_id']);
     $price = $this->db->selectrow('SELECT price FROM sdb_b2c_products WHERE product_id = ' . intval($filter['product_id']));
     $price = $price['price'];
     if ($rs) {
         $rs['title'] = $memLv['name'];
         $rs['custom'] = 'true';
     } else {
         $rs = array('level_id' => $filter['level_id'], 'price' => $memLv['dis_count'] > 0 ? $memLv['dis_count'] * $price : $price, 'title' => $memLv['name'], 'custom' => 'false');
     }
     return $rs;
 }
示例#12
0
 function dump($filter, $field = '*', $subSdf = null)
 {
     $rs = parent::dump($filter, $field, $subSdf);
     $oMlv =& $this->app->model('member_lv');
     $oPro =& $this->app->model('products');
     $memLv = $oMlv->dump($filter['level_id']);
     $price = $oPro->dump($filter['product_id'], 'price');
     $price = $price['price']['price']['price'];
     if ($rs) {
         $rs['title'] = $memLv['name'];
         $rs['custom'] = 'true';
     } else {
         $rs = array('level_id' => $filter['level_id'], 'price' => $memLv['dis_count'] > 0 ? $memLv['dis_count'] * $price : $price, 'title' => $memLv['name'], 'custom' => 'false');
     }
     return $rs;
 }
示例#13
0
 function dump($filter, $field = '*', $subSdf = null)
 {
     $data = parent::dump($filter, $field, $subSdf);
     if (!isset($this->site_member_lv_id)) {
         $ctlGoods = new b2c_ctl_site_product($this->app);
         $siteMember = $ctlGoods->get_current_member();
         $this->site_member_lv_id = $siteMember['member_lv'];
     }
     if (isset($data['price']) && $data['price'] && is_array($data['price']) && isset($data['price']['member_lv_price']) && $data['price']['member_lv_price'] && is_array($data['price']['member_lv_price'])) {
         if (array_key_exists('member_lv_price', $data['price']) && array_key_exists($this->site_member_lv_id, $data['price']['member_lv_price'])) {
             $data['price']['price']['current_price'] = $data['price']['member_lv_price'][$this->site_member_lv_id]['price'];
         } else {
             $data['price']['price']['current_price'] = $data['price']['price']['price'];
         }
     }
     return $data;
 }
示例#14
0
 function dump($filter, $field = '*', $subSdf = null)
 {
     if ($ret = parent::dump($filter, $field, $subSdf)) {
         $ret['profile']['birthday'] = $ret['b_year'] . '-' . $ret['b_month'] . '-' . $ret['b_day'];
         if ($ret['profile']['gender'] == 1) {
             $ret['profile']['gender'] = 'male';
         } elseif ($ret['profile']['gender'] == 0) {
             $ret['profile']['gender'] = 'female';
         } else {
             $ret['profile']['gender'] = 'no';
         }
     }
     if (intval($filter) == 0 || is_array($filter) && intval($filter['member_id']) == 0) {
         $ret['contact']['name'] = "匿名购买";
     }
     return $ret;
 }
示例#15
0
 function dump($filter, $field = '*', $subSdf = null)
 {
     $data = parent::dump($filter, $field, $subSdf);
     if (!isset($this->site_member_lv_id)) {
         $userObject = kernel::single('b2c_user_object');
         $siteMember = $userObject->get_members_data(array('members' => 'member_lv_id'));
         $this->site_member_lv_id = $siteMember['members']['member_lv_id'];
     }
     if (isset($data['price']) && $data['price'] && is_array($data['price']) && isset($data['price']['member_lv_price']) && $data['price']['member_lv_price'] && is_array($data['price']['member_lv_price'])) {
         if (array_key_exists('member_lv_price', $data['price']) && array_key_exists($this->site_member_lv_id, $data['price']['member_lv_price'])) {
             $data['price']['price']['current_price'] = $data['price']['member_lv_price'][$this->site_member_lv_id]['price'];
         } else {
             $data['price']['price']['current_price'] = $data['price']['price']['price'];
         }
     }
     return $data;
 }
示例#16
0
 function dump($filter, $field = '*', $subSdf = null)
 {
     if ($ret = parent::dump($filter, $field, $subSdf)) {
         $ret['profile']['birthday'] = $ret['b_year'] . '-' . $ret['b_month'] . '-' . $ret['b_day'];
         if ($ret['profile']['gender'] == 1) {
             $ret['profile']['gender'] = 'male';
         } elseif ($ret['profile']['gender'] == 0) {
             $ret['profile']['gender'] = 'female';
         } else {
             $ret['profile']['gender'] = 'no';
         }
     }
     if ($ret['contact']['name'] == "" || $ret['contact']['name'] == "null") {
         $list = app::get('pam')->model('account')->getList('login_name', array('account_id' => $filter['member_id']));
         $ret['contact']['name'] = $list[0]['login_name'] ? $list[0]['login_name'] : '匿名购买';
     }
     return $ret;
 }
示例#17
0
 function dump($filter, $field = '*', $subSdf = null)
 {
     $rs = parent::dump($filter, $field, $subSdf);
     if ($rs['spec_value']) {
         $tSpecValue = current($rs['spec_value']);
         if ($tSpecValue['p_order'] && $tSpecValue['spec_value_id']) {
             $specValue = array();
             foreach ($rs['spec_value'] as $k => $v) {
                 $specValue[$v['p_order']] = $v;
             }
             ksort($specValue);
             $rs['spec_value'] = array();
             foreach ($specValue as $vk => $vv) {
                 $rs['spec_value'][$vv['spec_value_id']] = $vv;
             }
         }
     }
     return $rs;
 }
示例#18
0
文件: cat.php 项目: syjzwjj/quyeba
 /**
  * 保存的方法
  * @param mixed 保存的数据内容
  * @return boolean
  */
 public function save(&$aData)
 {
     $path = array();
     $parent_id = $aData['parent_id'];
     while ($parent_id) {
         if ($aData['cat_id'] && $aData['cat_id'] == $parent_id) {
             return false;
             break;
         }
         array_unshift($path, $parent_id);
         $row = $this->dump(array('cat_id' => $parent_id), 'parent_id, cat_path, p_order');
         $parent_id = $row['parent_id'];
     }
     $aData['cat_path'] = $this->getCatPath($aData['parent_id']);
     if ($aData['parent_id'] != 0) {
         $row = parent::dump($aData['parent_id']);
         $data['child_count'] = $row['child_count'] + 1;
         $data['cat_id'] = $aData['parent_id'];
         parent::save($data);
     }
     parent::save($aData);
     return $this->cat2json();
 }
示例#19
0
文件: item.php 项目: 453111208/bbc
 function dump($filter, $field = '*', $subSdf = null)
 {
     $dumpData = parent::dump($filter, $field, $subSdf);
     $oSpec = app::get('syscategory')->model('props');
     if ($dumpData['spec_desc'] && is_array($dumpData['spec_desc'])) {
         foreach ($dumpData['spec_desc'] as $specId => $spec) {
             // $dumpData['spec'][$specId] = $oSpec->dump($specId,'*');
             $dumpData['spec'][$specId] = $oSpec->getRow('*', array('prop_id' => $specId));
             foreach ($spec as $pSpecId => $specValue) {
                 $dumpData['spec'][$specId]['option'][$pSpecId] = array_merge(array('private_spec_value_id' => $pSpecId), $specValue);
             }
         }
     }
     unset($dumpData['spec_desc']);
     return $dumpData;
 }
示例#20
0
 /**
  * 获得商品列表
  *
  * @param   array   $param          参数
  * @param   number  $update_visit   是否更新访问,1->更新(默认), 其它 -> 不更新
  * @return  array
  */
 function getSpecialInfo($param = array(), $update_visit = 1)
 {
     $info = array();
     if ($param['special_id']) {
         $filter = array('special_id' => $param['special_id']);
         $info = parent::dump($filter);
         $_param = array('app' => 'microshop', 'ctl' => 'site_index', 'full' => 1, 'act' => 'special', 'arg0' => $param['special_id']);
         $info['special_url'] = app::get('site')->router()->gen_url($_param);
         // 验证商店是否关闭
         $s_mdl = $this->app->model('shop');
         $_filter = array('shop_id' => $info['shop_id']);
         $s_info = $s_mdl->getDetail($_filter, 2);
         $info['shop_open'] = $s_info['is_open'];
         if ($info['shop_open'] != 1) {
             return $info;
         }
         // 专辑访问添加
         if ($update_visit == 1) {
             $_info = array('see_num' => $info['see_num'] + 1);
             parent::update($_info, $filter);
         }
         // 获得商品信息
         $mdl = $this->app->model('special_products');
         $page = intval($param['page']);
         $page = $page ? $page : 1;
         $limit = $param['limit'] ? $param['limit'] : 20;
         $offset = ($page - 1) * $limit;
         $offset = $offset > 0 ? $offset : 0;
         $orderby = $param['orderby'] ? $param['orderby'] : 'addtime DESC';
         $fields = $param['fields'] ? $param['fields'] : '*';
         $count = $mdl->count($filter);
         $list = array();
         if ($count > 0) {
             $list = $mdl->getList($fields, $filter, $offset, $limit, $orderby);
         }
         $platform = $param['platform'] ? $param['platform'] : 'wap';
         if ($list) {
             $p_mdl = app::get('b2c')->model('products');
             $g_mdl = app::get('b2c')->model('goods');
             $p_ids = array();
             foreach ($list as $v) {
                 $p_ids[] = $v['product_id'];
             }
             if ($p_ids) {
                 // 获得产品列表
                 $products = $p_mdl->getList('*', array('product_id' => $p_ids, 'marketable' => 'true'));
                 if ($products) {
                     $g_ids = array();
                     foreach ($products as $k => $v) {
                         $g_ids[$v['goods_id']] = $v['goods_id'];
                     }
                     $good_ids = array_values($g_ids);
                     // 获得商品图片
                     $img_arr = $g_mdl->getList('image_default_id, goods_id', array('goods_id' => $good_ids));
                     // 构造产品图片数据
                     foreach ($products as $k => $v) {
                         $products[$k]['title'] = $v['name'];
                         foreach ($img_arr as $val) {
                             if ($val['goods_id'] == $v['goods_id']) {
                                 $img_id = $val['image_default_id'];
                                 $products[$k]['images'] = array('big_url' => kernel::single('base_storager')->image_path($img_id, 'l'), 'thisuasm_url' => kernel::single('base_storager')->image_path($img_id, 'm'), 'small_url' => kernel::single('base_storager')->image_path($img_id, 's'));
                                 $products[$k]['image_default_id'] = $img_id;
                             }
                         }
                     }
                     // 获得商品收藏
                     $fav_arr = app::get('b2c')->model('member_goods')->getList('goods_id', array('goods_id' => $good_ids, 'type' => 'fav'));
                     // 构造产品收藏数据
                     foreach ($products as $k => $v) {
                         $products[$k]['fav_num'] = $products[$k]['fav_num'] ? $products[$k]['fav_num'] : 0;
                         foreach ($fav_arr as $val) {
                             if ($val['goods_id'] == $v['goods_id']) {
                                 $products[$k]['fav_num'] += 1;
                             }
                         }
                     }
                     // 将产品数据放入到列表中
                     foreach ($list as $k => $v) {
                         foreach ($products as $val) {
                             if ($val['product_id'] == $v['product_id']) {
                                 $list[$k]['detail'] = $val;
                             }
                         }
                         $v['platform'] = $platform;
                         $list[$k]['buy_url'] = $this->getBuyUrl($v);
                         $list[$k]['buy_code'] = $this->getBuyCode($v);
                     }
                 }
             }
         }
         $info['products'] = $list;
         $info['products_count'] = $count;
     }
     return $info;
 }
示例#21
0
文件: ref.php 项目: syjzwjj/quyeba
 public function dump2dump($filter, $field = '*', $subSdf = null)
 {
     return parent::dump($filter, $field, $subSdf);
 }
示例#22
0
 function dump($filter, $field = '*', $subSdf = null)
 {
     $subSdf = array_merge((array) $subSdf, array('props' => array('*', array('props_value' => array('*')))));
     $rs = parent::dump($filter, $field, $subSdf);
     $props = array();
     if ($rs['props']) {
         foreach ($rs['props'] as $k => $v) {
             $props[$v['goods_p']] = $v;
             if ($v['props_value']) {
                 foreach ($v['props_value'] as $vk => $vv) {
                     $props[$v['goods_p']]['options'][$vv['props_value_id']] = $vv['name'];
                     $props[$v['goods_p']]['optionAlias'][$vv['props_value_id']] = $vv['alias'];
                 }
             }
             unset($props[$v['goods_p']]['props_value']);
         }
         unset($rs['props']);
         $rs['props'] = $props;
     }
     return $rs;
 }
示例#23
0
 /**
  *  得到货品信息
  * @param $orderid
  * @param $goodsbn
  * @return array 货品信息数组
  */
 public function getProductInfo($orderid, $goodsbn)
 {
     $aOrder = parent::dump($orderid, 'member_id');
     $mdl_goods = $this->app->model('goods');
     $mdl_products = $this->app->model('products');
     $subsdf = array('product' => array('*'));
     $filter = array('bn' => $goodsbn, 'marketable' => 'true');
     $goods = $mdl_goods->getList('*', $filter);
     $goods = $goods[0];
     $aProduct = $mdl_products->getList('*', array('goods_id' => $goods['goods_id'], 'bn' => $goodsbn));
     $aProduct = $aProduct[0];
     if (!$aProduct['product_id']) {
         return 'none';
     }
     if ($goods['nostore_sell'] == '0' && !is_null($aProduct['store']) && $aProduct['store'] - intval($aProduct['freez']) < 1) {
         return 'understock';
     }
     if ($aOrder['member_id']) {
         $oMember = $this->app->model('members');
         $aMember = $oMember->dump($aOrder['member_id'], 'member_lv_id');
         $mdl_goods_lv_price = $this->app->model('goods_lv_price');
         $filter = array('product_id' => $aProduct['product_id'], 'level_id' => intval($aMember['member_lv_id']));
         $mPrice = $mPrice[0];
         if (!$mPrice['mprice']) {
             $mPrice['mprice'] = $aProduct['price'];
         }
     } else {
         $oLevel = $this->app->model('member_lv');
         $aLevel = $oLevel->getList('dis_count', array('default_lv' => 1));
         $mPrice['mprice'] = $aProduct['price'] * ($aLevel[0]['dis_count'] ? $aLevel[0]['dis_count'] : 1);
     }
     $except_obj_id = array();
     $obj_order_object = $this->app->model('order_objects');
     $arr_order_object = $obj_order_object->getList('obj_id,obj_type', array('order_id' => $orderid));
     if ($arr_order_object) {
         foreach ($arr_order_object as $str_order_object) {
             if ($str_order_object['obj_type'] != 'goods' && $str_order_object['obj_type'] != 'gift') {
                 $except_obj_id[] = $str_order_object['obj_id'];
             }
         }
     }
     $mdl_order_items = $this->app->model('order_items');
     $order_items = $mdl_order_items->getList('*', array('order_id' => $orderid, 'product_id' => $aProduct['product_id'], 'item_type' => 'product', 'obj_id|notin' => $except_obj_id));
     if ($order_items) {
         return 'exist';
     }
     return array_merge($aProduct, $mPrice);
 }
示例#24
0
 /**
  *  得到货品信息
  * @param $orderid
  * @param $goodsbn
  * @return array 货品信息数组
  */
 public function getProductInfo($orderid, $goodsbn)
 {
     $aOrder = parent::dump($orderid, 'member_id');
     $mdl_goods = $this->app->model('goods');
     $mdl_products = $this->app->model('products');
     $subsdf = array('product' => array('*'));
     $filter = array('bn' => $goodsbn, 'marketable' => 'true');
     $goods = $mdl_goods->getList('*', $filter);
     $goods = $goods[0];
     $aProduct = $mdl_products->getList('*', array('goods_id' => $goods['goods_id'], 'bn' => $goodsbn));
     $aProduct = $aProduct[0];
     if (!$aProduct['product_id']) {
         return 'none';
     }
     $freezTime = $this->app->getConf('system.goods.freez.time');
     if ($freezTime == 0 && $aProduct['store'] - intval($aProduct['freez']) < 1) {
         return 'understock';
     }
     if ($aOrder['member_id']) {
         $oMember = $this->app->model('members');
         $aMember = $oMember->dump($aOrder['member_id'], 'member_lv_id');
         $mdl_goods_lv_price = $this->app->model('goods_lv_price');
         $filter = array('product_id' => $aProduct['product_id'], 'level_id' => intval($aMember['member_lv_id']));
         $mPrice = $mPrice[0];
         if (!$mPrice['mprice']) {
             $mPrice['mprice'] = $aProduct['price'];
         }
     } else {
         $oLevel = $this->app->model('member_lv');
         $aLevel = $oLevel->getList('dis_count', array('default_lv' => 1));
         $mPrice['mprice'] = $aProduct['price'] * ($aLevel[0]['dis_count'] ? $aLevel[0]['dis_count'] : 1);
     }
     $mdl_order_items = $this->app->model('order_items');
     $order_items = $mdl_order_items->getList('*', array('order_id' => $orderid, 'product_id' => $aProduct['product_id']));
     if ($order_items) {
         return 'exist';
     }
     return array_merge($aProduct, $mPrice);
 }
示例#25
0
 function dump($filter, $field = '*', $subSdf = null)
 {
     if ((strpos($field, '*') !== false || strpos($field, 'props') !== false) && !$subSdf['props']) {
         $subSdf = array_merge((array) $subSdf, array('props' => array('*', array('props_value' => array('*', null, array(0, -1, 'order_by ASC'))), array(0, -1, 'ordernum ASC'))));
     }
     $rs = parent::dump($filter, $field, $subSdf);
     $props = array();
     if ($rs['props']) {
         foreach ($rs['props'] as $k => $v) {
             $props[$v['goods_p']] = $v;
             if ($v['props_value']) {
                 foreach ($v['props_value'] as $vk => $vv) {
                     $props[$v['goods_p']]['options'][$vv['props_value_id']] = $vv['name'];
                     $props[$v['goods_p']]['optionAlias'][$vv['props_value_id']] = $vv['alias'];
                     $props[$v['goods_p']]['optionIds'][$vv['props_value_id']] = $vv['props_value_id'];
                 }
             }
             unset($props[$v['goods_p']]['props_value']);
         }
         unset($rs['props']);
         $rs['props'] = $props;
     }
     return $rs;
 }