Beispiel #1
0
 function save(&$sdf, $mustUpdate = null)
 {
     if (!isset($sdf['orders'])) {
         $sdf['orders'] = array(array('order_id' => $sdf['order_id'], 'items' => $sdf['items']));
     }
     $tmpvar = $sdf['orders'];
     foreach ($tmpvar as $k => $row) {
         $sdf['orders'][$k]['dlytype'] = 'reship';
         $sdf['orders'][$k]['dly_id'] = $sdf['reship_id'];
     }
     unset($tmpvar);
     if (parent::save($sdf)) {
         //一张发货单多个订单
         $oOrder =& $this->app->model('orders');
         foreach ($sdf['orders'] as $order) {
             if ($sdf['order_id']) {
                 $sdf_order = $oOrder->dump($order['order_id']);
                 if ($sdf_order['ship_status'] == 5) {
                     continue;
                 }
                 //todo 订单是否完全发货
                 $data['ship_status'] = 4;
                 $data['order_id'] = $sdf['order_id'];
                 $filter['order_id'] = $sdf['order_id'];
                 $orders =& $this->app->model('orders');
                 $orders->update($data, $filter);
             }
         }
     }
     return true;
 }
Beispiel #2
0
 function __construct($app)
 {
     parent::__construct($app);
     $db = app::get('system')->database();
     $db->exec('set SESSION autocommit=1;');
     $db->exec('set @msgID = -1;');
 }
Beispiel #3
0
 public function _filter($filter, $tableAlias = null, $baseWhere = null)
 {
     if (is_array($filter) && $filter['login_account']) {
         $tmpfilter['login_account'] = $filter['login_account'];
         unset($filter['login_account']);
     }
     if (is_array($filter) && $filter['email']) {
         $tmpfilter['email'] = $filter['email'];
         unset($filter['email']);
     }
     if (is_array($filter) && $filter['mobile']) {
         $tmpfilter['mobile'] = $filter['mobile'];
         unset($filter['mobile']);
     }
     if (is_array($filter) && $tmpfilter) {
         $aData = app::get('sysuser')->model('account')->getList('user_id', $tmpfilter);
         if ($aData) {
             foreach ($aData as $key => $val) {
                 $user[$key] = $val['user_id'];
             }
             $filter['user_id'] = $user;
         } else {
             $filter['user_id'] = '-1';
         }
     }
     $filter = parent::_filter($filter);
     return $filter;
 }
Beispiel #4
0
 public function save(&$data, $mustUpdate = null, $mustInsert = false)
 {
     if ($data['area_fee_conf'] && is_array($data['area_fee_conf'])) {
     }
     $return = parent::save($data, $mustUpdate);
     return $return;
 }
Beispiel #5
0
 function save(&$data, $mustUpdate = null, $mustInsert = false)
 {
     if ($data['custom'] == 'false') {
         return true;
     }
     parent::save($data, $mustUpdate);
 }
Beispiel #6
0
 function save(&$data, $mustUpdate = null)
 {
     if ($data['area']) {
         $data['area'] = $data['area']['area_type'] . ':' . implode('/', $data['area']['sar']) . ':' . $data['area']['id'];
     }
     return parent::save($data, $mustUpdate);
 }
Beispiel #7
0
 /**
  * 重写getList方法
  * @param string column
  * @param array filter
  * @param int offset
  * @param int limit
  * @param string order by
  */
 public function getList($cols = '*', $filter = array(), $offset = 0, $limit = -1, $orderType = null)
 {
     $recycle_permission = $filter['recycle_permission'];
     unset($filter['recycle_permission']);
     if ($recycle_permission && is_array($recycle_permission)) {
         if (strpos($cols, 'permission') === false) {
             $cols .= ',permission ';
         }
     }
     $ids = array();
     $res = app::get('base')->model('apps')->getList('app_id', array('status' => 'active'));
     foreach ($res as $res_v) {
         $ids[] = $res_v['app_id'];
     }
     $filter['app_key|in'] = $ids;
     $data = parent::getList($cols, $filter, $offset, $limit, $orderType);
     if ($recycle_permission && is_array($recycle_permission)) {
         $aTmp = array();
         $menus = $this->app->model('menus');
         $recycle = $this->app->model('recycle');
         foreach ($data as $k => $v) {
             $per_row = $menus->getList('menu_id', array('menu_type' => 'permission', 'permission' => $v['permission']));
             if (!$per_row || in_array($v['permission'], $recycle_permission)) {
                 $aTmp[$k] = $v;
             }
         }
         return $aTmp;
     } else {
         return $data;
     }
 }
