示例#1
1
 /**
  * send
  * 必有方法,发送时调用.
  *
  * config参数为getOptions取得的所有项的配置结果
  *
  * @param mixed $target ['email']
  * @param mixed $title
  * @param mixed $config
  */
 public function send($target, $title, $content, $config)
 {
     logger::debug(__CLASS__ . var_export(func_get_args(), 1));
     $new_msg = array('member_id' => $target['member_id'], 'target' => $target['email'], 'subject' => $title, 'content' => $content, 'createtime' => time(), 'msg_type' => 'email', 'status' => 'sent');
     app::get('b2c')->model('member_msg')->save($new_msg);
     if (!($email_to = $target['email'])) {
         return false;
     }
     if ($config['sendway'] == 'mail') {
         $this->email = vmc::singleton('desktop_email_email');
     }
     $this->email->Sender = $this->Sender = $config['usermail'];
     $this->email->Subject = $this->Subject = $this->email->inlineCode($title);
     $From = $this->email->inlineCode(app::get('site')->getConf('site_name')) . '<' . $config['usermail'] . '>';
     $header = array('Return-path' => '<' . $config['usermail'] . '>', 'Date' => date('r'), 'From' => $From, 'MIME-Version' => '1.0', 'Subject' => $this->Subject, 'To' => $email_to, 'Content-Type' => 'text/html; charset=UTF-8; format=flowed', 'Content-Transfer-Encoding' => 'base64');
     $body = chunk_split(base64_encode($content));
     $header = $this->email->buildHeader($header);
     $config['sendway'] = $config['sendway'] ? $config['sendway'] : 'smtp';
     switch ($config['sendway']) {
         case 'sendmail':
             $result = $this->email->SendmailSend($email_to, $header, $body);
             break;
         case 'mail':
             $result = $this->email->MailSend($email_to, $header, $body);
             break;
         case 'smtp':
             $result = $this->email->SmtpSend($email_to, $header, $body, $config);
             break;
         default:
             $result = false;
             break;
     }
     return $result;
 }
示例#2
0
 /**
  * 退款单view 列表
  * @param null
  * @return null
  */
 public function _views()
 {
     $mdl_refunds = $this->app->model('refunds');
     $sub_menu = array(0 => array('label' => app::get('b2c')->_('退款中'), 'optional' => false, 'filter' => array('status' => array('progress'), 'disabled' => 'false')), 1 => array('label' => app::get('b2c')->_('失败'), 'optional' => false, 'filter' => array('status' => array('failed'), 'disabled' => 'false')), 2 => array('label' => app::get('b2c')->_('成功'), 'optional' => false, 'filter' => array('status' => array('succ'), 'disabled' => 'false')), 3 => array('label' => app::get('b2c')->_('全部'), 'optional' => false, 'filter' => array('disabled' => 'false')));
     if (isset($_GET['optional_view'])) {
         $sub_menu[$_GET['optional_view']]['optional'] = false;
     }
     foreach ($sub_menu as $k => $v) {
         if ($v['optional'] == false) {
             $show_menu[$k] = $v;
             if (is_array($v['filter'])) {
                 $v['filter'] = array_merge(array(), $v['filter']);
             } else {
                 $v['filter'] = array();
             }
             $show_menu[$k]['filter'] = $v['filter'] ? $v['filter'] : null;
             if ($k == $_GET['view']) {
                 $show_menu[$k]['newcount'] = true;
                 $show_menu[$k]['addon'] = $mdl_refunds->count($v['filter']);
             }
             $show_menu[$k]['href'] = 'index.php?app=ectools&ctl=admin_refund&act=index&view=' . $k . (isset($_GET['optional_view']) ? '&optional_view=' . $_GET['optional_view'] . '&view_from=dashboard' : '');
         } elseif ($_GET['view_from'] == 'dashboard' && $k == $_GET['view']) {
             $show_menu[$k] = $v;
         }
     }
     return $show_menu;
 }
