Beispiel #1
0
 function save(&$sdf, $mustUpdate = null)
 {
     if (isset($sdf['member_id']) && !isset($sdf['pam_account']['account_id'])) {
         $sdf['pam_account']['account_id'] = $sdf['member_id'];
     }
     if (isset($sdf['profile']['gender'])) {
         if ($sdf['profile']['gender'] == 'male') {
             $sdf['profile']['gender'] = 1;
         } elseif ($sdf['profile']['gender'] == 'female') {
             $sdf['profile']['gender'] = 0;
         } else {
             unset($sdf['profile']['gender']);
         }
     }
     if (isset($sdf['profile']['birthday'])) {
         $data = explode('-', $sdf['profile']['birthday']);
         $sdf['b_year'] = intval($data[0]);
         $sdf['b_month'] = intval($data[1]);
         $sdf['b_day'] = intval($data[2]);
         unset($sdf['profile']['birthday']);
     }
     $sdf['contact']['addr'] = htmlspecialchars($sdf['contact']['addr']);
     parent::save($sdf);
     return true;
 }
Beispiel #2
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 #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;
 }
Beispiel #4
0
 function save(&$sdf, $mustUpdate = null)
 {
     if (isset($sdf['member_id']) && !isset($sdf['pam_account']['account_id'])) {
         $sdf['pam_account']['account_id'] = $sdf['member_id'];
     }
     if (isset($sdf['profile']['gender'])) {
         if ($sdf['profile']['gender'] == 'male') {
             $sdf['profile']['gender'] = 1;
         } elseif ($sdf['profile']['gender'] == 'female') {
             $sdf['profile']['gender'] = 0;
         } else {
             unset($sdf['profile']['gender']);
         }
     }
     if (isset($sdf['profile']['birthday']) && $sdf['profile']['birthday']) {
         $data = explode('-', $sdf['profile']['birthday']);
         $sdf['b_year'] = intval($data[0]);
         $sdf['b_month'] = intval($data[1]);
         $sdf['b_day'] = intval($data[2]);
         unset($sdf['profile']['birthday']);
     }
     $sdf['contact']['addr'] = htmlspecialchars($sdf['contact']['addr']);
     $info_object = kernel::service('sensitive_information');
     if (is_object($info_object)) {
         $info_object->opinfo($sdf, 'b2c_mdl_members', __FUNCTION__);
     }
     parent::save($sdf);
     #$this->save_member_info_kv($sdf['member_id']);
     return true;
 }
Beispiel #5
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;
 }
Beispiel #6
0
 public function save(&$data, $mustUpdate = null, $mustInsert = false)
 {
     if ($data['content']) {
         $data['content'] = base64_encode($data['content']);
     }
     return parent::save($data, $mustUpdate);
 }
Beispiel #7
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 #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
 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 #10
0
 function save(&$sdf, $mustUpdate = null, $mustInsert = false)
 {
     if (!isset($sdf['orders'])) {
         $sdf['orders'] = array(array('order_id' => $sdf['order_id'], 'items' => $sdf['delivery_items']));
     }
     $tmpvar = $sdf['orders'];
     foreach ($tmpvar as $k => $row) {
         $sdf['orders'][$k]['dlytype'] = 'delivery';
         $sdf['orders'][$k]['dly_id'] = $sdf['delivery_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'],'*',array('order_items'=>'*'));
                   if($sdf_order['ship_status'] == 1){
                       continue;
                   }
                   //todo 订单是否完全退货 
                   $data['ship_status'] = 1;
                   
                   $data['order_id'] = $sdf['order_id'];
                   $filter['order_id'] = $sdf['order_id'];
                   $orders = $this->app->model('orders');
                   $orders->update($data, $filter);
               }
           }*/
         return true;
     }
     return false;
 }
Beispiel #11
0
 function save(&$data, $mustUpdate = null, $mustInsert = false)
 {
     if ($data['custom'] == 'false') {
         return true;
     }
     parent::save($data, $mustUpdate);
 }
