setup conduct draw流程

$this->luckydraw_campaignId 是我们的主的campaignId

 

1.插入新draw的记录到 ‘db_central.overall_campaign' 因为conduct draw的Type id是‘401’所以直接去voucherall_campaign_type去取campaign类型的信息就可以了

INSERT INTO $this->db_central.overall_campaign 
(overall_campaignName,overall_campaignType,customerId,createTime,modTime,startTime,remarks, overall_campaignStatus)
SELECT overall_campaignTypeName,overall_campaignTypeId, '$this->customer_id', NOW(), NOW(), NOW(),description, 3
FROM $this->db_central.overall_campaign_type
WHERE overall_campaignTypeId='401'


记录新插入的overall_campaignId

 

2.update 我们自定义的campaign name 到overall_campaign里 更新刚才insert的那条记录

 

3. 插入新的记录到‘db_central.luckydraw_drawcampaign’ 

这一步把这个draw的winner个数和reserve个数等创建,获奖人个数和draw的开始结束时间都在这个表里

INSERT INTO $this->db_central.luckydraw_drawcampaign (overall_campaignId,customerId,draw_campaignStatus, luckydraw_campaignId, winner_number, winner_type, reserve_number, reserve_type, condition_startTime, condition_endTime)
SELECT overall_campaignId, customerId, 0, $this->luckydraw_campaignId, $winner_number, 'Segment', $reserve_number, 'Total', '$srart_time', '$end_time'
FROM $this->db_central.overall_campaign
WHERE overall_campaignId='$overall_campaignId'

 

4.获得新建的luckydraw_draw_campaignId

 

5.在客户的数据库里插入 campaign_lookup

INSERT INTO $this->customer_db_name.campaign_lookup
(campaign_date,luckydraw_draw_campaignId) 
VALUES ('$campaign_date', $luckydraw_draw_campaignId)

得到$campaign_lookup_id 

 

6.在客户数据库里插入 luckydraw_draw_settings

INSERT INTO $this->customer_db_name.luckydraw_draw_settings 
(luckydraw_draw_campaignId,prize_index,prize_description,winner_number,reserve_number) 
VALUES ('$luckydraw_draw_campaignId', 1, '$prize_description', $winner_number, $reserve_number)

FEO Dinner & Dance 2014 Pre-Lucky Draw Winner System Draw的流程

1.这次的draw不需要从new_luckydraw_entry去拿chance所以entry_id可以不需要

 

2.新建表名为 ‘feo_2014_pre_draw_rsvp_list 作为原始chance的表

 

3.以’feo_2014_pre_draw_rsvp_list‘的nric与contact的nric做关联,获取`contactId` ,`luckydraw_draw_campaignId`为自定义字段 –》 插入`luckydraw_draw_chances`

——这个流程就是插入chance的流程,delete的话直接根据`luckydraw_draw_campaignId` delete 就行了

 

4.draw的时候select luckydraw_draw_chances` where luckydraw_draw_campaignId = $luckydraw_draw_campaignId ,

luckydraw_draw_result 新插入记录 获取 luckydraw_draw_Id, 然后 order by rand() limit $total_number 随机抽取指定数量 Insert 到luckydraw_draw_result_details里 这个时候奖品信息还没有获取。

 

6.save_draw_result_details_type update luckydraw_draw_result_details 更新奖品进入luckydraw_draw_result_details