示例#3
0
 /**
  * 结算明细
  * @return
  */
 public function detail()
 {
     $this->contentHeaderTitle = app::get('topshop')->_('企业结算明细');
     $filter['shop_id'] = $this->shopId;
     $postSend = input::get();
     if ($postSend['timearea']) {
         $pagedata['timearea'] = $postSend['timearea'];
         $timeArray = explode('-', $postSend['timearea']);
         $filter['settlement_time|than'] = strtotime($timeArray[0]);
         $filter['settlement_time|lthan'] = strtotime($timeArray[1]);
     } else {
         $filter['settlement_time|than'] = time() - 3600 * 24 * 7;
         $filter['settlement_time|lthan'] = time();
         $pagedata['timearea'] = date('Y/m/d', time() - 3600 * 24 * 7) . '-' . date('Y/m/d', time());
     }
     if ($postSend['settlement_type']) {
         $filter['settlement_type'] = $postSend['settlement_type'];
         $pagedata['settlement_type'] = $postSend['settlement_type'];
     }
     //处理翻页数据
     $pagedata['page'] = $page = $postSend['page'] ? $postSend['page'] : 1;
     $pagedata['limits'] = $pageLimit = 10;
     $objMdlSettleDetail = app::get('sysclearing')->model('settlement_detail');
     $pagedata['settlement_detail_list'] = $objMdlSettleDetail->getList('*', $filter, ($page - 1) * $pageLimit, $pageLimit, 'settlement_time desc');
     $count = $objMdlSettleDetail->count($filter);
     $postSend['token'] = time();
     if ($count > 0) {
         $total = ceil($count / $pageLimit);
     }
     $pagedata['pagers'] = array('link' => url::action('topshop_ctl_clearing_settlement@detail', $postSend), 'current' => $page, 'total' => $total, 'token' => $postSend['token']);
     return $this->page('topshop/clearing/settlement_detail.html', $pagedata);
 }
示例#4
0
文件: payment.php 项目: 453111208/bbc
 public function getPaymentId($filter)
 {
     $tids = $filter['tid'];
     if ($filter['tid'] && is_array($filter['tid'])) {
         $tids = implode(',', $filter['tid']);
     }
     $tradeParams = array('user_id' => $filter['user_id'], 'tid' => $tids, 'fields' => 'tid,payment,user_id,status');
     //获取需要支付的订单并检测其有效性
     $tradeList = app::get('topc')->rpcCall('trade.get.list', $tradeParams);
     $count = $tradeList['count'];
     $tradeList = $tradeList['list'];
     $countid = count($filter['tid']);
     if ($countid != $count) {
         throw new \LogicException(app::get('topc')->_("支付失败,提交的订单数据有误"));
         return false;
     }
     foreach ($tradeList as $key => $value) {
         if ($value['status'] != "WAIT_BUYER_PAY") {
             throw new \LogicException(app::get('topc')->_($value['tid'] . " 订单已被支付,请重新选择要支付订单"));
             return false;
         }
         $payment['money'] += $value['payment'];
         $payment['user_id'] = $value['user_id'];
     }
     $payment['tids'] = $tids;
     try {
         $paymentId = app::get('topc')->rpcCall('payment.bill.create', $payment);
     } catch (Exception $e) {
         throw $e;
     }
     return $paymentId;
 }
示例#5
0
文件: widgets.php 项目: 453111208/bbc
 function clear_by_app($app_id)
 {
     if (!$app_id) {
         return false;
     }
     app::get('desktop')->model('menus')->delete(array('app_id' => $app_id, 'menu_type' => $this->content_typename()));
 }
示例#6
0
 /**
  * 获取加密类型后的密文
  * @param string $source_str 加密明文
  * @return string 返回加密密文
  */
 public function get_encrypted($source_str, $account_type, $userdata = null)
 {
     if (!$userdata) {
         return md5($source_str);
     }
     if ($userdata['createtime']) {
         return $this->extends_md5($source_str, $userdata['login_name'], $userdata['createtime']);
     } else {
         if ($account_type == 'member') {
             $pam_members_model = app::get('pam')->model('members');
             $pam_filter = array('login_account' => $userdata['login_name']);
             $rows = $pam_members_model->getList('*', $pam_filter, 0, 1);
             // 商家 2015/8/31
         } else {
             if ($account_type == 'seller') {
                 $pam_model = app::get('pam')->model('seller');
                 $pam_filter = array('login_account' => $userdata['login_name']);
                 $rows = $pam_model->getList('*', $pam_filter, 0, 1);
             } else {
                 $pam_account_model = app::get('pam')->model('account');
                 $pam_filter = array('login_name' => $userdata['login_name'], 'account_type' => $account_type, 'disabled' => 'false');
                 $rows = $pam_account_model->getList('*', $pam_filter, 0, 1);
             }
         }
         if ($rows[0]) {
             if (substr($rows[0]['login_password'], 0, 1) !== 's') {
                 return md5($source_str);
             } else {
                 return $this->extends_md5($source_str, $userdata['login_name'], $rows[0]['createtime']);
             }
         } else {
             return false;
         }
     }
 }
示例#7
0
 public function update($params)
 {
     $db = app::get('sysaftersales')->database();
     $db->beginTransaction();
     try {
         $data['money'] = $params['money'];
         $data['cur_money'] = $params['cur_money'];
         $filter['payment_id'] = $params['payment_id'];
         $objMdlPayment = app::get('ectools')->model('payments');
         $objMdlPayBill = app::get('ectools')->model('trade_paybill');
         $result = $objMdlPayment->update($data, $filter);
         if (!$result) {
             throw new Exception('更新支付单失败');
         }
         $trade_own_money = json_decode($params['trade_own_money'], true);
         foreach ($trade_own_money as $key => $val) {
             $billdata['payment'] = $val;
             $billdata['modified_time'] = time();
             $billfilter['tid'] = $key;
             $billfilter['payment_id'] = $params['payment_id'];
             $result = $objMdlPayBill->update($billdata, $billfilter);
             if (!$result) {
                 throw new Exception('更新支付单失败');
             }
         }
         $db->commit();
     } catch (Exception $e) {
         $db->rollback();
         throw $e;
     }
     return true;
 }
