dongzhuner6981 2011-06-29 21:13
浏览 7
已采纳

PHP - 基于设定的时间表交替选择电子邮件

Ok, Here is the situation, I am looking for some general input on the logic of this class. The purpose of this class is to: query a schedule database for employees that are currently working, and select the email address of one person who is currently working.

This class gets called by procmail every time an email is received, and serves procmail one email to forward to.

When there is more than one person working, the 2nd email received should go to the next person, the third email to the next, and loop over them as such - Delivering them equally. If nobody is working at a specific time, the list of active workers is set to everybody working the next day, or the same day respectively.

I have this class half-made, and I'm having a hard time coming up with the logic of equal delivery. I figure I would log each email sent in a database table, limit it to about 10 entries and just email it to the person who shows up the least. However, this will not be exactly equal. Neither would just selecting a random email.

I'm not looking for someone to code this for me, just looking for some input on a better logic method; maybe someone has run into this kind of situation before?

The table design is extremely simple, it goes like:

date | name | email | time_in | time_out

Of course there are other tables that handle manual overrides, and the table I mentioned about logging sent emails. I can post the current class I have, but like I said it is half-made, and the class logic is pretty simple - other than this specific part.

Any Idea, or input is welcome!

  • 写回答

1条回答 默认 最新

  • dqz30992 2011-06-29 21:20
    关注

    How about -- keep a counter of how many emails each person got, sort by least to determine who gets the next, then reset all the counters to zero at the start of each shift.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)