Beispiel #8
0
 /**
  * 保存的方法
  * @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();
 }
Beispiel #9
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;
 }
Beispiel #10
0
 public function _filter($filter, $tableAlias = null, $baseWhere = null)
 {
     if (is_array($filter) && $filter['shop_name']) {
         $objMdlShop = app::get('sysshop')->model('shop');
         $adata = $objMdlShop->getList('shop_id', array('shop_name|has' => $filter['shop_name']));
         if ($adata) {
             foreach ($adata as $key => $value) {
                 $shop[$key] = $value['shop_id'];
             }
             $filter['shop_id'] = $shop;
         } else {
             $filter['shop_id'] = "-1";
         }
         unset($filter['shop_name']);
     }
     if (is_array($filter) && $filter['login_account']) {
         $aData = app::get('sysuser')->model('account')->getList('user_id', array('login_account' => $filter['login_account']));
         if ($aData) {
             foreach ($aData as $key => $val) {
                 $user[$key] = $val['user_id'];
             }
             $filter['user_id'] = $user;
         } else {
             $filter['user_id'] = '-1';
         }
         unset($filter['login_account']);
     }
     $filter = parent::_filter($filter, $tableAlias, $baseWhere);
     return $filter;
 }
Beispiel #11
0
 public function update($params, $filter)
 {
     $params = $this->valid_update($params);
     if (!$params) {
         return false;
     }
     return parent::update($params, $filter);
 }
Beispiel #12
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;
 }
Beispiel #13
0
 public function _filter($filter, $tableAlias = null, $baseWhere = null)
 {
     if (is_array($filter) && !$filter['disabled']) {
         $filter['disabled'] = 0;
     }
     $filter = parent::_filter($filter, $tableAlias, $baseWhere);
     return $filter;
 }
Beispiel #14
0
 public function getList($cols = '*', $filter = 'null', $offset = 0, $limit = -1, $orderby = null)
 {
     $list = parent::getList($cols, $filter, $offset, $limit, $orderby);
     foreach ($list as $key => $row) {
         $list[$key]['content'] = base64_decode($row['content']);
     }
     return $list;
 }
Beispiel #15
0
 function save(&$item)
 {
     $list = parent::getList('*', array('tag_name' => $item['tag_name'], 'tag_type' => $item['tag_type'], 'app_id' => $item['app_id']));
     if ($list && count($list) > 0) {
         $item['tag_id'] = $list[0]['tag_id'];
     }
     parent::save($item);
 }
Beispiel #16
0
 /**
  * getList
  * @params string - 
  * @params array - 
  * @params ƫʼֵ
  * @params ƫλֵ
  * @params 
  */
 public function getList($cols = '*', $filter = array(), $offset = 0, $limit = -1, $orderby = null)
 {
     if ($filter) {
         return parent::getList($cols, $filter, $offset, $limit, $orderby);
     } else {
         return parent::getList($cols, null, $offset, $limit, $orderby);
     }
 }
Beispiel #17
0
 function save($aData)
 {
     $default_lv_id = $this->get_default_lv();
     /*
             if( $aData['member_lv_id'] && $default_lv_id && $aData['member_lv_id'] != $default_lv_id ){
                 $this->unset_default_lv($default_lv_id);
             }*/
     return parent::save($aData);
 }
Beispiel #18
0
 function getList($cols = '*', $filter = array(), $offset = 0, $limit = -1, $orderType = null)
 {
     $row = parent::getList($cols, $filter, $offset, $limit, $orderType);
     foreach ($row as $key => $val) {
         $val['type_name'] = $this->get_type_name($val['type_id']);
         $aData[] = $val;
     }
     return $aData;
 }
Beispiel #19
0
 public function getList($cols = '*', $filter = array(), $offset = 0, $limit = -1, $orderType = null)
 {
     $this->monitor_txt();
     $list = parent::getList($cols, $filter, $offset, $limit, $orderType);
     // foreach ($list as $key => &$value) {
     //     $value['flag'] = $this->app->res_url.'/misc/'.strtolower($value['ct_abbreviation']).'.png';
     // }
     return $list;
 }