示例#8
0
文件: get.php 项目: 453111208/bbc
 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;
 }
示例#9
0
 public static function get_last_modify()
 {
     if (!isset(self::$__last_modified)) {
         self::$__last_modified = app::get('wap')->getConf('widgets_css_last_modify');
     }
     return self::$__last_modified;
 }
示例#10
0
文件: server.php 项目: 453111208/bbc
 public function callback(&$recv)
 {
     $objMath = kernel::single('ectools_math');
     $money = $objMath->number_multiple(array($recv['orderAmount'], 0.01));
     $merid = $this->getConf('mer_id', substr(__CLASS__, 0, strrpos(__CLASS__, '_')));
     $mer_key = $this->getConf('mer_key', substr(__CLASS__, 0, strrpos(__CLASS__, '_')));
     $sign = $recv['signature'];
     $sign_method = $recv['signMethod'];
     $arrs = array("version" => $recv['version'], "charset" => $recv['charset'], "transType" => $recv['transType'], "respCode" => $recv['respCode'], "respMsg" => $recv['respMsg'], "merAbbr" => $recv['merAbbr'], "merId" => $recv['merId'], "orderNumber" => $recv['orderNumber'], "traceNumber" => $recv['traceNumber'], "traceTime" => $recv['traceTime'], "qid" => $recv['qid'], "orderAmount" => $recv['orderAmount'], "orderCurrency" => $recv['orderCurrency'], "respTime" => $recv['respTime'], "settleCurrency" => $recv['settleCurrency'], "settleDate" => $recv['settleDate'], "settleAmount" => $recv['settleAmount'], "exchangeDate" => $recv['exchangeDate'], "exchangeRate" => $recv['exchangeRate'], "cupReserved" => $recv['cupReserved']);
     $chkvalue = $this->sign($arrs, $sign_method, $mer_key);
     $ret['payment_id'] = $arrs['orderNumber'];
     $ret['account'] = $arrs['merId'];
     $ret['bank'] = app::get('ectools')->_('银联');
     $ret['pay_account'] = app::get('ectools')->_('付款帐号');
     $ret['currency'] = 'CNY';
     $ret['money'] = $money;
     $ret['paycost'] = '0.000';
     $ret['cur_money'] = $money;
     $ret['tradeno'] = $recv['traceNumber'];
     // $ret['t_payed'] = strtotime($recv['settleDate']) ? strtotime($recv['settleDate']) : time();
     $ret['t_payed'] = time();
     $ret['pay_app_id'] = 'unionpay';
     $ret['pay_type'] = 'online';
     $ret['memo'] = 'unionpay';
     if ($sign == $chkvalue && $recv['respCode'] == 00) {
         $ret['status'] = 'succ';
     } else {
         $ret['status'] = 'failed';
     }
     return $ret;
 }
示例#11
0
 /**
  * 获取单笔交易数据
  *
  * @param array $params 接口传入参数
  * @return array
  */
 public function getData($params, $oauth)
 {
     if (isset($oauth['shop_id'])) {
         $filter['shop_id'] = $oauth['shop_id'];
     } else {
         if ($params['oauth']['account_id'] && $params['oauth']['auth_type'] == "member") {
             $filter['user_id'] = $params['oauth']['account_id'];
         } elseif ($params['oauth']['account_id'] && $params['oauth']['auth_type'] == "shop") {
             $sellerId = $params['oauth']['account_id'];
             $filter['shop_id'] = app::get('systrade')->rpcCall('shop.get.loginId', array('seller_id' => $this->sellerId), 'seller');
         }
     }
     if ($params['oid']) {
         $params['oid'] = explode(',', $params['oid']);
     }
     $tradeInfo = kernel::single('systrade_getTradeData')->getTradeInfo($params['fields'], $params['tid'], $params['oid'], $filter);
     if ($tradeInfo['dlytmpl_id']) {
         $dlytmpl = app::get('systrade')->rpcCall('logistics.dlytmpl.get', ['template_id' => $tradeInfo['dlytmpl_id'], 'fields' => 'corp_id,name']);
         $corptmpl = app::get('systrade')->rpcCall('logistics.dlycorp.get', ['corp_id' => $dlytmpl['corp_id'], 'fields' => 'corp_code,corp_name']);
         $tradeInfo['dlytmpl_name'] = $dlytmpl['name'];
         $tradeInfo['corptmpl_name'] = $corptmpl['corp_name'];
         $tradeInfo['corptmpl_code'] = $corptmpl['corp_code'];
     }
     //这里判断货到付款
     //现在判断货到付款在订单里没有字段标示,所以采用两个字段相结合,就是支付为线下支付且订单状态是待支付的时候,就判断为货到付款
     if ($tradeInfo['pay_type'] == "offline" && $tradeInfo['type'] == "WAIT_SELLER_SEND_GOODS") {
         $tradeInfo['is_cod'] = "true";
     } else {
         $tradeInfo['is_cod'] = "false";
     }
     $tradeInfo = $this->__paramsToString($tradeInfo);
     return $tradeInfo;
 }
