thinkphpÔõôʵÏÖ¿¼ÇÚ´ò¿¨
Ëæ×Å»¥ÁªÍøµÄÉú³¤£¬Ðí¶à¹«Ë¾Ò²×îÏȽÓÄɵç×Ó»¯¿¼ÇÚ´ò¿¨ÏµÍ³À´ÖÎÀíÔ±¹¤µÄ¿¼ÇÚÇéÐΣ¬ÆäÖУ¬Ê¹ÓÃthinkphp¿ò¼ÜʵÏÖ¿¼ÇÚ´ò¿¨¹¦Ð§Ò²Ô½À´Ô½Æձ顣±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃthinkphp¿ò¼ÜÀ´ÊµÏÖ¿¼ÇÚ´ò¿¨¹¦Ð§¡£
Ò»¡¢Ç°ÖÃÌõ¼þ
1.ÒѾ´î½¨ºÃÁËthinkphp¿ò¼ÜµÄ¿ª·¢ÇéÐΣ¬²¢Ïàʶ»ù´¡µÄMVC¼Ü¹¹ºÍ·ÓÉ¡£
2.ÒѾ¶Ô¿¼ÇÚÖÎÀíϵͳÓÐÒ»¶¨µÄÏàʶ£¬ÖªµÀ¿¼ÇÚ´ò¿¨°üÀ¨ÄÄЩÄÚÈÝÒÔ¼°ÊµÏÖÔÀí¡£
3.ÒѾ½¨ÉèºÃÁËÔ±¹¤µµ°¸ºÍ¿¼ÇÚ¹æÔòµÈÏà¹ØÐÅÏ¢¡£
Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»
¶þ¡¢Ë¼Ð÷ÓëÁ÷³Ì
1.ÔÚϵͳÖн¨É迼ÇÚ´ò¿¨¹¦Ð§µÄÄ£¿éºÍ¿ØÖÆÆ÷¡£
2.½øÈë¿ØÖÆÆ÷ÒªÁ죬´ÓÔ±¹¤µµ°¸ÖлñÈ¡Ä¿½ñÓû§µÄ¿¼ÇÚ¹æÔò¡£
3.»ñÈ¡Ä¿½ñʱ¼ä£¬ÅжÏÊÇ·ñÇкϴò¿¨Ê±¼ä¡£
4.Åжϴò¿¨ÊÇ·ñÕýµ±£¬²¢½«´ò¿¨¼Í¼дÈëÊý¾Ý¿â¡£
5.·µ»Ø´ò¿¨Ð§¹û¡£
Èý¡¢´úÂëʵÏÖ
1.ÏÂÔز¢×°ÖÃthinkphp¿ò¼Ü¡£
2.ÔÚϵͳĿ¼Ï½¨ÉèÒ»¸ö¿¼ÇÚ´ò¿¨µÄÄ£¿éºÍ¿ØÖÆÆ÷¡£
3.ÔÚ¿ØÖÆÆ÷Öн¨ÉèÒ»¸öÒªÁ죬ÓÃÓÚ´¦Àí´ò¿¨ÇëÇó¡£
4.ÔÚÒªÁìÖУ¬Ê×ÏÈÐèÒª»ñÈ¡Ä¿½ñÓû§µÄ¿¼ÇÚ¹æÔò£¬¼ì²éÓû§ÊÇ·ñÔÚÔÊÐí´ò¿¨Ê±¼äÄÚ£¬ÒÔ¼°´ò¿¨ÀàÐÍÊÇ·ñÕýµ±¡£
5.ÈôÊÇ´ò¿¨Õýµ±£¬Ôò½«´ò¿¨¼Í¼ÉúÑÄÔÚÊý¾Ý¿âÖС£
6.×îºó·µ»Ø´ò¿¨Ð§¹û¸øÇ°¶Ë¡£
ÏÂÃæÊÇÏêϸµÄ´úÂëʵÏÖʾÀý£º
namespace appttendancecontroller; use thinkController; use thinkDb; use thinkRequest; /** * ¿¼ÇÚ´ò¿¨¿ØÖÆÆ÷ */ class PunchClock extends Controller{ //´ò¿¨´¦ÀíÒªÁì public function punch(Request $request){ //»ñÈ¡Ä¿½ñÓû§ID $userId = session('UserID'); //»ñÈ¡Ä¿½ñʱ¼ä $now = strtotime('now'); //»ñÈ¡Óû§¿¼ÇÚ¹æÔò $userRule = Db::table('employee')->where('id','=',$userId)->find(); //ÅжÏÊÇ·ñÔÚÕýµ±´ò¿¨Ê±¼äÄÚ if($userRule && $now >= strtotime($userRule['start_time']) && $now <= strtotime($userRule['end_time'])){ //»ñÈ¡´ò¿¨ÀàÐÍ $type = $request->param('type'); //ÉúÑÄ´ò¿¨¼Í¼ $record = [ 'user_id' => $userId, 'type' => $type, 'time' => date('Y-m-d H:i:s', $now) ]; Db::table('attendance')->insert($record); //·µ»ØÀÖЧ¹û¹û return json_encode(['code'=>0,'msg'=>'´ò¿¨ÀÖ³É']); } else { // ·µ»Øʧ°ÜЧ¹û return json_encode(['code'=>1,'msg'=>'²»ÔÚ´ò¿¨Ê±¼äÄÚ']); } } }
µÇ¼ºó¸´ÖÆ
ËÄ¡¢×ܽá
ͨ¹ýÒÔÉϵĴúÂëʵÏÖʾÀý£¬ÎÒÃÇ¿ÉÒÔ¿´³öthinkphp¿ò¼ÜʵÏÖ¿¼ÇÚ´ò¿¨¹¦Ð§ºÜÊǼòÆÓ£¬Ö»ÐèÒªÊìϤ¿ò¼ÜµÄ»ù±¾ÖªÊ¶£¬¾Í¿ÉÒÔÇáËÉʵÏÖÀàËƹ¦Ð§¡£Í¬Ê±£¬ÎÒÃÇÒ²Ó¦¸Ã×¢Öص½¿¼ÇÚÖÎÀíϵͳµÄʹÓó¡¾°ºÍÐèÇó²î±ð£¬ÏêϸʵÏÖÒªÁìÒ²ÐèҪƾ֤²î±ðÐèÇó¾ÙÐе÷½âºÍÐ޸ģ¬ÒÔÖª×㹫˾ÏÖʵÐèÇó¡£
ÒÔÉϾÍÊÇthinkphpÔõôʵÏÖ¿¼ÇÚ´ò¿¨µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