當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Framework\M函數代碼示例

本文整理匯總了PHP中Lazybug\Framework\M函數的典型用法代碼示例。如果您正苦於以下問題:PHP M函數的具體用法?PHP M怎麽用?PHP M使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了M函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: act

 public function act()
 {
     if (!$this->check_param('userid, username, userrole')) {
         LF\V('Json.Base')->init(Const_Code::USER_PARAM_ERROR, '用戶傳遞參數錯誤');
         return;
     }
     $user_id = (int) Request::get_param('userid', 'post');
     $user_name = trim(Request::get_param('username', 'post'));
     $user_password = trim(Request::get_param('userpassword', 'post'));
     if (!preg_match('/^\\w+$/', $user_name)) {
         LF\V('Json.Base')->init(Const_Code::USER_FORMAT_ERROR, '用戶名稱格式錯誤');
         return;
     }
     if (LF\M('User')->check_name_update($user_id, $user_name)) {
         LF\V('Json.Base')->init(Const_Code::UPDATE_USER_EXISTS, '用戶名稱重複');
         return;
     }
     if ($user_password) {
         $_POST['userpassword'] = md5($user_name . $user_password);
     } else {
         unset($_POST['userpassword']);
     }
     unset($_POST['username']);
     $result = LF\M('User')->where('id=' . $user_id)->update();
     if (is_null($result)) {
         LF\V('Json.Base')->init(Const_Code::UPDATE_USER_FAIL, '用戶更新失敗');
         return;
     }
     LF\V('Json.Base')->init(Const_Code::SUCCESS, '用戶更新成功');
 }
開發者ID:hanviseas,項目名稱:lazybug-for-api,代碼行數:30,代碼來源:update.php

示例2: act

 public function act()
 {
     $page = (int) Request::get_param('page', 'post');
     $size = (int) Request::get_param('size', 'post');
     $history_size = (int) Request::get_param('historysize', 'post');
     if ($page < 1) {
         $page = 1;
     }
     if ($size < 1) {
         $size = 20;
     }
     if ($history_size) {
         $history_size = 3;
     }
     $task_list = LF\M('Task')->get_all($page, $size, $history_size);
     foreach ($task_list as &$task) {
         $package = LF\M('Package')->get_by_id((int) $task['package_id']);
         $task['packagename'] = $package['name'];
         $space = LF\M('Space')->get_by_id((int) $task['space_id']);
         $task['spacename'] = $space['name'];
         $job = LF\M('Job')->get_by_task((int) $task['id']);
         $task['running'] = $job ? 1 : 0;
         $task['total'] = $job ? (int) $job['total'] : 0;
         $task['current'] = $job ? (int) $job['current'] : 0;
         $task['history'] = LF\M('History')->get_by_task((int) $task['id'], 1, $history_size);
     }
     echo json_encode($task_list);
 }
開發者ID:hanviseas,項目名稱:lazybug-for-api,代碼行數:28,代碼來源:list.php

示例3: act

 public function act()
 {
     $space_list = LF\M('Space')->get_all();
     $view = LF\V('Html.Space.Index');
     $view->add_data('space_list', $space_list);
     $view->init('Space.Index');
 }
開發者ID:hanviseas,項目名稱:lazybug-for-api,代碼行數:7,代碼來源:index.php

示例4: act

 public function act()
 {
     $history_id = (int) Request::get_param('id', 'post');
     $host = trim(Request::get_param('host', 'post'));
     $system_info = LF\M('System')->select()->fetch();
     $history_info = LF\M('History')->get_by_id($history_id);
     $pass_num = (int) $history_info['pass'];
     $fail_num = (int) $history_info['fail'];
     $title = '接口自動化測試報告 (' . date('Y-m-d h:i:s') . ')';
     $result = $fail_num === 0 ? '<span style="color:#629731">PASS</span>' : '<span style="color:#d0636e">FAIL</span>';
     $content = '<p style="font-size:20px;font-family:Microsoft Yahei, SimHei, Arial;font-weight:bold;">任務結果: ' . $result . '</p>';
     $content .= '<p style="font-size:16px;font-family:Microsoft Yahei, SimHei, Arial;">總共執行' . ($pass_num + $fail_num) . '個檢查點,';
     $content .= '通過<span style="color:#629731;font-weight:bold;">' . $pass_num . '</span>,';
     $content .= '失敗<span style="color:#d0636e;font-weight:bold;">' . $fail_num . '</span></p>';
     $content .= '<p style="font-size:16px;font-family:Microsoft Yahei, SimHei, Arial;font-weight:bold;"><a stype="color:#22aabe;" href="' . $host . '/report?id=' . $history_id . '" target="_blank">查看詳細報告 >></a></p>';
     foreach (explode(',', $system_info['mail_list']) as $mail) {
         $mail = trim($mail);
         if (!$mail) {
             continue;
         }
         try {
             $smtp = new Extension_Smtp();
             $smtp->setServer($system_info['smtp_server'], $system_info['smtp_user'], $system_info['smtp_password'], $system_info['smtp_port'], $system_info['smtp_ssl'] ? TRUE : FALSE);
             $smtp->setFrom($system_info['smtp_user']);
             $smtp->setReceiver($mail);
             $smtp->setMail($title, $content);
             $smtp->sendMail();
         } catch (Exception $e) {
         }
     }
 }