示例#12
0
 function _process($all_settings)
 {
     $setting = new base_setting($this->app);
     $setlib = $setting->source();
     $typemap = array(SET_T_STR => 'text', SET_T_INT => 'number', SET_T_ENUM => 'select', SET_T_BOOL => 'bool', SET_T_TXT => 'text', SET_T_FILE => 'file', SET_T_IMAGE => 'image', SET_T_DIGITS => 'number');
     $tabs = array_keys($all_settings);
     $html = $this->ui->form_start(array('tabs' => $tabs, 'method' => 'POST'));
     foreach ($tabs as $tab => $tab_name) {
         foreach ($all_settings[$tab_name] as $set) {
             $current_set = $this->app->getConf($set);
             if ($_POST['set'] && array_key_exists($set, $_POST['set'])) {
                 if ($current_set != $_POST['set'][$set]) {
                     $current_set = $_POST['set'][$set];
                     $this->app->setConf($set, $_POST['set'][$set]);
                 }
             }
             $input_type = $typemap[$setlib[$set]['type']];
             $form_input = array('title' => $setlib[$set]['desc'], 'type' => $input_type, 'name' => "set[" . $set . "]", 'tab' => $tab, 'value' => $current_set, 'options' => $setlib[$set]['options']);
             if ($input_type == 'image') {
                 $form_input = array_merge($form_input, array('width' => $setlib[$set]['width'], 'height' => $setlib[$set]['height']));
             }
             $html .= $this->ui->form_input($form_input);
         }
     }
     return $html .= $this->ui->form_end(1, app::get('ectools')->_('保存设置'));
 }
示例#13
0
 /**
  * 订单完成\归档.
  *
  * @param $sdf array 订单ID\操作者ID\操作者名称
  *
  * @return bool - 成功与否
  */
 public function generate($sdf, &$msg = '')
 {
     $mdl_order = app::get('b2c')->model('orders');
     $order_sdf = $mdl_order->dump($sdf['order_id']);
     //订单作废前验证
     foreach (vmc::servicelist('b2c.order.end.finish') as $service) {
         if (!$service->exec($order_sdf, $msg)) {
             return false;
         }
     }
     $order_sdf['status'] = 'finish';
     // 更新退款日志结果
     if ($mdl_order->save($order_sdf)) {
         //订单日志记录
         vmc::singleton('b2c_order_log')->set_operator(array('ident' => $sdf['op_id'] ? $sdf['op_id'] : $order_sdf['member_id'], 'model' => $sdf['op_id'] ? 'shopadmin' : 'members', 'name' => $sdf['op_name'] ? $sdf['op_name'] : '会员'))->set_order_id($order_sdf['order_id'])->success('finish', '订单已完成归档!', $order_sdf);
     } else {
         $msg = '完成\\归档失败!';
         return false;
     }
     //订单作废时同步扩展服务
     foreach (vmc::servicelist('b2c.order.end.finish') as $service) {
         if (!$service->exec($order_sdf, $msg)) {
             //记录日志,不中断
             logger::error($sdf['order_id'] . '完成归档时出错!' . $msg);
         }
     }
     return true;
 }
示例#14
0
 function get_view($ctl, $member_id = 0)
 {
     $payment_cfg = app::get('ectools')->model('payment_cfgs');
     $payments = array();
     $rePayment = $payment_cfg->getList('*', array('status' => 'true', 'is_frontend' => true));
     if (!$member_id) {
         $arr_members = $ctl->get_current_member();
         $member_id = $arr_members['member_id'];
     }
     if ($rePayment) {
         foreach ($rePayment as $key => $payment) {
             /*$payment_app = $payment_cfg->model($payment['app_id']);
               if($payment_app->is_ready()){
                   $payment['name'] = $payment_app->display_name;
                   $payment['extra'] = $payment_app->extend();
                   $payment['intro'] = $payment_app->intro();
                   $payments[] = $payment;
               }*/
             if (!$member_id) {
                 if (trim($payment['app_id']) == 'deposit') {
                     unset($rePayment[$key]);
                     continue;
                 }
             }
             $payments[] = $payment;
         }
         /*
                     foreach($payments as $k=>$v){
                         $class_name = $v['app_class'];
                         $app = new $class_name();
                     }*/
         $ctl->pagedata['payments'] =& $payments;
         return $ctl->fetch("site/common/paymethod.html");
     }
 }