Beispiel #20
0
 /**
  * 重写getlist方法,重写排序方式
  */
 public function getList($cols = '*', $filter = array(), $offset = 0, $limit = -1, $orderType = null)
 {
     if ($orderType) {
         $orderType .= ',ordernum ASC';
     } else {
         $orderType = 'ordernum ASC';
     }
     return parent::getList($cols, $filter, $offset, $limit, $orderType);
 }
Beispiel #21
0
 function save(&$item)
 {
     $list = parent::getList('*', array('tag_id' => $item['tag']['tag_id'], 'rel_id' => $item['rel_id']));
     if ($list && count($list) > 0) {
         $item = $list[0];
     } else {
         parent::save($item);
     }
 }
Beispiel #22
0
 /**
  * 重写getList方法
  * @param string column
  * @param array filter
  * @param int offset
  * @param int limit
  * @param string order by
  */
 public function getList($cols = '*', $filter = array(), $offset = 0, $limit = -1, $orderType = null)
 {
     $addrs_member = parent::getList($cols, $filter, $offset, $limit, $orderType);
     $info_object = kernel::service('sensitive_information');
     if (is_object($info_object)) {
         $info_object->opinfo($addrs_member, 'b2c_mdl_member_addrs', __FUNCTION__);
     }
     return $addrs_member;
 }
Beispiel #23
0
 function save(&$item, $mustUpdate = null, $mustInsert = false)
 {
     $list = parent::getList('*', array('tag_id' => $item['tag']['tag_id'], 'rel_id' => $item['rel_id']));
     if ($list && count($list) > 0) {
         $item = $list[0];
     } else {
         parent::save($item);
     }
 }
Beispiel #24
0
 public function delete($filter, $subSdf = 'delete')
 {
     if (parent::delete($filter)) {
         kernel::single('site_module_base')->create_site_config();
         return true;
     } else {
         return false;
     }
 }
Beispiel #25
0
 public function getList($cols = '*', $filter = array(), $offset = 0, $limit = -1, $orderType = null)
 {
     $user_id = $filter['user_id'];
     unset($filter['user_id']);
     if (!$filter['user_ident']) {
         $filter['user_ident'] = $this->getUserIdentMd5($user_id);
     }
     return parent::getList($cols, $filter, $offset, $limit, $orderType);
 }
Beispiel #26
0
 public function _filter($filter, $tableAlias = null, $baseWhere = null)
 {
     if ($filter['search_bind_name']) {
         $bindData = app::get('weixin')->model('bind')->getRow('id', array('name' => $filter['search_bind_name']));
         $filter['bind_id'] = $bindData['id'];
         unset($filter['search_bind_name']);
     }
     $filter = parent::_filter($filter);
     return $filter;
 }
Beispiel #27
0
 public function save(&$data, $mustUpdate = null, $mustInsert = false)
 {
     if ($data['member_id'] && $data['is_default'] == 'true') {
         $this->update(array('is_default' => 'false'), array('member_id' => $data['member_id']));
     }
     if (!isset($data['is_default']) || empty($data['is_default'])) {
         $data['is_default'] = 'false';
     }
     return parent::save($data, $mustUpdate = null, $mustInsert = false);
 }
Beispiel #28
0
 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;
 }
Beispiel #29
0
 public function _filter($filter)
 {
     if ($filter['timearea']) {
         $timeArray = explode('-', $filter['timearea']);
         $filter['settlement_time|than'] = strtotime($timeArray[0]);
         $filter['settlement_time|lthan'] = strtotime($timeArray[1]);
         unset($filter['timearea']);
     }
     return parent::_filter($filter);
 }
Beispiel #30
0
 public function delete($filter, $subSdf = 'delete')
 {
     $hasroleMdl = app::get('desktop')->model('hasrole');
     $roleId = $hasroleMdl->getList('role_id', array('role_id' => $filter['role_id']));
     if ($roleId) {
         $msg = "含有已被使用角色,不可以删除!";
         throw new \logicException($msg);
     }
     return parent::delete($filter);
 }