開發者ID:hanviseas,項目名稱:lazybug-for-api,代碼行數:31,代碼來源:notice.php

示例5: act

 public function act()
 {
     if (!$this->check_param('username, password, issave')) {
         LF\V('Json.Base')->init(Const_Code::LOGIN_PARAM_ERROR, '登錄傳遞參數錯誤');
         return;
     }
     $username = trim(Request::get_param('username', 'post'));
     $password = trim(Request::get_param('password', 'post'));
     $is_save = (int) Request::get_param('issave', 'post');
     $time = time();
     $seckey = LF\lb_read_system('seckey');
     $user_id = (int) LF\M('User')->check_password($username, md5($username . $password));
     if (!$user_id) {
         LF\V('Json.Base')->init(Const_Code::LOGIN_FAIL, '帳號驗證失敗');
         return;
     }
     $user = LF\M('User')->get_by_id($user_id);
     $expire_time = $is_save ? 86400 * 30 : 0;
     Cookie::set_cookie('userid', $user_id, $expire_time);
     Cookie::set_cookie('username', $user['name'], $expire_time);
     Cookie::set_cookie('userrole', $user['role'], $expire_time);
     Cookie::set_cookie('time', $time, $expire_time);
     Cookie::set_cookie('secstr', md5($user_id . '$' . $user['name'] . '$' . $user['role'] . '$' . $time . '$' . $seckey), $expire_time);
     LF\V('Json.Base')->init(Const_Code::SUCCESS, '帳號驗證通過');
 }
開發者ID:hanviseas,項目名稱:lazybug-for-api,代碼行數:25,代碼來源:login.php

示例6: act

 public function act()
 {
     if (!$this->check_param('oldpassword, newpassword')) {
         LF\V('Json.Base')->init(Const_Code::USER_PARAM_ERROR, '用戶傳遞參數錯誤');
         return;
     }
     $old_password = trim(Request::get_param('oldpassword', 'post'));
     $new_password = trim(Request::get_param('newpassword', 'post'));
     $user_id = (int) $_COOKIE['userid'];
     $user_name = $_COOKIE['username'];
     $old_password = md5($user_name . $old_password);
     $new_password = md5($user_name . $new_password);
     $user = LF\M('User')->get_by_id($user_id);
     if ($old_password !== $user['passwd']) {
         LF\V('Json.Base')->init(Const_Code::USER_CHECK_ERROR, '用戶密碼校驗失敗');
         return;
     }
     $_POST['userpassword'] = $new_password;
     $result = LF\M('User')->where('id=' . $user_id)->update();
     if (is_null($result)) {
         LF\V('Json.Base')->init(Const_Code::UPDATE_USER_FAIL, '用戶密碼更新失敗');
         return;
     }
     LF\V('Json.Base')->init(Const_Code::SUCCESS, '用戶密碼更新成功');
 }
開發者ID:hanviseas,項目名稱:lazybug-for-api,代碼行數:25,代碼來源:password.php

示例7: act

 public function act()
 {
     if (!$this->check_param('itemid, moduleid, spaceid, casename, sendtype, contenttype')) {
         LF\V('Json.Base')->init(Const_Code::CASE_PARAM_ERROR, '用例傳遞參數錯誤');
         return;
     }
     $item_id = (int) Request::get_param('itemid', 'post');
     $case_name = trim(Request::get_param('casename', 'post'));
     if (LF\M('Case')->check_name_exists($item_id, $case_name)) {
         LF\V('Json.Base')->init(Const_Code::ADD_CASE_EXISTS, '用例名稱重複');
         return;
     }
     LF\M('Case')->insert();
     $case = LF\M('Case')->get_by_name($item_id, $case_name);
     $case_id = (int) $case['id'];
     if (!$case_id) {
         LF\V('Json.Base')->init(Const_Code::ADD_CASE_FAIL, '用例添加失敗');
         return;
     }
     $item = LF\M('Item')->get_by_id($item_id);
     $_POST['caseid'] = $case_id;
     $_POST['stepname'] = '調用: ' . $item['name'] . '->' . $case_name;
     $_POST['steptype'] = '接口調用';
     $_POST['stepcommand'] = 'self';
     $_POST['stepvalue'] = $case_id;
     $_POST['stepsequence'] = 1;
     LF\M('Step')->insert();
     LF\V('Json.Base')->init(Const_Code::SUCCESS, $case_id);
 }