示例#15
0
 static function bool(&$rows, $options = null)
 {
     $aBool = array(0 => app::get('base')->_('否'), 1 => app::get('base')->_('是'));
     foreach ($rows as $i => $v) {
         $rows[$i] = $aBool[$v];
     }
 }
示例#16
0
 public function save()
 {
     $this->begin();
     if (empty($_POST['content'])) {
         $this->end(false, app::get('weixin')->_('操作失败!内容不能为空'));
     }
     if (empty($_POST['name'])) {
         $this->end(false, app::get('weixin')->_('操作失败!消息名称不能为空'));
     }
     $_POST['content'] = trim($_POST['content']);
     if (strlen($_POST['content']) > 1200) {
         $this->end(false, app::get('weixin')->_('操作失败!内容不能超出1200字符'));
     }
     if ($row = app::get('weixin')->model('message_text')->getList('id', array('name' => $_POST['name']))) {
         if (!$_POST['id'] || $row[0]['id'] != intval($_POST['id'])) {
             $this->end(false, app::get('weixin')->_('操作失败!消息名称已存在'));
         }
     }
     $data = array('content' => trim(str_replace('&nbsp;', ' ', $_POST['content'])), 'name' => trim($_POST['name']), 'is_check_bind' => $_POST['is_check_bind']);
     if (isset($_POST['id']) && intval($_POST['id'])) {
         $data['id'] = intval($_POST['id']);
     }
     if (app::get('weixin')->model('message_text')->save($data)) {
         $this->end(true, app::get('weixin')->_('添加成功!'));
     } else {
         $this->end(true, app::get('weixin')->_('添加失败!'));
     }
 }
示例#17
0
 public function login($userData, $vcode = false, &$msg)
 {
     $userData = utils::_filter_input($userData);
     //过滤xss攻击
     if ($vcode && !$this->vcode_verify($vcode)) {
         $msg = app::get('pam')->_('验证码错误');
         return false;
     }
     //如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录)
     if (!$userData['login_type']) {
         $userPassport = kernel::single('b2c_user_passport');
         $userData['login_type'] = $userPassport->get_login_account_type($userData['login_account']);
     }
     $filter = array('login_type' => $userData['login_type'], 'login_account' => $userData['login_account']);
     $account = app::get('pam')->model('members')->getList('member_id,password_account,login_password,createtime', $filter);
     if (!$account) {
         $msg = app::get('pam')->_('用户名或密码错误');
         return false;
     }
     $login_password = pam_encrypt::get_encrypted_password($userData['login_password'], 'member', array('createtime' => $account[0]['createtime'], 'login_name' => $account[0]['password_account']));
     if ($account[0]['login_password'] != $login_password) {
         $msg = app::get('pam')->_('用户名或密码错误');
         return false;
     }
     return $account[0]['member_id'];
 }
示例#18
0
 function clear_by_app($app_id)
 {
     if (!$app_id) {
         return false;
     }
     app::get('site')->model('widgets')->delete(array('app' => $app_id));
 }
示例#19
0
文件: coupon.php 项目: 453111208/bbc
 public function getCouponCode($coupon_id, $user_id)
 {
     $objMdlUserCoupon = app::get('sysuser')->model('user_coupon');
     $couponNum = $objMdlUserCoupon->count(array('coupon_id' => $coupon_id, 'user_id' => $user_id));
     $oldQuantity = $couponNum ? $couponNum : 0;
     $userInfo = kernel::single('sysuser_passport')->memInfo($user_id);
     $apiData = array('gen_quantity' => 1, 'old_quantity' => $oldQuantity, 'coupon_id' => $coupon_id, 'grade_id' => $userInfo['grade_id']);
     $db = app::get('sysuser')->database();
     $transaction_status = $db->beginTransaction();
     try {
         if ($couponInfo = app::get('sysuser')->rpcCall('promotion.coupon.gencode', $apiData)) {
             $userCoupon['coupon_id'] = $coupon_id;
             $userCoupon['coupon_code'] = $couponInfo['coupon_code'];
             $userCoupon['user_id'] = $user_id;
             $userCoupon['obtain_desc'] = '免费领取';
             $userCoupon['shop_id'] = $couponInfo['shop_id'];
             $userCoupon['obtain_time'] = time();
             $userCoupon['used_platform'] = $couponInfo['used_platform'];
             if (!app::get('sysuser')->model('user_coupon')->save($userCoupon)) {
                 throw new \LogicException('优惠券保存失败');
             }
             $db->commit($transaction_status);
             return $couponInfo;
         } else {
             throw new \LogicException('生成优惠券号码失败');
         }
     } catch (Exception $e) {
         $db->rollback();
         throw $e;
     }
     return true;
 }
