Skip to content

Commit c1432d9

Browse files
committed
change bid top logic
1 parent 70dc80f commit c1432d9

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

pa_back/pa_rpc/stuff_info_imp.h

+21-3
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ class stuff_info_handler : virtual public stuff_infoIf
364364
ret->begin_time = single_turn.begin_time;
365365
double top_price = 0;
366366
std::string top_customer;
367+
long time_stamp_tmp = time(nullptr);
367368
auto all_bc = single_turn.get_all_children<pa_sql_bidding_customer>("belong_bidding_turn");
368369
for (auto &single_customer : all_bc)
369370
{
@@ -376,10 +377,27 @@ class stuff_info_handler : virtual public stuff_infoIf
376377
{
377378
bc_tmp.price = single_customer.price;
378379
bc_tmp.timestamp = single_customer.timestamp;
379-
if (single_customer.price > top_price)
380+
long bid_time = PA_DATAOPT_timestring_2_date(bc_tmp.timestamp, true);
381+
if (single_customer.price >= top_price)
380382
{
381-
top_price = single_customer.price;
382-
top_customer = customer->name;
383+
bool should_replace = false;
384+
if (single_customer.price == top_price)
385+
{
386+
if (bid_time < time_stamp_tmp)
387+
{
388+
should_replace = true;
389+
}
390+
}
391+
else
392+
{
393+
should_replace = true;
394+
}
395+
if (should_replace)
396+
{
397+
top_price = single_customer.price;
398+
top_customer = customer->name;
399+
time_stamp_tmp = bid_time;
400+
}
383401
}
384402
}
385403
}

0 commit comments

Comments
 (0)