Beispiel #12
0
 public function save(&$sdf, $mustUpdate = null, $mustInsert = false)
 {
     if (isset($sdf['profile']['gender'])) {
         if ($sdf['profile']['gender'] === 'male') {
             $sdf['profile']['gender'] = 1;
         } elseif ($sdf['profile']['gender'] === 'female') {
             $sdf['profile']['gender'] = 0;
         } else {
             unset($sdf['profile']['gender']);
         }
     }
     if (isset($sdf['profile']['birthday']) && $sdf['profile']['birthday']) {
         $data = explode('-', $sdf['profile']['birthday']);
         $sdf['b_year'] = intval($data[0]);
         $sdf['b_month'] = intval($data[1]);
         $sdf['b_day'] = intval($data[2]);
         unset($sdf['profile']['birthday']);
     }
     $sdf['contact']['addr'] = htmlspecialchars($sdf['contact']['addr']);
     if (empty($sdf['member_lv']) || empty($sdf['member_lv']['member_group_id'])) {
         $sdf['member_lv']['member_group_id'] = $this->app->model('member_lv')->get_default_lv();
     }
     $info_object = vmc::service('sensitive_information');
     if (is_object($info_object)) {
         $info_object->opinfo($sdf, 'b2c_mdl_members', __FUNCTION__);
     }
     $flag = parent::save($sdf, $mustUpdate, $mustInsert);
     return $flag;
 }
Beispiel #13
0
 public function save(&$sdf, $mustUpdate = null, $mustInsert = false)
 {
     if (!$sdf['comment_id']) {
         $sdf['comment_id'] = $this->apply_id($sdf['comment_type'] ? $sdf['comment_type'] : 'comment');
     }
     $is_save = parent::save($sdf, $mustUpdate, $mustInsert);
     return $is_save;
 }
Beispiel #14
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 #15
0
 /**
  * 重载订单标准数据
  * @params array - standard data format
  * @params boolean 是否必须强制保存
  */
 public function save(&$sdf, $mustUpdate = null, $mustInsert = false)
 {
     $info_object = vmc::service('sensitive_information');
     if (is_object($info_object)) {
         $info_object->opinfo($sdf, 'b2c_mdl_orders', __FUNCTION__);
     }
     $is_save = parent::save($sdf, $mustUpdate, $mustInsert);
     return $is_save;
 }
Beispiel #16
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 #17
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 #18
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 #19
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 #20
0
 function save(&$data, $mustUpdate = null)
 {
     if ($data['spec_value']) {
         $i = 1;
         foreach ($data['spec_value'] as $k => $v) {
             $data['spec_value'][$k]['p_order'] = $i++;
         }
     }
     return parent::save($data, $mustUpdate);
 }
Beispiel #21
0
 function save(&$data, $mustUpdate = null, $mustInsert = false)
 {
     if ($data['area']) {
         $data['area'] = $data['area']['area_type'] . ':' . implode('/', $data['area']['sar']) . ':' . $data['area']['id'];
     }
     $info_object = kernel::service('sensitive_information');
     if (is_object($info_object)) {
         $info_object->opinfo($data, 'b2c_mdl_member_addrs', __FUNCTION__);
     }
     return parent::save($data, $mustUpdate);
 }
Beispiel #22
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);
 }
Beispiel #23
0
 function editUser(&$data)
 {
     if ($data['userpass']) {
         $data[':account@desktop']['login_password'] = pam_encrypt::make(trim($data['userpass']));
     }
     $data['pam_account']['account_type'] = pamAccount::getAuthType($this->app->app_id);
     $data['pam_account']['createtime'] = time();
     //return parent::save($data);
     parent::save($data);
     exit;
 }