/**
 * ShopEx licence
 *
 * @copyright  Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
 * @license  http://ecos.shopex.cn/ ShopEx License
 */

function theme_widget_main_slide(&$setting,&$render){
    $setting['allimg']="";
    $setting['allurl']="";
    if($system->theme){
        $theme_dir = kernel::get_themes_host_url().'/'.$smarty->theme;
    }else{
        $theme_dir = kernel::get_themes_host_url().'/'.app::get('site')->getConf('current_theme');
    }
    if(!$setting['pic']){
        foreach($setting['img'] as $value){
            $setting['allimg'].=$rvalue."|";
            $setting['allurl'].=urlencode($value["url"])."|";
        }
    }else{
        foreach($setting['pic'] as $key=>$value){
            if($value['link']){
                if($value["url"]){
                    $value["linktarget"]=$value["url"];
                }
                $setting['allimg'].=$rvalue."|";
                $setting['allurl'].=urlencode($value["linktarget"])."|";
                $setting['pic'][$key]['link'] = str_replace('%THEME%',$theme_dir,$value['link']);
            }
        }
    }
    return $setting;
}
示例#21
0
文件: sync.php 项目: syjzwjj/quyeba
 public function command_sync_user()
 {
     //kernel::console_output = false;
     $http = kernel::single('base_httpclient');
     $response = $http->get(app::get('suitclient')->getConf('syncuser'));
     if ($response) {
         $server_users = json_decode($response);
         $model = app::get('pam')->model('account');
         $result = $model->getList('login_name', array('account_type' => 'shopadmin'));
         $client_user = array();
         foreach ($result as $value) {
             $client_user[] = $value['login_name'];
         }
         $model2 = app::get('desktop')->model('users');
         foreach ($server_users as $server_user) {
             if (!in_array($server_user, $client_user)) {
                 $user = array('name' => $server_user, 'status' => 1, 'super' => 0, 'disabled' => false, 'pam_account' => array('login_name' => $server_user, 'login_password' => md5(time() . rand()), 'account_type' => 'shopadmin'), 'roles' => array(array('role_id' => 1)));
                 $model2->save($user);
             }
         }
         kernel::log('同步成功');
         kernel::log('ok.');
         //不加 "ok."则会弹提示信息并不能自动关闭@lujy
     } else {
         kernel::log('同步失败或套件里没有用户');
         kernel::log('ok.');
     }
     exit;
 }
示例#22
0
 private function __run($shopItemData, $shopId, $itemId)
 {
     pamAccount::setAuthType('sysshop');
     pamAccount::setSession($shopId, 'test');
     $objMdlItemDesc = app::get('sysitem')->model('item_desc');
     $itemInfoDesc = $objMdlItemDesc->getRow("*", array('item_id' => $itemId));
     $update = [];
     if ($itemInfoDesc['pc_desc']) {
         $pcDesc = $this->__replaceHost($itemInfoDesc['pc_desc']);
         //$pcDesc = $this->__replaceHref($this->__replaceImage($itemInfoDesc['pc_desc']));
         if ($pcDesc != stripslashes($itemInfoDesc['pc_desc'])) {
             $update['pc_desc'] = $pcDesc;
         }
     }
     if ($itemInfoDesc['wap_desc']) {
         $wapDesc = $this->__replaceHost($itemInfoDesc['wap_desc']);
         //$wapDesc = $this->__replaceHref($this->__replaceImage($itemInfoDesc['wap_desc']));
         if ($wapDesc != stripslashes($itemInfoDesc['wap_desc'])) {
             $update['wap_desc'] = $wapDesc;
         }
     }
     if ($update) {
         $objMdlItemDesc->update($update, array('item_id' => $itemId));
     }
     return true;
 }
示例#23
0
    public function create($aData, $object = '')
    {
        // todo 2010-04-13 14:35 wubin
        // 通过$aStandard['default'] $aStandard['attribute'] 取出存在值
        // 要和dialog返回来的值做好对接 返回的数据加在原有数据后面
        // 过滤掉已存在的数....
        //$url = app::get('desktop')->router()->gen_url(array('app'=>'b2c', 'ctl'=>'admin_sales_goods', 'act'=>'goods_dialog', 'arg0'=>urlencode(serialize($table_info))));
        /**
                ob_start();
                app::get('b2c')->controller('admin_sales_goods')->get_defaine_dialog($aData, $table_info);
                $html = ob_get_contents();
                ob_end_clean();
        //*/
        /**/
        print_r($table_info);
        ob_start();
        app::get('b2c')->controller('admin_sales_goods')->pagedata['object'] = $object;
        app::get('b2c')->controller('admin_sales_goods')->pagedata['value'] = $aData['default'];
        app::get('b2c')->controller('admin_sales_goods')->pagedata['name'] = $aData['name'];
        app::get('b2c')->controller('admin_sales_goods')->display("admin/sales/dialog/index.html");
        $html = ob_get_clean();
        return $html;
        //*/
        return <<<EOF
            <a href="{$url}" onclick="return doTemplate(this, '{$aData['name']}[]');" >筛选</a>
            <div class="gridlist rows-body" id="div-dialog-data" >{$html}</div>
EOF;
    }
