public function run() { parent::run(); $this->getInputJson(); if (!($token = validateToken($this->input['token']))) { throw new \Exception("Invalid token."); } //TODO: delete global somehow global $user; $user = new \User($token['uid']); if (isset($this->input['remove'])) { if (!$user->removeFavorites($this->input['remove'])) { throw new \Exception("Could not remove favorites."); } } if (isset($this->input['add'])) { if (!$user->addFavorites($this->input['add'])) { throw new \Exception("Could not add favorites."); } } $favorites = array(); $user->getFavorites(); foreach ($user->favorites as $favorite) { $favorites[] = $favorite['tid']; } $this->return['favorites'] = $favorites; }
public function run() { parent::run(); $this->tableName = \Request::SimpletextRequired('table'); if (!array_key_exists($this->tableName, $this->validColumnsTables)) { throw new \Exception("Table '{$this->tableName}' is invalid."); } $this->getInputJson(); if (isset($this->input['delimiter'])) { $this->delimiter = $this->input['delimeter']; } if (isset($this->input['format'])) { $this->format = $this->input['format']; } $this->columns = $this->input['columns']; switch ($this->tableName) { case 'templomok': $this->prepareTemplomokQuery(); $this->runQuery(); $this->mapTemplomok(); break; default: throw new \Exception("Table '{$this->tableName}' is accepted, but we cannot process."); break; } if ($this->format == 'text') { $this->format = 'csv'; } $this->return[$this->tableName] = $this->table; return; }
public function run() { $reqId = (int) $this->httpRequest->postData('id'); $reqsData = json_decode($this->httpRequest->postData('data'), true); if (json_last_error() !== JSON_ERROR_NONE) { //Try with stripslashes() $reqsData = json_decode(stripslashes($this->httpRequest->postData('data')), true); if (json_last_error() !== JSON_ERROR_NONE) { $errMsg = '#' . json_last_error(); if (function_exists('json_last_error_msg')) { $errMsg .= ' ' . json_last_error_msg(); } throw new \RuntimeException('Malformed JSON-encoded request (' . $errMsg . ')', 400); } } $responses = array(); foreach ($reqsData as $requestData) { $apiCall = new Api(); $apiCall->emulate($requestData, $this->httpRequest); $apiCall->run(); $responses[] = $apiCall->httpResponse()->content(); } $resp = new ApiGroupResponse(); $resp->setResponses($responses); $resp->setId($reqId); $this->httpResponse->addHeader('Content-Type: application/json'); if ($resp->cacheable()) { $this->httpResponse->setCacheable(); } $this->httpResponse->setContent($resp); }
public function run() { parent::run(); $this->getInputJson(); $userId = login($this->input['username'], $this->input['password']); if (!$userId) { throw new \Exception("Invalid username or password."); } $token = generateToken($userId); $this->return['token'] = $token; }
public function run() { parent::run(); $query = "SELECT id, moddatum FROM templomok WHERE moddatum >= '" . $this->date . "' "; $result = mysql_query($query); if (mysql_num_rows($result) > 0) { $this->return = "1"; } else { $this->return = "0"; } }
public function run() { parent::run(); $this->getInputJson(); $this->prepareUser(); $this->prepareRemark(); try { $this->remark->save(); $this->remark->emails(); $this->return['text'] = 'Köszönjük. Elmentettük.'; } catch (Exception $e) { throw new \Exception($e->getMessage()); } }
public function run() { parent::run(); $sqllitefile = 'fajlok/sqlite/miserend_v' . $this->version . '.sqlite3'; if (file_exists($sqllitefile) && strtotime("-20 hours") < filemtime($sqllitefile) and $config['debug'] == 0 and !isset($date)) { header("Location: /" . $sqllitefile); } else { if (generateSqlite($this->version, 'fajlok/sqlite/miserend_v' . $this->version . '.sqlite3')) { //Sajnos ez itten nem működik... Nem lesz szépen letölthető. Headerrel sem //$data = readfile($sqllitefile); exit($data); header("Location: /" . $sqllitefile); } else { throw new \Exception("Could not make the requested sqlite3 file."); } } }
public function run() { parent::run(); $this->getInputJson(); if (!($token = validateToken($this->input['token']))) { throw new \Exception("Invalid token."); } //TODO: delete global somehow global $user; $user = new \User($token['uid']); $user->getFavorites(); $data = array('username' => $user->username, 'nickname' => $user->nickname, 'name' => $user->name, 'email' => $user->email); foreach ($user->favorites as $favorite) { $data['favorites'][] = $favorite['tid']; } $this->return['user'] = $data; }
public function run() { parent::run(); $this->getInputJson(); $newuser = new \User(); $validFields = array('username', 'email', 'password', 'nickname', 'name'); $fieldsToSubmit = array(); foreach ($validFields as $field) { if ($this->input[$field] and $this->input[$field] != '') { $fieldsToSubmit[$field] = $this->input[$field]; } } $success = $newuser->submit($fieldsToSubmit); $messages = getMessages(); if (!$success) { $exceptionTexts = array(); foreach ($messages as $message) { $exceptionTexts[] = $message['text']; } throw new \Exception(implode("\n", $exceptionTexts)); } }
function cart2() { $id = IFilter::act(IReq::get('id'), 'int'); $type = IFilter::act(IReq::get('type')); //goods,product $promo = IFilter::act(IReq::get('promo')); $active_id = IFilter::act(IReq::get('active_id'), 'int'); $buy_num = IReq::get('num') ? IFilter::act(IReq::get('num'), 'int') : 1; $tourist = IReq::get('tourist'); //游客方式购物 //必须为登录用户 if ($tourist === null && $this->user['user_id'] == null) { if ($id == 0 || $type == '') { $this->redirect('/simple/login?tourist&callback=/simple/cart2'); } else { $url = '/simple/login?tourist&callback=/simple/cart2/id/' . $id . '/type/' . $type . '/num/' . $buy_num; $url .= $promo ? '/promo/' . $promo : ''; $url .= $active_id ? '/active_id/' . $active_id : ''; $this->redirect($url); } } //游客的user_id默认为0 $user_id = $this->user['user_id'] == null ? 0 : $this->user['user_id']; //计算商品 $countSumObj = new CountSum($user_id); //判断是特定活动还是购物车 if ($id && $type) { $result = $countSumObj->direct_count($id, $type, $buy_num, $promo, $active_id); $this->gid = $id; $this->type = $type; $this->num = $buy_num; $this->promo = $promo; $this->active_id = $active_id; } else { //计算购物车中的商品价格 $result = $countSumObj->cart_count(); } //检查商品合法性或促销活动等有错误 if (is_string($result)) { IError::show(403, $result); exit; } //是否需要多选地址 $this->need_choose_addr_num = 1; if (count($result['goodsList']) == 1 && $result['count'] > 1) { $this->need_choose_addr_num = $result['count']; } //检测是否属于入驻商家商品 if ($this->gid) { $bool = $this->is_seller($this->gid); if ($bool) { //获取商家版支付方式 $this->paymentList = Api::run('getSellerPaymentList'); } else { $this->paymentList = Api::run('getPaymentList'); } } else { $this->paymentList = Api::run('getPaymentList'); } //获取收货地址 $addressObj = new IModel('address'); $addressList = $addressObj->query('user_id = ' . $user_id); //更新$addressList数据 foreach ($addressList as $key => $val) { $temp = area::name($val['province'], $val['city'], $val['area']); if (isset($temp[$val['province']]) && isset($temp[$val['city']]) && isset($temp[$val['area']])) { $addressList[$key]['province_val'] = $temp[$val['province']]; $addressList[$key]['city_val'] = $temp[$val['city']]; $addressList[$key]['area_val'] = $temp[$val['area']]; if ($val['default'] == 1) { $this->defaultAddressId = $val['id']; } } } //获取用户的道具红包和用户的习惯方式 $this->prop = array(); $memberObj = new IModel('member'); $memberRow = $memberObj->getObj('user_id = ' . $user_id, 'prop,custom'); if (isset($memberRow['prop']) && ($propId = trim($memberRow['prop'], ','))) { $porpObj = new IModel('prop'); $this->prop = $porpObj->query('id in (' . $propId . ') and NOW() between start_time and end_time and type = 0 and is_close = 0 and is_userd = 0 and is_send = 1', 'id,name,value,card_name'); } if (isset($memberRow['custom']) && $memberRow['custom']) { $this->custom = unserialize($memberRow['custom']); } else { $this->custom = array('payment' => '', 'delivery' => '', 'takeself' => ''); } //返回值 $this->final_sum = $result['final_sum']; $this->promotion = $result['promotion']; $this->proReduce = $result['proReduce']; $this->sum = $result['sum']; $this->goodsList = $result['goodsList']; $this->count = $result['count']; $this->reduce = $result['reduce']; $this->weight = $result['weight']; $this->freeFreight = $result['freeFreight']; //收货地址列表 $this->addressList = $addressList; //获取商品税金 $this->goodsTax = $countSumObj->getGoodsTax($this->sum); //渲染页面 $this->redirect('cart2'); }
/** * @brief 配送方式计算管理模块 * @param $province int 省份的ID * @param $delivery_id int 配送方式ID * @param $goods_id array 商品ID * @param $product_id array 货品ID * @param $num array 商品数量 * @return array( * if_delivery => 0:支持配送;1:不支持配送; * price => 运费; * protect_price => 保价; * seller_id => array(price => 运费,protect_price => 保价,org_price => 原始运费) * ) */ public static function getDelivery($province, $delivery_id, $goods_id, $product_id = 0, $num = 1) { //获取默认的配送方式信息 $delivery = new IModel('delivery'); $deliveryDefaultRow = $delivery->getObj('is_delete = 0 and status = 1 and id = ' . $delivery_id); if (!$deliveryDefaultRow) { return "配送方式不存在"; } //最终返回结果 $result = array('name' => $deliveryDefaultRow['name'], 'description' => $deliveryDefaultRow['description'], 'if_delivery' => 0, 'org_price' => 0, 'price' => 0, 'protect_price' => 0); //读取全部商品,array('goodsSum' => 商品总价,'weight' => 商品总重量) $sellerGoods = array(); $goods_id = is_array($goods_id) ? $goods_id : array($goods_id); $product_id = is_array($product_id) ? $product_id : array($product_id); $num = is_array($num) ? $num : array($num); $goodsArray = array(); $productArray = array(); foreach ($goods_id as $key => $gid) { $pid = $product_id[$key]; $gnum = $num[$key]; if ($pid > 0) { $productArray[$pid] = $gnum; $goodsRow = Api::run("getProductInfo", array('#id#', $pid)); if (!$goodsRow) { throw new IException("计算商品运费货品ID【" . $pid . "】信息不存在"); } } else { $goodsArray[$gid] = $gnum; $goodsRow = Api::run("getGoodsInfo", array('#id#', $gid)); if (!$goodsRow) { throw new IException("计算商品运费商品ID【" . $gid . "】信息不存在"); } } if (!isset($sellerGoods[$goodsRow['seller_id']])) { $sellerGoods[$goodsRow['seller_id']] = array('goodsSum' => 0, 'weight' => 0); } $sellerGoods[$goodsRow['seller_id']]['weight'] += $goodsRow['weight'] * $gnum; $sellerGoods[$goodsRow['seller_id']]['goodsSum'] += $goodsRow['sell_price'] * $gnum; } //获取促销规则是否免运费 $countSumObj = new CountSum(self::$user_id); $cartObj = new Cart(); $countSumResult = $countSumObj->goodsCount($cartObj->cartFormat(array("goods" => $goodsArray, "product" => $productArray))); //根据商家不同计算运费 $deliveryExtendDB = new IModel('delivery_extend'); foreach ($sellerGoods as $seller_id => $data) { $weight = $data['weight']; //计算运费 $goodsSum = $data['goodsSum']; //计算保价 //使用商家配置的物流运费 $deliverySellerRow = $deliveryExtendDB->getObj('delivery_id = ' . $delivery_id . ' and seller_id = ' . $seller_id); $deliveryRow = $deliverySellerRow ? $deliverySellerRow : $deliveryDefaultRow; //设置首重和次重 self::$firstWeight = $deliveryRow['first_weight']; self::$secondWeight = $deliveryRow['second_weight']; $deliveryRow['if_delivery'] = '0'; //当配送方式是统一配置的时候,不进行区分地区价格 if ($deliveryRow['price_type'] == 0) { $deliveryRow['price'] = self::getFeeByWeight($weight, $deliveryRow['first_price'], $deliveryRow['second_price']); } else { $matchKey = ''; $flag = false; //每项都是以';'隔开的省份ID $area_groupid = unserialize($deliveryRow['area_groupid']); foreach ($area_groupid as $key => $item) { //匹配到了特殊的省份运费价格 if (strpos($item, ';' . $province . ';') !== false) { $matchKey = $key; $flag = true; break; } } //匹配到了特殊的省份运费价格 if ($flag) { //获取当前省份特殊的运费价格 $firstprice = unserialize($deliveryRow['firstprice']); $secondprice = unserialize($deliveryRow['secondprice']); $deliveryRow['price'] = self::getFeeByWeight($weight, $firstprice[$matchKey], $secondprice[$matchKey]); } else { //判断是否设置默认费用了 if ($deliveryRow['open_default'] == 1) { $deliveryRow['price'] = self::getFeeByWeight($weight, $deliveryRow['first_price'], $deliveryRow['second_price']); } else { $deliveryRow['price'] = '0'; $deliveryRow['if_delivery'] = '1'; } } } $deliveryRow['org_price'] = $deliveryRow['price']; //促销规则满足免运费 if (isset($countSumResult['freeFreight']) && in_array($seller_id, $countSumResult['freeFreight'])) { $deliveryRow['price'] = 0; } //计算保价 if ($deliveryRow['is_save_price'] == 1) { $tempProtectPrice = $goodsSum * ($deliveryRow['save_rate'] * 0.01); $deliveryRow['protect_price'] = $tempProtectPrice <= $deliveryRow['low_price'] ? $deliveryRow['low_price'] : $tempProtectPrice; } else { $deliveryRow['protect_price'] = 0; } //无法送达 if ($deliveryRow['if_delivery'] == 1) { return $deliveryRow; } //更新最终数据 $result['org_price'] += $deliveryRow['org_price']; $result['price'] += $deliveryRow['price']; $result['protect_price'] += $deliveryRow['protect_price']; } return $result; }
/** * @brief 检查商品或者货品的库存是否充足 * @param $buy_num 检查数量 * @param $goods_id 商品id * @param $product_id 货品id * @result array() true:满足数量; false:不满足数量 */ public static function checkStore($buy_num, $goods_id, $product_id = 0) { $data = $product_id ? Api::run('getProductInfo', array('#id#', $product_id)) : Api::run('getGoodsInfo', array('#id#', $goods_id)); //库存判断 if ($buy_num <= 0 || $buy_num > $data['store_nums']) { return false; } return true; }
" src="<?php echo IUrl::creatUrl("/pic/thumb/img/" . $item['img'] . "/w/66/h/66"); ?> " width="66" height="66" /></a></li> <?php } ?> </ul> <a class="last" href="javascript:void(0);" onclick="pic_pre();"><span>上一个</span></a> <a class="next" href="javascript:void(0);" onclick="pic_next();"><span>下一个</span></a> </div> </div> <div class="showbox f14 m_10"> <?php $item = Api::run('getGoodsInfo', array('#id#', $id)); ?> <h2><a href="<?php echo IUrl::creatUrl("/site/products/id/" . $id . ""); ?> "><?php echo isset($item['name']) ? $item['name'] : ""; ?> </a></h2> <?php $seo_data = array(); ?> <?php $seo_data['title'] = "查看大图_" . $item['name'] . '_' . $siteConfig->name; ?> <?php
} break; case cNew . '_error': $this->doNewError(); break; default: $this->getEntryPoints(); break; } } } class Api extends ApiObject { public function getEntryPoints() { $data = array(array(cObject => cAutor, cURI => API_URI . '?' . cObject . '=' . cAutor, cMethod => cGET), array(cObject => cEditora, cURI => API_URI . '?' . cObject . '=' . cEditora, cMethod => cGET), array(cObject => cLivro, cURI => API_URI . '?' . cObject . '=' . cLivro, cMethod => cGET)); sendJson(stripslashes(json_encode($data, JSON_PRETTY_PRINT))); } public function run() { $object = getVal(cObject); if ($object != '') { (new $object())->run(); } else { $this->getEntryPoints(); } } } $api = new Api(); $api->run();
" pattern='required' alt='填写用户名或邮箱' /></td></tr> <tr><th>密码:</th><td><input class="gray" type="password" name="password" pattern='^\S{6,32}$' alt='填写密码' /></td></tr> <tr class="low"><td></td> <td> <label class="attr"><input class="radio" type="checkbox" name="remember" value='1' />记住登录名</label> <label class="attr"><a class="link pwd" href="<?php echo IUrl::creatUrl("/simple/find_password"); ?> ">忘记密码</a></label> </td> </tr> <tr class="low"> <td></td> <td> <?php foreach (Api::run('getOauthList') as $key => $item) { ?> <a href="javascript:oauthlogin('<?php echo isset($item['id']) ? $item['id'] : ""; ?> ');"><img src='<?php echo IUrl::creatUrl("") . "" . $item['logo'] . ""; ?> ' /></a> <?php } ?> </td> </tr> <tr><td></td><td><input class="submit_login" type="submit" value="登录" /></td></tr> </table>
?> <a href="<?php echo IUrl::creatUrl("/site/home/id/" . $refunds['seller_id'] . ""); ?> " target="_blank"><img src="<?php echo IUrl::creatUrl("") . "views/" . $this->theme . "/skin/" . $this->skin . "/images/admin/seller_ico.png"; ?> " /></a> <?php } ?> <?php } else { ?> <?php foreach (Api::run('getOrderGoodsListByGoodsid', array('#order_id#', $order_id)) as $key => $good) { ?> <?php $good_info = JSON::decode($good['goods_array']); ?> <?php if ($good['is_send'] != 2) { ?> <label> <input type="radio" name="order_goods_id" value="<?php echo isset($good['id']) ? $good['id'] : ""; ?> " onclick="countGoodsAmount(<?php echo $good['goods_nums'] * $good['real_price']; ?> );" />
function groupon() { $id = IFilter::act(IReq::get("id"), 'int'); //指定某个团购 if ($id) { $this->regiment_list = Api::run('getRegimentRowById', array('#id#', $id)); $this->regiment_list = $this->regiment_list ? array($this->regiment_list) : array(); } else { $this->regiment_list = Api::run('getRegimentList'); } //往期团购 $this->ever_list = Api::run('getEverRegimentList'); $this->redirect("groupon"); }
<?php if ($this->goodsList) { ?> <a class="btn_pay" href="javascript:check_finish();">去结算</a> <?php } ?> </td> </tr> </tfoot> </table> <div class="box"><div class="title">热门商品推荐</div></div> <ul id="scrollpic" class="prolist"> <?php foreach (Api::run('getCommendHot', 5) as $key => $item) { ?> <li> <a href="<?php echo IUrl::creatUrl("/site/products/id/" . $item['id'] . ""); ?> "> <img width="98px" height="106px" src="<?php echo IUrl::creatUrl("/pic/thumb/img/" . $item['img'] . "/w/98/h/106"); ?> " alt="<?php echo isset($item['name']) ? $item['name'] : ""; ?> " title="<?php echo isset($item['name']) ? $item['name'] : ""; ?>
<?php error_reporting(E_ERROR ^ E_NOTICE ^ E_WARNING); /** ///调试、找错时请去掉///前空格 ini_set('display_errors',true); error_reporting(E_ALL); set_time_limit(0); //*/ //网站根路径设置 define('SITE_PATH', dirname(__FILE__)); //默认应用设置为API $_GET['app'] = 'api'; define('APP_NAME', 'api'); if (isset($_REQUEST['api_version'])) { $api_version = preg_replace('/[^A-Za-z0-9\\._-]/', '', $_REQUEST['api_version']); define('API_VERSION', $api_version); } else { define('API_VERSION', 'sociax'); } //载入核心文件 require SITE_PATH . '/core/core.php'; //实例化一个网站应用实例 $app = new Api(); $app->run(); unset($app); /* # The end */
<?php error_reporting(E_ERROR ^ E_NOTICE ^ E_WARNING); /*ini_set('display_errors', true); error_reporting(E_ALL); set_time_limit(0);*/ //网站根路径设置 define('SITE_PATH', dirname(__FILE__)); //默认应用设置为API $_GET['app'] = 'api'; define('APP_NAME', 'api'); $api_version = !empty($_REQUEST['api_version']) ? $_REQUEST['api_version'] : '4.5.0'; $api_type = !empty($_REQUEST['api_type']) ? $_REQUEST['api_type'] : 'sociax'; define('API_VERSION', $api_type . '_v' . $api_version); /* 新系统需要的一些配置 */ define('TS_ROOT', dirname(__FILE__)); // Ts根 define('TS_APPLICATION', TS_ROOT . '/apps'); // 应用存在的目录 define('TS_CONFIGURE', TS_ROOT . '/config'); // 配置文件存在的目录 define('TS_STORAGE', '/storage'); // 储存目录,需要可以公开访问,相对于域名根 define('TS_APP_DEV', false); // 新的系统核心接入 require SITE_PATH . '/src/Build.php'; Ts::import(TS_ROOT, 'src', 'old', 'core', '.php'); Api::run(); /* # The end */
<div class="help m_10"> <div class="cont clearfix"> <?php foreach (Api::run('getHelpCategoryFoot') as $key => $helpCat) { ?> <dl> <dt><a href="<?php echo IUrl::creatUrl("/site/help_list/id/" . $helpCat['id'] . ""); ?> "><?php echo isset($helpCat['name']) ? $helpCat['name'] : ""; ?> </a></dt> <?php foreach (Api::run('getHelpListByCatidAll', array('#cat_id#', $helpCat['id'])) as $key => $item) { ?> <dd><a href="<?php echo IUrl::creatUrl("/site/help/id/" . $item['id'] . ""); ?> "><?php echo isset($item['name']) ? $item['name'] : ""; ?> </a></dd> <?php } ?> </dl> <?php } ?>
/** * @brief 检查活动的合法性 * @return string(有错误) or true(处理正确) */ public function checkValid() { if (!$this->id) { return "商品ID不存在"; } $goodsData = $this->type == 'product' ? Api::run('getProductInfo', array('#id#', $this->id)) : Api::run('getGoodsInfo', array('#id#', $this->id)); //库存判断 if (!$goodsData || $this->buy_num <= 0 || $this->buy_num > $goodsData['store_nums']) { return "购买的数量不正确或大于商品的库存量"; } $this->originalGoodsInfo = $goodsData; $this->activePrice = $goodsData['sell_price']; $goods_id = $goodsData['goods_id']; //具体促销活动的合法性判断 switch ($this->promo) { //团购 case "groupon": if (!$this->user_id) { return "参加团购活动请您先登录"; } $regimentRow = Api::run('getRegimentRowById', array("#id#", $this->active_id)); if ($regimentRow) { if ($regimentRow['goods_id'] != $goodsData['goods_id']) { return "该商品没有参与团购活动"; } if ($regimentRow['store_nums'] <= $regimentRow['sum_count']) { return "团购商品已经销售一空"; } //检查次团购订单 $orderDB = new IModel('order as o,order_goods as og'); $orderData = $orderDB->query('o.user_id = ' . $this->user_id . ' and o.type = 1 and active_id = ' . $this->active_id); $hasBugNum = 0; foreach ($orderData as $key => $val) { $orderStatus = Order_class::getOrderStatus($val); if (in_array($orderStatus, array(2, 1, 11))) { return "您参与的该团购订单还没有完成"; } if (in_array($orderStatus, array(3, 4, 6))) { $hasBugNum += $val['goods_nums']; } } //批量购买(薄利多销) if ($regimentRow['limit_min_count'] > 0) { if ($this->buy_num < $regimentRow['limit_min_count']) { return "购买数量必须超过 " . $regimentRow['limit_min_count'] . " 件才能下单"; } } //限制购买(限购,要多人参与) if ($regimentRow['limit_max_count'] > 0) { if ($this->buy_num > $regimentRow['limit_max_count']) { return "购买数量不能超过 " . $regimentRow['limit_min_count'] . " 件"; } if ($hasBugNum + $this->buy_num > $regimentRow['limit_max_count']) { return "此团购为限购活动,您累计购买数量不能超过" . $regimentRow['limit_max_count']; } } if ($this->buy_num > $regimentRow['store_nums']) { return "购买数量超过了团购剩余量"; } $this->activePrice = $regimentRow['regiment_price']; } else { return "当前时间段内不存在此团购活动"; } return true; break; //抢购 //抢购 case "time": $promotionRow = Api::run('getPromotionRowById', array("#id#", $this->active_id)); if ($promotionRow) { if ($promotionRow['condition'] != $goodsData['goods_id']) { return "该商品没有参与抢购活动"; } $memberObj = new IModel('member'); $memberRow = $memberObj->getObj('user_id = ' . $this->user_id, 'group_id'); if ($promotionRow['user_group'] == 'all' || isset($memberRow['group_id']) && stripos(',' . $promotionRow['user_group'] . ',', $memberRow['group_id']) !== false) { $this->activePrice = $promotionRow['award_value']; } else { return "此活动仅限指定的用户组"; } } else { return "不存在此限时抢购活动"; } return true; break; } return "未知促销活动"; }