Beispiel #24
0
 public function save(&$goods, $mustUpdate = null, $mustInsert = false)
 {
     //随机商品管理ID
     $rand_gid = 'v' . str_pad(substr(preg_replace('/[a-z]|4/', '', uniqid()), -6), 8, rand(10, 99), STR_PAD_BOTH);
     if (!$goods['gid']) {
         $goods['gid'] = $rand_gid;
     }
     is_array($goods['product']) or $goods['product'] = array();
     foreach ($goods['product'] as $pk => $pv) {
         if ($goods['goods_type']) {
             //product add goods_type default normal
             $goods['product'][$pk]['goods_type'] = $goods['goods_type'];
         }
         //随机货号
         if (!$pv['bn']) {
             $goods['product'][$pk]['bn'] = 'bn' . str_pad(preg_replace('/[a-z]/', '', substr(uniqid(), -5)), 7, time(), STR_PAD_BOTH);
         }
         $goods['product'][$pk]['name'] = $goods['name'];
     }
     #↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓记录编辑商品日志-start@lujy↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
     if ($obj_operatorlogs = vmc::service('operatorlog.goods')) {
         $addorrestore_goods_flag = false;
         if (empty($goods['goods_id'])) {
             //添加商品则为空
             $addorrestore_goods_flag = true;
             if (method_exists($obj_operatorlogs, 'new_goods')) {
                 $obj_operatorlogs->new_goods($goods['name']);
             }
         } else {
             //回收站恢复商品时判断
             $isindb = $this->getList('goods_id', array('goods_id' => $goods['goods_id']));
             if (!$isindb['0']['goods_id']) {
                 $addorrestore_goods_flag = true;
             }
         }
         if (isset($addorrestore_goods_flag) && !$addorrestore_goods_flag) {
             $olddata = app::get('b2c')->model('goods')->dump($goods['goods_id'], '*', 'default');
         }
     }
     #↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑记录编辑商品日志-end@lujy↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
     $rs = parent::save($goods, $mustUpdate);
     #↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓记录编辑商品日志-start@lujy↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
     if ($obj_operatorlogs = vmc::service('operatorlog.goods')) {
         if (method_exists($obj_operatorlogs, 'goods_log')) {
             if (isset($addorrestore_goods_flag) && !$addorrestore_goods_flag) {
                 $newdata = app::get('b2c')->model('goods')->dump($goods['goods_id'], '*', 'default');
                 $obj_operatorlogs->goods_log($newdata, $olddata);
             }
         }
     }
     #↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑记录编辑商品日志-end@lujy↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
     return $rs;
 }
Beispiel #25
0
 function save(&$data, $mustUpdate = null)
 {
     if (isset($data['spec_desc']) && $data['spec_desc'] && is_array($data['spec_desc']) && isset($data['spec_desc']['spec_value']) && $data['spec_desc']['spec_value']) {
         $data['spec_info'] = implode('、', (array) $data['spec_desc']['spec_value']);
     }
     if ($data['price']['member_lv_price']) {
         foreach ($data['price']['member_lv_price'] as $k => $v) {
             $data['price']['member_lv_price'][$k]['goods_id'] = $data['goods_id'];
         }
     }
     return parent::save($data, $mustUpdate);
 }
Beispiel #26
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'];
     }
     if (!$item['tag_fgcolor'] && $item['tag_bgcolor']) {
         $item['tag_fgcolor'] = '#' . $this->fgcolor(substr($item['tag_bgcolor'], 1));
     }
     if (!$item['tag_bgcolor'] && $item['tag_fgcolor']) {
         $item['tag_bgcolor'] = '#' . $this->fgcolor(substr($item['tag_fgcolor'], 1));
     }
     return parent::save($item);
 }
Beispiel #27
0
 function editUser(&$data)
 {
     if ($data['userpass']) {
         $data[':account@pam']['login_password'] = md5(trim($data['userpass']));
     }
     /*
      else{
          $data[':account@pam']['login_password'] = trim($data['oldpass']);
      }
     */
     $data['pam_account']['account_type'] = pam_account::get_account_type($this->app->app_id);
     $data['pam_account']['createtime'] = time();
     return parent::save($data);
 }
Beispiel #28
0
 public function save(&$aData, $mustUpdate = null, $mustInsert = false)
 {
     $default_lv_id = $this->get_default_lv();
     if (!$default_lv_id) {
         $aData['default_lv'] = 1;
     }
     if (isset($aData['point'])) {
         $aData['experience'] = $aData['point'];
     }
     if (isset($aData['experience'])) {
         $aData['point'] = $aData['experience'];
     }
     return parent::save($aData);
 }