示例#24
0
文件: info.php 项目: 453111208/bbc
 /**
  * 资讯保存
  **/
 public function saveInfo()
 {
     $userId = userAuth::id();
     //$postData =utils::_filter_input(input::get());
     $postData = input::get();
     $postData['user_id'] = $userId;
     $postData['modified'] = time();
     $postData['pubtime'] = time();
     $postData['ifpub'] = 0;
     $postData["platform"] = 'pc';
     $userName = app::get('sysuser')->model('account');
     $infoName = $userName->getList(login_account, array('user_id' => $userId));
     $postData['source'] = $infoName[0]['login_account'];
     $postData["article_logo"] = $postData["article_logo"][0];
     try {
         $userMdlAddr = app::get('sysinfo')->model('article');
         $userMdlAddr->save($postData);
     } catch (Exception $e) {
         $msg = $e->getMessage();
         return $this->splash('error', null, $msg);
     } catch (\LogicException $e) {
         $msg = $e->getMessage();
         return $this->splash('error', null, $msg);
     }
     $url = url::action('topc_ctl_member_info@publishInfo');
     $msg = app::get('topc')->_('添加成功');
     return $this->splash('success', $url, $msg);
 }
示例#25
0
 public function getInfo($params)
 {
     $filter = array();
     $paymenList = array();
     $objPayment = kernel::single('ectools_data_payment');
     $row = $params['fields'];
     if ($params['payment_id']) {
         $filterBill['payment_id'] = $filter['payment_id'] = $params['payment_id'];
     }
     if ($params['tids']) {
         $filterBill['tid'] = explode(',', $params['tids']);
     }
     if ($params['status']) {
         $filter['status|in'] = explode(',', $params['status']);
     }
     if ($filter) {
         $objMdlPayment = app::get('ectools')->model('payments');
         $paymentBill = $objMdlPayment->getRow($row, $filter);
     }
     if ($filterBill) {
         $objMdlTradePaybill = app::get('ectools')->model('trade_paybill');
         $billList = $objMdlTradePaybill->getList('payment_id,tid,payment,status', $filterBill);
     }
     if ($paymentBill && $billList) {
         foreach ($billList as $val) {
             $paymentBill['trade'][$val['tid']] = $val;
         }
     }
     return $paymentBill;
 }
示例#26
0
 /**
  * 需要同步的数据
  */
 public function sync($request, $rpcService)
 {
     // $cnt    = kernel::single('b2c_shop')->getShopBindStatus();
     // if ( $cnt > 0 ) {
     if ($request['region_id']) {
         $obj_regions_op = kernel::service('ectools_regions_apps', array('content_path' => 'ectools_regions_operation'));
         if ($request['sync_type'] == 'del') {
             if ($request['region_id']) {
                 $obj_regions_op->toRemoveArea($request['region_id']);
             }
         } else {
             $ordernum = isset($request['ordernum']) ? $request['ordernum'] : 50;
             $package = $request['package'] ? $request['package'] : 'mainland';
             $data = array('region_id' => $request['region_id'], 'local_name' => $request['local_name'], 'ordernum' => $ordernum, 'package' => $package);
             if ($request['p_region_id']) {
                 $data['p_region_id'] = $request['p_region_id'];
             }
             $obj_regions_op->replaceDlArea($data, $msg);
         }
         $ret = array('code' => 1, 'msg' => app::get('ectools')->_('同步成功'));
     } else {
         $ret = array('code' => -1, 'msg' => app::get('ectools')->_('请确保地区ID'));
     }
     // } else {
     //     $ret    = array (
     //             'code'  => -2,
     //             'msg'   => app::get('ectools')->_('店铺未绑定无需同步'),
     //             );
     // }
     if ($ret['code'] < 0) {
         $rpcService->send_user_error($ret['code'], $ret['msg']);
     }
     return $ret;
 }
示例#27
0
 public function index()
 {
     $desktop_user = vmc::singleton('desktop_user');
     $menus = $desktop_user->get_work_menu();
     $user_id = $this->user->get_id();
     foreach ((array) $menus['workground'] as $key => $value) {
         //if($i++>$workground_count) break;
         $fav_menus[] = $key;
     }
     $this->pagedata['title'] = $title;
     $this->pagedata['title_desc'] = $title_desc;
     $this->pagedata['session_id'] = vmc::singleton('base_session')->sess_id();
     $this->pagedata['uname'] = $this->user->get_login_name();
     $this->pagedata['avatar'] = $this->user->get_avatar();
     $this->pagedata['is_super'] = $this->user->is_super();
     $this->pagedata['param_id'] = $user_id;
     $this->pagedata['menus'] = $menus;
     $this->pagedata['fav_menus'] = (array) $fav_menus;
     $this->pagedata['shop_base'] = vmc::base_url(1);
     $this->pagedata['shopadmin_dir'] = $_SERVER['REQUEST_URI'];
     // 桌面内容替换埋点
     foreach (vmc::servicelist('desktop_content') as $services) {
         if (is_object($services)) {
             if (method_exists($services, 'changeContent')) {
                 $services->changeContent(app::get('desktop'));
                 $services->changeContent($desktop_menu);
             }
         }
     }
     $this->display('index.html');
 }
