douhui4699 2015-04-25 07:13
浏览 11

正在加入特定类别或票证的竞赛

I have now a PHP/MySQL website for signup and payment for running races.

My main problem (which blocks me now at all) is, an user sign up, and pay inscription for a single race. This single race has MySQL field "price". running race <-> single price.

In a month I will have a new event, and the organizer wants multiple prices for different runners (depending age, child, senior, etc)

My actual MySQL Schema is

USERS (**id**, username, password, email)
USER_PROFILES (user_id, name, surname, gender, birthdate, etc...)
EVENTS (**id**, name_desc, date, price, ...)
REGISTRATIONS (id, user_id, event_id, signup_date, bank_order, bank_result)

I imagine the user website flow, but I don't know how to implement it in DB. The flow would be: - Types the spanish ID card. - The system check if it's joined previously. - If not, the user fills personal data form. - (New) Click the category/ticket/price for this user. - Adds the user to a "cart". - Pay all runners in single payment.


Ex: http://www.cronometrajes.com/en/guest_signup/race/ii_carrera_popular_olleros_de_sabero

Test ID: 71000000N

Spanish phone format: [0-9]{9} Ex: 666554433


Due to my website schema, I don't know how to improve my actual site with this other feature.

I hope I have explained everything perfect. Sorry about my bad English.

  • 写回答

1条回答 默认 最新

  • duanhuanzhi6431 2015-04-25 13:19
    关注

    This is simple and you are almost there already. You know that you need multiple prices per event. Which means you need some sort of event price list object that relates to an event. Then you can have many prices per event.

    So now you could create something like

    event_price_list (id, event_id, max_age, price)
    

    So this data would look like

    id, event_id, max_age, price
    1,  1,        10,        80
    2,  1,        18,        100
    3,  1,        21,        140 
    4,  1,        60,        60
    

    Now you can use the event table to get all event price lists and using age you could work out which price list you want. You could potentially create another table called age_brackets or something like that which would relate child, adult, senior to actual ages if you want and this could be referenced in your price list table or you could manage that in code. There are a couple of variations, but this should get you started.

    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么