function command_dd() { $args = func_get_args(); $options = $this->get_options(); $dd = kernel::single('dev_docbuilder_dd'); if (empty($args)) { $dd->export(); } else { foreach ($args as $app_id) { $dd->export_tables($app_id); } } if ($filename = $options['result-file']) { ob_start(); $dd->output(); $out = ob_get_contents(); ob_end_clean(); if (!is_dir(dirname($filename))) { throw new Exception('cannot find the ' . dirname($filename) . 'directory'); } elseif (is_dir($filename)) { throw new Exception('the result-file path is a directory.'); } file_put_contents($options['result-file'], $out); echo 'data dictionary doc export success.'; } else { $dd->output(); } }
public function post_install() { kernel::log('Initial ectools'); kernel::single('base_initial', 'ectools')->init(); kernel::log('Initial Regions'); kernel::single('ectools_regions_mainland')->install(); }
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; }
/** * 获取单笔交易数据 * * @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; }
public function validate($cart_objects, &$condition) { $all = $condition['aggregator'] === 'all'; $true = (bool) $condition['value']; if (!isset($condition['conditions'])) { return true; } if (!is_array($condition['conditions'])) { return false; } foreach ($condition['conditions'] as $_cond) { if (!is_object($this->{$_cond}['type'])) { $this->{$_cond}['type'] = kernel::single($_cond['type']); } $oCond = $this->{$_cond}['type']; $validated = $oCond->validate($cart_objects, $_cond); // return boolean if ($all && $validated !== $true) { // 所有不符合 如果有一个满足返回false return false; } elseif (!$all && $validated === $true) { // 任意一条符合 则返回true return true; } } return $all ? true : false; }
private static function _get_obj($obj_name) { $_obj_name = self::$_widgets_conf[$obj_name]; $object_class = self::$_prefix . $_obj_name; $object = kernel::single($object_class); return $object; }
function detail_basic($id) { $arr = $this->app->model('sales_rule_goods')->dump($id); $render = $this->app->render(); //会员等级 if ($arr['member_lv_ids']) { $member_lv_id = explode(',', $arr['member_lv_ids']); $member = $this->app->model('member_lv')->getList('*', array('member_lv_id' => $member_lv_id)); if (count($member_lv_id) > count($member)) { $member[] = array('name' => '非会员'); } $render->pagedata['member'] = $member; } //过滤条件 if ($arr['conditions']) { if ($arr['c_template']) { $render->pagedata['conditions'] = kernel::single($arr['c_template'])->tpl_name; } } //优惠方案 if ($arr['action_solution']) { if ($arr['s_template']) { $render->pagedata['action_solution'] = kernel::single($arr['s_template'])->name; } } $render->pagedata['rules'] = $arr; return $render->fetch('admin/sales/finder/goods.html'); }
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; }
public function layout() { $article_id = $this->_request->get_get('article_id'); $this->pagedata['layouts'] = kernel::single('content_article_single')->get_layout_list(); $this->pagedata['article_id'] = $article_id; $this->display('admin/article/single/layout.html'); }
/** * ShopEx licence * * @copyright Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn) * @license http://ecos.shopex.cn/ ShopEx License */ function theme_widget_footer_information(&$setting,&$smarty){ $setting['order'] or $setting['order'] = 'desc'; $setting['order_type'] or $setting['order_type'] = 'pubtime'; $orderby = $setting['order_type'].' '.$setting['order']; $func = array('asc'=>'ksort','desc'=>'krsort'); $oMAI = app::get('content')->model('article_indexs'); $filter['ifpub'] = 'true'; $filter['pubtime|lthan'] = time(); $filter['article_id'] = $setting['article_id']; $arr = $oMAI->getList('*',$filter,0,-1,$orderby); $tmp['indexs'] = $arr; $tmp['__stripparenturl'] = $setting['stripparenturl']; $nodeItem= kernel::single('content_article_node')->get_node($setting['node_id']); $tmp['node_name'] = $nodeItem['node_name']; if( $tmp['homepage']=='true' ) $tmp['node_url'] = app::get('site')->router()->gen_url( array('app'=>'content', 'ctl'=>'site_article', 'act'=>'i', 'arg0'=>$setting['node_id']) ); else $tmp['node_url'] = app::get('site')->router()->gen_url( array('app'=>'content', 'ctl'=>'site_article', 'act'=>'l', 'arg0'=>$setting['node_id']) ); return $tmp; }
function post_install() { kernel::log('Initial themes'); kernel::single('site_theme_base')->set_last_modify(); kernel::single('site_theme_install')->initthemes(); $themes = kernel::single('site_theme_install')->check_install(); }
/** * 实例化存储方式类 */ private function _instance() { $params = $this->storage_policy(); $obj_name = 'importexport_policy_' . $params['policy']; $this->policy_obj = kernel::single($obj_name); return true; }
public function cancelTrade($params) { if ($params['oauth']['account_id'] && $params['oauth']['auth_type'] == "member") { $params['user_id'] = $params['oauth']['account_id']; } elseif ($params['oauth']['account_id'] && $params['oauth']['auth_type'] == "shop") { $sellerId = $params['oauth']['account_id']; $params['shop_id'] = app::get('systrade')->rpcCall('shop.get.loginId', array('seller_id' => $sellerId), 'seller'); } $postData = array('filter' => array('tid' => $params['tid']), 'data' => array('status' => 'TRADE_CLOSED_BY_SYSTEM', 'end_time' => time(), 'cancel_reason' => $params['cancel_reason'])); if ($params['user_id']) { $postData['filter']['user_id'] = $params['user_id']; } if ($params['shop_id']) { $postData['filter']['shop_id'] = $params['shop_id']; } if ($params['oauth']['account_id']) { $postData['operator']['op_id'] = $params['oauth']['account_id']; $postData['operator']['op_account'] = $params['oauth']['account_name']; $postData['operator']['account_type'] = $params['oauth']['auth_type']; } try { kernel::single('systrade_data_trade_cancel')->generate($postData); } catch (Exception $e) { throw $e; } return true; }
protected function _init_aggregator() { if (is_null($this->_aAggregator)) { $aResult = array(); /* // 这里会产生死循环的递归操作 // 暂时使用kernel::servicelist 内部的代码进行处理 foreach(kernel::servicelist($this->aggregator_apps) as $object) { //if(get_class($this)) $aResult = array_merge($aResult,$object->getItem()); }*/ // 多个的时候也会出现递归的问题 这个得好好想想解决方案 2010-05-17 14:27 wubin // todo 这里只是暂时的处理 等待解决方案 2010-05-14 15:21 $apps = app::get('base')->model('app_content')->getlist('content_path,app_id', array('content_type' => 'service', 'content_name' => $this->aggregator_apps)); foreach ($apps as $row) { if ($row['content_path']) { if ($row['content_path'] == get_class($this)) { $aResult = array_merge($aResult, $this->getItem()); } else { $aResult = array_merge($aResult, kernel::single($row['content_path'], app::get($row['app_id']))->getItem()); } } } $this->_aAggregator = $aResult; } }
public function detail_columns_modifier(&$detail_pages) { if ($this->app->getConf('site.get_policy.method') == 1 && $detail_pages['detail_point']) { unset($detail_pages['detail_point']); } $objuser = kernel::single('desktop_user'); if ($objuser->is_super()) { return; } $perss = $objuser->group(); $get = $_GET; $menu_path = 'app=' . $_GET['app'] . '&' . 'ctl=' . $_GET['ctl'] . '&' . 'act=' . $_GET['act']; $menus = app::get('desktop')->model('menus'); $filter = array('menu_type' => 'menu', 'menu_path' => $menu_path); $row = $menus->getList('*', $filter); $detail_action = array_keys($detail_pages); foreach ($row as $key => $v) { if ($v['addon']) { $addon = unserialize($v['addon']); if ($addon['url_params'] && $addon['url_params']['action'] == 'detail') { if (!in_array($v['permission'], (array) $perss)) { if ($detail_pages[$addon['url_params']['finderview']]) { unset($detail_pages[$addon['url_params']['finderview']]); } } } } continue; } }
function index($method = 'apply', $app_id = 'b2c', &$callback = '', $api_url = '') { $this->Certi = base_certificate::get('certificate_id'); $this->Token = base_certificate::get('token'); $this->Node_id = base_shopnode::node_id($app_id); $token = $this->Token; $sess_id = kernel::single('base_session')->sess_id(); $apply['certi_id'] = $this->Certi; if ($this->Node_id) { $apply['node_idnode_id'] = $this->Node_id; } $apply['sess_id'] = $sess_id; $str = ''; ksort($apply); foreach ($apply as $key => $value) { $str .= $value; } $apply['certi_ac'] = md5($str . $token); if ($method == 'apply') { if ($apply['node_idnode_id']) { $this->pagedata['_PAGE_CONTENT'] = '<iframe width="100%" height="100%" src="' . MATRIX_RELATION_URL . '?source=apply&certi_id=' . $apply['certi_id'] . '&node_id=' . $apply['node_idnode_id'] . '&sess_id=' . $apply['sess_id'] . '&certi_ac=' . $apply['certi_ac'] . '&callback=' . $callback . '&api_url=' . $api_url . '" ></iframe>'; } else { $this->pagedata['_PAGE_CONTENT'] = '<iframe width="100%" height="100%" src="' . MATRIX_RELATION_URL . '?source=apply&certi_id=' . $apply['certi_id'] . '&sess_id=' . $apply['sess_id'] . '&certi_ac=' . $apply['certi_ac'] . '&callback=' . $callback . '&api_url=' . $api_url . '" ></iframe>'; } } elseif ($method == 'accept') { if ($apply['node_idnode_id']) { $this->pagedata['_PAGE_CONTENT'] = '<iframe width="100%" height="100%" src="' . MATRIX_RELATION_URL . '?source=accept&certi_id=' . $apply['certi_id'] . '&node_id=' . $apply['node_idnode_id'] . '&sess_id=' . $apply['sess_id'] . '&certi_ac=' . $apply['certi_ac'] . '&callback=' . $callback . '" ></iframe>'; } else { $this->pagedata['_PAGE_CONTENT'] = '<iframe width="100%" height="100%" src="' . MATRIX_RELATION_URL . '?source=accept&certi_id=' . $apply['certi_id'] . '&sess_id=' . $apply['sess_id'] . '&certi_ac=' . $apply['certi_ac'] . '&callback=' . $callback . '" ></iframe>'; } } else { $this->pagedata['_PAGE_CONTENT'] = ""; } $this->page(); }
/** * 根据提交的图片全局配置大小,生成相应的缩略图 * filesystem图片重新生成 * @param null - 通过function_get_args方法来获取 * @return null */ public function command_do() { $options = $this->get_options(); $imageSet = app::get('image')->getConf('image.set'); if (isset($options['large'])) { $setting['l'] = $imageSet['L']; } elseif (isset($options['middle'])) { $setting['m'] = $imageSet['M']; } elseif (isset($options['small'])) { $setting['s'] = $imageSet['S']; } else { $setting = $imageSet; } $objLibImage = kernel::single('image_data_image'); $pagesize = 50; $imgObj = kernel::single('image_clip'); $imgMdl = app::get('image')->model('images'); $filter['disabled'] = 0; $count = $imgMdl->count($filter); logger::info(sprintf('Total %d records', $count)); for ($i = 0; $i < $count; $i += $pagesize) { $rows = $imgMdl->getList('ident', $filter, $i, $pagesize); foreach ($rows as $row) { $objLibImage->rebuild($row['ident'], $setting); } logger::info(sprintf('%d records Completed!', $i + count($rows))); } }
public function exec($params = null) { $params = array('time_start' => strtotime(date('Y-m-d 00:00:00', strtotime('-1 day'))), 'time_end' => strtotime(date('Y-m-d 23:59:59', strtotime('-1 day'))), 'time_insert' => strtotime(date('Y-m-d', strtotime('-1 day')))); if (kernel::single('sysstat_shop_taskdata')->exec($params)) { return true; } }
/** * 导出需要的数据 * @access public * @param array &$data * @param array $filter * @param int $offset * @return bool * @version 1 Jul 15, 2011 */ public function fgetlist_csv(&$data, $filter, $offset) { //CSV标题 $title = array('开户人姓名', '开户银行', '账户类型', '开户支行', '开户账号', '用户名', '发放状态', '佣金总额'); $data['title'] = '"' . implode('","', $title) . '"'; //联盟商银行账户模型 $mdlUpa = kernel::single('cps_mdl_userpayaccount'); //联盟商模型 $mdlUser = kernel::single('cps_mdl_users'); //用户类型 $userTypes = $mdlUser->getUserTypes(); //发放状态 $umpState = $this->getStates(); $limit = 100; if (!($umps = $this->getList('u_id, u_name, state, money_sum', $filter, $offset * $limit, $limit))) { return false; } $cnt = array(); //根据u_id获取用户信息 foreach ($umps as $ump) { $upa = $mdlUpa->dump($ump['u_id'], 'acc_person, acc_bank, acc_bname, account'); $user = $mdlUser->dump($ump['u_id'], 'u_type'); $cnt[] = '"' . $upa['acc_person'] . '","' . $upa['acc_bank'] . '","' . $userTypes[$user['u_type']] . '","' . $upa['acc_bname'] . '","' . $upa['account'] . '","' . $ump['u_name'] . '","' . $umpState[$ump['state']] . '","' . $ump['money_sum'] . '"'; } $data['contents'] = $cnt; return true; }
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']; }
public function updateStatus($params) { $itemId = $params['item_id']; $status = $params['approve_status']; $result = kernel::single('sysitem_data_item')->setSaleStatus(intval($itemId), $status); return $result; }
private function __replaceImage($desc) { $desc = stripslashes($desc); preg_match_all("/src=[\\'|\"](.+?)[\\'|\"]/", $desc, $match); foreach ($match[1] as $imageUrl) { if (strpos($imageUrl, 'images.bbc.shopex123.com')) { continue; } if (strpos($imageUrl, 'localhost')) { continue; } ini_set("memory_limit", "120M"); try { $localImageUrl = kernel::single('image_data_image')->storeNetworkImage($imageUrl, 'shop', 'item'); if ($localImageUrl) { $url = $localImageUrl['url']; kernel::single('image_data_image')->rebuild($localImageUrl['ident']); $desc = str_replace($imageUrl, $url, $desc); } else { $desc = str_replace($imageUrl, '#', $desc); } } catch (\Exception $e) { $desc = str_replace($imageUrl, '#', $desc); } } return $desc; }
public function generate($order) { $order_id = $order['order_id']; if ($order['status'] != 'finish') { return false; } //未完成的的不建立提成数据 $sql = "SELECT pri_id FROM `sdb_microshop_promotion_into` where from_system = 'ecstore' and order_id = '" . $order_id . "'"; $proi = $this->db->selectrow($sql); if ($proi) { return false; } //已经建立不再建立提成数据 $sql = "SELECT * FROM `sdb_b2c_order_items` where buy_code != '' and order_id = '{$order_id}' and cost < price and cost > 0 "; $order_items = $this->db->select($sql); $proi_model = kernel::single('microshop_mdl_promotion_into'); if ($order_items) { foreach ($order_items as $p_item) { $buy_code = explode('_', $p_item['buy_code']); $special_id = $buy_code[0]; $sql = "SELECT special_name,member_id FROM `sdb_microshop_special` where special_id = '{$special_id}'"; $special = $this->db->selectrow($sql); $sql = "SELECT agency_id,member_id FROM `sdb_microshop_shop` where member_id = '" . $special['member_id'] . "'"; $microshop_shop = $this->db->selectrow($sql); $sql = "SELECT number,agency_no FROM `sdb_b2c_delivery_items` where order_item_id = '" . $p_item['item_id'] . "'"; $delivery_items = $this->db->select($sql); if ($special && $p_item['cost'] > 0) { $proi_row = array('pro_member_id' => $special['member_id'], 'agency_id' => $microshop_shop['agency_id'] ? $microshop_shop['agency_id'] : 0, 'ship_members' => $delivery_items, 'order_id' => $p_item["order_id"], 'ext_order_id' => '', 'from_system' => 'ecstore', 'from_client' => $buy_code[1], 'special_id' => $special_id, 'special_name' => $special['special_name'], 'product_id' => $p_item['product_id'], 'bn' => $p_item['bn'], 'name' => $p_item['name'], 'cost' => $p_item['cost'], 'price' => $p_item['price'], 'nums' => $p_item['nums'], 'pri_status' => '0', 'addtime' => time()); $proi_model->insert($proi_row); } } } }
public function get_params($sdf) { $order_id = $sdf['order_id']; $order_detail = kernel::single('b2c_order_full')->get($order_id); $order_detail['real_time'] = 'true'; return $order_detail; }
public function add() { $article_id = input::get('article_id'); if ($article_id) { $articles = app::get('sysinfo')->model('article'); $artnode = app::get('sysinfo')->model('article_nodes'); $articleinfo = $articles->getRow('*', array('article_id' => $article_id)); $pagedata['articleinfo'] = $articleinfo; $pagedata['artnode'] = $artnode->getRow('*', array('node_id' => $articleinfo['node_id'])); } $nodeId = input::get('node_id'); if (!empty($nodeId)) { $pagedata['article']['node_id'] = $nodeId; } $sysinfoLibNode = kernel::single('sysinfo_article_node'); $nodeList = $sysinfoLibNode->getNodeList(); foreach ($nodeList as $key => $value) { $selectmaps[$key]['node_id'] = $value['node_id']; $selectmaps[$key]['step'] = $value['node_depth']; $selectmaps[$key]['node_name'] = $value['node_name']; } $articlecatlist = app::get("sysinfo")->model("article_nodes")->getlist("*"); $pagedata["articlecatlist"] = $articlecatlist; $pagedata['selectmaps'] = $selectmaps; $pagedata['platform_options'] = $this->platforms; return $this->page('sysinfo/admin/article/editor.html', $pagedata); }
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; }
function __construct() { if (!setlocale(LC_ALL, 'zh_CN.gbk')) { setlocale(LC_ALL, "chs"); } $this->charset = kernel::single('base_charset'); }
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; }
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; }
/** * send * 必有方法,发送时调用 * * config参数为getOptions取得的所有项的配置结果 * * @param mixed $to * @param mixed $message * @param mixed $config * @access public * @return void */ function send($to, $subject, $body, $config) { if ($config['sendway'] == "mail") { $this->email = kernel::single('desktop_email_email'); } $this->Sender = $config['usermail']; $this->Subject = $this->email->inlineCode($subject); $this->email->Sender = $this->Sender; $this->email->Subject = $this->Subject; $header = array('Return-path' => '<' . $config['usermail'] . '>', 'Date' => date('r'), 'From' => $this->email->inlineCode(app::get('site')->getConf('site.name')) . '<' . $config['usermail'] . '>', 'MIME-Version' => '1.0', 'Subject' => $this->Subject, 'To' => $to, 'Content-Type' => 'text/html; charset=UTF-8; format=flowed', 'Content-Transfer-Encoding' => 'base64'); $body = chunk_split(base64_encode($body)); $header = $this->email->buildHeader($header); $config['sendway'] = $config['sendway'] ? $config['sendway'] : 'smtp'; switch ($config['sendway']) { case "sendmail": $result = $this->email->SendmailSend($to, $header, $body); break; case "mail": $result = $this->email->MailSend($to, $header, $body); break; case "smtp": $result = $this->email->SmtpSend($to, $header, $body, $config); break; default: # trigger_error('mailer_not_supported',E_ERROR); $result = false; break; } return $result; }