示例#28
0
 function show($gid, $item = 'ask', $limit)
 {
     $objComment = kernel::single('b2c_message_disask');
     $aComment = $objComment->good_all_disask($gid, $item, 1, null, $limit);
     $memberInfo = kernel::single('b2c_frontpage')->get_current_member();
     $params['member_id'] = $memberInfo['member_id'];
     if (!$params['member_id']) {
         $aComment['setting']['login'] = '******';
     }
     $validate_type = $item == 'discuss' ? 'discussReply' : $item;
     // 评论回复/咨询/咨询回复的权限
     $aComment['setting']['power_status'] = kernel::single('b2c_message_disask')->toValidate($validate_type, $params, $message);
     $aComment['setting']['power_message'] = $message;
     if ($item == 'ask') {
         $aComment['gask_type'] = $objComment->gask_type($gid);
     } else {
         $point_status = app::get('b2c')->getConf('goods.point.status') ? app::get('b2c')->getConf('goods.point.status') : 'on';
         if ($point_status == 'on') {
             $objPoint = $this->app->model('comment_goods_point');
             $aComment['goods_point'] = $objPoint->get_single_point($gid);
             $aComment['total_point_nums'] = $objPoint->get_point_nums($gid);
             $aComment['_all_point'] = $objPoint->get_goods_point($gid);
         }
         $aComment['point_status'] = $point_status;
     }
     return $aComment;
 }
示例#29
0
文件: tagcols.php 项目: 453111208/bbc
 public function column_tag(&$colList, $list)
 {
     //todo  如果list为空则 retunn
     if (!$list) {
         return;
     }
     $idColumnKey = $list[0]['idColumn'];
     $appId = $list[0]['app_id'];
     $tagType = $list[0]['tag_type'];
     $list = utils::array_change_key($list, $idColumnKey);
     // 获取所有当前finder主键列表
     $relatedIds = array_keys(utils::array_change_key($list, $idColumnKey));
     $filter = array('rel_id' => $relatedIds, 'tag_type' => $tagType, 'app_id' => $appId);
     // 获取tag列表
     $tagRows = app::get('desktop')->model('tag_rel')->getList('tag_id, rel_id', $filter);
     /*-----start------>*/
     $tagIds = array_keys(utils::array_change_key($tagRows, 'tag_id'));
     if ($tagIds) {
         $tagList = app::get('desktop')->model('tag')->getList('*', array('tag_id' => $tagIds));
         $tagList = utils::array_change_key($tagList, 'tag_id');
     }
     /*<----end-------->*/
     foreach ($tagRows as $row) {
         $relatedRows[$row['rel_id']][] = $tagList[$row['tag_id']];
     }
     $i = 0;
     foreach ($relatedIds as $id) {
         $colList[$i] = $this->getColumnTagHtml($relatedRows[$id]);
         $i++;
     }
 }
示例#30
0
 public function sync($request, $rpcService)
 {
     if (!($data = unserialize($request['data']))) {
         return '没有数据';
     }
     $goodsModel = app::get('b2c')->model('goods');
     $productModel = app::get('b2c')->model('products');
     $data = unserialize($request['data']);
     if ($data['goods_id']) {
         unset($data['goods_id']);
         if ($goods = $goodsModel->dump(array('bn' => $data['bn']), 'goods_id')) {
             $data['goods_id'] = $goods['goods_id'];
             if ($goodsModel->update($data, array('goods_id' => $goods['goods_id']))) {
                 $params = $data;
                 $params['bn'] = $data['p_bn'];
                 $product = $productModel->dump(array('goods_id' => $params['goods_id'], 'bn' => $params['bn']), 'product_id');
                 if ($product['product_id']) {
                     unset($params['goods_id'], $params['last_modify'], $params['intro'], $params['modify_status'], $params['goods_status']);
                     $params['product_id'] = $product['product_id'];
                     if ($productModel->update($params, array('product_id' => $product['product_id']))) {
                         return '更新数据成功';
                     }
                 } else {
                     $rpcService->send_user_error('error', '更新ecstore product数据失败!');
                 }
             } else {
                 $rpcService->send_user_error('error', '更新ecstore goods数据失败!');
             }
         }
     } else {
         $goodsModel->save($data);
         return '更新数据成功';
     }
 }