Beispiel #29
0
 public function save(&$data, $mustUpdate = null, $mustInsert = false)
 {
     if ($bill = $this->dump($data['bill_id'])) {
         if ($bill['order_id'] && $bill['order_id'] != $data['order_id']) {
             return false;
         }
         if ($bill['status'] == $data['status'] || $bill['status'] != 'progress' && $bill['status'] != 'ready') {
             return true;
         }
     } else {
         $data['createtime'] = time();
     }
     return parent::save($data, $mustUpdate, $mustInsert);
 }
Beispiel #30
0
 public function save(&$data, $mustUpdate = null)
 {
     if (!isset($data['dt_discount']) || !$data['dt_discount']) {
         $data['dt_discount'] = '1.00';
     }
     if ($data['dt_useexp'] == 0) {
         //如果未使用公式则使用默认
         $data['dt_expressions'] = "{{w-0}-0.4}*{{{" . $data['firstunit'] . "-w}-0.4}+1}*fp*" . $data['dt_discount'] . "+ {{w-" . $data['firstunit'] . "}-0.6}*[(w-" . $data['firstunit'] . ")/" . $data['continueunit'] . "]*cp*" . $data['dt_discount'] . "";
     }
     $tmp_threshold = array();
     if ($data['is_threshold']) {
         if ($data['threshold'] && is_array($data['threshold'])) {
             foreach ($data['threshold'] as $key => $thres) {
                 if ($key - 1 < 0) {
                     $tmp_threshold[] = array('area' => array(0, $thres), 'first_price' => $data['firstprice'] ? $data['firstprice'] : 0, 'continue_price' => $data['continueprice'] ? $data['continueprice'] : 0);
                     if ($key + 1 > count($data['threshold']) - 1) {
                         $tmp_threshold[] = array('area' => array($thres, 0), 'first_price' => $data['after_firstunit'][$key] ? $data['after_firstunit'][$key] : 0, 'continue_price' => $data['after_continueunit'][$key] ? $data['after_continueunit'][$key] : 0);
                     } else {
                         $tmp_threshold[] = array('area' => array($thres, $data['threshold'][$key + 1]), 'first_price' => $data['after_firstunit'][$key] ? $data['after_firstunit'][$key] : 0, 'continue_price' => $data['after_continueunit'][$key] ? $data['after_continueunit'][$key] : 0);
                     }
                 } elseif ($key + 1 > count($data['threshold']) - 1) {
                     $tmp_threshold[] = array('area' => array($thres, 0), 'first_price' => $data['after_firstunit'][$key] ? $data['after_firstunit'][$key] : 0, 'continue_price' => $data['after_continueunit'][$key] ? $data['after_continueunit'][$key] : 0);
                 } else {
                     $tmp_threshold[] = array('area' => array($thres, $data['threshold'][$key + 1]), 'first_price' => $data['after_firstunit'][$key] ? $data['after_firstunit'][$key] : 0, 'continue_price' => $data['after_continueunit'][$key] ? $data['after_continueunit'][$key] : 0);
                 }
             }
         }
     }
     $data['threshold'] = $tmp_threshold;
     if ($data['protect']) {
         $data['protect_rate'] = $data['protect_rate'] / 100;
     }
     $data['ordernum'] = intval($data['ordernum']);
     if ($data['area_fee_conf'] && is_array($data['area_fee_conf'])) {
         foreach ($data['area_fee_conf'] as $key => $value) {
             if ($value['dt_useexp'] == 0) {
                 //如果未使用公式则使用默认
                 if (!isset($value['dt_discount']) || !$value['dt_discount']) {
                     $value['dt_discount'] = '1.00';
                 }
                 $data['area_fee_conf'][$key]['dt_expressions'] = "{{w-0}-0.4}*{{{" . $data['firstunit'] . "-w}-0.4}+1}*fp*" . $value['dt_discount'] . "+ {{w-" . $data['firstunit'] . "}-0.6}*[(w-" . $data['firstunit'] . ")/" . $data['continueunit'] . "]*cp*" . $value['dt_discount'] . "";
             } else {
                 $data['area_fee_conf'][$key]['dt_expressions'] = $data['area_fee_conf'][$key]['expressions'];
             }
         }
     }
     $return = parent::save($data, $mustUpdate);
     return $return;
 }