function view_detail($id) { $info = Model_Activity::detail_info($id); foreach ($info['styles'] as $product_id => $styles) { foreach ($styles as $style_key => $style) { $style_id = $style['product_style_id']; $info["styles"][$product_id][$style_key]["sizes"] = self::_db()->select_rows("select\n goods.pro_size,sum(goods.quantity) as quantity,brand.name as brand_name ,product.name as product_name\n from et_order_goods as goods\n left join et_product_style as style on style.id = goods.style_id\n left join et_product as product on product.id = style.product_id\n left join et_product_brand as brand on brand.id = product.brand_id\n where goods.activity_id = ? and goods.style_id = ? group by goods.pro_size ", $id, $style_id); } } $manufacturers = self::_db()->select_rows("select * from et_product_manufacturer"); $produce = self::_db()->select_row("select\n produce.*,m.name as m_name\n from et_activity_produce as produce\n left join et_product_manufacturer as m on m.id = produce.man_id\n where produce.id = ?", $id); $res = array("produce" => $produce, "info" => $info, "manufacturers" => $manufacturers); //print_r($res);exit; return $res; }
/** * 活动详情 * @return array */ static function activity_detail($id) { $activity_info = Model_Activity::detail_info($id); return $activity_info; }
function action_detail($app_id, $activity_id, $time, $sign) { $app = self::_db()->select_row("select id,app_secret from et_application where app_id = ?", $app_id); if (!$app) { throw new Exception("app 不存在"); } $request = array("model" => "open/activity", "action" => "detail", "app_id" => $app_id, "activity_id" => $activity_id, "time" => $time); $_sign = md5(http_build_query($request) . $app['app_secret']); if ($_sign != $sign) { throw new Exception("签名不正确"); } return Model_Activity::detail_info($activity_id, $app['id']); }