開發者ID:hanviseas,項目名稱:lazybug-for-api,代碼行數:29,代碼來源:add.php

示例8: act

 public function act()
 {
     $history_id = (int) Request::get_param('historyid', 'post');
     $item_id = (int) Request::get_param('itemid', 'post');
     $case_id = (int) Request::get_param('caseid', 'post');
     echo json_encode(LF\M('Result')->get_by_case($history_id, $item_id, $case_id));
 }
開發者ID:hanviseas,項目名稱:lazybug-for-api,代碼行數:7,代碼來源:step.php

示例9: act

 public function act()
 {
     if (!$this->check_param('guid')) {
         return;
     }
     $guid = trim(Request::get_param('guid', 'post'));
     LF\V('Xml.Base')->init('summary', LF\M('History')->get_by_guid($guid));
 }
開發者ID:hanviseas,項目名稱:lazybug-for-api,代碼行數:8,代碼來源:summary.php

示例10: set_system_param

 public function set_system_param($subject, $package, $fliter)
 {
     preg_match_all('/\\$\\{param:(\\w+)\\}/', $subject, $matches);
     foreach (array_unique($matches[1]) as $match) {
         $config = LF\M('Conf')->get_by_keyword($package, 'param', $match);
         $config['value'] = isset($config['value']) ? $config['value'] : '[[ 配置不存在 ]]';
         $replacement = $fliter ? str_replace('"', '\\"', $config['value']) : $config['value'];
         $subject = preg_replace('/\\$\\{param:' . $match . '\\}/', $replacement, $subject);
     }
     return $subject;
 }
開發者ID:hanviseas,項目名稱:lazybug-for-api,代碼行數:11,代碼來源:base.php

示例11: add_result

 private function add_result($content, $addition)
 {
     $temp = (int) Request::get_param('temp', 'post');
     if ($temp) {
         return;
     }
     $_POST['stepid'] = 1;
     $_POST['steptype'] = '存儲查詢';
     $_POST['resultcontent'] = $content;
     $_POST['resultvalue1'] = $addition['query'];
     LF\M('Result')->insert();
 }
開發者ID:hanviseas,項目名稱:lazybug-for-api,代碼行數:12,代碼來源:store.php

示例12: act

 public function act()
 {
     $task_id = (int) Request::get_param('taskid', 'post');
     $space_id = (int) Request::get_param('spaceid', 'post');
     $module_id = (int) Request::get_param('moduleid', 'post');
     if ($module_id) {
         $item_list = LF\M('Item')->get_by_module($module_id, 0, 0);
     } else {
         $item_list = LF\M('Item')->get_by_space($space_id, 0, 0);
     }
     LF\M('Job')->set_total($task_id, count($item_list));
     LF\V('Xml.Base')->init('item', $item_list);
 }
開發者ID:hanviseas,項目名稱:lazybug-for-api,代碼行數:13,代碼來源:item.php

示例13: act

 public function act()
 {
     if (!$this->check_param('smtpserver, smtpport')) {
         LF\V('Json.Base')->init(Const_Code::SYSTEM_PARAM_ERROR, '係統傳遞參數錯誤');
         return;
     }
     $result = LF\M('System')->update();
     if (is_null($result)) {
         LF\V('Json.Base')->init(Const_Code::UPDATE_SYSTEM_FAIL, '係統更新失敗');
         return;
     }
     LF\V('Json.Base')->init(Const_Code::SUCCESS, '係統更新成功');
 }
開發者ID:hanviseas,項目名稱:lazybug-for-api,代碼行數:13,代碼來源:mail.php

示例14: act

 public function act()
 {
     $space_id = (int) Request::get_param('spaceid', 'post');
     $module_id = (int) Request::get_param('moduleid', 'post');
     if ($module_id) {
         $item_num = LF\M('Item')->get_count_by_module($module_id);
         $case_num = LF\M('Case')->get_count_by_module($module_id);
     } else {
         $item_num = LF\M('Item')->get_count_by_space($space_id);
         $case_num = LF\M('Case')->get_count_by_space($space_id);
     }
     echo json_encode(array('item_num' => $item_num, 'case_num' => $case_num));
 }
開發者ID:hanviseas,項目名稱:lazybug-for-api,代碼行數:13,代碼來源:count.php

示例15: add_job

 private function add_job($task_id)
 {
     if (LF\M('Job')->check_task_exists($task_id)) {
         return;
     }
     $_POST['taskid'] = $task_id;
     LF\M('Job')->insert();
     $job = LF\M('Job')->get_by_task($task_id);
     if (!$job) {
         return;
     }
     LF\M('Task')->set_date($task_id);
 }
開發者ID:hanviseas,項目名稱:lazybug-for-api,代碼行數:13,代碼來源:list.php


注:本文中的Lazybug\Framework\M函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。